33 namespace functionObjects
48 if (fieldNames_.empty())
50 fieldNames_ = defaultArgs;
53 if (resultName_.empty())
55 if (!fieldNames_.empty())
57 resultName_ = typeName +
'(' + fieldNames_[0];
58 for (
label i=1; i<fieldNames_.size(); i++)
60 resultName_ +=
',' + fieldNames_[i];
66 resultName_ = typeName;
74 Foam::functionObjects::fieldsExpression::fieldsExpression
80 const word& resultName
84 fieldNames_(fieldNames),
85 resultName_(resultName)
89 if (fieldNames_.size() < 2)
92 <<
"functionObject::" <<
type() <<
" " << name
93 <<
" requires at least 2 fields only " 94 << fieldNames_.size() <<
" provided: " << fieldNames_
112 if (fieldNames_.empty() || dict.
found(
"fields"))
114 dict.
lookup(
"fields") >> fieldNames_;
117 if (dict.
found(
"result"))
119 dict.
lookup(
"result") >> resultName_;
131 <<
" functionObjects::" <<
type() <<
" " <<
name()
132 <<
" cannot find required fields " << fieldNames_ <<
endl;
148 return writeObject(resultName_);
154 return clearObject(resultName_);
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool write()
Write the result fields.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual bool read(const dictionary &)
Read the fieldsExpression data.
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 &)
Read optional controls.
bool read(const char *, int32_t &)
virtual bool execute()
Calculate the result fields.
void setResultName(const word &typeName, const wordList &defaultArg=wordList::null())
A class for handling words, derived from string.
virtual bool clear()
Clear the result fields from the objectRegistry.
virtual ~fieldsExpression()
Destructor.
word name(const complex &)
Return a string representation of a complex.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.