33 namespace functionObjects
45 const word& defaultArg
48 if (fieldName_.empty())
50 fieldName_ = defaultArg;
53 if (resultName_.empty())
55 if (fieldName_ != defaultArg)
57 resultName_ = typeName +
'(' + fieldName_ +
')';
61 resultName_ = typeName;
69 Foam::functionObjects::fieldExpression::fieldExpression
74 const word& fieldName,
75 const word& resultName
79 fieldName_(fieldName),
80 resultName_(resultName)
98 if (fieldName_.empty() || dict.
found(
"field"))
100 dict.
lookup(
"field") >> fieldName_;
103 if (dict.
found(
"result"))
105 dict.
lookup(
"result") >> resultName_;
117 <<
" functionObjects::" <<
type() <<
" " <<
name()
118 <<
" failed to execute." <<
endl;
134 return writeObject(resultName_);
140 return clearObject(resultName_);
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void setResultName(const word &typeName, const word &defaultArg)
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
virtual ~fieldExpression()
Destructor.
A class for handling words, derived from string.
virtual bool write()
Write the result field.
virtual bool read(const dictionary &)
Read the fieldExpression data.
virtual bool execute()
Calculate the result field.
virtual bool clear()
Clear the result field from the objectRegistry.
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.
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.