Go to the documentation of this file.
37 namespace functionObjects
39 namespace runTimeControls
53 { windowType::NONE,
"none" },
54 { windowType::APPROXIMATE,
"approximate" },
55 { windowType::EXACT,
"exact" }
70 functionObjectName_(
dict.get<
word>(
"functionObject")),
72 tolerance_(
dict.get<scalar>(
"tolerance")),
73 window_(
dict.getOrDefault<scalar>(
"window", -1)),
77 ? windowTypeNames.get(
"windowType",
dict)
80 totalTime_(fieldNames_.size(), scalar(0)),
81 resetOnRestart_(
dict.getOrDefault(
"resetOnRestart",
false)),
82 nIterStartUp_(
dict.getOrDefault<label>(
"nIterStartUp", 10)),
85 dictionary& conditionDict = this->conditionDict();
87 forAll(fieldNames_, fieldi)
89 const word& fieldName = fieldNames_[fieldi];
97 if (conditionDict.
found(fieldName))
136 bool processed =
false;
137 calc<scalar>(fieldi, satisfied, processed);
138 calc<vector>(fieldi, satisfied, processed);
139 calc<sphericalTensor>(fieldi, satisfied, processed);
140 calc<symmTensor>(fieldi, satisfied, processed);
141 calc<tensor>(fieldi, satisfied, processed);
145 unprocessedFields.append(fieldi);
149 if (unprocessedFields.size())
153 <<
"Unprocessed fields:" <<
nl;
155 for (
const label fieldi : unprocessedFields)
160 if (unprocessedFields.size() ==
fieldNames_.size())
174 dictionary& conditionDict = this->conditionDict();
176 forAll(fieldNames_, fieldi)
178 const word& fieldName = fieldNames_[fieldi];
180 if (conditionDict.
found(fieldName))
183 valueDict.
add(
"totalTime", totalTime_[fieldi],
true);
188 valueDict.
add(
"totalTime", totalTime_[fieldi],
true);
189 conditionDict.
add(fieldName, valueDict);
193 conditionDict.
set(
"iter", iter_);
defineTypeNameAndDebug(averageCondition, 0)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Base class for run time conditions.
List< scalar > totalTime_
Average time per field.
A class for handling words, derived from Foam::string.
bool active_
On/off switch.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
addToRunTimeSelectionTable(runTimeCondition, averageCondition, dictionary)
label nIterStartUp_
Number of start-up iterations before allowing satisfied checks.
Base class for function objects, adding functionality to read/write state information (data required ...
Ostream & endl(Ostream &os)
Add newline and flush stream.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
scalar deltaTValue() const noexcept
Return time step value.
#define forAll(list, i)
Loop across all elements in list.
Registry of regIOobjects.
Average run time condition - satisfied when average does not change by more than a given value.
word functionObjectName_
Name of function object to retrieve data from.
const objectRegistry & obr_
Reference to the object registry.
messageStream Info
Information stream (stdout output on master, null elsewhere)
label iter_
Current iteration count.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
virtual void write()
Write.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
virtual bool apply()
Apply the condition.
averageCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
wordList fieldNames_
List of fields on which to operate.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
word name_
Condition name.
#define WarningInFunction
Report a warning using Foam::Warning.
const Time & time() const noexcept
Return time registry.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
static const Enum< windowType > windowTypeNames