ensightCase.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) 2016-2023 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 "ensightCase.H"
29 #include "ensightGeoFile.H"
30 #include "Time.H"
31 #include "cloud.H"
32 #include "IOmanip.H"
33 #include "OSstream.H"
34 #include <iomanip>
35 #include <sstream>
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 const char* Foam::ensightCase::dataDirName = "data";
40 const char* Foam::ensightCase::geometryName = "geometry";
41 
42 
43 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
44 
45 Foam::word Foam::ensightCase::padded(const int nwidth, const label value)
46 {
47  if (nwidth < 1)
48  {
49  return Foam::name(value);
50  }
51 
52  std::ostringstream oss;
53  oss << std::setfill('0') << std::setw(nwidth) << value;
54 
55  return word(oss.str(), false); // stripping=false
56 }
57 
58 
60 (
61  OSstream& os,
63  const int timePrec
64 )
65 {
66  os.setf(std::ios_base::left);
67  os.setf
68  (
69  std::ios_base::fmtflags(timeFmt),
70  std::ios_base::floatfield
71  );
72 
73  if (timePrec > 0)
74  {
75  os.precision(timePrec);
76  }
77 }
78 
79 
81 (
82  OSstream& os,
83  const ensightCase::options& opts
84 )
85 {
86  os.setf(std::ios_base::left);
87  os.setf
88  (
89  std::ios_base::fmtflags(opts.timeFormat()),
90  std::ios_base::floatfield
91  );
92 
93  os.precision(opts.timePrecision());
94 }
95 
96 
98 (
99  OSstream& os,
100  const label ts,
101  const scalar timeValue
102 )
103 {
104  os
105  << "time set: " << ts << nl
106  << "number of steps: " << 1 << nl;
107 
108  // Single value - starts at index 0
109  os << "filename start number: 0" << nl
110  << "filename increment: 1" << nl
111  << "time values:" << nl;
113  os << " " << timeValue
114  << nl << nl;
115 }
116 
117 
119 (
120  OSstream& os,
121  const label ts,
122  const UList<scalar>& values
123 )
124 {
125  label pos_(0);
126 
127  os
128  << "time set: " << ts << nl
129  << "number of steps: " << values.size() << nl;
130 
131  // Assume contiguous numbering - starts at index 0
132  os << "filename start number: 0" << nl
133  << "filename increment: 1" << nl;
134 
135 
136  os << "time values:" << nl;
137  pos_ = 0;
138  for (const scalar val : values)
139  {
140  if (pos_ == 6)
141  {
142  os << nl;
143  pos_ = 0;
144  }
145  ++pos_;
146 
147  os << ' ' << setf(ios_base::right) << setw(12) << val;
148  }
149  os << nl << nl;
150 }
151 
152 
154 (
155  OSstream& os,
156  const label ts,
157  const UList<scalar>& values,
158  const bitSet& indices
159 )
160 {
161  label pos_(0);
162 
163  // Check if continuous numbering can be used
164  if
165  (
166  values.empty()
167  || (indices.size() == values.size() && indices.all())
168  )
169  {
170  // Can simply emit as 0-based with increment
171  printTimeset(os, ts, values);
172  return;
173  }
174 
175 
176  // Generate time set
177  os
178  << "time set: " << ts << nl
179  << "number of steps: " << indices.count() << nl;
180 
181 
182  os << "filename numbers:" << nl;
183  pos_ = 0;
184  for (const label idx : indices)
185  {
186  if (pos_ == 6)
187  {
188  os << nl;
189  pos_ = 0;
190  }
191  ++pos_;
192 
193  os << ' ' << setf(ios_base::right) << setw(8) << idx;
194  }
195  os << nl;
196 
197 
198  os << "time values:" << nl;
199  pos_ = 0;
200  for (const label idx : indices)
201  {
202  if (pos_ == 6)
203  {
204  os << nl;
205  pos_ = 0;
206  }
207  ++pos_;
208 
209  os << ' ' << setf(ios_base::right) << setw(12) << values[idx];
210  }
211  os << nl << nl;
212 }
213 
214 
215 // * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
216 
217 Foam::fileName Foam::ensightCase::dataDir() const
218 {
219  return ensightDir_/dataDirName;
220 }
221 
222 
223 void Foam::ensightCase::initialize()
224 {
225  if (UPstream::master())
226  {
227  // EnSight and EnSight/data directories must exist
228 
229  // We may wish to retain old data
230  // eg, convert new results or a particular time interval
231  // OR remove everything
232 
233  if (isDir(ensightDir_))
234  {
235  if (options_->overwrite())
236  {
237  Foam::rmDir(ensightDir_);
238  }
239  else
240  {
241  DetailInfo
242  << "Warning: re-using existing directory" << nl
243  << " " << ensightDir_ << endl;
244  }
245  }
246 
247  // Create ensight and data directories
248  mkDir(dataDir());
249 
250  // The case file is always ASCII
251  os_.reset(new OFstream(ensightDir_/caseName_, IOstreamOption::ASCII));
252  ensightCase::setTimeFormat(*os_, *options_); // Format options
253 
254  writeHeader();
255  }
256 }
257 
258 
259 Foam::label Foam::ensightCase::checkTimeset(const labelHashSet& lookup) const
260 {
261  // assume the worst
262  label ts = -1;
263 
264  // work on a copy
265  labelHashSet tsTimes(lookup);
266  tsTimes.erase(-1);
267 
268  if (tsTimes.empty())
269  {
270  // no times needed
271  ts = 0;
272  }
273  else if (tsTimes.size() == timesUsed_.size())
274  {
275  forAllConstIters(timesUsed_, iter)
276  {
277  tsTimes.erase(iter.key());
278  }
279 
280  // OR
281  // tsTimes.unset(timesUsed_.toc());
282 
283  if (tsTimes.empty())
284  {
285  ts = 1; // can use timeset 1
286  }
287  }
288 
289  return ts;
290 }
291 
292 
293 void Foam::ensightCase::writeHeader() const
294 {
295  if (os_) // True on master only
296  {
297  this->rewind();
298  *os_
299  << "FORMAT" << nl
300  << "type: ensight gold" << nl;
301  }
302 }
303 
304 
305 Foam::scalar Foam::ensightCase::writeTimeset() const
306 {
307  const label ts = 1;
308 
309  const labelList indices(timesUsed_.sortedToc());
310  label count = indices.size();
311 
312  // correct for negative starting values
313  scalar timeCorrection = timesUsed_[indices[0]];
314  if (timeCorrection < 0)
315  {
316  timeCorrection = -timeCorrection;
317  Info<< "Correcting time values. Adding " << timeCorrection << endl;
318  }
319  else
320  {
321  timeCorrection = 0;
322  }
323 
324 
325  *os_
326  << "time set: " << ts << nl
327  << "number of steps: " << count << nl;
328 
329  if (indices[0] == 0 && indices[count-1] == count-1)
330  {
331  // looks to be contiguous numbering
332  *os_
333  << "filename start number: " << 0 << nl
334  << "filename increment: " << 1 << nl;
335  }
336  else
337  {
338  *os_
339  << "filename numbers:" << nl;
340 
341  count = 0;
342  for (const label idx : indices)
343  {
344  *os_ << ' ' << setw(12) << idx;
345 
346  if (++count % 6 == 0)
347  {
348  *os_ << nl;
349  }
350  }
351 
352  if (count)
353  {
354  *os_ << nl;
355  }
356  }
357 
358 
359  *os_ << "time values:" << nl;
360 
361  count = 0;
362  for (const label idx : indices)
363  {
364  *os_ << ' ' << setw(12) << timesUsed_[idx] + timeCorrection;
365 
366  if (++count % 6 == 0)
367  {
368  *os_ << nl;
369  }
370  }
371  if (count)
372  {
373  *os_ << nl;
374  }
375 
376  return timeCorrection;
377 }
378 
379 
380 void Foam::ensightCase::writeTimeset
381 (
382  const label ts,
383  const labelHashSet& lookup,
384  const scalar timeCorrection
385 ) const
386 {
387  // Make a copy
388  labelHashSet hashed(lookup);
389  hashed.erase(-1);
390 
391  const labelList indices(hashed.sortedToc());
392  label count = indices.size();
393 
394  *os_
395  << "time set: " << ts << nl
396  << "number of steps: " << count << nl
397  << "filename numbers:" << nl;
398 
399  count = 0;
400  for (const label idx : indices)
401  {
402  *os_ << ' ' << setw(12) << idx;
403 
404  if (++count % 6 == 0)
405  {
406  *os_ << nl;
407  }
408  }
409 
410  if (count)
411  {
412  *os_ << nl;
413  }
414 
415  *os_ << "time values:" << nl;
416 
417  count = 0;
418  for (const label idx : indices)
419  {
420  *os_ << ' ' << setw(12) << timesUsed_[idx] + timeCorrection;
421 
422  if (++count % 6 == 0)
423  {
424  *os_ << nl;
425  }
426  }
427  if (count)
428  {
429  *os_ << nl;
430  }
431 }
432 
433 
434 void Foam::ensightCase::noteGeometry(const bool moving) const
435 {
436  if (moving)
437  {
438  geomTimes_.insert(timeIndex_);
439  }
440  else
441  {
442  geomTimes_.insert(-1);
443  }
444 
445  changed_ = true;
446 }
447 
448 
449 void Foam::ensightCase::noteCloud(const word& cloudName) const
450 {
451  // Force into existence
452  if (!cloudVars_.found(cloudName))
453  {
454  cloudVars_.emplace(cloudName);
455  }
456  cloudTimes_.insert(timeIndex_);
457 
458  changed_ = true;
459 }
460 
461 
462 void Foam::ensightCase::noteCloud
463 (
464  const word& cloudName,
465  const word& varName,
466  const char* ensightType
467 ) const
468 {
469  if (cloudVars_.found(cloudName))
470  {
471  if (cloudVars_[cloudName].insert(varName, ensightType))
472  {
473  changed_ = true;
474  }
475  }
476  else
477  {
479  << "Tried to add a cloud variable for writing"
480  << " - without having added a cloud"
481  << abort(FatalError);
482  }
483 }
484 
485 
486 void Foam::ensightCase::noteVariable
487 (
488  const word& varName,
489  const char* ensightType
490 ) const
491 {
492  if (variables_.insert(varName, ensightType))
493  {
494  changed_ = true;
495  }
496 }
497 
498 
500 Foam::ensightCase::createDataFile
501 (
502  const word& name
503 ) const
504 {
505  if (UPstream::master())
506  {
507  // The data/ITER subdirectory must exist
508  // Note that data/ITER is indeed a valid ensight::FileName
509 
510  const fileName outdir = dataDir()/padded(timeIndex_);
511  mkDir(outdir);
512 
513  return autoPtr<ensightFile>::New(outdir, name, format());
514  }
515 
516  return nullptr;
517 }
518 
519 
521 Foam::ensightCase::createCloudFile
522 (
523  const word& cloudName,
524  const word& name
525 ) const
526 {
527  if (UPstream::master())
528  {
529  // Write
530  // eg -> "data/********/lagrangian/<cloudName>/positions"
531  // or -> "lagrangian/<cloudName>/********/positions"
532  // TODO? check that cloudName is a valid ensight filename
533  const fileName outdir =
534  (
535  separateCloud()
536  ? (ensightDir_ / cloud::prefix / cloudName / padded(timeIndex_))
537  : (dataDir() / padded(timeIndex_) / cloud::prefix / cloudName)
538  );
539 
540  mkDir(outdir); // should be unnecessary after newCloud()
541 
542  return autoPtr<ensightFile>::New(outdir, name, format());
543  }
544 
545  return nullptr;
546 }
547 
548 
549 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
550 
551 Foam::ensightCase::ensightCase
552 (
553  const fileName& ensightDir,
554  const word& caseName,
555  const ensightCase::options& opts
556 )
557 :
558  options_(new options(opts)),
559  os_(nullptr),
560  ensightDir_(ensightDir),
561  caseName_(caseName + ".case"),
562  changed_(false),
563  timeIndex_(0),
564  timeValue_(0),
565  timesUsed_(),
566  geomTimes_(),
567  cloudTimes_(),
568  variables_(),
569  nodeVariables_(),
570  cloudVars_()
571 {
572  initialize();
573 }
574 
575 
576 Foam::ensightCase::ensightCase
577 (
578  const fileName& ensightDir,
579  const word& caseName,
581 )
582 :
583  options_(new options(fmt)),
584  os_(nullptr),
585  ensightDir_(ensightDir),
586  caseName_(caseName + ".case"),
587  changed_(false),
588  timeIndex_(0),
589  timeValue_(0),
590  timesUsed_(),
591  geomTimes_(),
592  cloudTimes_(),
593  variables_(),
594  nodeVariables_(),
595  cloudVars_()
596 {
597  initialize();
598 }
599 
600 
601 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
602 
603 void Foam::ensightCase::nextTime(const scalar value)
604 {
605  // use next available index
606  setTime(value, timesUsed_.size());
607 }
608 
611 {
612  nextTime(t.value());
613 }
614 
615 
616 void Foam::ensightCase::setTime(const scalar value, const label index)
617 {
618  timeIndex_ = index;
619  timeValue_ = value;
620 
621  if (UPstream::master())
622  {
623  // The data/ITER subdirectory must exist
624  // Note that data/ITER is indeed a valid ensight::FileName
625 
626  const fileName outdir = dataDir()/padded(timeIndex_);
627  mkDir(outdir);
628 
629  // place a timestamp in the directory for future reference
630  OFstream timeStamp(outdir/"time");
631  timeStamp
632  << "# index time" << nl
633  << outdir.name() << ' ' << timeValue_ << nl;
634  }
635 
636  // Record of time index/value used
637  timesUsed_.set(index, value);
638 }
639 
641 void Foam::ensightCase::setTime(const instant& t, const label index)
642 {
643  setTime(t.value(), index);
644 }
645 
646 
647 void Foam::ensightCase::write() const
648 {
649  if (!os_) return; // master only
650 
651  // geometry timeset
652  const bool staticGeom = (geomTimes_.size() == 1 && geomTimes_.found(-1));
653  label tsGeom = staticGeom ? 0 : checkTimeset(geomTimes_);
654 
655  // geometry index, when mesh is not moving but stored under data/XXX/
656  label meshIndex = -1;
657 
658  // cloud timeset
659  label tsCloud = checkTimeset(cloudTimes_);
660 
661  // Increment time-sets to the correct indices
662  if (tsGeom < 0)
663  {
664  tsGeom = 2; // Next available timeset
665 
666  // Saved under data/XXX/geometry, but not actually moving
667  if (geomTimes_.size() == 1)
668  {
669  tsGeom = 0;
670  meshIndex = *(geomTimes_.begin());
671  }
672  }
673  if (tsCloud < 0)
674  {
675  tsCloud = 1 + std::max(label(1), tsGeom); // Next available timeset
676  }
677 
678  writeHeader();
679 
680 
681  // data mask: eg "data/******"
682  const fileName dataMask = (dataDirName/mask());
683 
684  //
685  // GEOMETRY
686  //
687  if (!geomTimes_.empty() || !cloudTimes_.empty())
688  {
689  // start of variables
690  *os_
691  << nl
692  << "GEOMETRY" << nl;
693  }
694 
695  if (staticGeom)
696  {
697  // Static mesh: store under data/constant/geometry
698  *os_
699  << setw(16) << "model:"
700  << (dataDirName/word("constant")/geometryName).c_str()
701  << nl;
702  }
703  else if (meshIndex >= 0)
704  {
705  // Not really moving, but stored under data/XXXX/geometry
706  *os_
707  << setw(16) << "model:"
708  << (dataDirName/padded(meshIndex)/geometryName).c_str()
709  << nl;
710  }
711  else if (!geomTimes_.empty())
712  {
713  // Moving
714  *os_
715  << word::printf("model: %-9d", tsGeom) // width 16 (no quotes)
716  << (dataMask/geometryName).c_str()
717  << nl;
718  }
719 
720  // Clouds and cloud variables
721  const wordList cloudNames(cloudVars_.sortedToc());
722 
723  for (const word& cloudName : cloudNames)
724  {
725  const fileName masked =
726  (
727  separateCloud()
728  ? (cloud::prefix / cloudName / mask())
729  : (dataMask / cloud::prefix / cloudName)
730  );
731 
732  *os_
733  << word::printf("measured: %-6d", tsCloud) // width 16 (no quotes)
734  << (masked/"positions").c_str()
735  << nl;
736  }
737 
738 
739  //
740  // VARIABLE
741  //
742  if (variables_.size() || cloudVars_.size())
743  {
744  // Start of variables
745  *os_
746  << nl
747  << "VARIABLE" << nl;
748  }
749 
750 
751  // Field variables (always use timeset 1)
752  // NB: The output file name is stricter than the variable name
753 
754  for (const word& varName : variables_.sortedToc())
755  {
756  const string& ensType = variables_[varName];
757 
758  *os_
759  << ensType.c_str()
760  <<
761  (
762  (nodeVariables_.found(varName) || nodeValues())
763  ? " per node: 1 " // time-set 1
764  : " per element: 1 " // time-set 1
765  )
766  << setw(15) << varName << ' '
767  << (dataMask/ensight::FileName(varName)).c_str() << nl;
768  }
769 
770 
771  // Clouds and cloud variables (using cloud timeset)
772  // Write
773  // as -> "data/********/lagrangian/<cloudName>/positions"
774  // or -> "lagrangian/<cloudName>/********/positions"
775  // NB: The output file name is stricter than the variable name
776 
777  label cloudNo = 0;
778  for (const word& cloudName : cloudNames)
779  {
780  const fileName masked =
781  (
782  separateCloud()
783  ? (cloud::prefix / cloudName / mask())
784  : (dataMask / cloud::prefix / cloudName)
785  );
786 
787  const HashTable<string>& vars = cloudVars_[cloudName];
788 
789  for (const word& varName : vars.sortedToc())
790  {
791  const string& ensType = vars[varName];
792 
793  // prefix variables with 'c' (cloud) and cloud index
794  *os_
795  << ensType.c_str() << " per "
796  << word::printf("measured node: %-5d", tsCloud) // width 20
797  << setw(15)
798  << ("c" + Foam::name(cloudNo) + varName).c_str() << ' '
799  << (masked/ensight::FileName(varName)).c_str() << nl;
800  }
801 
802  ++cloudNo;
803  }
804 
805 
806  //
807  // TIME
808  //
809 
810  if (!timesUsed_.empty())
811  {
812  *os_
813  << nl << "TIME" << nl;
814 
815  // timeset 1
816  const scalar timeCorrection = writeTimeset();
817 
818  // timeset geometry
819  if (tsGeom > 1)
820  {
821  writeTimeset(tsGeom, geomTimes_, timeCorrection);
822  }
823 
824  // timeset cloud
825  if (tsCloud > 1)
826  {
827  writeTimeset(tsCloud, cloudTimes_, timeCorrection);
828  }
829 
830  *os_
831  << "# end" << nl;
832  }
833 
834  *os_ << flush;
835  changed_ = false;
836 }
837 
838 
841 (
842  bool moving
843 ) const
844 {
846 
847  if (UPstream::master())
848  {
849  // Set the path of the ensight file
850  fileName path;
851 
852  if (moving)
853  {
854  // Moving mesh: write as "data/********/geometry"
855  path = dataDir()/padded(timeIndex_);
856  }
857  else
858  {
859  // Static mesh: write as "data/constant/geometry"
860  path = dataDir()/word("constant");
861  }
862  mkDir(path);
863 
864  noteGeometry(moving); // note for later use
865 
866  return autoPtr<ensightGeoFile>::New(path, geometryName, format());
867  }
869  return nullptr;
870 }
871 
872 
875 (
876  const word& cloudName
877 ) const
878 {
880 
881  if (UPstream::master())
882  {
883  output = createCloudFile(cloudName, "positions");
884 
885  // Tag binary format (just like geometry files)
886  output().writeBinaryHeader();
887 
888  // Description
890  output().newline();
891 
892  noteCloud(cloudName); // note for later use
893  }
894 
895  return output;
896 }
897 
898 
899 void Foam::ensightCase::rewind() const
900 {
901  if (os_) // master only
902  {
903  os_->stdStream().seekp(0, std::ios_base::beg);
904  }
905 }
906 
907 
909 {
910  os << "Ensight case:" << nl
911  << " path: " << ensightDir_ << nl
912  << " name: " << caseName_ << nl
913  << " format: " << format() << nl;
914 
915  if (nodeValues())
916  {
917  os << " values per node" << nl;
918  }
919 
920  return os;
921 }
922 
923 
924 // ************************************************************************* //
static void printTimeset(OSstream &os, const label ts, const scalar timeValue)
Print time-set for ensight case file with a single time.
Definition: ensightCase.C:91
Omanip< char > setfill(char fillch)
Definition: IOmanip.H:175
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:50
A class for handling file names.
Definition: fileName.H:72
static void setTimeFormat(OSstream &os, IOstreamOption::floatFormat timeFmt, const int timePrec)
Set output time format for ensight case file.
Definition: ensightCase.C:53
static void writeHeader(Ostream &os, const word &fieldName)
static word padded(const int nwidth, const label value)
Stringified zero-padded integer value.
Definition: ensightCase.C:38
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
Definition: IOstream.H:472
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
Output to file stream, using an OSstream.
Definition: OFstream.H:49
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
"ascii" (normal default)
floatFormat
Float formats (eg, time directory name formats)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
void nextTime(const scalar t)
Set time for time-set 1, using next available index.
Definition: ensightCase.C:596
void rewind() const
Rewind the output stream (master only).
Definition: ensightCase.C:892
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
scalar value() const noexcept
The value (const access)
Definition: Instant.H:134
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: POSIX.C:860
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:164
Configuration options for the ensightCase.
Definition: ensightCase.H:530
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:614
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
const word cloudName(propsDict.get< word >("cloud"))
virtual int precision() const override
Get precision of output field.
Definition: OSstream.C:334
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const char * geometryName
The name for geometry files: "geometry".
Definition: ensightCase.H:82
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
Definition: IOmanip.H:169
#define DetailInfo
Definition: evalEntry.C:30
errorManip< error > abort(error &err)
Definition: errorManip.H:139
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:105
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
Definition: POSIX.C:1433
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
Istream and Ostream manipulators taking arguments.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:192
autoPtr< ensightGeoFile > newGeometry(bool moving=false) const
Open stream for new geometry file (on master).
Definition: ensightCase.C:834
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
word format(conversionProperties.get< word >("format"))
List< word > wordList
List of word.
Definition: fileName.H:59
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
Definition: instant.H:53
void write() const
Write the case file.
Definition: ensightCase.C:640
Ostream & flush(Ostream &os)
Flush stream.
Definition: Ostream.H:521
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Definition: UPstream.H:1082
streamFormat
Data format (ascii | binary)
messageStream Info
Information stream (stdout output on master, null elsewhere)
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:44
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
static const char * dataDirName
The name for data subdirectory: "data".
Definition: ensightCase.H:70
Omanip< int > setw(const int i)
Definition: IOmanip.H:199
List< label > labelList
A List of labels.
Definition: List.H:62
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
Ostream & printInfo(Ostream &os) const
Print some general information.
Definition: ensightCase.C:901
autoPtr< ensightFile > newCloud(const word &cloudName) const
Open stream for new cloud positions (on master).
Definition: ensightCase.C:868
void setTime(const scalar t, const label index)
Set current index and time for time-set 1.
Definition: ensightCase.C:609
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
static const word prefix
The prefix to local: lagrangian.
Definition: cloud.H:79