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());
137 dict.subDict(
"region1"),
147 dict.subDict(
"region2"),
152 operation_ = operationTypeNames_.get(
"operation",
dict);
160 region1Ptr_->write();
161 region2Ptr_->write();
163 writeCurrentTime(file());
167 const word& name1 = region1Ptr_->name();
168 const word& name2 = region2Ptr_->name();
170 const wordList entries1 = objectResultEntries(name1);
171 const wordList entries2 = objectResultEntries(name2);
173 if (entries1.size() != entries2.size())
176 <<
name() <<
": objects must generate the same number of results"
178 <<
" " << name1 <<
" objects: " << entries1 <<
nl
179 <<
" " << name2 <<
" objects: " << entries2 <<
nl
185 const word& entry1(entries1[i]);
186 const word& entry2(entries2[i]);
187 const word type1 = objectResultType(name1, entry1);
188 const word type2 = objectResultType(name2, entry2);
194 <<
": input values for operation must be of the same type"
196 <<
" " << entry1 <<
": " << type1 <<
nl
197 <<
" " << entry2 <<
": " << type2 <<
nl
203 applyOperation<scalar>(type1, name1, name2, entry1, entry2,
found);
204 applyOperation<vector>(type1, name1, name2, entry1, entry2,
found);
205 applyOperation<sphericalTensor>
206 (type1, name1, name2, entry1, entry2,
found);
207 applyOperation<symmTensor>(type1, name1, name2, entry1, entry2,
found);
208 applyOperation<tensor>(type1, name1, name2, entry1, entry2,
found);
212 Log <<
"Operation between "
213 << name1 <<
" with result " << entry1 <<
" and "
214 << name2 <<
" with result " << entry2 <<
" not applied"
219 Log << (entries1.empty() ?
" none" :
"") <<
endl;
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.
Provides an operation between two 'field value' function objects.
virtual bool execute()
Do nothing.
virtual ~fieldValueDelta()
Destructor.
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.
static autoPtr< fieldValue > New(const word &name, const objectRegistry &obr, const dictionary &dict, const bool output=true)
Return a reference to the selected fieldValue.
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.
virtual bool read(const dictionary &dict)
Read.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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,...
virtual bool read(const dictionary &dict)
Read optional controls.
Macros for easy insertion into run-time selection tables.
virtual bool write()
Calculate and write.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#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.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
fieldValueDelta(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
functionObject base class for writing single files
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.
#define Log
Report write to Foam::Info if the local log switch is true.