34 const char* NamedEnum<timeControl::timeControls, 8>::
49 Foam::timeControl::timeControlNames_;
63 timeControl_(timeControls::timeStep),
82 word controlName(prefix_ +
"Control");
83 word intervalName(prefix_ +
"Interval");
87 if (prefix_ ==
"write" && dict.
found(
"outputControl"))
90 <<
"Using deprecated 'outputControl'" <<
nl 91 <<
" Please use 'writeControl' with 'writeInterval'" 95 controlName =
"outputControl";
96 intervalName =
"outputInterval";
99 if (dict.
found(controlName))
101 timeControl_ = timeControlNames_.read(dict.
lookup(controlName));
105 timeControl_ = timeControls::timeStep;
108 switch (timeControl_)
110 case timeControls::timeStep:
116 case timeControls::writeTime:
117 case timeControls::outputTime:
123 case timeControls::clockTime:
124 case timeControls::runTime:
125 case timeControls::cpuTime:
126 case timeControls::adjustableRunTime:
128 interval_ = time_.userTimeToTime(dict.
lookup<scalar>(intervalName));
130 if (timeControl_ == timeControls::adjustableRunTime)
132 executionIndex_ =
label 135 (time_.value() - time_.beginTime().value())
136 + 0.5*time_.deltaTValue()
155 switch (timeControl_)
157 case timeControls::timeStep:
161 (intervalSteps_ <= 1)
162 || !(time_.timeIndex() % intervalSteps_)
167 case timeControls::writeTime:
168 case timeControls::outputTime:
170 if (time_.writeTime())
173 return !(executionIndex_ % intervalSteps_);
178 case timeControls::runTime:
179 case timeControls::adjustableRunTime:
184 (time_.value() - time_.beginTime().value())
185 + 0.5*time_.deltaTValue()
190 if (executionIndex > executionIndex_)
192 executionIndex_ = executionIndex;
198 case timeControls::cpuTime:
205 if (executionIndex > executionIndex_)
207 executionIndex_ = executionIndex;
213 case timeControls::clockTime:
220 if (executionIndex > executionIndex_)
222 executionIndex_ = executionIndex;
228 case timeControls::none:
236 <<
"Undefined output control: " 237 << timeControlNames_[timeControl_] <<
nl timeControl(const Time &, const dictionary &, const word &prefix)
Construct from Time object and dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Inter-processor communication reduction functions.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool execute()
Flag to indicate whether to execute.
Initialise the NamedEnum HashTable from the static list of names.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool read(const char *, int32_t &)
A class for handling words, derived from string.
errorManip< error > abort(error &err)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
~timeControl()
Destructor.
void read(const dictionary &)
Read from dictionary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.