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:
125 case timeControls::cpuTime:
126 case timeControls::adjustableRunTime:
128 interval_ = dict.
lookup<scalar>(intervalName);
142 switch (timeControl_)
144 case timeControls::timeStep:
148 (intervalSteps_ <= 1)
149 || !(time_.timeIndex() % intervalSteps_)
154 case timeControls::writeTime:
155 case timeControls::outputTime:
157 if (time_.writeTime())
160 return !(executionIndex_ % intervalSteps_);
166 case timeControls::adjustableRunTime:
171 (time_.value() - time_.beginTime().value())
172 + 0.5*time_.deltaTValue()
177 if (executionIndex > executionIndex_)
179 executionIndex_ = executionIndex;
185 case timeControls::cpuTime:
192 if (executionIndex > executionIndex_)
194 executionIndex_ = executionIndex;
200 case timeControls::clockTime:
207 if (executionIndex > executionIndex_)
209 executionIndex_ = executionIndex;
215 case timeControls::none:
223 <<
"Undefined output control: " 224 << 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.
intWM_LABEL_SIZE_t 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.