foamVtkSeriesWriter.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "foamVtkSeriesWriter.H"
29 #include "Fstream.H"
30 #include "ListOps.H"
31 #include "stringOpsSort.H"
32 #include "OSspecific.H"
33 
34 // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  // Get any single token.
39  static inline bool getToken(ISstream& is, token& tok)
40  {
41  return (!is.read(tok).bad() && tok.good());
42  }
43 
44  // Get two tokens.
45  // The first one must be a ':' token, the second one is any value
46  //
47  // This corrsponds to the JSON "key" : value syntax,
48  // we trigger after reading the "key".
49  static inline bool getValueToken(ISstream& is, token& tok)
50  {
51  return
52  (
53  // Token 1 = ':' separator
54  (
55  getToken(is, tok)
56  && tok.isPunctuation() && tok.pToken() == token::COLON
57  )
58 
59  // Token 2 is the value
60  && getToken(is, tok)
61  );
62  }
63 
64 
65  // Sorting for fileNameInstant
66  // 1. sort by value (time)
67  // 2. natural sort (name)
68  struct seriesLess
69  {
70  bool operator()(const fileNameInstant a, const fileNameInstant b) const
71  {
72  scalar val = compareOp<scalar>()(a.value(), b.value());
73  if (val == 0)
74  {
75  return
77  }
78  return val < 0;
79  }
80  };
81 
82 
83  // Check if value is less than upper, with some tolerance.
84  static inline bool lessThan(const scalar& val, const scalar& upper)
85  {
86  return (val < upper && Foam::mag(val - upper) > ROOTVSMALL);
87  }
88 }
89 
90 
91 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
92 
94 (
95  const fileName& outputName,
96  char sep
97 )
98 {
99  const auto dash = outputName.rfind(sep);
100 
101  // No separator? Or separator in path() instead of name()?
102  if
103  (
104  std::string::npos == dash
105  || std::string::npos != outputName.find('/', dash)
106  )
107  {
108  // Warn?
109  return outputName;
110  }
111 
112  const auto dot = outputName.find('.', dash);
113 
114  if (std::string::npos == dot)
115  {
116  return outputName.substr(0, dash);
117  }
118 
119  return outputName.substr(0, dash) + outputName.substr(dot);
120 }
121 
122 
124 (
125  const fileName& file,
126  char sep
127 )
128 {
129  const auto dash = file.rfind(sep);
130 
131  // No separator? Or separator in path() instead of name()?
132  if
133  (
134  std::string::npos == dash
135  || std::string::npos != file.find('/', dash)
136  )
137  {
138  // Warn?
139  return "";
140  }
141 
142  const auto dot = file.find('.', dash);
143 
144  if (std::string::npos == dot)
145  {
146  return file.substr(dash);
147  }
148 
149  return file.substr(dash, (dot-dash));
150 }
151 
152 
154 (
155  Ostream& os,
156  const fileName& base,
157  const UList<instant>& series,
158  const char sep
159 )
160 {
161  // Split the base into (stem, ext) components
162  //
163  // base = "path/file.vtm"
164  //
165  // stem = "file"
166  // ext = ".vtm"
167 
168  const word stem = base.nameLessExt();
169  const word ext = "." + base.ext();
170 
171  // Begin file-series (JSON)
172  os << "{\n \"file-series-version\" : \"1.0\",\n \"files\" : [\n";
173 
174  // Track how many entries are remaining
175  // - trailing commas on all but the final entry (JSON requirement)
176  label nremain = series.size();
177 
178  // Each entry
179  // { "name" : "<stem><sep>name<ext>", "time" : value }
180 
181  for (const instant& inst : series)
182  {
183  os << " { \"name\" : \""
184  << stem << sep << inst.name() << ext
185  << "\", \"time\" : " << inst.value() << " }";
186 
187  if (--nremain)
188  {
189  os << ',';
190  }
191  os << nl;
192  }
193 
194  os << " ]\n}\n";
195 
196  return os;
197 }
198 
199 
201 (
202  Ostream& os,
203  const UList<fileNameInstant>& series
204 )
205 {
206  // Begin file-series (JSON)
207  os << "{\n \"file-series-version\" : \"1.0\",\n \"files\" : [\n";
208 
209  // Track how many entries are remaining
210  // - trailing commas on all but the final entry (JSON requirement)
211  label nremain = series.size();
212 
213  // Each entry
214  // { "name" : "<file>", "time" : <value> }
215 
216  for (const fileNameInstant& inst : series)
217  {
218  os << " { \"name\" : \""
219  << inst.name().name()
220  << "\", \"time\" : " << inst.value() << " }";
221 
222  if (--nremain)
223  {
224  os << ',';
225  }
226  os << nl;
227  }
228 
229  os << " ]\n}\n";
230 
231  return os;
232 }
233 
234 
236 (
237  const fileName& seriesName,
238  const UList<instant>& series,
239  const char sep
240 )
241 {
242  mkDir(seriesName.path());
243 
244  autoPtr<OFstream> osPtr =
245  (
246  seriesName.hasExt("series")
247  ? autoPtr<OFstream>::New(seriesName)
248  : autoPtr<OFstream>::New(seriesName + ".series")
249  );
250 
251  print(*osPtr, seriesName, series, sep);
252 }
253 
254 
255 
257 (
258  const fileName& seriesName,
259  const UList<fileNameInstant>& series
260 )
261 {
262  mkDir(seriesName.path());
263 
264  autoPtr<OFstream> osPtr =
265  (
266  seriesName.hasExt("series")
267  ? autoPtr<OFstream>::New(seriesName)
268  : autoPtr<OFstream>::New(seriesName + ".series")
269  );
270 
271  print(*osPtr, series);
272 }
273 
274 
275 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
276 
277 bool Foam::vtk::seriesWriter::appendCheck(fileNameInstant inst)
278 {
279  if (inst.name().empty())
280  {
281  return false;
282  }
283 
284  const auto iter = existing_.find(inst.name());
285 
286  if (iter.found())
287  {
288  for (fileNameInstant& dst : entries_)
289  {
290  if (dst.name() == inst.name())
291  {
292  // Replace value
293  dst.value() = inst.value();
294  return true;
295  }
296  }
297  }
298 
299  entries_.append(inst);
300  existing_.insert(inst.name());
301 
302  return true;
303 }
304 
305 
306 bool Foam::vtk::seriesWriter::removeDuplicates()
307 {
308  const label nElem = entries_.size();
309 
310  HashTable<label, fileName> filesSeen(2*nElem);
311 
312  bool changed = false;
313 
314  for (label elemi=0; elemi < nElem; ++elemi)
315  {
316  fileNameInstant& inst = entries_[elemi];
317 
318  if (inst.name().empty())
319  {
320  changed = true;
321  }
322  else
323  {
324  auto iter = filesSeen.find(inst.name());
325 
326  if (iter.found())
327  {
328  // Mark previous location as being superseded
329  entries_[*iter].name().clear();
330  changed = true;
331 
332  *iter = elemi; // The latest with this name
333  }
334  else
335  {
336  filesSeen.insert(inst.name(), elemi);
337  }
338  }
339  }
340 
341 
342  if (changed)
343  {
344  label dsti = 0;
345  for (label elemi=0; elemi < nElem; ++elemi)
346  {
347  fileNameInstant& src = entries_[elemi];
348 
349  if (!src.name().empty())
350  {
351  if (dsti != elemi)
352  {
353  entries_[dsti] = std::move(src);
354  }
355  ++dsti;
356  }
357  }
358 
359  entries_.resize(dsti);
360  }
361 
362  return (nElem != entries_.size());
363 }
364 
365 
366 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
367 
369 (
370  const fileName& seriesName,
371  const bool checkFiles,
372  const scalar restartTime
373 )
374 {
375  clear();
376 
377  fileName seriesFile(seriesName);
378  if (!seriesFile.hasExt("series"))
379  {
380  seriesFile.ext("series");
381  }
382 
383  if (!isFile(seriesFile))
384  {
385  return size();
386  }
387 
388  HashSet<fileName> filesOnDisk;
389 
390  if (checkFiles)
391  {
392  filesOnDisk.insert(Foam::readDir(seriesFile.path()));
393  }
394 
395 
396  // Parse JSON content:
397  //
398  // {
399  // "file-series-version" : "1.0",
400  // "files" : [
401  // { "name" : "abc", "time" : 123 },
402  // { "name" : "def", "time" : 345 }
403  // ]
404  // }
405 
406  // Parsing states
407  enum parse
408  {
409  NONE, // Looking for "files"
410  FILES_ARRAY, // Saw "file" : '['
411  ENTRY, // Parsing in { "name" : ... }
412  DONE, // Saw a ']' while in FILES_ARRAY
413  FAIL // Something bad happened
414  };
415 
416  // Track if "file" and "time" keys have been located
417  unsigned instStatus = 0;
418  fileNameInstant inst;
419 
420  token tok;
421 
422  IFstream is(seriesFile);
423 
424  for
425  (
426  parse state = parse::NONE;
427  (state != parse::DONE && state != parse::FAIL)
428  && getToken(is, tok);
429  /*nil*/
430  )
431  {
432  switch (state)
433  {
434  // Still scanning for initial "files" entry
435  case parse::NONE :
436  {
437  if (tok.isString() && tok.stringToken() == "files")
438  {
439  // Expect "files" : [ ...
440 
441  if
442  (
443  getValueToken(is, tok)
444  && tok.isPunctuation()
445  && tok.pToken() == token::BEGIN_SQR
446  )
447  {
448  state = parse::FILES_ARRAY;
449  }
450  else
451  {
452  state = parse::FAIL;
453  }
454  }
455  }
456  break;
457 
458  // Parsing entries within "files" array
459  case parse::FILES_ARRAY :
460  {
461  if (tok.isPunctuation())
462  {
463  switch (tok.pToken())
464  {
465  // ',' - keep going (another entry)
466  case token::COMMA :
467  break;
468 
469  // '{' - begin entry
470  case token::BEGIN_BLOCK :
471  state = parse::ENTRY;
472  instStatus = 0;
473  break;
474 
475  // ']' - done array
476  case token::END_SQR :
477  state = parse::DONE;
478  break;
479 
480  default:
481  state = parse::FAIL;
482  break;
483  }
484  }
485  else
486  {
487  state = parse::FAIL;
488  }
489  }
490  break;
491 
492  // Parsing an individual entry within "files"
493  case parse::ENTRY :
494  {
495  if (tok.isPunctuation())
496  {
497  switch (tok.pToken())
498  {
499  // ',' - keep going (another key/value pair)
500  case token::COMMA :
501  break;
502 
503  // '}'
504  case token::END_BLOCK :
505  {
506  // Verify instant was properly parsed and
507  // is also valid
508  if
509  (
510  instStatus == 0x03
511  && lessThan(inst.value(), restartTime)
512  &&
513  (
514  checkFiles
515  ? filesOnDisk.found(inst.name())
516  : true
517  )
518  )
519  {
520  appendCheck(inst);
521  }
522 
523  state = parse::FILES_ARRAY;
524  instStatus = 0;
525  }
526  break;
527 
528  default:
529  state = parse::FAIL;
530  break;
531  }
532  }
533  else if (tok.isString())
534  {
535  // Expect "key" : value
536 
537  const string key(tok.stringToken());
538 
539  if (getValueToken(is, tok))
540  {
541  if ("name" == key)
542  {
543  if (tok.isString())
544  {
545  inst.name() = tok.stringToken();
546  instStatus |= 0x01;
547  }
548  else
549  {
550  state = parse::FAIL;
551  }
552  }
553  else if ("time" == key)
554  {
555  if (tok.isNumber())
556  {
557  inst.value() = tok.number();
558  instStatus |= 0x02;
559  }
560  else
561  {
562  state = parse::FAIL;
563  }
564  }
565  }
566  else
567  {
568  state = parse::FAIL;
569  }
570  }
571  else
572  {
573  state = parse::FAIL;
574  }
575  }
576  break;
577 
578  default:
579  break;
580  }
581  }
582 
583  return size();
584 }
585 
586 
588 (
589  const fileName& seriesName,
590  const scalar restartTime
591 )
592 {
593  clear();
594 
595  const fileName path = seriesName.path();
596 
597  if (!isDir(path))
598  {
599  return size();
600  }
601 
602  fileName seriesFile(seriesName);
603 
604  if (seriesName.hasExt("series"))
605  {
606  seriesFile.removeExt();
607  }
608 
609  const word stem = seriesFile.nameLessExt();
610  const word ext = seriesFile.ext();
611 
612  // Accept "fileN.ext", "fileNN.ext", but reject "file.ext"
613  const auto minLen = stem.length() + ext.length() + 1;
614 
615  const auto acceptName =
616  [=](const fileName& file) -> bool
617  {
618  return
619  (
620  minLen < file.length()
621  && file.hasExt(ext) && file.starts_with(stem)
622  );
623  };
624 
625 
626  fileNameList files = subsetList(Foam::readDir(path), acceptName);
627 
628  // Names sorted so warnings appear less random
630 
631  // Scratch space for reading some of the file
632  std::string header;
633 
634  scalar timeValue;
635 
636  bool warnings = false;
637 
638  for (const fileName& file : files)
639  {
640  std::ifstream is(path/file);
641 
642  if (!is)
643  {
644  continue;
645  }
646 
647  // Read directly into the string
648  // 1024 (12 lines of 80 chars) is plenty for all comments
649 
650  header.resize(1024);
651  is.read(&(header.front()), header.size());
652  header.resize(is.gcount());
653 
654  // DebugInfo
655  // << "got header:\n=====\n" << header << "\n=====\n" << nl;
656 
657 
658  // Look for time="...", time='...', or even time=... attribute
659 
660  auto begAttr = header.find("time=");
661 
662  if (string::npos == begAttr)
663  {
664  if (!warnings)
665  {
666  Info<< "No 'time=' comment attribute found:\n(" << nl;
667  warnings = true;
668  }
669  Info<< " " << file << nl;
670  continue;
671  }
672 
673  // Skip past the 'time='
674  begAttr += 5;
675  const char quote = header[begAttr];
676 
677  // Info<< "have time=" << int(begAttr) << nl;
678 
679  auto endAttr =
680  (
681  (quote == '"' || quote == '\'')
682  ?
683  // Quoted
684  header.find(quote, ++begAttr)
685  :
686  // Unquoted
687  header.find_first_of("\t\n\v\f\r ", begAttr)
688  );
689 
690 
691  if
692  (
693  string::npos != endAttr && begAttr < endAttr
694  && readScalar
695  (
696  header.substr(begAttr, endAttr-begAttr),
697  timeValue
698  )
699  && lessThan(timeValue, restartTime)
700  )
701  {
702  // Success
703  append(timeValue, file);
704  }
705  }
706 
707  if (warnings)
708  {
709  Info<< ")" << nl << nl;
710  }
711 
712  // Don't trust the order. Sort by time and name instead.
713  this->sort();
714 
715  return size();
716 }
717 
718 
719 bool Foam::vtk::seriesWriter::removeNewer(const scalar timeValue)
720 {
721  // Rebuild hash as side-effect
722  existing_.clear();
723 
724  label dsti = 0;
725 
726  const label nElem = entries_.size();
727 
728  for (label elemi=0; elemi < nElem; ++elemi)
729  {
730  fileNameInstant& src = entries_[elemi];
731 
732  if (!src.name().empty() && lessThan(src.value(), timeValue))
733  {
734  if (dsti != elemi)
735  {
736  entries_[dsti] = std::move(src);
737  existing_.insert(entries_[dsti].name());
738  }
739  ++dsti;
740  }
741  }
742 
743  entries_.resize(dsti);
744 
745  return (nElem != entries_.size());
746 }
747 
748 
750 {
751  Foam::sort(entries_, seriesLess());
752 }
753 
754 
755 // ************************************************************************* //
Foam::token::COMMA
Comma [isseparator].
Definition: token.H:129
OSspecific.H
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Foam::fileName::nameLessExt
static std::string nameLessExt(const std::string &str)
Return basename, without extension.
Definition: fileName.C:402
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::vtk::seriesWriter::base
static fileName base(const fileName &outputName, char sep='_')
Extract the base name for a file series.
Definition: foamVtkSeriesWriter.C:94
stringOpsSort.H
Specialized string sorting.
Foam::fileName::path
static std::string path(const std::string &str)
Return directory path name (part before last /)
Definition: fileNameI.H:186
Foam::IFstream
Input from file stream, using an ISstream.
Definition: IFstream.H:53
Foam::token::stringToken
const string & stringToken() const
Return const reference to the string contents.
Definition: tokenI.H:644
Foam::string::starts_with
bool starts_with(const std::string &s) const
True if string starts with the given prefix (cf. C++20)
Definition: string.H:299
Foam::vtk::seriesWriter::removeNewer
bool removeNewer(const scalar timeValue)
Remove entries that are greater_equal the time value.
Definition: foamVtkSeriesWriter.C:719
Foam::compareOp
Three-way comparison operation of two parameters,.
Definition: ops.H:265
Foam::fileName::name
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:209
Foam::dot
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:944
Foam::dimensioned::name
const word & name() const
Return const reference to name.
Definition: dimensionedType.C:406
Foam::ISstream
Generic input stream using a standard (STL) stream.
Definition: ISstream.H:55
Foam::isFile
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Definition: MSwindows.C:658
Foam::token
A token holds an item read from Istream.
Definition: token.H:68
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:434
append
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
Foam::HashSet
A HashTable with keys but without contents that is similar to std::unordered_set.
Definition: HashSet.H:83
Foam::vtk::seriesWriter::suffix
static word suffix(const fileName &file, char sep='_')
Extract the time-varying ending of files.
Definition: foamVtkSeriesWriter.C:124
Foam::token::pToken
punctuationToken pToken() const
Return punctuation character.
Definition: tokenI.H:459
Foam::token::isNumber
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
Definition: tokenI.H:561
Foam::token::number
scalar number() const
Return label, float or double value.
Definition: tokenI.H:567
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::fileName::hasExt
bool hasExt() const
Return true if it has an extension or simply ends with a '.'.
Definition: fileNameI.H:174
Foam::token::BEGIN_SQR
Begin dimensions [isseparator].
Definition: token.H:124
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fileName::removeExt
bool removeExt()
Remove extension, returning true if string changed.
Definition: fileNameI.H:259
Foam::sort
void sort(UList< T > &a)
Definition: UList.C:254
Foam::token::isPunctuation
bool isPunctuation() const noexcept
Token is PUNCTUATION.
Definition: tokenI.H:453
Foam::vtk::seriesWriter::print
static Ostream & print(Ostream &os, const fileName &seriesName, const UList< instant > &series, const char sep='_')
Print file series (JSON format) for specified time instances.
Definition: foamVtkSeriesWriter.C:154
Foam::IOstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: IOstream.C:39
foamVtkSeriesWriter.H
Foam::vtk::seriesWriter::load
label load(const fileName &seriesName, const bool checkFiles=false, const scalar restartTime=ROOTVGREAT)
Clear contents and reload by parsing the specified file.
Definition: foamVtkSeriesWriter.C:369
Foam::token::END_BLOCK
End block [isseparator].
Definition: token.H:127
Foam::IOstream::bad
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:242
Foam::token::END_SQR
End dimensions [isseparator].
Definition: token.H:125
Foam::fileNameInstant
Instant< fileName > fileNameInstant
A tuple of value and fileName.
Definition: fileNameInstant.H:44
Foam::vtk::seriesWriter::write
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
Definition: foamVtkSeriesWriter.C:236
Foam::fileName::ext
word ext() const
Return file name extension (part after last .)
Definition: fileNameI.H:228
Foam::stringOps::natural_sort::compare
static int compare(const std::string &s1, const std::string &s2)
Natural compare for std::string.
Definition: stringOpsSort.H:67
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::getToken
static bool getToken(ISstream &is, token &tok)
Definition: foamVtkSeriesWriter.C:39
Foam::token::BEGIN_BLOCK
Begin block [isseparator].
Definition: token.H:126
Foam::seriesLess
Definition: foamVtkSeriesWriter.C:68
Foam::Instant::name
const T & name() const
The name/key (const access)
Definition: Instant.H:111
Foam::token::good
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
Definition: tokenI.H:399
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::token::COLON
Colon [isseparator].
Definition: token.H:128
Foam::seriesLess::operator()
bool operator()(const fileNameInstant a, const fileNameInstant b) const
Definition: foamVtkSeriesWriter.C:70
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Fstream.H
Foam::List< fileName >
Foam::getValueToken
static bool getValueToken(ISstream &is, token &tok)
Definition: foamVtkSeriesWriter.C:49
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::Instant::value
scalar value() const
The value (const access)
Definition: Instant.H:99
Foam::BitOps::print
Ostream & print(Ostream &os, UIntType value, char off='0', char on='1')
Print 0/1 bits in the (unsigned) integral type.
Definition: BitOps.H:199
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Definition: HashSet.H:181
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::token::isString
bool isString() const noexcept
Token is STRING, VARIABLE or VERBATIM string.
Definition: tokenI.H:615
Foam::ISstream::read
virtual Istream & read(token &t)
Return next token from stream.
Definition: ISstream.C:158
Foam::stringOps::natural_sort
Encapsulation of natural order sorting for algorithms.
Definition: stringOpsSort.H:62
Foam::UList::size
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
Definition: UListI.H:360
Foam::vtk::seriesWriter::sort
void sort()
Sort by time value and by file name.
Definition: foamVtkSeriesWriter.C:749
ListOps.H
Various functions to operate on Lists.
Foam::instant
An instant of time. Contains the time value and name.
Definition: instant.H:52
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::stringOps::upper
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Definition: stringOps.C:1202
Foam::HashTable< zero::null, Key, Hash >::found
bool found(const Key &key) const
Return true if hashed entry is found in table.
Definition: HashTableI.H:100
Foam::mkDir
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: MSwindows.C:507
Foam::readDir
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
Definition: MSwindows.C:707
Foam::vtk::seriesWriter::scan
label scan(const fileName &seriesName, const scalar restartTime=ROOTVGREAT)
Clear contents and scan directory for files.
Definition: foamVtkSeriesWriter.C:588
Foam::Instant
A tuple of value and key. The value often corresponds to a time value, thus the naming of the class....
Definition: Instant.H:53
Foam::isDir
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:643
Foam::lessThan
static bool lessThan(const scalar &val, const scalar &upper)
Definition: foamVtkSeriesWriter.C:84
Foam::subsetList
List< T > subsetList(const UList< T > &input, const UnaryPredicate &pred, const bool invert=false)
Copy a subset of the input list when predicate is true.