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'"
Various functions to operate on Lists.
scalar value() const noexcept
The value (const access)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
instantList times() const
Search the case for valid time directories.
static label findClosestTimeIndex(const instantList &timeDirs, const scalar t, const word &constantName="constant")
Search instantList for the time index closest to the specified time.
const word & constant() const
Return constant name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word timeName(const scalar t, const int precision=precision_)
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
T & first()
Return the first element of the list.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
Extract command arguments and options from the supplied argc and argv parameters.
bool found(const word &optName) const
Return true if the named option is found.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static HashTable< string > validOptions
A list of valid options.
const Type & value() const
Return const reference to value.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
constant condensation/saturation model.
Scalar bounds to be used as a unary predicate.
A collection of scalar bounds to be used as a unary predicate.
bool match(const scalar &value) const
Match any condition in the list.
A List of scalarRange for selecting times.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
bool selected(const instant &value) const
Return true if the given instant is within the ranges.
static instantList select0(Time &runTime, const argList &args)
static instantList selectIfPresent(Time &runTime, const argList &args)
timeSelector()=default
Default construct.
void inplaceSelect(instantList ×) const
Select a list of Time values that are within the ranges.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
const wordList & selected() const noexcept
The list of selected files.
A class for handling words, derived from Foam::string.
#define WarningInFunction
Report a warning using Foam::Warning.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< instant > instantList
List of instants.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.