Go to the documentation of this file.
36 namespace functionObjects
53 { operationType::opSum,
"sum" },
54 { operationType::opAdd,
"add" },
55 { operationType::opSubtract,
"subtract" },
56 { operationType::opMin,
"min" },
57 { operationType::opMax,
"max" },
58 { operationType::opAverage,
"average" },
69 const wordList& fields0 = functions_[0].fields();
73 for (
const word& fieldName : fields0)
77 for (label functioni=1; functioni < functions_.size(); ++functioni)
79 if (!functions_[functioni].
fields().
found(fieldName))
88 commonFields.append(fieldName);
92 forAll(functions_, functioni)
98 functions_[functioni].
name()
105 for (
const word& fieldName : commonFields)
107 os <<
tab << fieldName;
125 operation_(opSubtract),
145 functions_.resize(functionsDict.size());
147 if (functions_.empty())
150 <<
"No functions specified"
156 for (
const entry& dEntry : functionsDict)
158 if (!dEntry.isDict())
161 <<
"Functions must be specified in dictionary format"
165 const dictionary& localDict = dEntry.dict();
182 operation_ = operationTypeNames_.get(
"operation",
dict);
193 if (functions_.empty())
200 const label nFunction = functions_.size();
208 forAll(functions_, functioni)
210 auto&
f = functions_[functioni];
211 names[functioni] =
f.name();
216 const wordList e(objectResultEntries(
f.name()));
227 entries[entryi].
resize(nFunction);
228 types[entryi].
resize(nFunction);
232 if (
e.size() != nEntries)
234 const word& f0Name = functions_[0].name();
237 <<
"Inconsistent number of result entries" <<
nl
238 <<
" " << f0Name <<
" entries:" << entries0 <<
nl
239 <<
" " <<
f.name() <<
" entries:" <<
e
245 entries[entryi][functioni] =
e[entryi];
246 types[entryi][functioni] = objectResultType(
f.name(),
e[entryi]);
250 writeCurrentTime(file());
254 const wordList& entriesi = entries[entryi];
255 const word& t0 = types[entryi][0];
256 const wordList& typesi = types[entryi];
259 const word& t = typesi[functioni];
264 <<
"Inconsistent function result types" <<
nl
265 <<
" " << functions_[0].name()
266 <<
" result type:" << t0 <<
nl
267 <<
" " << functions_[functioni].name()
268 <<
" result type:" << typesi[functioni]
275 applyOperation<scalar>(t0,
names, entriesi)
276 || applyOperation<vector>(t0,
names, entriesi)
277 || applyOperation<sphericalTensor>(t0,
names, entriesi)
278 || applyOperation<symmTensor>(t0,
names, entriesi)
279 || applyOperation<tensor>(t0,
names, entriesi)
284 Log <<
"Operation not applied between functions:" <<
nl
286 <<
"with result names:" <<
nl
287 <<
flatOutput(entriesi, FlatOutput::BareComma{})
292 Log << (nEntries == 0 ?
" none" :
"") <<
endl;
A keyword and a list of tokens is an 'entry'.
virtual void writeCurrentTime(Ostream &os) const
virtual void writeFileHeader(Ostream &os) const
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
multiFieldValue(const word &name, const Time &runTime, const dictionary &dict)
defineTypeNameAndDebug(multiFieldValue, 0)
virtual OFstream & file()
void resize(const label len)
Base class for function objects, adding functionality to read/write state information (data required ...
virtual bool read(const dictionary &dict)
Ostream & endl(Ostream &os)
Computes a selected operation between multiple fieldValue function objects.
entry * set(entry *entryPtr)
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
static const Enum< operationType > operationTypeNames_
Abstract base-class for Time/database function objects.
List< word > wordList
A List of words.
virtual bool read(const dictionary &dict)
wordList objectResultEntries() const
DynamicList< T, SizeMin > & append(const T &val)
static autoPtr< fieldValue > New(const word &name, const Time &runTime, const dictionary &dict, const bool output=true)
addToRunTimeSelectionTable(functionObject, multiFieldValue, dictionary)
virtual bool read(const dictionary &dict)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
errorManip< error > abort(error &err)
word objectResultType(const word &objectName, const word &entryName) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
#define FatalErrorInFunction
const word & name() const noexcept
virtual void writeCommented(Ostream &os, const string &str) const
virtual const word & type() const =0
Surround with '\0' and '\0' separate with ','.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
fileName::Type type(const fileName &name, const bool followLink=true)
const dimensionedScalar e
word name(const expressions::valueTypeCode typeCode)
Base class for writing single files from the function objects.
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static word scopedName(const std::string &scope, const word &name)
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
#define WarningInFunction
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields