35 const word& entryName,
42 valueExpr_(
"expression", dict_),
45 if (
dict.getOrDefault(
"debug",
false))
51 if (valueExpr_.empty())
53 FatalIOErrorInFunction(dict_)
54 <<
"The expression was not defined!" << nl
55 << exit(FatalIOError);
58 driver_.readDict(dict_);
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);
Function1 with values supplied by a parsed expression.
virtual void writeData(Ostream &os) const
Write in dictionary format.
virtual Type value(const scalar x) const
Return value.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two values.
Function1Expression(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name, dictionary and optional registry.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Function1(const word &entryName, const objectRegistry *obrPtr=nullptr)
Construct from entry name.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A polymorphic field/result from evaluating an expression.
const word & valueType() const noexcept
Basic type for the field or single value.
label size() const
The field or object size.
bool isType() const
True if valueType corresponds to the given Type.
const Field< Type > & cref() const
Return const reference to the field.
bool hasValue() const
Has a value?
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define DebugInfo
Report an information message using Foam::Info.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).