Go to the documentation of this file.
36 namespace functionObjects
53 { operationType::opAdd,
"add" },
54 { operationType::opSubtract,
"subtract" },
55 { operationType::opMin,
"min" },
56 { operationType::opMax,
"max" },
57 { operationType::opAverage,
"average" },
68 const wordList& fields1 = region1Ptr_->fields();
69 const wordList& fields2 = region2Ptr_->fields();
74 label index = fields2.find(fields1[fieldi]);
77 commonFields.
append(fields1[fieldi]);
81 writeHeaderValue(os,
"Source1", region1Ptr_->
name());
82 writeHeaderValue(os,
"Source2", region2Ptr_->
name());
83 writeHeaderValue(os,
"Operation", operationTypeNames_[operation_]);
84 writeCommented(os,
"Time");
88 os <<
tab << commonFields[i];
106 operation_(opSubtract),
107 region1Ptr_(
nullptr),
111 writeFileHeader(file());
131 dict.subDict(
"region1"),
141 dict.subDict(
"region2"),
146 operation_ = operationTypeNames_.get(
"operation",
dict);
154 region1Ptr_->write();
155 region2Ptr_->write();
161 const word& name1 = region1Ptr_->name();
162 const word& name2 = region2Ptr_->name();
167 if (entries1.size() != entries2.size())
170 <<
name() <<
": objects must generate the same number of results"
172 <<
" " << name1 <<
" objects: " << entries1 <<
nl
173 <<
" " << name2 <<
" objects: " << entries2 <<
nl
179 const word& entry1(entries1[i]);
180 const word& entry2(entries2[i]);
188 <<
": input values for operation must be of the same type"
190 <<
" " << entry1 <<
": " << type1 <<
nl
191 <<
" " << entry2 <<
": " << type2 <<
nl
197 applyOperation<scalar>(type1, name1, name2, entry1, entry2,
found);
198 applyOperation<vector>(type1, name1, name2, entry1, entry2,
found);
199 applyOperation<sphericalTensor>
200 (type1, name1, name2, entry1, entry2,
found);
201 applyOperation<symmTensor>(type1, name1, name2, entry1, entry2,
found);
202 applyOperation<tensor>(type1, name1, name2, entry1, entry2,
found);
206 Log <<
"Operation between "
207 << name1 <<
" with result " << entry1 <<
" and "
208 << name2 <<
" with result " << entry2 <<
" not applied"
213 Log << (entries1.empty() ?
" none" :
"") <<
endl;
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
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.
addToRunTimeSelectionTable(functionObject, fieldValueDelta, dictionary)
A class for handling words, derived from Foam::string.
virtual OFstream & file()
Return access to the file (if only 1)
Computes a selected operation between two fieldValue function objects.
virtual bool execute()
Do nothing.
defineTypeNameAndDebug(fieldValueDelta, 0)
void append(const T &val)
Append an element at the end of the list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Abstract base-class for Time/database function objects.
#define forAll(list, i)
Loop across all elements in list.
word name(const complex &c)
Return string representation of complex.
virtual const fileName & name() const
Return the name of the stream.
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 write()
Calculate and write.
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.
List< word > objectResultEntries() const
Retrieve the result entries.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool read(const dictionary &)
Read from dictionary.
virtual void writeFileHeader(Ostream &os) const
Output file header information.
const word & name() const
Return the name of this functionObject.
virtual const word & type() const =0
Runtime type information.
fieldValueDelta(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Base class for writing single files from the function objects.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static const Enum< operationType > operationTypeNames_
Operation type names.
operationType
Operation type enumeration.