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