35 const word& entryName,
42 valueExpr_(
"expression", dict_),
45 if (
dict.getOrDefault(
"debug",
false))
51 if (valueExpr_.empty())
54 <<
"The expression was not defined!" <<
nl 70 valueExpr_(rhs.valueExpr_),
71 driver_(1, rhs.driver_, dict_)
84 driver_.clearVariables();
86 driver_.setArgument(
x);
88 driver_.resetDb(this->whichDb());
90 driver_.parse(this->valueExpr_);
95 <<
"Evaluated: " << result <<
nl;
97 if (!result.hasValue() || !result.size() || !result.isType<Type>())
100 <<
"Could not evaluate: " << this->valueExpr_ <<
nl 101 <<
"Result size:" << result.size()
102 <<
" type:" << result.valueType() <<
nl 106 return result.cref<Type>().first();
130 dict_.writeEntry(this->
name(), os);
virtual Type value(const scalar x) const
Return value.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
const word const dictionary & dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
A polymorphic field/result from evaluating an expression.
constexpr char nl
The newline '\n' character (0x0a)
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two values.
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.
Function1Expression(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name, dictionary and optional registry.
#define DebugInfo
Report an information message using Foam::Info.
virtual void writeData(Ostream &os) const
Write in dictionary format.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Registry of regIOobjects.
Function1 with values supplied by a parsed expression.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...