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-2024 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  TimeNew.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  //- Names for writeControls
110  //- Names for stopAtControls
112 
113 
114  //- Style for "ExecutionTime = " output
115  // 0 = seconds (with trailing 's')
116  // 1 = day-hh:mm:ss
117  //
118  // \note this is public so registered info switches can modify it.
119  static int printExecutionFormat_;
120 
121 
122 private:
123 
124  // Private Data
126  //- Profiling trigger for time-loop (for run, loop)
127  mutable std::unique_ptr<profilingTrigger> loopProfiling_;
128 
129  //- Any loaded dynamic libraries
130  // Construct before reading controlDict
131  mutable dlLibraryTable libs_;
132 
133  //- The controlDict
134  unwatchedIOdictionary controlDict_;
135 
136 
137 protected:
138 
139  // Protected Data
140 
141  label startTimeIndex_;
142 
143  scalar startTime_;
144 
145  mutable scalar endTime_;
146 
147  mutable stopAtControls stopAt_;
148 
150 
151  scalar writeInterval_;
152 
153  label purgeWrite_;
157  //- The total number of sub-cycles, the current sub-cycle index,
158  //- or 0 if time is not being sub-cycled
159  label subCycling_;
161  // One-shot writing
163 
164  //- If time is being sub-cycled this is the previous TimeState
167  //- Signal handler for one-shot writing upon signal
169 
170  //- Signal handler for write and clean exit upon signal
172 
173  //- Format for time directory names (general | fixed | scientific)
175 
176  //- Time directory name precision
177  static int precision_;
178 
179  //- Maximum time directory name precision
180  static const int maxPrecision_;
181 
183  //- Adjust the time step so that writing occurs at the specified time
184  void adjustDeltaT();
185 
186  //- Set the controls from the current controlDict
187  void setControls();
188 
189  //- Set file monitoring, profiling, etc
190  // Optionally force profiling without inspecting the controlDict
191  void setMonitoring(const bool forceProfiling=false);
193  //- Read the control dictionary and set the write controls etc.
194  virtual void readDict();
195 
196 
197 private:
198 
199  //- The write stream option (format, compression, version)
200  IOstreamOption writeStreamOption_;
201 
202  //- Default graph format
203  word graphFormat_;
204 
205  //- Is runtime modification of dictionaries allowed?
206  Switch runTimeModifiable_;
208  //- Is temporary object cache enabled?
209  mutable bool cacheTemporaryObjects_;
210 
211  //- Function objects executed at start and on ++, +=
212  mutable functionObjectList functionObjects_;
213 
214 
215 public:
216 
217  // Static Data Members
218 
219  //- The default control dictionary name (normally "controlDict")
220  static word controlDictName;
221 
222 
223  //- Runtime type information
224  TypeName("time");
225 
226 
227  // Constructors
228 
229  // Construct from argList
230 
231  //- Construct from argument list,
232  //- reading from specified control dictionary name
233  // Uses "system" and "constant" for its directories.
234  inline Time
235  (
236  const word& ctrlDictName,
237  const argList& args,
238  const bool enableFunctionObjects = true,
239  const bool enableLibs = true,
242  );
243 
244  //- Construct from argument list,
245  //- reading from specified control dictionary name.
246  // Use specified system/constant directory names.
247  Time
248  (
249  const word& ctrlDictName,
250  const argList& args,
251  const word& systemDirName,
252  const word& constantDirName,
253  const bool enableFunctionObjects = true,
254  const bool enableLibs = true,
257  );
258 
259 
260  // Construct from root and case paths
261 
262  //- Construct given name of dictionary to read and root/case paths.
263  // Uses "system" and "constant" for its directories.
264  inline Time
265  (
266  const word& ctrlDictName,
267  const fileName& rootPath,
269  const bool enableFunctionObjects = true,
270  const bool enableLibs = true,
273  );
274 
275  //- Construct given name of dictionary to read and root/case paths.
276  // Use specified system/constant directory names.
277  Time
278  (
279  const word& ctrlDictName,
280  const fileName& rootPath,
281  const fileName& caseName,
282  const word& systemDirName,
283  const word& constantDirName,
284  const bool enableFunctionObjects = true,
285  const bool enableLibs = true,
288  );
289 
290  //- Construct from root/case paths,
291  //- with initial dictionary content
292  //- \em without reading from "controlDict".
293  // Uses "system" and "constant" for its directories.
294  inline Time
295  (
296  const dictionary& dict,
297  const fileName& rootPath,
298  const fileName& caseName,
299  const bool enableFunctionObjects = true,
300  const bool enableLibs = true,
303  );
304 
305  //- Construct from root/case paths,
306  //- with initial dictionary content
307  //- \em without reading from "controlDict".
308  // Use specified system/constant directory names.
309  Time
310  (
311  const dictionary& dict,
312  const fileName& rootPath,
313  const fileName& caseName,
314  const word& systemDirName,
315  const word& constantDirName,
316  const bool enableFunctionObjects = true,
317  const bool enableLibs = true,
320  );
321 
322  //- Construct from root/case paths
323  //- \em without reading or requiring a controlDict or other files.
324  // Uses "system" and "constant" for its directories.
325  // Uses default controls values
326  // (write: timeStep, stop: endTime, format: ASCII, ...),
327  inline Time
328  (
329  const fileName& rootPath,
330  const fileName& caseName,
331  const bool enableFunctionObjects = true,
332  const bool enableLibs = true
333  );
334 
335  //- Construct from root/case paths
336  //- \em without reading or requiring a controlDict or other files.
337  // Use specified system/constant directory names.
338  // Uses default controls values
339  // (write: timeStep, stop: endTime, format: ASCII, ...)
340  Time
341  (
342  const fileName& rootPath,
343  const fileName& caseName,
344  const word& systemDirName,
345  const word& constantDirName,
346  const bool enableFunctionObjects = true,
347  const bool enableLibs = true
348  );
349 
350 
351  // Factory Methods
352 
353  //- Construct (dummy) Time - no functionObjects or libraries
354  static autoPtr<Time> New();
355 
356  //- Construct (dummy) Time - no functionObjects or libraries
357  static autoPtr<Time> New(const fileName& caseDir);
358 
359  //- Construct (dummy) Time - no functionObjects or libraries
360  static autoPtr<Time> New(const argList& args);
361 
362  //- Construct (dummy) global Time - no functionObjects or libraries,
363  //- using the global path information stored in the FOAM_CASE
364  //- environment. See argList::envGlobalPath()
365  static autoPtr<Time> NewGlobalTime();
366 
367  //- Construct (dummy) global Time - no functionObjects or libraries,
368  //- using the global path information from the referenced Time.
369  static autoPtr<Time> NewGlobalTime(const Time& runTime);
370 
371 
372  //- Destructor
373  virtual ~Time();
374 
375 
376  // Member Functions
377 
378  // TimeState Functions
379 
380  //- Return the current time name
381  using TimeState::timeName;
382 
383  //- Return a time name for the given scalar time value
384  //- formatted with the given precision
385  static word timeName(const scalar t, const int precision = precision_);
386 
387 
388  // Database names and paths
389 
390  //- Use name from objectRegistry, not TimePaths
391  using objectRegistry::name;
392 
393  //- Return the rootPath
394  using TimePaths::rootPath;
395 
396  //- Return global case name
398 
399  //- Return case name
400  using TimePaths::caseName;
401 
402  //- Return path = rootPath/caseName. Same as TimePaths::path()
403  fileName path() const
404  {
406  }
407 
408  //- Return global path for the case = rootPath/globalCaseName.
409  //- Same as TimePaths::globalPath()
410  fileName globalPath() const
411  {
413  }
414 
415  //- Return current time path = path/timeName
416  fileName timePath() const
417  {
419  }
420 
421  //- Return current time global path = globalPath/timeName
422  fileName globalTimePath() const
423  {
425  }
426 
427 
428  // Database Functions
429 
430  //- Return read access to the controlDict dictionary
431  const dictionary& controlDict() const noexcept { return controlDict_; }
432 
433  virtual const fileName& dbDir() const { return fileName::null; }
434 
435  //- Get write stream option (format, compression, version)
436  inline IOstreamOption writeStreamOption() const noexcept;
437 
438  //- Get write stream format
439  inline IOstreamOption::streamFormat writeFormat() const noexcept;
440 
441  //- Set the write stream format and return the previous value.
442  // This change will only effective until the next readModified.
443  // As a side-effect (eg, changing from ASCII to BINARY)
444  // it may also disable compression
445  inline IOstreamOption::streamFormat
446  writeFormat(IOstreamOption::streamFormat fmt) noexcept;
447 
448  //- Get the write stream compression
449  inline IOstreamOption::compressionType writeCompression()
450  const noexcept;
451 
452  //- Get the write stream version
453  inline IOstreamOption::versionNumber writeVersion() const noexcept;
454 
455  //- Default graph format
456  const word& graphFormat() const noexcept { return graphFormat_; }
457 
458 
459  // Reading
460 
461  //- Supports re-reading
462  Switch runTimeModifiable() const noexcept
463  {
464  return runTimeModifiable_;
465  }
466 
467  //- Set re-reading support on/off (use with caution).
468  // \return the previous value
469  Switch runTimeModifiable(Switch sw) noexcept
470  {
471  Switch old(runTimeModifiable_);
472  runTimeModifiable_ = sw;
473  return old;
474  }
475 
476  //- Read control dictionary, update controls and time
477  virtual bool read();
478 
479  //- Read the objects that have been modified
480  void readModifiedObjects();
481 
482 
483  // Searching
484 
485  //- Return time instance (location) of \c directory containing
486  //- the file \c name (eg, used in reading mesh data).
487  //- When \c name is empty, searches for \c directory only.
488  //- Does not search beyond \c stopInstance (if set) or \c constant.
489  //
490  // If the instance cannot be found:
491  // - FatalError when readOpt is MUST_READ or READ_MODIFIED
492  // - return \c stopInstance (if set and reached)
493  // - return \c constant if constant_fallback is true
494  // - return an empty word if constant_fallback is false
495  // .
496  word findInstance
497  (
499  const fileName& directory,
501  const word& name = word::null,
505  const word& stopInstance = word::null,
507  const bool constant_fallback = true
508  ) const;
509 
510 
511  // Member Functions
513  // Writing
514 
515  //- Write time dictionary to the <time>/uniform directory
516  virtual bool writeTimeDict() const;
517 
518  //- Write using stream options
519  virtual bool writeObject
520  (
521  IOstreamOption streamOpt,
522  const bool writeOnProc
523  ) const;
524 
525  //- Write the objects immediately (not at end of iteration)
526  //- and continue the run
527  bool writeNow();
529  //- Write the objects now (not at end of iteration) and end the run
530  bool writeAndEnd();
531 
532  //- Write the objects once (one shot) and continue the run
533  void writeOnce();
534 
535  //- Print the elapsed ExecutionTime (cpu-time), ClockTime
537 
538 
539  // Access
540 
541  //- Return start time index
542  virtual label startTimeIndex() const;
543 
544  //- Return start time
545  virtual dimensionedScalar startTime() const;
546 
547  //- Return end time
548  virtual dimensionedScalar endTime() const;
549 
550  //- Return the stop control information
551  virtual stopAtControls stopAt() const;
552 
553  //- Return true if adjustTimeStep is true
554  virtual bool isAdjustTimeStep() const;
555 
556  //- Return the list of function objects
558  {
559  return functionObjects_;
560  }
561 
562  //- Mutable access to the loaded dynamic libraries
563  dlLibraryTable& libs() const noexcept
564  {
565  return libs_;
566  }
567 
568  //- Zero (tests as false) if time is not being sub-cycled,
569  //- otherwise the current sub-cycle index or the total number of
570  //- sub-cycles.
571  // The interpretation of non-zero values is dependent on the
572  // routine.
573  label subCycling() const noexcept
574  {
575  return subCycling_;
576  }
578  //- Return previous TimeState if time is being sub-cycled
579  const TimeState& prevTimeState() const
580  {
581  return *prevTimeState_;
582  }
583 
584 
585  // Check
586 
587  //- Return true if run should continue,
588  // also invokes the functionObjectList::end() method
589  // when the time goes out of range
590  // \note
591  // For correct behaviour, the following style of time-loop
592  // is recommended:
593  // \code
594  // while (runTime.run())
595  // {
596  // ++runTime;
597  // solve;
598  // runTime.write();
599  // }
600  // \endcode
601  virtual bool run() const;
602 
603  //- Return true if run should continue and if so increment time
604  // also invokes the functionObjectList::end() method
605  // when the time goes out of range
606  // \note
607  // For correct behaviour, the following style of time-loop
608  // is recommended:
609  // \code
610  // while (runTime.loop())
611  // {
612  // solve;
613  // runTime.write();
614  // }
615  // \endcode
616  virtual bool loop();
617 
618  //- Return true if end of run,
619  // does not invoke any functionObject methods
620  // \note
621  // The rounding heuristics near endTime mean that
622  // \code run() \endcode and \code !end() \endcode may
623  // not yield the same result
624  virtual bool end() const;
625 
626 
627  // Edit
628 
629  //- Adjust the current stopAtControl.
630  // \param stopCtrl the new stop control, whereby
631  // stopAtControls::saUnknown is treated as a no-op.
632  // \note this value only persists until the next time the
633  // dictionary is read.
634  // \return true if the stopAt() value was changed.
635  virtual bool stopAt(const stopAtControls stopCtrl) const;
636 
637  //- Reset the time and time-index to those of the given time
638  virtual void setTime(const Time& t);
639 
640  //- Reset the time and time-index
641  virtual void setTime(const instant& inst, const label newIndex);
642 
643  //- Reset the time and time-index
644  virtual void setTime
645  (
646  const dimensionedScalar& newTime,
647  const label newIndex
648  );
649 
650  //- Reset the time and time-index
651  virtual void setTime(const scalar newTime, const label newIndex);
652 
653  //- Reset end time
654  virtual void setEndTime(const dimensionedScalar& endTime);
655 
656  //- Reset end time
657  virtual void setEndTime(const scalar endTime);
658 
659  //- Reset time step, normally also calling adjustDeltaT()
660  virtual void setDeltaT
661  (
662  const dimensionedScalar& deltaT,
663  const bool adjust = true
664  );
665 
666  //- Reset time step, normally also calling adjustDeltaT()
667  virtual void setDeltaT
668  (
669  const scalar deltaT,
670  const bool adjust = true
671  );
672 
673  //- Set time to sub-cycle for the given number of steps
674  virtual TimeState subCycle(const label nSubCycles);
675 
676  //- Adjust the reported sub-cycle index.
677  // \param index is the sub-cycle index.
678  // This index is ignored sub-cycling was
679  // not already registered, or if the index is zero or
680  // negative.
681  virtual void subCycleIndex(const label index);
682 
683  //- Reset time after sub-cycling back to previous TimeState
684  virtual void endSubCycle();
685 
686  //- Return non-const access to the list of function objects
688  {
689  return functionObjects_;
690  }
691 
692 
693  // Member Operators
694 
695  //- Set deltaT to that specified and increment time via operator++()
696  virtual Time& operator+=(const dimensionedScalar& deltaT);
697 
698  //- Set deltaT to that specified and increment time via operator++()
699  virtual Time& operator+=(const scalar deltaT);
700 
701  //- Prefix increment,
702  // also invokes the functionObjectList::start() or
703  // functionObjectList::execute() method, depending on the time-index
704  virtual Time& operator++();
705 
706  //- Postfix increment, this is identical to the prefix increment
707  virtual Time& operator++(int);
708 };
709 
710 
711 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
712 
713 } // End namespace Foam
715 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
716 
717 #include "TimeI.H"
718 
719 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
720 
721 #endif
723 // ************************************************************************* //
A FIFO stack based on a singly-linked list.
Definition: FIFOStack.H:45
virtual Time & operator++()
Prefix increment,.
Definition: Time.C:1050
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 = rootPath/caseName. Same as TimePaths::path()
Definition: Time.H:503
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
Definition: Time.H:722
Address the time paths without using the Time class.
Definition: TimePaths.H:51
A class for handling file names.
Definition: fileName.H:72
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
Definition: TimeIO.C:592
static int printExecutionFormat_
Style for "ExecutionTime = " output.
Definition: Time.H:125
stopAtControls stopAt_
Definition: Time.H:160
sigStopAtWriteNow sigStopAtWriteNow_
Signal handler for write and clean exit upon signal.
Definition: Time.H:192
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:47
static autoPtr< Time > NewGlobalTime()
Construct (dummy) global Time - no functionObjects or libraries, using the global path information st...
Definition: TimeNew.C:78
Dummy no-op. Do not change current value.
Definition: Time.H:103
void adjustDeltaT()
Adjust the time step so that writing occurs at the specified time.
Definition: Time.C:95
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
adjust endTime to stop immediately w/ writing
Definition: Time.H:101
virtual ~Time()
Destructor.
Definition: Time.C:692
virtual bool isAdjustTimeStep() const
Return true if adjustTimeStep is true.
Definition: Time.C:896
fileName timePath() const
Return current time path = path/timeName.
Definition: Time.H:520
scalar writeInterval_
Definition: Time.H:164
virtual stopAtControls stopAt() const
Return the stop control information.
Definition: Time.C:768
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
virtual void setEndTime(const dimensionedScalar &endTime)
Reset end time.
Definition: Time.C:952
floatFormat
Float formats (eg, time directory name formats)
Read access to the system clock with formatting.
Definition: clock.H:48
static const fileName null
An empty fileName.
Definition: fileName.H:111
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:856
virtual dimensionedScalar startTime() const
Return start time.
Definition: Time.C:756
engineTime & runTime
"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
IOstreamOption writeStreamOption() const noexcept
Get write stream option (format, compression, version)
Definition: TimeI.H:116
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: TimeNew.C:26
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
Definition: Time.H:114
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:735
A simple container for options an IOstream can normally have.
Time(const word &ctrlDictName, const argList &args, const bool enableFunctionObjects=true, const bool enableLibs=true, IOobjectOption::readOption rOpt=IOobjectOption::READ_MODIFIED)
Construct from argument list, reading from specified control dictionary name.
Definition: TimeI.H:24
virtual dimensionedScalar endTime() const
Return end time.
Definition: Time.C:762
Dummy no-op.
Definition: Time.H:90
scalar startTime_
Definition: Time.H:156
writeControls writeControl_
Definition: Time.H:162
const TimeState & prevTimeState() const
Return previous TimeState if time is being sub-cycled.
Definition: Time.H:743
void setMonitoring(const bool forceProfiling=false)
Set file monitoring, profiling, etc.
Definition: Time.C:344
const word & timeName() const noexcept
Return the current time name.
Definition: TimeStateI.H:30
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
"runTime"
Definition: Time.H:86
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:774
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:174
static const int maxPrecision_
Maximum time directory name precision.
Definition: Time.H:207
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
Definition: TimeIO.C:536
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
Definition: TimeIO.C:501
IOstreamOption::versionNumber writeVersion() const noexcept
Get the write stream version.
Definition: TimeI.H:150
label purgeWrite_
Definition: Time.H:166
virtual TimeState subCycle(const label nSubCycles)
Set time to sub-cycle for the given number of steps.
Definition: Time.C:986
"adjustable" / "adjustableRunTime"
Definition: Time.H:87
"timeStep"
Definition: Time.H:85
word findInstance(const fileName &directory, const word &name=word::null, IOobjectOption::readOption rOpt=IOobjectOption::MUST_READ, const word &stopInstance=word::null, const bool constant_fallback=true) const
Return time instance (location) of directory containing the file name (eg, used in reading mesh data)...
Definition: Time.C:725
const functionObjectList & functionObjects() const noexcept
Return the list of function objects.
Definition: Time.H:714
static int precision_
Time directory name precision.
Definition: Time.H:202
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName. Same as TimePaths::globalPath() ...
Definition: Time.H:512
TypeName("time")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition: word.H:63
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:109
scalar endTime_
Definition: Time.H:158
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Definition: Time.C:902
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
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:268
const dictionary & controlDict() const noexcept
Return read access to the controlDict dictionary.
Definition: Time.H:539
A table of dynamically loaded libraries.
virtual void subCycleIndex(const label index)
Adjust the reported sub-cycle index.
Definition: Time.C:1010
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
FIFOStack< word > previousWriteTimes_
Definition: Time.H:168
IOstreamOption::compressionType writeCompression() const noexcept
Get the write stream compression.
Definition: TimeI.H:143
static IOstreamOption::floatFormat format_
Format for time directory names (general | fixed | scientific)
Definition: Time.H:197
OBJstream os(runTime.globalPath()/outputName)
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:83
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
Definition: TimeIO.C:607
fileName globalTimePath() const
Return current time global path = globalPath/timeName.
Definition: Time.H:528
void readModifiedObjects()
Read the objects that have been modified.
Definition: TimeIO.C:455
"cpuTime"
Definition: Time.H:89
const word & graphFormat() const noexcept
Default graph format.
Definition: Time.H:577
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:601
Adjust endTime to stop immediately w/o writing.
Definition: Time.H:100
Basic run-time type information using word as the type&#39;s name. Used to enhance the standard RTTI to c...
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:66
virtual bool end() const
Return true if end of run,.
Definition: Time.C:869
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:430
const fileName & globalCaseName() const noexcept
Return global case name.
Definition: TimePathsI.H:72
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:1037
bool writeOnce_
Definition: Time.H:177
sigWriteNow sigWriteNow_
Signal handler for one-shot writing upon signal.
Definition: Time.H:187
virtual void setDeltaT(const dimensionedScalar &deltaT, const bool adjust=true)
Reset time step, normally also calling adjustDeltaT()
Definition: Time.C:965
label startTimeIndex_
Definition: Time.H:154
fileName path() const
Return path for the case = rootPath/caseName.
Definition: TimePathsI.H:90
virtual void endSubCycle()
Reset time after sub-cycling back to previous TimeState.
Definition: Time.C:1023
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
IOstreamOption::streamFormat writeFormat() const noexcept
Get write stream format.
Definition: TimeI.H:123
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:585
Foam::argList args(argc, argv)
virtual label startTimeIndex() const
Return start time index.
Definition: Time.C:750
"none"
Definition: Time.H:84
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Definition: Time.H:541
autoPtr< TimeState > prevTimeState_
If time is being sub-cycled this is the previous TimeState.
Definition: Time.H:182
bool writeNow()
Write the objects immediately (not at end of iteration) and continue the run.
Definition: TimeIO.C:585
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:61
const fileName & caseName() const noexcept
Return case name.
Definition: TimePathsI.H:78
void setControls()
Set the controls from the current controlDict.
Definition: Time.C:139
Namespace for OpenFOAM.
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName.
Definition: TimePathsI.H:96
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTimePosix.H:52
readOption
Enumeration defining read preferences.