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-2019 OpenFOAM Foundation
9  Copyright (C) 2016-2023 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  //- Is temporary object cache enabled?
219  mutable bool cacheTemporaryObjects_;
220 
221  //- Function objects executed at start and on ++, +=
222  mutable functionObjectList functionObjects_;
223 
224 
225 public:
226 
227  // Static Data Members
228 
229  //- The default control dictionary name (normally "controlDict")
230  static word controlDictName;
231 
232 
233  //- Runtime type information
234  TypeName("time");
235 
236 
237  // Constructors
238 
239  //- Construct from dictionary name to read and argument list.
240  // Uses "system" and "constant" for its directories.
241  inline Time
242  (
243  const word& ctrlDictName,
244  const argList& args,
245  const bool enableFunctionObjects = true,
246  const bool enableLibs = true
247  );
248 
249  //- Construct given name of dictionary to read and root/case paths.
250  // Uses "system" and "constant" for its directories.
251  inline Time
252  (
253  const word& ctrlDictName,
254  const fileName& rootPath,
255  const fileName& caseName,
256  const bool enableFunctionObjects = true,
257  const bool enableLibs = true
258  );
259 
260  //- Construct given dictionary and root/case paths.
261  // Uses "system" and "constant" for its directories.
262  inline Time
263  (
264  const dictionary& dict,
265  const fileName& rootPath,
266  const fileName& caseName,
267  const bool enableFunctionObjects = true,
268  const bool enableLibs = true
269  );
270 
271  //- Construct at endTime and root/case paths.
272  // Uses "system" and "constant" for its directories.
273  inline Time
274  (
275  const fileName& rootPath,
276  const fileName& caseName,
277  const bool enableFunctionObjects = true,
278  const bool enableLibs = true
279  );
281  //- Construct from dictionary name to read and argument list.
282  // Use specified system/constant directory names.
283  Time
284  (
285  const word& ctrlDictName,
286  const argList& args,
287  const word& systemName,
288  const word& constantName,
289  const bool enableFunctionObjects = true,
290  const bool enableLibs = true
291  );
292 
293  //- Construct given name of dictionary to read and root/case paths.
294  // Use specified system/constant directory names.
295  Time
296  (
297  const word& ctrlDictName,
298  const fileName& rootPath,
299  const fileName& caseName,
300  const word& systemName,
301  const word& constantName,
302  const bool enableFunctionObjects = true,
303  const bool enableLibs = true
304  );
305 
306  //- Construct given dictionary and root/case paths.
307  // Use specified system/constant directory names.
308  Time
309  (
310  const dictionary& dict,
311  const fileName& rootPath,
312  const fileName& caseName,
313  const word& systemName,
314  const word& constantName,
315  const bool enableFunctionObjects = true,
316  const bool enableLibs = true
317  );
318 
319  //- Construct given endTime and root/case paths.
320  // Use specified system/constant directory names.
321  Time
322  (
323  const fileName& rootPath,
324  const fileName& caseName,
325  const word& systemName,
326  const word& constantName,
327  const bool enableFunctionObjects = true,
328  const bool enableLibs = true
329  );
330 
331 
332  // Selectors
333 
334  //- Construct (dummy) Time - no functionObjects or libraries
335  static autoPtr<Time> New();
336 
337  //- Construct (dummy) Time - no functionObjects or libraries
338  static autoPtr<Time> New(const fileName& caseDir);
339 
340  //- Construct (dummy) Time - no functionObjects or libraries
341  static autoPtr<Time> New(const argList& args);
342 
343 
344  //- Destructor
345  virtual ~Time();
346 
347 
348  // Member Functions
349 
350  // Database functions
351 
352  //- Return name from objectRegistry and not TimePaths
353  using objectRegistry::name;
354 
355  //- Return root path
356  using TimePaths::rootPath;
357 
358  //- Return case name
359  using TimePaths::caseName;
360 
361  //- Return path
362  fileName path() const
363  {
364  return rootPath()/caseName();
365  }
366 
367  //- Return read access to the controlDict dictionary
368  const dictionary& controlDict() const
369  {
370  return controlDict_;
371  }
372 
373  virtual const fileName& dbDir() const
374  {
375  return fileName::null;
376  }
377 
378  //- Return current time path
379  fileName timePath() const
380  {
381  return path()/timeName();
382  }
383 
384  //- The write stream option (format, compression, version)
385  IOstreamOption writeStreamOption() const noexcept
386  {
387  return writeStreamOption_;
388  }
389 
390  //- The write stream format
392  {
393  return writeStreamOption_.format();
394  }
395 
396  //- The write stream compression
398  {
399  return writeStreamOption_.compression();
400  }
401 
402  //- The write stream version
403  IOstreamOption::versionNumber writeVersion() const noexcept
404  {
405  return writeStreamOption_.version();
406  }
407 
408  //- Default graph format
409  const word& graphFormat() const noexcept
410  {
411  return graphFormat_;
412  }
413 
414  //- Supports re-reading
415  Switch runTimeModifiable() const noexcept
416  {
417  return runTimeModifiable_;
418  }
419 
420  //- Set re-reading support on/off (use with caution).
421  // \return the previous value
422  Switch runTimeModifiable(const Switch sw) noexcept
423  {
424  Switch old(runTimeModifiable_);
425  runTimeModifiable_ = sw;
426  return old;
427  }
428 
429  //- Read control dictionary, update controls and time
430  virtual bool read();
431 
432  //- Read the objects that have been modified
433  void readModifiedObjects();
434 
435  //- Return time instance (location) of \em dir that contains
436  //- the file \em name (eg, used in reading mesh data).
437  // When \em is empty, searches for directory \em dir only.
438  // Does not search beyond stopInstance (if set) or \em constant.
439  //
440  // \note If the instance cannot be found, returns the
441  // stopInstance (if set and reached) or \em constant.
442  // FatalError if it cannot be found and readOpt is
443  // (MUST_READ or MUST_READ_IF_MODIFIED).
444  word findInstance
445  (
446  const fileName& dir,
447  const word& name = word::null,
449  const word& stopInstance = word::null
450  ) const;
451 
452  //- Search the case for the time directory path
453  //- corresponding to the given instance
455  (
456  const fileName& directory,
457  const instant& t
458  ) const;
459 
460  //- Search the case for the time directory path
461  //- corresponding to the given instance
462  word findInstancePath(const instant& t) const;
463 
464  //- Write time dictionary to the <time>/uniform directory
465  virtual bool writeTimeDict() const;
466 
467  //- Write using stream options
468  virtual bool writeObject
469  (
470  IOstreamOption streamOpt,
471  const bool writeOnProc
472  ) const;
473 
474  //- Write the objects immediately (not at end of iteration)
475  //- and continue the run
476  bool writeNow();
477 
478  //- Write the objects now (not at end of iteration) and end the run
479  bool writeAndEnd();
480 
481  //- Write the objects once (one shot) and continue the run
482  void writeOnce();
484  //- Print the elapsed ExecutionTime (cpu-time), ClockTime
486 
487 
488  // Access
489 
490  //- Return time name of given scalar time
491  //- formatted with the given precision
492  static word timeName
493  (
494  const scalar t,
495  const int precision = precision_
496  );
497 
498  //- Return current time name
499  virtual word timeName() const;
500 
501  //- Return start time index
502  virtual label startTimeIndex() const;
503 
504  //- Return start time
505  virtual dimensionedScalar startTime() const;
506 
507  //- Return end time
508  virtual dimensionedScalar endTime() const;
509 
510  //- Return the stop control information
511  virtual stopAtControls stopAt() const;
512 
513  //- Return true if adjustTimeStep is true
514  virtual bool isAdjustTimeStep() const;
516  //- Return the list of function objects
517  const functionObjectList& functionObjects() const
518  {
519  return functionObjects_;
520  }
521 
522  //- Mutable access to the loaded dynamic libraries
524  {
525  return libs_;
526  }
527 
528  //- Zero (tests as false) if time is not being sub-cycled,
529  //- otherwise the current sub-cycle index or the total number of
530  //- sub-cycles.
531  // The interpretation of non-zero values is dependent on the
532  // routine.
533  label subCycling() const noexcept
534  {
535  return subCycling_;
536  }
537 
538  //- Return previous TimeState if time is being sub-cycled
539  const TimeState& prevTimeState() const
540  {
541  return *prevTimeState_;
542  }
543 
544 
545  // Check
546 
547  //- Return true if run should continue,
548  // also invokes the functionObjectList::end() method
549  // when the time goes out of range
550  // \note
551  // For correct behaviour, the following style of time-loop
552  // is recommended:
553  // \code
554  // while (runTime.run())
555  // {
556  // ++runTime;
557  // solve;
558  // runTime.write();
559  // }
560  // \endcode
561  virtual bool run() const;
562 
563  //- Return true if run should continue and if so increment time
564  // also invokes the functionObjectList::end() method
565  // when the time goes out of range
566  // \note
567  // For correct behaviour, the following style of time-loop
568  // is recommended:
569  // \code
570  // while (runTime.loop())
571  // {
572  // solve;
573  // runTime.write();
574  // }
575  // \endcode
576  virtual bool loop();
577 
578  //- Return true if end of run,
579  // does not invoke any functionObject methods
580  // \note
581  // The rounding heuristics near endTime mean that
582  // \code run() \endcode and \code !end() \endcode may
583  // not yield the same result
584  virtual bool end() const;
585 
586 
587  // Edit
588 
589  //- Adjust the current stopAtControl.
590  // \param stopCtrl the new stop control, whereby
591  // stopAtControls::saUnknown is treated as a no-op.
592  // \note this value only persists until the next time the
593  // dictionary is read.
594  // \return true if the stopAt() value was changed.
595  virtual bool stopAt(const stopAtControls stopCtrl) const;
596 
597  //- Reset the time and time-index to those of the given time
598  virtual void setTime(const Time& t);
599 
600  //- Reset the time and time-index
601  virtual void setTime(const instant& inst, const label newIndex);
602 
603  //- Reset the time and time-index
604  virtual void setTime
605  (
606  const dimensionedScalar& newTime,
607  const label newIndex
608  );
609 
610  //- Reset the time and time-index
611  virtual void setTime(const scalar newTime, const label newIndex);
612 
613  //- Reset end time
614  virtual void setEndTime(const dimensionedScalar& endTime);
615 
616  //- Reset end time
617  virtual void setEndTime(const scalar endTime);
618 
619  //- Reset time step, normally also calling adjustDeltaT()
620  virtual void setDeltaT
621  (
622  const dimensionedScalar& deltaT,
623  const bool adjust = true
624  );
625 
626  //- Reset time step, normally also calling adjustDeltaT()
627  virtual void setDeltaT
628  (
629  const scalar deltaT,
630  const bool adjust = true
631  );
632 
633  //- Set time to sub-cycle for the given number of steps
634  virtual TimeState subCycle(const label nSubCycles);
635 
636  //- Adjust the reported sub-cycle index.
637  // \param index is the sub-cycle index.
638  // This index is ignored sub-cycling was
639  // not already registered, or if the index is zero or
640  // negative.
641  virtual void subCycleIndex(const label index);
642 
643  //- Reset time after sub-cycling back to previous TimeState
644  virtual void endSubCycle();
645 
646  //- Return non-const access to the list of function objects
647  functionObjectList& functionObjects()
648  {
649  return functionObjects_;
650  }
651 
652 
653  // Member operators
654 
655  //- Set deltaT to that specified and increment time via operator++()
656  virtual Time& operator+=(const dimensionedScalar& deltaT);
657 
658  //- Set deltaT to that specified and increment time via operator++()
659  virtual Time& operator+=(const scalar deltaT);
660 
661  //- Prefix increment,
662  // also invokes the functionObjectList::start() or
663  // functionObjectList::execute() method, depending on the time-index
664  virtual Time& operator++();
665 
666  //- Postfix increment, this is identical to the prefix increment
667  virtual Time& operator++(int);
668 };
669 
670 
671 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
672 
673 } // End namespace Foam
674 
675 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
676 
677 #include "TimeI.H"
678 
679 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
680 
681 #endif
682 
683 // ************************************************************************* //
A FIFO stack based on a singly-linked list.
Definition: FIFOStack.H:45
virtual Time & operator++()
Prefix increment,.
Definition: Time.C:1146
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:454
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
Definition: Time.H:675
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:605
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:787
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:748
virtual bool isAdjustTimeStep() const
Return true if adjustTimeStep is true.
Definition: Time.C:991
fileName timePath() const
Return current time path.
Definition: Time.H:475
scalar writeInterval_
Definition: Time.H:175
virtual stopAtControls stopAt() const
Return the stop control information.
Definition: Time.C:863
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:162
virtual void setEndTime(const dimensionedScalar &endTime)
Reset end time.
Definition: Time.C:1048
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:951
virtual dimensionedScalar startTime() const
Return start time.
Definition: Time.C:851
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:707
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:688
A simple container for options an IOstream can normally have.
virtual dimensionedScalar endTime() const
Return end time.
Definition: Time.C:857
Dummy no-op.
Definition: Time.H:90
scalar startTime_
Definition: Time.H:167
IOstream & fixed(IOstream &io)
Definition: IOstream.H:557
writeControls writeControl_
Definition: Time.H:173
const TimeState & prevTimeState() const
Return previous TimeState if time is being sub-cycled.
Definition: Time.H:696
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:780
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:483
"runTime"
Definition: Time.H:86
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:869
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 writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
Definition: TimeIO.C:549
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
Definition: TimeIO.C:514
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:1082
"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:507
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:997
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:499
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:280
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:1106
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:620
void readModifiedObjects()
Read the objects that have been modified.
Definition: TimeIO.C:468
IOstreamOption::streamFormat writeFormat() const noexcept
The write stream format.
Definition: Time.H:491
"cpuTime"
Definition: Time.H:89
const word & graphFormat() const noexcept
Default graph format.
Definition: Time.H:515
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:614
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:811
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:964
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:443
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:667
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:1133
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:1061
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
Definition: Time.H:462
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:1119
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:523
Foam::argList args(argc, argv)
virtual label startTimeIndex() const
Return start time index.
Definition: Time.C:845
"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:467
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:598
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:563
Namespace for OpenFOAM.
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTimePosix.H:52
readOption
Enumeration defining read preferences.