61 if (Times[timeI].
name() !=
"constant" &&
selected(Times[timeI]))
70 if (
operator[](rangeI).isExact())
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;
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;
177 if (timeDirs[timeI].
name() == constantName)
181 else if (timeDirs[timeI].value() == 0)
186 if (constantIdx >= 0 && zeroIdx >= 0)
194 label latestIdx = -1;
198 latestIdx = timeDirs.
size() - 1;
201 if (latestIdx == constantIdx)
213 ).selected(timeDirs);
219 selectTimes[latestIdx] =
true;
222 if (constantIdx >= 0)
225 selectTimes[constantIdx] = args.
optionFound(
"constant");
234 selectTimes[zeroIdx] =
false;
239 selectTimes[zeroIdx] = args.
optionFound(
"withZero");
243 return subset(selectTimes, timeDirs);
268 if (timeDirs.
empty())
271 <<
"No time specified or available, selecting 'constant'" 277 runTime.
setTime(timeDirs[0], 0);
324 !
exists(runTime.
path()/timeDirs[timeI].name()/fName);
327 return subset(selectTimes, timeDirs);
void inplaceSubset(const UList< T > &select, const T &value, ListType &)
Inplace extract elements of List when select is a certain value.
bool selected(const instant &) const
Return true if the given instant is within the ranges.
List< instant > instantList
List of instants.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
T & operator[](const label)
Return element of UList.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
scalar value() const
Value (const access)
Ostream & endl(Ostream &os)
Add newline and flush stream.
timeSelector()
Construct Null.
const Type & value() const
Return const reference to value.
instantList select(const instantList &) const
Select a list of Time values that are within the ranges.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Various functions to operate on Lists.
static instantList timeDirs
bool optionFound(const word &opt) const
Return true if the named option is found.
A class for handling words, derived from string.
Extract command arguments and options from the supplied argc and argv parameters. ...
void append(const T &)
Append an element at the end of the list.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
const word & constant() const
Return constant name.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0)
virtual void setTime(const Time &)
Reset the time and time-index to those of the given time.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
bool selected(const scalar) const
Return true if the given value is within the ranges.
word name(const complex &)
Return a string representation of a complex.
An instant of time. Contains the time value and name.
bool exists(const fileName &, const bool checkGzip=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
#define WarningInFunction
Report a warning using Foam::Warning.
void inplaceSelect(instantList &) const
Select a list of Time values that are within the ranges.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
ListType subset(const UList< T > &select, const T &value, const ListType &)
Extract elements of List when select is a certain value.
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.
fileName path() const
Return path.
Foam::argList args(argc, argv)
static HashTable< string > validOptions
A list of valid options.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.