Go to the documentation of this file.
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 "exclude the '0/' dir from the times list, "
139 "has precedence over the -withZero option"
144 "select the latest time"
149 "select the new times"
155 "comma-separated time ranges - eg, ':10,20,40:70,1000:'"
164 const word& constantName
172 label constantIdx = -1;
181 else if (
timeDirs[timeI].value() == 0)
186 if (constantIdx >= 0 && zeroIdx >= 0)
194 label latestIdx = -1;
201 if (latestIdx == constantIdx)
219 selectTimes[latestIdx] =
true;
222 if (constantIdx >= 0)
234 selectTimes[zeroIdx] =
false;
271 <<
"No time specified or available, selecting 'constant'"
298 return select0(runTime,
args);
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from string.
bool exists(const fileName &, const bool checkGzip=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
#define forAll(list, i)
Loop across all elements in list.
instantList times() const
Search the case for valid time directories.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Extract command arguments and options from the supplied argc and argv parameters.
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.
Constant dispersed-phase particle diameter model.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
void inplaceSelect(instantList &) const
Select a list of Time values that are within the ranges.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0)
static HashTable< string > validOptions
A list of valid options.
virtual void setTime(const Time &)
Reset the time and time-index to those of the given time.
ListType subset(const UList< T > &select, const T &value, const ListType &)
Extract elements of List when select is a certain value.
scalar value() const
Value (const access)
static instantList timeDirs
fileName path() const
Return path.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const word & constant() const
Return constant name.
bool optionFound(const word &opt) const
Return true if the named option is found.
void inplaceSubset(const UList< T > &select, const T &value, ListType &)
Inplace extract elements of List when select is a certain value.
instantList select(const instantList &) const
Select a list of Time values that are within the ranges.
bool selected(const scalar) const
Return true if the given value is within the ranges.
Various functions to operate on Lists.
An instant of time. Contains the time value and name.
void size(const label)
Override size to be inconsistent with allocated storage.
bool selected(const instant &) const
Return true if the given instant is within the ranges.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
A List of scalarRange for selecting times.
word name(const complex &)
Return a string representation of a complex.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.