Go to the documentation of this file.
57 if (times[timei].
name() !=
"constant" && selected(times[timei]))
59 selectTimes[timei] =
true;
68 const scalar target =
range.value();
70 const label nearestIndex =
78 if (nearestIndex >= 0)
80 selectTimes[nearestIndex] =
true;
91 return subset(selected(times), times);
112 "Include the 'constant/' dir in the times list"
120 "Include the '0/' dir in the times list"
126 string(
"Exclude the '0/' dir from the times list")
129 ?
", has precedence over the -withZero option"
136 "Select the latest time"
142 "List of ranges. Eg, ':10,20 40:70 1000:', 'none', etc"
151 const word& constantName
158 label constantIdx = -1;
160 label latestIdx = -1;
165 if (times[timei].
name() == constantName)
169 else if (times[timei].value() == 0)
174 if (constantIdx >= 0 && zeroIdx >= 0)
185 latestIdx = times.size() - 1;
188 if (latestIdx == constantIdx)
203 selectTimes[latestIdx] =
true;
206 if (constantIdx >= 0)
209 selectTimes[constantIdx] =
args.
found(
"constant");
218 selectTimes[zeroIdx] =
false;
223 selectTimes[zeroIdx] =
args.
found(
"withZero");
227 return subset(selectTimes, times);
253 <<
"No time specified or available, selecting 'constant'"
static label findClosestTimeIndex(const instantList &timeDirs, const scalar t, const word &constantName="constant")
Search instantList for the time index closest to the specified time.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A collection of scalar bounds to be used as a unary predicate.
timeSelector()=default
Default construct.
static word timeName(const scalar t, const int precision=precision_)
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
bool selected(const instant &value) const
Return true if the given instant is within the ranges.
Extract command arguments and options from the supplied argc and argv parameters.
void append(const T &val)
Append an element at the end of the list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
List< instant > instantList
List of instants.
#define forAll(list, i)
Loop across all elements in list.
void inplaceSelect(instantList ×) const
Select a list of Time values that are within the ranges.
Scalar bounds to be used as a unary predicate.
instantList times() const
Search the case for valid time directories.
static instantList selectIfPresent(Time &runTime, const argList &args)
static HashTable< string > validOptions
A list of valid options.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
bool match(const scalar &value) const
Match any condition in the list.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
scalar value() const
The value (const access)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Various functions to operate on Lists.
An instant of time. Contains the time value and name.
static instantList select0(Time &runTime, const argList &args)
const word & constant() const
Return constant name.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
constant condensation/saturation model.
#define WarningInFunction
Report a warning using Foam::Warning.
A List of scalarRange for selecting times.
bool found(const word &optName) const
Return true if the named option is found.