36 namespace functionObjects
53 { operationType::opSum,
"sum" },
54 { operationType::opAdd,
"add" },
55 { operationType::opSubtract,
"subtract" },
56 { operationType::opDivide,
"divide" },
57 { operationType::opCmptDivide,
"cmptDivide" },
58 { operationType::opMin,
"min" },
59 { operationType::opMax,
"max" },
60 { operationType::opAverage,
"average" },
80 const word groupPrefix(
"Group");
87 forAll(entries[i], functioni)
92 " - " + foNames[functioni] +
":" + entries[i][functioni]
121 operation_(opSubtract),
140 operation_ = operationTypeNames_.get(
"operation",
dict);
143 functions_.resize(functionsDict.size());
145 if (functions_.empty())
148 <<
"No functions specified" 153 resultFields_.resize(functions_.size());
156 for (
const entry& dEntry : functionsDict)
158 if (!dEntry.isDict())
161 <<
"Functions must be specified in dictionary format" 182 resultFields_[functioni] =
186 if (resultFields_[functioni].size())
188 Info<<
" " << functions_[functioni].name()
189 <<
" " << resultFields_[functioni];
193 Info<<
" " << functions_[functioni].name()
194 <<
" - using all available entries";
207 if (functions_.empty())
214 const label nFunction = functions_.size();
222 forAll(functions_, functioni)
224 auto&
f = functions_[functioni];
225 foNames[functioni] =
f.name();
235 e = objectResultEntries(
f.name());
247 entries[entryi].
resize(nFunction);
248 types[entryi].
resize(nFunction);
252 if (
e.size() != nEntries)
254 const word& f0Name = functions_[0].name();
257 <<
"Inconsistent number of result entries" <<
nl 258 <<
" " << f0Name <<
" entries:" << entries0 <<
nl 259 <<
" " <<
f.name() <<
" entries:" <<
e 265 entries[entryi][functioni] =
e[entryi];
266 types[entryi][functioni] = objectResultType(
f.name(),
e[entryi]);
271 <<
"Unable to find function object result" <<
nl 272 <<
" function object : " <<
f.name() <<
nl 273 <<
" result name : " <<
e[entryi] <<
nl 274 <<
" available results : " 275 << objectResultEntries(
f.name())
283 writeFileHeader(foNames, entries, types, file());
284 writtenHeader_ =
true;
287 writeCurrentTime(file());
291 const wordList& entryi = entries[i];
292 const word& expectedType = types[i][0];
295 forAll(foTypes, functioni)
297 const word& foType = foTypes[functioni];
299 if (foType != expectedType)
302 <<
"Inconsistent function result types" <<
nl 303 <<
" " << functions_[0].name()
304 <<
" result type:" << expectedType <<
nl 305 <<
" " << functions_[functioni].name()
306 <<
" result type:" << foType
313 applyOperation<scalar>(expectedType, foNames, entryi)
314 || applyOperation<vector>(expectedType, foNames, entryi)
315 || applyOperation<sphericalTensor>(expectedType, foNames, entryi)
316 || applyOperation<symmTensor>(expectedType, foNames, entryi)
317 || applyOperation<tensor>(expectedType, foNames, entryi)
322 Log <<
"Operation not applied between functions:" <<
nl 324 <<
"with result names:" <<
nl 325 <<
flatOutput(entryi, FlatOutput::BareComma{})
330 Log << (nEntries == 0 ?
" none" :
"") <<
endl;
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool read(const dictionary &dict)
Read from dictionary.
Macros for easy insertion into run-time selection tables.
virtual bool write()
Calculate and write.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
addToRunTimeSelectionTable(fieldValue, surfaceFieldValue, runTime)
static const word null
An empty word.
static const Enum< operationType > operationTypeNames_
Operation type names.
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
virtual bool read(const dictionary &dict)
Read.
virtual bool execute()
Do nothing.
List< word > wordList
List of word.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual void writeFileHeader(const wordList &foNames, const List< wordList > &entries, const List< wordList > &types, Ostream &os) const
Output file header information.
multiFieldValue(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Base class for function objects, adding functionality to read/write state information (data required ...
messageStream Info
Information stream (stdout output on master, null elsewhere)
defineTypeNameAndDebug(surfaceFieldValue, 0)
static autoPtr< functionObject > New(const word &name, const Time &runTime, const dictionary &dict)
Select from dictionary, based on its "type" entry.
operationType
Operation type enumeration.
Base class for writing single files from the function objects.
A keyword and a list of tokens is an 'entry'.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.