TimeIO.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2016-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "Time.H"
30 #include "argList.H"
31 #include "Pstream.H"
32 #include "simpleObjectRegistry.H"
33 #include "dimensionedConstants.H"
34 #include "profiling.H"
35 #include "IOdictionary.H"
36 #include "fileOperation.H"
37 
38 #include <iomanip>
39 
40 // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Output seconds as day-hh:mm:ss
46 static std::ostream& printTimeHMS(std::ostream& os, double seconds)
47 {
48  const unsigned long ss = seconds;
49 
50  // days
51  const auto dd = (ss / 86400);
52 
53  if (dd) os << dd << '-';
54 
55  // hours
56  const int hh = ((ss / 3600) % 24);
57 
58  if (dd || hh)
59  {
60  os << std::setw(2) << std::setfill('0')
61  << hh << ':';
62  }
63 
64  // minutes
65  os << std::setw(2) << std::setfill('0')
66  << ((ss / 60) % 60) << ':';
67 
68  // seconds
69  os << std::setw(2) << std::setfill('0')
70  << (ss % 60);
71 
72 
73  // 1/100th seconds. As none or 2 decimal places
74  const int hundredths = int(100 * (seconds - ss)) % 100;
75 
76  if (hundredths)
77  {
78  os << '.' << std::setw(2) << std::setfill('0') << hundredths;
79  }
80 
81  return os;
82 }
83 
84 } // End namespace Foam
85 
86 
87 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
88 
90 {
91  word application;
92  if (controlDict_.readIfPresent("application", application))
93  {
94  // Do not override if already set so external application can override
95  setEnv("FOAM_APPLICATION", application, false);
96  }
97 
98  // Check for local switches and settings
99 
100  const dictionary* localDict = nullptr;
101 
102  // DebugSwitches
103  if
104  (
105  (localDict = controlDict_.findDict("DebugSwitches")) != nullptr
106  && localDict->size()
107  )
108  {
109  DetailInfo
110  << "Overriding DebugSwitches according to "
111  << controlDict_.name() << nl;
112 
113  debug::debugObjects().setValues(*localDict, true);
114  }
115 
116 
117  // InfoSwitches
118  if
119  (
120  (localDict = controlDict_.findDict("InfoSwitches")) != nullptr
121  && localDict->size()
122  )
123  {
124  DetailInfo
125  << "Overriding InfoSwitches according to "
126  << controlDict_.name() << nl;
127 
128  debug::infoObjects().setValues(*localDict, true);
129  }
130 
131  // OptimisationSwitches
132  if
133  (
134  (localDict = controlDict_.findDict("OptimisationSwitches")) != nullptr
135  && localDict->size()
136  )
137  {
138  DetailInfo
139  << "Overriding OptimisationSwitches according to "
140  << controlDict_.name() << nl;
141 
142  debug::optimisationObjects().setValues(*localDict, true);
143  }
144 
145 
146  // Handle fileHandler explicitly since it affects local dictionary
147  // monitoring.
148  word fileHandlerName;
149  if
150  (
151  localDict
152  && localDict->readIfPresent("fileHandler", fileHandlerName)
153  && fileHandler().type() != fileHandlerName
154  )
155  {
156  DetailInfo << "Overriding fileHandler to " << fileHandlerName << nl;
157 
158  // Remove old watches since destroying the file
159  fileNameList oldWatched(controlDict_.watchIndices().size());
160  forAllReverse(controlDict_.watchIndices(), i)
161  {
162  const label watchi = controlDict_.watchIndices()[i];
163  oldWatched[i] = fileHandler().getFile(watchi);
164  fileHandler().removeWatch(watchi);
165  }
166  controlDict_.watchIndices().clear();
167 
168  // Installing the new handler
169  Foam::fileHandler(fileOperation::New(fileHandlerName, true));
170 
171  // Reinstall old watches
172  fileHandler().addWatches(controlDict_, oldWatched);
173  }
174 
175 
176  // DimensionedConstants.
177  // - special case since it may change both the 'unitSet' and the
178  // individual values
179  if
180  (
181 
182  (localDict = controlDict_.findDict("DimensionedConstants")) != nullptr
183  && localDict->size()
184  )
185  {
186  DetailInfo
187  << "Overriding DimensionedConstants according to "
188  << controlDict_.name() << nl;
189 
191 
192  // Change in-memory
193  dimensionedConstants().merge(*localDict);
194 
195  IStringStream dummyIs("");
196 
197  forAllConstIters(objs, iter)
198  {
199  const List<simpleRegIOobject*>& objects = *iter;
200 
201  for (simpleRegIOobject* obj : objects)
202  {
203  obj->readData(dummyIs);
204 
205  if (Foam::infoDetailLevel > 0)
206  {
207  Info<< " ";
208  obj->writeData(Info);
209  Info<< nl;
210  }
211  }
212  }
213  }
214 
215 
216  // DimensionSets
217  if
218  (
219  (localDict = controlDict_.findDict("DimensionSets")) != nullptr
220  && localDict->size()
221  )
222  {
223  DetailInfo
224  << "Overriding DimensionSets according to "
225  << controlDict_.name() << nl;
226 
228 
230  dict.merge(*localDict);
231 
232  simpleObjectRegistryEntry* objPtr = objs.find("DimensionSets");
233 
234  if (objPtr)
235  {
236  DetailInfo << *localDict << nl;
237 
238  const List<simpleRegIOobject*>& objects = *objPtr;
239 
240  for (simpleRegIOobject* obj : objects)
241  {
243  os << dict;
244  IStringStream is(os.str());
245  obj->readData(is);
246  }
247  }
248  }
249 
250 
251  if (!deltaTchanged_)
252  {
253  controlDict_.readEntry("deltaT", deltaT_);
254  }
255 
257  (
258  "writeControl",
259  controlDict_,
261  );
262 
263  scalar oldWriteInterval = writeInterval_;
264 
265  if (controlDict_.readIfPresent("writeInterval", writeInterval_))
266  {
267  if (writeControl_ == wcTimeStep && label(writeInterval_) < 1)
268  {
269  FatalIOErrorInFunction(controlDict_)
270  << "writeInterval < 1 for writeControl timeStep"
271  << exit(FatalIOError);
272  }
273  }
274  else
275  {
276  controlDict_.readEntry("writeFrequency", writeInterval_);
277  }
278 
279 
280  if (oldWriteInterval != writeInterval_)
281  {
282  switch (writeControl_)
283  {
284  case wcRunTime:
285  case wcAdjustableRunTime:
286  // Recalculate writeTimeIndex_ to be in units of current
287  // writeInterval.
288  writeTimeIndex_ = label
289  (
291  * oldWriteInterval
293  );
294  break;
295 
296  default:
297  break;
298  }
299  }
300 
301  if (controlDict_.readIfPresent("purgeWrite", purgeWrite_))
302  {
303  if (purgeWrite_ < 0)
304  {
306  << "invalid value for purgeWrite " << purgeWrite_
307  << ", should be >= 0, setting to 0"
308  << endl;
309 
310  purgeWrite_ = 0;
311  }
312  }
313 
314  if (controlDict_.found("timeFormat"))
315  {
316  const word formatName(controlDict_.get<word>("timeFormat"));
317 
318  if (formatName == "general")
319  {
320  format_ = general;
321  }
322  else if (formatName == "fixed")
323  {
324  format_ = fixed;
325  }
326  else if (formatName == "scientific")
327  {
329  }
330  else
331  {
333  << "unsupported time format " << formatName
334  << endl;
335  }
336  }
337 
338  controlDict_.readIfPresent("timePrecision", precision_);
339 
340  // stopAt at 'endTime' or a specified value
341  // if nothing is specified, the endTime is zero
342  if (stopAtControlNames.readIfPresent("stopAt", controlDict_, stopAt_))
343  {
344  if (stopAt_ == saEndTime)
345  {
346  controlDict_.readEntry("endTime", endTime_);
347  }
348  else
349  {
350  endTime_ = GREAT;
351  }
352  }
353  else if (!controlDict_.readIfPresent("endTime", endTime_))
354  {
355  endTime_ = 0;
356  }
357 
359 
360  if (controlDict_.found("writeVersion"))
361  {
362  writeStreamOption_.version(controlDict_.get<token>("writeVersion"));
363  }
364 
365  if (controlDict_.found("writeFormat"))
366  {
367  writeStreamOption_.format(controlDict_.get<word>("writeFormat"));
368  }
369 
370  if (controlDict_.found("writePrecision"))
371  {
373  (
374  controlDict_.get<unsigned int>("writePrecision")
375  );
376 
379 
382 
383  FatalError().precision(IOstream::defaultPrecision());
384  FatalIOError.error::operator()().precision
385  (
387  );
388  }
389 
390  if (controlDict_.found("writeCompression"))
391  {
392  writeStreamOption_.compression
393  (
394  controlDict_.get<word>("writeCompression")
395  );
396 
397  if
398  (
399  writeStreamOption_.compression() == IOstream::COMPRESSED
400  && writeStreamOption_.format() == IOstream::BINARY
401  )
402  {
403  IOWarningInFunction(controlDict_)
404  << "Disabled binary format compression"
405  << " (inefficient/ineffective)"
406  << endl;
407 
408  writeStreamOption_.compression(IOstream::UNCOMPRESSED);
409  }
410  }
411 
412  controlDict_.readIfPresent("graphFormat", graphFormat_);
413  controlDict_.readIfPresent("runTimeModifiable", runTimeModifiable_);
414 
415 
416  if (!runTimeModifiable_ && controlDict_.watchIndices().size())
417  {
418  forAllReverse(controlDict_.watchIndices(), i)
419  {
420  fileHandler().removeWatch(controlDict_.watchIndices()[i]);
421  }
422  controlDict_.watchIndices().clear();
423  }
424 }
425 
426 
428 {
429  if (controlDict_.regIOobject::read())
430  {
431  // Read contents
432  readDict();
433  functionObjects_.read();
434 
435  if (runTimeModifiable_)
436  {
437  // For IOdictionary the call to regIOobject::read() would have
438  // already updated all the watchIndices via the addWatch but
439  // controlDict_ is an unwatchedIOdictionary so will only have
440  // stored the dependencies as files.
441  fileHandler().addWatches(controlDict_, controlDict_.files());
442  }
443  controlDict_.files().clear();
444 
445  return true;
446  }
447 
448  return false;
449 }
450 
451 
453 {
454  if (runTimeModifiable_)
455  {
456  // Get state of all monitored objects (=registered objects with a
457  // valid filePath).
458  // Note: requires same ordering in objectRegistries on different
459  // processors!
461  (
462  (
464  || regIOobject::fileModificationChecking == timeStampMaster
465  ),
467  );
468  // Time handling is special since controlDict_ is the one dictionary
469  // that is not registered to any database.
470 
471  if (controlDict_.readIfModified())
472  {
473  readDict();
474  functionObjects_.read();
475 
476  if (runTimeModifiable_)
477  {
478  // For IOdictionary the call to regIOobject::read() would have
479  // already updated all the watchIndices via the addWatch but
480  // controlDict_ is an unwatchedIOdictionary so will only have
481  // stored the dependencies as files.
482 
483  fileHandler().addWatches(controlDict_, controlDict_.files());
484  }
485  controlDict_.files().clear();
486  }
487 
488  bool registryModified = objectRegistry::modified();
489 
490  if (registryModified)
491  {
493  }
494  }
495 }
496 
497 
499 {
500  addProfiling(writing, "objectRegistry::writeObject");
501 
502  const word tmName(timeName());
503 
504  IOdictionary timeDict
505  (
506  IOobject
507  (
508  "time",
509  tmName,
510  "uniform",
511  *this,
514  false
515  )
516  );
517 
518  timeDict.add("value", timeName(timeToUserTime(value()), maxPrecision_));
519  timeDict.add("name", string(tmName));
520  timeDict.add("index", timeIndex_);
521  timeDict.add("deltaT", timeToUserTime(deltaT_));
522  timeDict.add("deltaT0", timeToUserTime(deltaT0_));
523 
524  return timeDict.regIOobject::writeObject
525  (
527  true
528  );
529 }
530 
531 
533 (
534  IOstreamOption streamOpt,
535  const bool valid
536 ) const
537 {
538  if (writeTime())
539  {
540  bool writeOK = writeTimeDict();
541 
542  if (writeOK)
543  {
544  writeOK = objectRegistry::writeObject(streamOpt, valid);
545  }
546 
547  if (writeOK)
548  {
549  // Does the writeTime trigger purging?
550  if (writeTime_ && purgeWrite_)
551  {
552  if
553  (
554  previousWriteTimes_.empty()
555  || previousWriteTimes_.top() != timeName()
556  )
557  {
558  previousWriteTimes_.push(timeName());
559  }
560 
561  while (previousWriteTimes_.size() > purgeWrite_)
562  {
564  (
565  fileHandler().filePath
566  (
567  objectRegistry::path(previousWriteTimes_.pop())
568  )
569  );
570  }
571  }
572  }
573 
574  return writeOK;
575  }
576 
577  return false;
578 }
579 
580 
582 {
583  writeTime_ = true;
584  return write();
585 }
586 
587 
589 {
590  stopAt_ = saWriteNow;
591  endTime_ = value();
592 
593  return writeNow();
594 }
595 
596 
598 {
599  writeOnce_ = true;
600 }
601 
602 
604 {
605  switch (printExecutionFormat_)
606  {
607  case 1:
608  {
609  os << "ExecutionTime = ";
610  printTimeHMS(os.stdStream(), elapsedCpuTime());
611 
612  os << " ClockTime = ";
613  printTimeHMS(os.stdStream(), elapsedClockTime());
614  }
615  break;
616 
617  default:
618  {
619  os << "ExecutionTime = " << elapsedCpuTime() << " s"
620  << " ClockTime = " << elapsedClockTime() << " s";
621  }
622  break;
623  }
624 
625  os << nl << endl;
626 
627  return os;
628 }
629 
630 
631 // ************************************************************************* //
Foam::fileOperation::type
virtual fileName::Type type(const fileName &, const bool followLink=true) const =0
Return the file type: DIRECTORY, FILE or LINK.
Foam::IOstreamOption::UNCOMPRESSED
compression = false
Definition: IOstreamOption.H:79
Foam::dictionary::findDict
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
Definition: dictionary.C:508
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::Time::general
default float notation
Definition: Time.H:109
profiling.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::simpleObjectRegistry::setValues
void setValues(const dictionary &dict, bool report=false)
Set values (invoke callbacks) from dictionary entries.
Definition: simpleObjectRegistry.C:36
Foam::fileOperation::addWatches
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
Definition: fileOperation.C:598
Foam::Time::purgeWrite_
label purgeWrite_
Definition: Time.H:161
Foam::regIOobject::watchIndices
const labelList & watchIndices() const
Return file-monitoring handles.
Definition: regIOobjectI.H:155
Foam::dictionary::found
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionary.C:364
Foam::Time::writeControlNames
static const Enum< writeControls > writeControlNames
Names for writeControls.
Definition: Time.H:116
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:415
Foam::IOobject::fileModificationChecking
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition: IOobject.H:211
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:289
simpleObjectRegistry.H
Foam::dimensioned::name
const word & name() const
Return const reference to name.
Definition: dimensionedType.C:406
Foam::fileHandler
const fileOperation & fileHandler()
Get current file handler.
Definition: fileOperation.C:1170
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::token
A token holds an item read from Istream.
Definition: token.H:69
Foam::setEnv
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable, return true on success.
Definition: MSwindows.C:395
Foam::dimensioned< scalar >::value
const scalar & value() const
Return const reference to value.
Definition: dimensionedType.C:434
Foam::Serr
OSstream Serr
An Ostream wrapper for std::cerr.
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:81
Foam::Pout
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:82
Foam::Time::writeOnce
void writeOnce()
Write the objects once (one shot) and continue the run.
Definition: TimeIO.C:597
Foam::fileOperation::updateStates
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
Definition: fileOperation.C:641
Foam::Time::read
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:427
Foam::fileOperation::getFile
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
Definition: fileOperation.C:634
Foam::Time::writeAndEnd
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
Definition: TimeIO.C:588
Foam::Time::wcTimeStep
"timeStep"
Definition: Time.H:87
Foam::Time::saEndTime
Stop when Time reaches prescribed endTime.
Definition: Time.H:99
Foam::fileOperation::New
static autoPtr< fileOperation > New(const word &handlerType, bool verbose=false)
Select fileHandler-type.
Definition: fileOperation.C:428
Foam::Time::printExecutionTime
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
Definition: TimeIO.C:603
Foam::dictionary::merge
bool merge(const dictionary &dict)
Merge entries from the given dictionary.
Definition: dictionary.C:879
Foam::Time::stopAtControlNames
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
Definition: Time.H:119
Foam::simpleObjectRegistryEntry
Definition: simpleObjectRegistry.H:56
Foam::Time::precision_
static int precision_
Time directory name precision.
Definition: Time.H:186
Foam::Time::timeName
virtual word timeName() const
Return current time name.
Definition: Time.C:795
Foam::debug::optimisationObjects
simpleObjectRegistry & optimisationObjects()
Access to registered OptimisationSwitch objects.
Definition: debug.C:313
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::debug::debugObjects
simpleObjectRegistry & debugObjects()
Access to registered DebugSwitch objects.
Definition: debug.C:291
Foam::dimensionSystems
dictionary & dimensionSystems()
Top level dictionary.
Definition: dimensionSets.C:93
Foam::OSstream::stdStream
virtual std::ostream & stdStream()
Access to underlying std::ostream.
Definition: OSstream.H:222
argList.H
Foam::TimeState::writeTimeIndex_
label writeTimeIndex_
Definition: TimeState.H:58
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::Time::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
Definition: TimeIO.C:533
Foam::dimensionedConstants
dictionary & dimensionedConstants()
Definition: dimensionedConstants.C:41
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::OSstream
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:54
Foam::fileOperation::rmDir
virtual bool rmDir(const fileName &dir, const bool silent=false) const =0
Remove a directory and its contents.
Foam::debug::dimensionSetObjects
simpleObjectRegistry & dimensionSetObjects()
Access to registered DimensionSets objects.
Definition: debug.C:324
DetailInfo
#define DetailInfo
Definition: evalEntry.C:36
Foam::IOstreamOption::version
versionNumber version() const noexcept
Get the stream version.
Definition: IOstreamOption.H:341
Foam::Time::stopAt_
stopAtControls stopAt_
Definition: Time.H:155
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
addProfiling
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
Definition: profilingTrigger.H:114
Foam::objectRegistry::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write the objects using stream options.
Definition: objectRegistry.C:475
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::debug::infoObjects
simpleObjectRegistry & infoObjects()
Access to registered InfoSwitch objects.
Definition: debug.C:302
fileOperation.H
Pstream.H
Foam::debug::dimensionedConstantObjects
simpleObjectRegistry & dimensionedConstantObjects()
Access to registered DimensionedConstants objects.
Definition: debug.C:335
Foam::Time::wcAdjustableRunTime
"adjustable" / "adjustableRunTime"
Definition: Time.H:89
Foam::IStringStream
Input from string buffer, using a ISstream.
Definition: StringStream.H:111
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::setw
Omanip< int > setw(const int i)
Definition: IOmanip.H:199
Foam::DictionaryBase::find
T * find(const word &keyword)
Find and return an entry, nullptr on failure.
Definition: DictionaryBase.C:114
Foam::Time::writeTimeDict
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
Definition: TimeIO.C:498
Foam::infoDetailLevel
int infoDetailLevel
Global for selective suppression of Info output.
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::fileOperation::removeWatch
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
Definition: fileOperation.C:574
Foam::objectRegistry::modified
virtual bool modified() const
Return true if any of the object's files have been modified.
Definition: objectRegistry.C:437
Foam::objectRegistry::readModifiedObjects
void readModifiedObjects()
Read the objects that have been modified.
Definition: objectRegistry.C:451
Foam::Perr
prefixOSstream Perr
An Ostream wrapper for parallel output to std::cerr.
Foam::OSstream::precision
virtual int precision() const
Get precision of output field.
Definition: OSstream.C:320
Foam::Time::readDict
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:89
Foam::Detail::StringStreamAllocator::str
Foam::string str() const
Get the string - as Foam::string rather than std::string.
Definition: StringStream.H:91
IOdictionary.H
Time.H
Foam::IOstreamOption::BINARY
"binary"
Definition: IOstreamOption.H:73
Foam::Time::readModifiedObjects
void readModifiedObjects()
Read the objects that have been modified.
Definition: TimeIO.C:452
Foam::IOstreamOption::ASCII
"ascii" (normal default)
Definition: IOstreamOption.H:72
Foam::IOstreamOption::COMPRESSED
compression = true
Definition: IOstreamOption.H:80
Foam::nl
constexpr char nl
Definition: Ostream.H:385
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
Foam::IOstream::defaultPrecision
static unsigned int defaultPrecision()
Return the default precision.
Definition: IOstream.H:333
Foam::List< fileName >
Foam::Time::wcRunTime
"runTime"
Definition: Time.H:88
Foam::OStringStream
Output to string buffer, using a OSstream.
Definition: StringStream.H:196
Foam::setfill
Omanip< char > setfill(char fillch)
Definition: IOmanip.H:175
Foam::Time::writeInterval_
scalar writeInterval_
Definition: Time.H:159
Foam::Time::fixed
fixed-point notation
Definition: Time.H:110
Foam::Time::writeNow
bool writeNow()
Definition: TimeIO.C:581
Foam::Time::format_
static fmtflags format_
Time directory name format.
Definition: Time.H:183
Foam::List::clear
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:115
Foam::Time::scientific
scientific notation
Definition: Time.H:111
Foam::Enum::readIfPresent
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
Definition: Enum.C:271
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
forAllReverse
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Definition: stdFoam.H:309
Foam::dictionary::add
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:708
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:392
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::Time::endTime_
scalar endTime_
Definition: Time.H:153
IOWarningInFunction
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Definition: messageStream.H:310
Foam::Sout
OSstream Sout
An Ostream wrapper for std::cout.
Foam::IOstreamOption::compression
compressionType compression() const noexcept
Get the stream compression.
Definition: IOstreamOption.H:315
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::IOobject::path
fileName path() const
The complete path.
Definition: IOobject.C:467
Foam::Time::writeControl_
writeControls writeControl_
Definition: Time.H:157
Foam::TimeState::deltaT_
scalar deltaT_
Definition: TimeState.H:60
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:298
Foam::TimeState::deltaTchanged_
bool deltaTchanged_
Definition: TimeState.H:64
Foam::simpleRegIOobject
Abstract base class for registered object with I/O. Used in debug symbol registration.
Definition: simpleRegIOobject.H:52
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:417
Foam::printTimeHMS
static std::ostream & printTimeHMS(std::ostream &os, double seconds)
Definition: TimeIO.C:46
dimensionedConstants.H
Dictionary reading and supplying the dimensioned constants used within OpenFOAM, particularly for the...
Foam::simpleObjectRegistry
Object registry for simpleRegIOobject. Maintains ordering.
Definition: simpleObjectRegistry.H:81