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 Time_H
42 #define 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
85  enum writeControls
86  {
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 
165 
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_;
169 
170  // One-shot writing
171  bool writeOnce_;
172 
173  //- If time is being sub-cycled this is the previous TimeState
175 
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_;
185 
186  //- Time directory name precision
187  static int precision_;
188 
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();
198 
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_;
214 
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)
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
401  {
402  return writeStreamOption_.version();
403  }
404 
405  //- Default graph format
406  const word& graphFormat() const
407  {
408  return graphFormat_;
409  }
410 
411  //- Supports re-reading
412  const Switch& runTimeModifiable() const
413  {
414  return runTimeModifiable_;
415  }
416 
417  //- Read control dictionary, update controls and time
418  virtual bool read();
419 
420  //- Read the objects that have been modified
421  void readModifiedObjects();
422 
423  //- Return the location of "dir" containing the file "name".
424  //- (eg, used in reading mesh data)
425  // If name is null, search for the directory "dir" only.
426  // Does not search beyond stopInstance (if set) or constant.
428  (
429  const fileName& dir,
430  const word& name = word::null,
432  const word& stopInstance = word::null
433  ) const;
434 
435  //- Search the case for the time directory path
436  //- corresponding to the given instance
438  (
439  const fileName& directory,
440  const instant& t
441  ) const;
442 
443  //- Search the case for the time directory path
444  //- corresponding to the given instance
445  word findInstancePath(const instant& t) const;
446 
447  //- Write time dictionary to the <time>/uniform directory
448  virtual bool writeTimeDict() const;
449 
450  //- Write using stream options
451  virtual bool writeObject
452  (
453  IOstreamOption streamOpt,
454  const bool valid
455  ) const;
456 
457  //- Write the objects immediately (not at end of iteration)
458  //- and continue the run
459  bool writeNow();
460 
461  //- Write the objects now (not at end of iteration) and end the run
462  bool writeAndEnd();
463 
464  //- Write the objects once (one shot) and continue the run
465  void writeOnce();
466 
467  //- Print the elapsed ExecutionTime (cpu-time), ClockTime
469 
470 
471  // Access
472 
473  //- Return time name of given scalar time
474  //- formatted with the given precision
475  static word timeName
476  (
477  const scalar t,
478  const int precision = precision_
479  );
480 
481  //- Return current time name
482  virtual word timeName() const;
483 
484  //- Return start time index
485  virtual label startTimeIndex() const;
486 
487  //- Return start time
488  virtual dimensionedScalar startTime() const;
489 
490  //- Return end time
491  virtual dimensionedScalar endTime() const;
492 
493  //- Return the stop control information
494  virtual stopAtControls stopAt() const;
495 
496  //- Return true if adjustTimeStep is true
497  virtual bool isAdjustTimeStep() const;
498 
499  //- Return the list of function objects
500  const functionObjectList& functionObjects() const
501  {
502  return functionObjects_;
503  }
504 
505  //- Mutable access to the loaded dynamic libraries
506  dlLibraryTable& libs() const
507  {
508  return libs_;
509  }
510 
511  //- Zero (tests as false) if time is not being sub-cycled,
512  //- otherwise the current sub-cycle index or the total number of
513  //- sub-cycles.
514  // The interpretation of non-zero values is dependent on the
515  // routine.
516  label subCycling() const
517  {
518  return subCycling_;
519  }
520 
521  //- Return previous TimeState if time is being sub-cycled
522  const TimeState& prevTimeState() const
523  {
524  return *prevTimeState_;
525  }
526 
527 
528  // Check
529 
530  //- Return true if run should continue,
531  // also invokes the functionObjectList::end() method
532  // when the time goes out of range
533  // \note
534  // For correct behaviour, the following style of time-loop
535  // is recommended:
536  // \code
537  // while (runTime.run())
538  // {
539  // ++runTime;
540  // solve;
541  // runTime.write();
542  // }
543  // \endcode
544  virtual bool run() const;
545 
546  //- Return true if run should continue and if so increment time
547  // also invokes the functionObjectList::end() method
548  // when the time goes out of range
549  // \note
550  // For correct behaviour, the following style of time-loop
551  // is recommended:
552  // \code
553  // while (runTime.loop())
554  // {
555  // solve;
556  // runTime.write();
557  // }
558  // \endcode
559  virtual bool loop();
560 
561  //- Return true if end of run,
562  // does not invoke any functionObject methods
563  // \note
564  // The rounding heuristics near endTime mean that
565  // \code run() \endcode and \code !end() \endcode may
566  // not yield the same result
567  virtual bool end() const;
568 
569 
570  // Edit
571 
572  //- Adjust the current stopAtControl.
573  // \param stopCtrl the new stop control, whereby
574  // stopAtControls::saUnknown is treated as a no-op.
575  // \note this value only persists until the next time the
576  // dictionary is read.
577  // \return true if the stopAt() value was changed.
578  virtual bool stopAt(const stopAtControls stopCtrl) const;
579 
580  //- Reset the time and time-index to those of the given time
581  virtual void setTime(const Time& t);
582 
583  //- Reset the time and time-index
584  virtual void setTime(const instant& inst, const label newIndex);
585 
586  //- Reset the time and time-index
587  virtual void setTime
588  (
589  const dimensionedScalar& newTime,
590  const label newIndex
591  );
592 
593  //- Reset the time and time-index
594  virtual void setTime(const scalar newTime, const label newIndex);
595 
596  //- Reset end time
597  virtual void setEndTime(const dimensionedScalar& endTime);
598 
599  //- Reset end time
600  virtual void setEndTime(const scalar endTime);
601 
602  //- Reset time step, normally also calling adjustDeltaT()
603  virtual void setDeltaT
604  (
605  const dimensionedScalar& deltaT,
606  const bool adjust = true
607  );
608 
609  //- Reset time step, normally also calling adjustDeltaT()
610  virtual void setDeltaT
611  (
612  const scalar deltaT,
613  const bool adjust = true
614  );
615 
616  //- Set time to sub-cycle for the given number of steps
617  virtual TimeState subCycle(const label nSubCycles);
618 
619  //- Adjust the reported sub-cycle index.
620  // \param index is the sub-cycle index.
621  // This index is ignored sub-cycling was
622  // not already registered, or if the index is zero or
623  // negative.
624  virtual void subCycleIndex(const label index);
625 
626  //- Reset time after sub-cycling back to previous TimeState
627  virtual void endSubCycle();
628 
629  //- Return non-const access to the list of function objects
631  {
632  return functionObjects_;
633  }
634 
635 
636  // Member operators
637 
638  //- Set deltaT to that specified and increment time via operator++()
639  virtual Time& operator+=(const dimensionedScalar& deltaT);
640 
641  //- Set deltaT to that specified and increment time via operator++()
642  virtual Time& operator+=(const scalar deltaT);
643 
644  //- Prefix increment,
645  // also invokes the functionObjectList::start() or
646  // functionObjectList::execute() method, depending on the time-index
647  virtual Time& operator++();
648 
649  //- Postfix increment, this is identical to the prefix increment
650  virtual Time& operator++(int);
651 };
652 
653 
654 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
655 
656 } // End namespace Foam
657 
658 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
659 
660 #include "TimeI.H"
661 
662 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
663 
664 #endif
665 
666 // ************************************************************************* //
Foam::TimePaths::rootPath
const fileName & rootPath() const
Return root path.
Definition: TimePathsI.H:50
Foam::Time::writeCompression
IOstream::compressionType writeCompression() const
The write stream compression.
Definition: Time.H:393
instantList.H
Foam::Time::Time
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:31
FIFOStack.H
Foam::Time::writeControls
writeControls
Write control options.
Definition: Time.H:84
Foam::dlLibraryTable
A table of dynamically loaded libraries.
Definition: dlLibraryTable.H:63
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::Enum< writeControls >
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::Time::end
virtual bool end() const
Return true if end of run,.
Definition: Time.C:970
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::Time::writeOnce_
bool writeOnce_
Definition: Time.H:170
TimePaths.H
typeInfo.H
Foam::TimeState::deltaT
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:55
Foam::sigStopAtWriteNow
Signal handler to write and stop the job. The interrupt is defined by OptimisationSwitches::stopAtWri...
Definition: sigStopAtWriteNow.H:53
Foam::Time::saNextWrite
stop at the next data write interval
Definition: Time.H:102
Foam::Time::purgeWrite_
label purgeWrite_
Definition: Time.H:161
Foam::Time::previousWriteTimes_
FIFOStack< word > previousWriteTimes_
Definition: Time.H:163
Foam::Time::writeFormat
IOstream::streamFormat writeFormat() const
The write stream format.
Definition: Time.H:387
Foam::Time::writeControlNames
static const Enum< writeControls > writeControlNames
Names for writeControls.
Definition: Time.H:116
Foam::Time::sigWriteNow_
sigWriteNow sigWriteNow_
Signal handler for one-shot writing upon signal.
Definition: Time.H:176
Foam::Time::saUnknown
Dummy no-op. Do not change current value.
Definition: Time.H:103
functionObjectList.H
objectRegistry.H
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:286
Foam::dimensioned::name
const word & name() const
Return const reference to name.
Definition: dimensionedType.C:406
Foam::Time::functionObjects
const functionObjectList & functionObjects() const
Return the list of function objects.
Definition: Time.H:499
Foam::Time::stopAt
virtual stopAtControls stopAt() const
Return the stop control information.
Definition: Time.C:879
Foam::TimePaths::caseName
const fileName & caseName() const
Return case name.
Definition: TimePathsI.H:62
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:123
Foam::Time::writeOnce
void writeOnce()
Write the objects once (one shot) and continue the run.
Definition: TimeIO.C:612
Foam::Time::controlDictName
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:226
Foam::Time::fmtflags
fmtflags
Supported time directory name formats.
Definition: Time.H:107
Foam::functionObjectList
List of function objects with start(), execute() and end() functions that is called for each object.
Definition: functionObjectList.H:130
Foam::Time::startTimeIndex_
label startTimeIndex_
Definition: Time.H:149
Foam::Time::read
virtual bool read()
Read control dictionary, update controls and time.
Definition: TimeIO.C:442
Foam::Time::wcUnknown
Dummy no-op.
Definition: Time.H:92
Foam::unwatchedIOdictionary
unwatchedIOdictionary is like IOdictionary but stores dependencies as files instead of fileMonitor wa...
Definition: unwatchedIOdictionary.H:53
Foam::Time::writeAndEnd
bool writeAndEnd()
Write the objects now (not at end of iteration) and end the run.
Definition: TimeIO.C:603
Foam::Time::wcTimeStep
"timeStep"
Definition: Time.H:87
Foam::Time::prevTimeState_
autoPtr< TimeState > prevTimeState_
If time is being sub-cycled this is the previous TimeState.
Definition: Time.H:173
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::Time::saEndTime
Stop when Time reaches prescribed endTime.
Definition: Time.H:99
Foam::Time::subCycling
label subCycling() const
Definition: Time.H:515
Foam::Time::writeStreamOption
IOstreamOption writeStreamOption() const
The write stream option (format, compression, version)
Definition: Time.H:381
Foam::Time::printExecutionTime
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
Definition: TimeIO.C:618
Foam::Time::stopAtControlNames
static const Enum< stopAtControls > stopAtControlNames
Names for stopAtControls.
Definition: Time.H:119
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:790
Foam::Time::adjustDeltaT
void adjustDeltaT()
Adjust the time step so that writing occurs at the specified time.
Definition: Time.C:99
Foam::TimeState
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:51
Foam::Time::~Time
virtual ~Time()
Destructor.
Definition: Time.C:758
Foam::Time::subCycle
virtual TimeState subCycle(const label nSubCycles)
Set time to sub-cycle for the given number of steps.
Definition: Time.C:1088
Foam::IOstreamOption::versionNumber
Representation of a major/minor version number.
Definition: IOstreamOption.H:85
general
General relative velocity model.
Foam::Time::setEndTime
virtual void setEndTime(const dimensionedScalar &endTime)
Reset end time.
Definition: Time.C:1054
Foam::Time::timePath
fileName timePath() const
Return current time path.
Definition: Time.H:375
clock.H
Foam::Time::wcCpuTime
"cpuTime"
Definition: Time.H:91
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:548
Switch.H
Foam::Time::subCycling_
label subCycling_
Definition: Time.H:167
Foam::Time::saNoWriteNow
Adjust endTime to stop immediately w/o writing.
Definition: Time.H:100
Foam::OSstream
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:54
Foam::Time::operator+=
virtual Time & operator+=(const dimensionedScalar &deltaT)
Set deltaT to that specified and increment time via operator++()
Definition: Time.C:1139
Foam::IOstreamOption::version
versionNumber version() const noexcept
Get the stream version.
Definition: IOstreamOption.H:338
Foam::Time::stopAt_
stopAtControls stopAt_
Definition: Time.H:155
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fixed
IOstream & fixed(IOstream &io)
Definition: IOstream.H:458
Foam::cpuTimeCxx
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTimeCxx.H:53
Foam::Time::prevTimeState
const TimeState & prevTimeState() const
Return previous TimeState if time is being sub-cycled.
Definition: Time.H:521
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:70
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::Time::loop
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:957
Foam::Time::controlDict
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
Definition: Time.H:364
Foam::Time::libs
dlLibraryTable & libs() const
Mutable access to the loaded dynamic libraries.
Definition: Time.H:505
os
OBJstream os(runTime.globalPath()/outputName)
Foam::Time::operator++
virtual Time & operator++()
Prefix increment,.
Definition: Time.C:1152
Foam::Time::TypeName
TypeName("time")
Runtime type information.
Foam::dimensioned< scalar >
Foam::Time::wcAdjustableRunTime
"adjustable" / "adjustableRunTime"
Definition: Time.H:89
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Time::sigStopAtWriteNow_
sigStopAtWriteNow sigStopAtWriteNow_
Signal handler for write and clean exit upon signal.
Definition: Time.H:179
Foam::Time::New
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Foam::scientific
IOstream & scientific(IOstream &io)
Definition: IOstream.H:464
Foam::clock
Read access to the system clock with formatting.
Definition: clock.H:52
Foam::TimePaths
Address the time paths without using the Time class.
Definition: TimePaths.H:56
Foam::Time::findInstance
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
Definition: Time.C:797
Foam::Time::writeTimeDict
virtual bool writeTimeDict() const
Write time dictionary to the <time>/uniform directory.
Definition: TimeIO.C:513
Foam::fileName::null
static const fileName null
An empty fileName.
Definition: fileName.H:101
Foam::Time::wcNone
"none"
Definition: Time.H:86
Foam::Time::writeVersion
IOstream::versionNumber writeVersion() const
The write stream version.
Definition: Time.H:399
Foam::Time::setDeltaT
virtual void setDeltaT(const dimensionedScalar &deltaT, const bool adjust=true)
Reset time step, normally also calling adjustDeltaT()
Definition: Time.C:1067
TimeI.H
Foam::Time::readDict
virtual void readDict()
Read the control dictionary and set the write controls etc.
Definition: TimeIO.C:90
Foam::IOobject::name
const word & name() const noexcept
Return name.
Definition: IOobjectI.H:65
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Time::findInstancePath
word findInstancePath(const fileName &directory, const instant &t) const
Definition: Time.C:827
Foam::Time::readModifiedObjects
void readModifiedObjects()
Read the objects that have been modified.
Definition: TimeIO.C:467
Foam::Time::printExecutionFormat_
static int printExecutionFormat_
Style for "ExecutionTime = " output.
Definition: Time.H:127
Foam::Time::saWriteNow
adjust endTime to stop immediately w/ writing
Definition: Time.H:101
Foam::Time::path
fileName path() const
Return path.
Definition: Time.H:358
Foam::sigWriteNow
Signal handler to write once and continue. The interrupt is defined by OptimisationSwitches::writeNow...
Definition: sigWriteNow.H:53
Foam::Time::wcRunTime
"runTime"
Definition: Time.H:88
Foam::Time::maxPrecision_
static const int maxPrecision_
Maximum time directory name precision.
Definition: Time.H:189
Foam::Time::setTime
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Definition: Time.C:1003
Foam::Time::writeInterval_
scalar writeInterval_
Definition: Time.H:159
dlLibraryTable.H
Foam::Time::fixed
fixed-point notation
Definition: Time.H:110
Foam::Time::writeNow
bool writeNow()
Definition: TimeIO.C:596
Foam::Time::format_
static fmtflags format_
Time directory name format.
Definition: Time.H:183
Foam::Time::scientific
scientific notation
Definition: Time.H:111
Foam::word::null
static const word null
An empty word.
Definition: word.H:80
Foam::Time::startTime_
scalar startTime_
Definition: Time.H:151
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:77
Foam::Time::wcClockTime
"clockTime"
Definition: Time.H:90
Foam::Time::isAdjustTimeStep
virtual bool isAdjustTimeStep() const
Return true if adjustTimeStep is true.
Definition: Time.C:997
Foam::Time::stopAtControls
stopAtControls
Definition: Time.H:97
Foam::Time::endTime
virtual dimensionedScalar endTime() const
Return end time.
Definition: Time.C:873
Foam::instant
An instant of time. Contains the time value and name.
Definition: instant.H:52
Foam::Time::setMonitoring
void setMonitoring(const bool forceProfiling=false)
Set file monitoring, profiling, etc.
Definition: Time.C:349
Foam::IOobject::readOption
readOption
Enumeration defining the read options.
Definition: IOobject.H:183
Foam::Time::endSubCycle
virtual void endSubCycle()
Reset time after sub-cycling back to previous TimeState.
Definition: Time.C:1125
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::Time::graphFormat
const word & graphFormat() const
Default graph format.
Definition: Time.H:405
Foam::Time::endTime_
scalar endTime_
Definition: Time.H:153
Foam::Time::setControls
void setControls()
Set the controls from the current controlDict.
Definition: Time.C:143
Foam::FIFOStack
A FIFO stack based on a singly-linked list.
Definition: FIFOStack.H:51
Foam::IOstreamOption::compression
compressionType compression() const noexcept
Get the stream compression.
Definition: IOstreamOption.H:312
args
Foam::argList args(argc, argv)
Foam::Time::functionObjects
functionObjectList & functionObjects()
Return non-const access to the list of function objects.
Definition: Time.H:629
Foam::Time::writeControl_
writeControls writeControl_
Definition: Time.H:157
Foam::Time::run
virtual bool run() const
Return true if run should continue,.
Definition: Time.C:885
Foam::Time::startTime
virtual dimensionedScalar startTime() const
Return start time.
Definition: Time.C:867
Foam::Time::startTimeIndex
virtual label startTimeIndex() const
Return start time index.
Definition: Time.C:861
TimeState.H
Foam::Time::dbDir
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Definition: Time.H:369
Foam::Time::subCycleIndex
virtual void subCycleIndex(const label index)
Adjust the reported sub-cycle index.
Definition: Time.C:1112
unwatchedIOdictionary.H
Foam::IOobject::MUST_READ
Definition: IOobject.H:185
Foam::Time::runTimeModifiable
const Switch & runTimeModifiable() const
Supports re-reading.
Definition: Time.H:411
Enum.H