Go to the documentation of this file.
63 if (times[timei].
name() !=
"constant" && selected(times[timei]))
65 selectTimes[timei] =
true;
74 const scalar target =
range.value();
76 const label nearestIndex =
84 if (nearestIndex >= 0)
86 selectTimes[nearestIndex] =
true;
97 return subset(selected(times), times);
118 "Include the 'constant/' dir in the times list"
126 "Include the '0/' dir in the times list"
132 string(
"Exclude the '0/' dir from the times list")
135 ?
", has precedence over the -withZero option"
142 "Select the latest time"
148 "List of ranges. Eg, ':10,20 40:70 1000:', 'none', etc"
157 const word& constantName
164 label constantIdx = -1;
166 label latestIdx = -1;
171 if (times[timei].
name() == constantName)
175 else if (times[timei].value() == 0)
180 if (constantIdx >= 0 && zeroIdx >= 0)
191 latestIdx = times.size() - 1;
194 if (latestIdx == constantIdx)
209 selectTimes[latestIdx] =
true;
212 if (constantIdx >= 0)
215 selectTimes[constantIdx] =
args.
found(
"constant");
224 selectTimes[zeroIdx] =
false;
229 selectTimes[zeroIdx] =
args.
found(
"withZero");
233 return subset(selectTimes, times);
259 <<
"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.
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.
timeSelector()
Construct null.
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.
word name(const complex &c)
Return string representation of complex.
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.
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)
bool operator()(const scalar &value) const
Identical to match(), for use as a predicate.
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.