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