Time.H
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 Class
28  Foam::Time
29 
30 Description
31  Class to control time during OpenFOAM simulations that is also the
32  top-level objectRegistry.
33 
34 SourceFiles
35  Time.C
36  TimeIO.C
37  findInstance.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Foam_Time_H
42 #define Foam_Time_H
43 
44 #include "TimePaths.H"
45 #include "objectRegistry.H"
46 #include "unwatchedIOdictionary.H"
47 #include "FIFOStack.H"
48 #include "clock.H"
49 #include "cpuTime.H"
50 #include "TimeState.H"
51 #include "Switch.H"
52 #include "instantList.H"
53 #include "Enum.H"
54 #include "typeInfo.H"
55 #include "dlLibraryTable.H"
56 #include "functionObjectList.H"
57 #include "sigWriteNow.H"
58 #include "sigStopAtWriteNow.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 // Forward Declarations
66 class argList;
67 class profilingTrigger;
68 class OSstream;
69 
70 /*---------------------------------------------------------------------------*\
71  Class Time Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 class Time
75 :
76  public clock,
77  public cpuTime,
78  public TimePaths,
79  public objectRegistry,
80  public TimeState
81 {
82 public:
83 
84  //- Write control options
86  {
91  wcClockTime,
92  wcCpuTime,
93  wcUnknown
94  };
95 
96  //- Stop-run control options, which are primarily used when
97  //- altering the stopAt condition.
98  enum stopAtControls
99  {
104  saUnknown
105  };
106 
107  //- Supported time directory name formats
108  enum fmtflags
109  {
110  general = 0,
113  };
114 
115 
116  //- Names for writeControls
118 
119  //- Names for stopAtControls
121 
122 
123  //- Style for "ExecutionTime = " output
124  // 0 = seconds (with trailing 's')
125  // 1 = day-hh:mm:ss
126  //
127  // \note this is public so registered info switches can modify it.
128  static int printExecutionFormat_;
129 
130 
131 private:
132 
133  // Private Data
134 
135  //- Profiling trigger for time-loop (for run, loop)
136  mutable std::unique_ptr<profilingTrigger> loopProfiling_;
137 
138  //- Any loaded dynamic libraries
139  // Construct before reading controlDict
140  mutable dlLibraryTable libs_;
141 
142  //- The controlDict
143  unwatchedIOdictionary controlDict_;
144 
145 
146 protected:
147 
148  // Protected Data
149 
150  label startTimeIndex_;
151 
152  scalar startTime_;
153 
154  mutable scalar endTime_;
155 
156  mutable stopAtControls stopAt_;
157 
159 
160  scalar writeInterval_;
161 
162  label purgeWrite_;
163 
166  //- The total number of sub-cycles, the current sub-cycle index,
167  //- or 0 if time is not being sub-cycled
168  label subCycling_;
170  // One-shot writing
172 
173  //- If time is being sub-cycled this is the previous TimeState
176  //- Signal handler for one-shot writing upon signal
178 
179  //- Signal handler for write and clean exit upon signal
181 
182 
183  //- Time directory name format
184  static fmtflags format_;
186  //- Time directory name precision
187  static int precision_;
189  //- Maximum time directory name precision
190  static const int maxPrecision_;
191 
192 
193  //- Adjust the time step so that writing occurs at the specified time
194  void adjustDeltaT();
195 
196  //- Set the controls from the current controlDict
197  void setControls();
199  //- Set file monitoring, profiling, etc
200  // Optionally force profiling without inspecting the controlDict
201  void setMonitoring(const bool forceProfiling=false);
202 
203  //- Read the control dictionary and set the write controls etc.
204  virtual void readDict();
205 
206 
207 private:
208 
209  //- The write stream option (format, compression, version)
210  IOstreamOption writeStreamOption_;
211 
212  //- Default graph format
213  word graphFormat_;
215  //- Is runtime modification of dictionaries allowed?
216  Switch runTimeModifiable_;
217 
218  //- Function objects executed at start and on ++, +=
219  mutable functionObjectList functionObjects_;
220 
221 
222 public:
223 
224  // Static Data Members
225 
226  //- The default control dictionary name (normally "controlDict")
227  static word controlDictName;
228 
229 
230  //- Runtime type information
231  TypeName("time");
232 
233 
234  // Constructors
235 
236  //- Construct from dictionary name to read and argument list.
237  // Uses "system" and "constant" for its directories.
238  inline Time
239  (
240  const word& ctrlDictName,
241  const argList& args,
242  const bool enableFunctionObjects = true,
243  const bool enableLibs = true
244  );
245 
246  //- Construct given name of dictionary to read and root/case paths.
247  // Uses "system" and "constant" for its directories.
248  inline Time
249  (
250  const word& ctrlDictName,
251  const fileName& rootPath,
252  const fileName& caseName,
253  const bool enableFunctionObjects = true,
254  const bool enableLibs = true
255  );
256 
257  //- Construct given dictionary and root/case paths.
258  // Uses "system" and "constant" for its directories.
259  inline Time
260  (
261  const dictionary& dict,
262  const fileName& rootPath,
263  const fileName& caseName,
264  const bool enableFunctionObjects = true,
265  const bool enableLibs = true
266  );
267 
268  //- Construct at endTime and root/case paths.
269  // Uses "system" and "constant" for its directories.
270  inline Time
271  (
272  const fileName& rootPath,
273  const fileName& caseName,
274  const bool enableFunctionObjects = true,
275  const bool enableLibs = true
276  );
277 
278  //- Construct from dictionary name to read and argument list.
279  // Use specified system/constant directory names.
280  Time
281  (
282  const word& ctrlDictName,
283  const argList& args,
284  const word& systemName,
285  const word& constantName,
286  const bool enableFunctionObjects = true,
287  const bool enableLibs = true
288  );
289 
290  //- Construct given name of dictionary to read and root/case paths.
291  // Use specified system/constant directory names.
292  Time
293  (
294  const word& ctrlDictName,
295  const fileName& rootPath,
296  const fileName& caseName,
297  const word& systemName,
298  const word& constantName,
299  const bool enableFunctionObjects = true,
300  const bool enableLibs = true
301  );
302 
303  //- Construct given dictionary and root/case paths.
304  // Use specified system/constant directory names.
305  Time
306  (
307  const dictionary& dict,
308  const fileName& rootPath,
309  const fileName& caseName,
310  const word& systemName,
311  const word& constantName,
312  const bool enableFunctionObjects = true,
313  const bool enableLibs = true
314  );
315 
316  //- Construct given endTime and root/case paths.
317  // Use specified system/constant directory names.
318  Time
319  (
320  const fileName& rootPath,
321  const fileName& caseName,
322  const word& systemName,
323  const word& constantName,
324  const bool enableFunctionObjects = true,
325  const bool enableLibs = true
326  );
327 
328 
329  // Selectors
330 
331  //- Construct (dummy) Time - no functionObjects or libraries
332  static autoPtr<Time> New();
333 
334  //- Construct (dummy) Time - no functionObjects or libraries
335  static autoPtr<Time> New(const fileName& caseDir);
336 
337  //- Construct (dummy) Time - no functionObjects or libraries
338  static autoPtr<Time> New(const argList& args);
339 
340 
341  //- Destructor
342  virtual ~Time();
343 
344 
345  // Member Functions
346 
347  // Database functions
348 
349  //- Return name from objectRegistry and not TimePaths
350  using objectRegistry::name;
351 
352  //- Return root path
353  using TimePaths::rootPath;
354 
355  //- Return case name
356  using TimePaths::caseName;
357 
358  //- Return path
359  fileName path() const
360  {
361  return rootPath()/caseName();
362  }
363 
364  //- Return read access to the controlDict dictionary
365  const dictionary& controlDict() const
366  {
367  return controlDict_;
368  }
369 
370  virtual const fileName& dbDir() const
371  {
372  return fileName::null;
373  }
374 
375  //- Return current time path
376  fileName timePath() const
377  {
378  return path()/timeName();
379  }
380 
381  //- The write stream option (format, compression, version)
382  IOstreamOption writeStreamOption() const noexcept
383  {
384  return writeStreamOption_;
385  }
386 
387  //- The write stream format
389  {
390  return writeStreamOption_.format();
391  }
392 
393  //- The write stream compression
395  {
396  return writeStreamOption_.compression();
397  }
398 
399  //- The write stream version
400  IOstreamOption::versionNumber writeVersion() const noexcept
401  {
402  return writeStreamOption_.version();
403  }
404 
405  //- Default graph format
406  const word& graphFormat() const noexcept
407  {
408  return graphFormat_;
409  }
410 
411  //- Supports re-reading
412  Switch runTimeModifiable() const noexcept
413  {
414  return runTimeModifiable_;
415  }
416 
417  //- Set re-reading support on/off (use with caution).
418  // \return the previous value
419  Switch runTimeModifiable(const Switch sw) noexcept
420  {
421  Switch old(runTimeModifiable_);
422  runTimeModifiable_ = sw;
423  return old;
424  }
425 
426  //- Read control dictionary, update controls and time
427  virtual bool read();
428 
429  //- Read the objects that have been modified
430  void readModifiedObjects();
431 
432  //- Return time instance (location) of \em dir that contains
433  //- the file \em name (eg, used in reading mesh data).
434  // When \em is empty, searches for directory \em dir only.
435  // Does not search beyond stopInstance (if set) or \em constant.
436  //
437  // \note If the instance cannot be found, returns the
438  // stopInstance (if set and reached) or \em constant.
439  // FatalError if it cannot be found and readOpt is
440  // (MUST_READ or MUST_READ_IF_MODIFIED).
441  word findInstance
442  (
443  const fileName& dir,
444  const word& name = word::null,
446  const word& stopInstance = word::null
447  ) const;
448 
449  //- Search the case for the time directory path
450  //- corresponding to the given instance
452  (
453  const fileName& directory,
454  const instant& t
455  ) const;
456 
457  //- Search the case for the time directory path
458  //- corresponding to the given instance
459  word findInstancePath(const instant& t) const;
460 
461  //- Write time dictionary to the <time>/uniform directory
462  virtual bool writeTimeDict() const;
463 
464  //- Write using stream options
465  virtual bool writeObject
466  (
467  IOstreamOption streamOpt,
468  const bool valid
469  ) const;
471  //- Write the objects immediately (not at end of iteration)
472  //- and continue the run
473  bool writeNow();
474 
475  //- Write the objects now (not at end of iteration) and end the run
476  bool writeAndEnd();
477 
478  //- Write the objects once (one shot) and continue the run
479  void writeOnce();
480 
481  //- Print the elapsed ExecutionTime (cpu-time), ClockTime
483 
484 
485  // Access
487  //- Return time name of given scalar time
488  //- formatted with the given precision
489  static word timeName
490  (
491  const scalar t,
492  const int precision = precision_
493  );
495  //- Return current time name
496  virtual word timeName() const;
497 
498  //- Return start time index
499  virtual label startTimeIndex() const;
500 
501  //- Return start time
502  virtual dimensionedScalar startTime() const;
503 
504  //- Return end time
505  virtual dimensionedScalar endTime() const;
506 
507  //- Return the stop control information
508  virtual stopAtControls stopAt() const;
509 
510  //- Return true if adjustTimeStep is true
511  virtual bool isAdjustTimeStep() const;
512 
513  //- Return the list of function objects
514  const functionObjectList& functionObjects() const
515  {
516  return functionObjects_;
517  }
519  //- Mutable access to the loaded dynamic libraries
520  dlLibraryTable& libs() const noexcept
521  {
522  return libs_;
523  }
524 
525  //- Zero (tests as false) if time is not being sub-cycled,
526  //- otherwise the current sub-cycle index or the total number of
527  //- sub-cycles.
528  // The interpretation of non-zero values is dependent on the
529  // routine.
530  label subCycling() const noexcept
531  {
532  return subCycling_;
533  }
534 
535  //- Return previous TimeState if time is being sub-cycled
536  const TimeState& prevTimeState() const
537  {
538  return *prevTimeState_;
539  }
540 
541 
542  // Check
543 
544  //- Return true if run should continue,
545  // also invokes the functionObjectList::end() method
546  // when the time goes out of range
547  // \note
548  // For correct behaviour, the following style of time-loop
549  // is recommended:
550  // \code
551  // while (runTime.run())
552  // {
553  // ++runTime;
554  // solve;
555  // runTime.write();
556  // }
557  // \endcode
558  virtual bool run() const;
559 
560  //- Return true if run should continue and if so increment time
561  // also invokes the functionObjectList::end() method
562  // when the time goes out of range
563  // \note
564  // For correct behaviour, the following style of time-loop
565  // is recommended:
566  // \code
567  // while (runTime.loop())
568  // {
569  // solve;
570  // runTime.write();
571  // }
572  // \endcode
573  virtual bool loop();
574 
575  //- Return true if end of run,
576  // does not invoke any functionObject methods
577  // \note
578  // The rounding heuristics near endTime mean that
579  // \code run() \endcode and \code !end() \endcode may
580  // not yield the same result
581  virtual bool end() const;
582 
583 
584  // Edit
585 
586  //- Adjust the current stopAtControl.
587  // \param stopCtrl the new stop control, whereby
588  // stopAtControls::saUnknown is treated as a no-op.
589  // \note this value only persists until the next time the
590  // dictionary is read.
591  // \return true if the stopAt() value was changed.
592  virtual bool stopAt(const stopAtControls stopCtrl) const;
593 
594  //- Reset the time and time-index to those of the given time
595  virtual void setTime(const Time& t);
596 
597  //- Reset the time and time-index
598  virtual void setTime(const instant& inst, const label newIndex);
599 
600  //- Reset the time and time-index
601  virtual void setTime
602  (
603  const dimensionedScalar& newTime,
604  const label newIndex
605  );
606 
607  //- Reset the time and time-index
608  virtual void setTime(const scalar newTime, const label newIndex);
609 
610  //- Reset end time
611  virtual void setEndTime(const dimensionedScalar& endTime);
612 
613  //- Reset end time
614  virtual void setEndTime(const scalar endTime);
615 
616  //- Reset time step, normally also calling adjustDeltaT()
617  virtual void setDeltaT
618  (
619  const dimensionedScalar& deltaT,
620  const bool adjust = true
621  );
622 
623  //- Reset time step, normally also calling adjustDeltaT()
624  virtual void setDeltaT
625  (
626  const scalar deltaT,
627  const bool adjust = true
628  );
629 
630  //- Set time to sub-cycle for the given number of steps
631  virtual TimeState subCycle(const label nSubCycles);
632 
633  //- Adjust the reported sub-cycle index.
634  // \param index is the sub-cycle index.
635  // This index is ignored sub-cycling was
636  // not already registered, or if the index is zero or
637  // negative.
638  virtual void subCycleIndex(const label index);
639 
640  //- Reset time after sub-cycling back to previous TimeState
641  virtual void endSubCycle();
642 
643  //- Return non-const access to the list of function objects
644  functionObjectList& functionObjects()
645  {
646  return functionObjects_;
647  }
648 
649 
650  // Member operators
651 
652  //- Set deltaT to that specified and increment time via operator++()
653  virtual Time& operator+=(const dimensionedScalar& deltaT);
654 
655  //- Set deltaT to that specified and increment time via operator++()
656  virtual Time& operator+=(const scalar deltaT);
657 
658  //- Prefix increment,
659  // also invokes the functionObjectList::start() or
660  // functionObjectList::execute() method, depending on the time-index
661  virtual Time& operator++();
663  //- Postfix increment, this is identical to the prefix increment
664  virtual Time& operator++(int);
665 };
666 
667 
668 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
669 
670 } // End namespace Foam
671 
672 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
673 
674 #include "TimeI.H"
675 
676 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
677 
678 #endif
679 
680 // ************************************************************************* //
A FIFO stack based on a singly-linked list.
Definition: FIFOStack.H:45
virtual Time & operator++()
Prefix increment,.
Definition: Time.C:1126
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:50
dictionary dict
unwatchedIOdictionary is like IOdictionary but stores dependencies as files instead of fileMonitor wa...
fileName path() const
Return path.
Definition: Time.H:449
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
Definition: Time.H:670
Address the time paths without using the Time class.
Definition: TimePaths.H:52
A class for handling file names.
Definition: fileName.H:71
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
Definition: TimeIO.C:597
static int printExecutionFormat_
Style for "ExecutionTime = " output.
Definition: Time.H:136
stopAtControls stopAt_
Definition: Time.H:171
sigStopAtWriteNow sigStopAtWriteNow_
Signal handler for write and clean exit upon signal.
Definition: Time.H:203
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:47
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Dummy no-op. Do not change current value.
Definition: Time.H:103
word findInstance(const fileName &dir, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null) const
Return time instance (location) of dir that contains the file name (eg, used in reading mesh data)...
Definition: Time.C:777
void adjustDeltaT()
Adjust the time step so that writing occurs at the specified time.
Definition: Time.C:92
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
adjust endTime to stop immediately w/ writing
Definition: Time.H:101
virtual ~Time()
Destructor.
Definition: Time.C:738
virtual bool isAdjustTimeStep() const
Return true if adjustTimeStep is true.
Definition: Time.C:971
fileName timePath() const
Return current time path.
Definition: Time.H:470
scalar writeInterval_
Definition: Time.H:175
virtual stopAtControls stopAt() const
Return the stop control information.
Definition: Time.C:853
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:150
virtual void setEndTime(const dimensionedScalar &endTime)
Reset end time.
Definition: Time.C:1028
General relative velocity model.
Read access to the system clock with formatting.
Definition: clock.H:48
static const fileName null
An empty fileName.
Definition: fileName.H:110
writeControls
Write control options.
Definition: Time.H:82
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:931
virtual dimensionedScalar startTime() const
Return start time.
Definition: Time.C:841
static fmtflags format_
Time directory name format.
Definition: Time.H:209
"clockTime"
Definition: Time.H:88
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Definition: Switch.H:77
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:697
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
Definition: Time.H:125
label subCycling() const noexcept
Zero (tests as false) if time is not being sub-cycled, otherwise the current sub-cycle index or the t...
Definition: Time.H:683
A simple container for options an IOstream can normally have.
virtual dimensionedScalar endTime() const
Return end time.
Definition: Time.C:847
Dummy no-op.
Definition: Time.H:90
scalar startTime_
Definition: Time.H:167
IOstream & fixed(IOstream &io)
Definition: IOstream.H:560
writeControls writeControl_
Definition: Time.H:173
const TimeState & prevTimeState() const
Return previous TimeState if time is being sub-cycled.
Definition: Time.H:691
void setMonitoring(const bool forceProfiling=false)
Set file monitoring, profiling, etc.
Definition: Time.C:339
virtual word timeName() const
Return current time name.
Definition: Time.C:770
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
IOstreamOption writeStreamOption() const noexcept
The write stream option (format, compression, version)
Definition: Time.H:478
"runTime"
Definition: Time.H:86
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:859
label subCycling_
The total number of sub-cycles, the current sub-cycle index, or 0 if time is not being sub-cycled...
Definition: Time.H:185
static const int maxPrecision_
Maximum time directory name precision.
Definition: Time.H:219
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
Definition: TimeIO.C:506
label purgeWrite_
Definition: Time.H:177
virtual TimeState subCycle(const label nSubCycles)
Set time to sub-cycle for the given number of steps.
Definition: Time.C:1062
"adjustable" / "adjustableRunTime"
Definition: Time.H:87
"timeStep"
Definition: Time.H:85
static int precision_
Time directory name precision.
Definition: Time.H:214
TypeName("time")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition: word.H:63
IOstreamOption::versionNumber writeVersion() const noexcept
The write stream version.
Definition: Time.H:502
Extract command arguments and options from the supplied argc and argv parameters. ...
Definition: argList.H:118
static const word null
An empty word.
Definition: word.H:84
static const Enum< writeControls > writeControlNames
Names for writeControls.
Definition: Time.H:120
scalar endTime_
Definition: Time.H:169
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Definition: Time.C:977
Time(const word &ctrlDictName, const argList &args, const bool enableFunctionObjects=true, const bool enableLibs=true)
Construct from dictionary name to read and argument list.
Definition: TimeI.H:24
List of function objects with start(), execute() and end() functions that is called for each object...
Signal handler to write once and continue. The interrupt is defined by OptimisationSwitches::writeNow...
Definition: sigWriteNow.H:49
IOstreamOption::compressionType writeCompression() const noexcept
The write stream compression.
Definition: Time.H:494
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:275
fixed-point notation
Definition: Time.H:112
A table of dynamically loaded libraries.
scientific notation
Definition: Time.H:113
virtual void subCycleIndex(const label index)
Adjust the reported sub-cycle index.
Definition: Time.C:1086
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
const direction noexcept
Definition: Scalar.H:258
FIFOStack< word > previousWriteTimes_
Definition: Time.H:179
OBJstream os(runTime.globalPath()/outputName)
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:83
compressionType compression() const noexcept
Get the stream compression.
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
Definition: TimeIO.C:612
void readModifiedObjects()
Read the objects that have been modified.
Definition: TimeIO.C:460
IOstreamOption::streamFormat writeFormat() const noexcept
The write stream format.
Definition: Time.H:486
"cpuTime"
Definition: Time.H:89
const word & graphFormat() const noexcept
Default graph format.
Definition: Time.H:510
const word & name() const noexcept
Return const reference to name.
void writeOnce()
Write the objects once (one shot) and continue the run.
Definition: TimeIO.C:606
Adjust endTime to stop immediately w/o writing.
Definition: Time.H:100
word findInstancePath(const fileName &directory, const instant &t) const
Search the case for the time directory path corresponding to the given instance.
Definition: Time.C:801
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
Definition: instant.H:53
const fileName & rootPath() const noexcept
Return root path.
Definition: TimePathsI.H:43
virtual bool end() const
Return true if end of run,.
Definition: Time.C:944
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:435
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:662
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Stop when Time reaches prescribed endTime.
Definition: Time.H:99
virtual Time & operator+=(const dimensionedScalar &deltaT)
Set deltaT to that specified and increment time via operator++()
Definition: Time.C:1113
bool writeOnce_
Definition: Time.H:188
sigWriteNow sigWriteNow_
Signal handler for one-shot writing upon signal.
Definition: Time.H:198
virtual void setDeltaT(const dimensionedScalar &deltaT, const bool adjust=true)
Reset time step, normally also calling adjustDeltaT()
Definition: Time.C:1041
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
Definition: Time.H:457
versionNumber version() const noexcept
Get the stream version.
label startTimeIndex_
Definition: Time.H:165
streamFormat
Data format (ascii | binary)
virtual void endSubCycle()
Reset time after sub-cycling back to previous TimeState.
Definition: Time.C:1099
fmtflags
Supported time directory name formats.
Definition: Time.H:109
Signal handler to write and stop the job. The interrupt is defined by OptimisationSwitches::stopAtWri...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
stop at the next data write interval
Definition: Time.H:102
stopAtControls
Stop-run control options, which are primarily used when altering the stopAt condition.
Definition: Time.H:97
Registry of regIOobjects.
Switch runTimeModifiable() const noexcept
Supports re-reading.
Definition: Time.H:518
Foam::argList args(argc, argv)
virtual label startTimeIndex() const
Return start time index.
Definition: Time.C:835
"none"
Definition: Time.H:84
TimeState()
Construct a zero time state, using the current time formatting.
Definition: TimeState.C:27
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Definition: Time.H:462
streamFormat format() const noexcept
Get the current stream format.
autoPtr< TimeState > prevTimeState_
If time is being sub-cycled this is the previous TimeState.
Definition: Time.H:193
bool writeNow()
Write the objects immediately (not at end of iteration) and continue the run.
Definition: TimeIO.C:590
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:48
const fileName & caseName() const noexcept
Return case name.
Definition: TimePathsI.H:55
void setControls()
Set the controls from the current controlDict.
Definition: Time.C:136
IOstream & scientific(IOstream &io)
Definition: IOstream.H:566
Namespace for OpenFOAM.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
Definition: TimeIO.C:541
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTimePosix.H:52
readOption
Enumeration defining read preferences.