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