61 if (Times[timeI].
name() !=
"constant" && selected(Times[timeI]))
70 if (
operator[](rangeI).isExact())
72 scalar target = operator[](rangeI).value();
74 int nearestIndex = -1;
75 scalar nearestDiff = Foam::great;
79 if (Times[timeI].
name() ==
"constant")
continue;
81 scalar
diff = fabs(Times[timeI].value() - target);
82 if (
diff < nearestDiff)
89 if (nearestIndex >= 0)
91 lst[nearestIndex] =
true;
103 return subset(selected(Times), Times);
124 "include the 'constant/' dir in the times list"
132 "include the '0/' dir in the times list"
138 string(
"exclude the '0/' dir from the times list")
141 ?
", has precedence over the -withZero option"
148 "select the latest time"
154 "comma-separated time ranges - eg, ':10,20,40:70,1000:'"
163 const word& constantName
171 label constantIdx = -1;
180 else if (
timeDirs[timeI].value() == 0)
185 if (constantIdx >= 0 && zeroIdx >= 0)
193 label latestIdx = -1;
200 if (latestIdx == constantIdx)
218 selectTimes[latestIdx] =
true;
221 if (constantIdx >= 0)
233 selectTimes[zeroIdx] =
false;
270 <<
"No time specified or available, selecting 'constant'"
297 return select0(runTime,
args);
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
static const word & constant()
Return constant name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
instantList times() const
Search the case for valid time directories.
virtual void setTime(const Time &)
Reset the time and time-index to those of the given time.
scalar userTimeValue() const
Return current user time value.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
Extract command arguments and options from the supplied argc and argv parameters.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
static HashTable< string > validOptions
A list of valid options.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
const word & name() const
Return const reference to name.
An instant of time. Contains the time value and name.
scalar value() const
Value (const access)
bool selected(const scalar) const
Return true if the given value is within the ranges.
A List of scalarRange for selecting times.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
bool selected(const instant &) const
Return true if the given instant is within the ranges.
void inplaceSelect(instantList &) const
Select a list of Time values that are within the ranges.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0)
timeSelector()
Construct Null.
instantList select(const instantList &) const
Select a list of Time values that are within the ranges.
A class for handling words, derived from string.
static instantList timeDirs
#define WarningInFunction
Report a warning using Foam::Warning.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
void inplaceSubset(const UList< T > &select, const T &value, ListType &)
Inplace extract elements of List when select is a certain value.
List< instant > instantList
List of instants.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
ListType subset(const UList< T > &select, const T &value, const ListType &)
Extract elements of List when select is a certain value.
Foam::argList args(argc, argv)