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()
102 writeHeaderValue(
os,
"Operation", operationTypeNames_[operation_]);
103 writeCommented(
os,
"Time");
105 for (
const word& fieldName : commonFields)
107 os <<
tab << fieldName;
125 operation_(opSubtract),
130 writeFileHeader(file());
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"
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();
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];
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
292 Log << (nEntries == 0 ?
" none" :
"") <<
endl;
A keyword and a list of tokens is an 'entry'.
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
virtual void writeFileHeader(Ostream &os) const
Output file header information.
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)
Construct from Time and dictionary.
defineTypeNameAndDebug(multiFieldValue, 0)
virtual OFstream & file()
Return access to the file (if only 1)
void resize(const label len)
Adjust allocated size of list.
virtual bool write()
Calculate and write.
Base class for function objects, adding functionality to read/write state information (data required ...
virtual bool read(const dictionary &dict)
Read from dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Computes a selected operation between multiple fieldValue function objects.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
static const Enum< operationType > operationTypeNames_
Operation type names.
Abstract base-class for Time/database function objects.
#define forAll(list, i)
Loop across all elements in list.
operationType
Operation type enumeration.
wordList objectResultEntries() const
Retrieve the result entries.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
addToRunTimeSelectionTable(functionObject, multiFieldValue, dictionary)
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)
Global flatOutput() function with specified output delimiters.
errorManip< error > abort(error &err)
word objectResultType(const word &objectName, const word &entryName) const
Return the type of result.
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)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the name of this functionObject.
virtual const word & type() const =0
Runtime type information.
Surround with '\0' and '\0' separate with ','.
const dimensionedScalar e
Elementary charge.
virtual bool execute()
Do nothing.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Base class for writing single files from the function objects.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
#define WarningInFunction
Report a warning using Foam::Warning.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
word dictName() const
The local dictionary name (final part of scoped name)