Convert dictionary entry to a stringified expression. More...
#include <expressionEntry.H>

Public Member Functions | |
| TypeNameNoDebug ("expressionEntry") | |
| Runtime type information. | |
| declareRunTimeSelectionTable (autoPtr, expressionEntry, empty,(),()) | |
| expressionEntry () noexcept=default | |
| Default construct. | |
| virtual | ~expressionEntry ()=default |
| Destructor. | |
| virtual string | toExpr (const entry &e) const |
| To string. Normally with comma separators. | |
| template<class Type> | |
| Foam::string | toExprStr (const Type &data) |
| template<class Type> | |
| Foam::string | toExprStr (ITstream &is) |
Static Public Member Functions | |
| static autoPtr< expressionEntry > | New (const word &name) |
| Return an entry to expression converter. | |
| static string | evaluate (const entry &e) |
| Generic concatenate tokens to space-separated string. | |
| static void | inplaceExpand (std::string &s, const dictionary &dict) |
| Inplace expand expression with dictionary variables/entries. | |
| static expressions::exprString | expand (const std::string &str, const dictionary &dict) |
| Expand expression with dictionary entries. | |
Static Protected Member Functions | |
| template<class Type> | |
| static string | toExprStr (const Type &data) |
| Stringified version of data with comma-separated components. Uses prefix corresponding to the pTraits of Type. | |
| template<class Type> | |
| static string | toExprStr (ITstream &is) |
| Comma-separated stringified version of primitiveEntry of Type. Prefix corresponding to the pTraits of Type. | |
Convert dictionary entry to a stringified expression.
The general OpenFOAM dictionary expansions will result in space-separated values. For example,
origin (0.21 0 0.01);
condition "mag(pos() - $centre) < 0.5";
this will expand to the following:
condition "mag(pos() - (0.21 0 0.01)) < 0.5";
For these type of expressions, we'd would like better control. Using instead the special expansions, we can add an effective type cast.
condition "mag(pos() - $[(vector)centre]) < 0.5";
which will expand to the following:
condition "mag(pos() - vector(0.21,0,0.01)) < 0.5";
Definition at line 81 of file expressionEntry.H.
|
defaultnoexcept |
Default construct.
References expressionEntry(), Foam::name(), New(), and Foam::noexcept.
Referenced by declareRunTimeSelectionTable(), expressionEntry(), and ~expressionEntry().


|
virtualdefault |
Destructor.
References dict, e, evaluate(), expand(), expressionEntry(), inplaceExpand(), and s().

|
staticprotected |
Stringified version of data with comma-separated components. Uses prefix corresponding to the pTraits of Type.
Referenced by toExprStr().

Comma-separated stringified version of primitiveEntry of Type. Prefix corresponding to the pTraits of Type.
| TypeNameNoDebug | ( | "expressionEntry" | ) |
Runtime type information.
| declareRunTimeSelectionTable | ( | autoPtr | , |
| expressionEntry | , | ||
| empty | , | ||
| () | , | ||
| () | ) |
|
static |
Return an entry to expression converter.
Definition at line 110 of file expressionEntry.C.
References Foam::exit(), Foam::FatalError, FatalErrorInLookup, and Foam::name().
Referenced by expressionEntry(), and inplaceExpand().


|
inlinestatic |
Generic concatenate tokens to space-separated string.
Definition at line 27 of file expressionEntryI.H.
References e.
Referenced by toExpr(), and ~expressionEntry().

|
static |
Inplace expand expression with dictionary variables/entries.
Definition at line 133 of file expressionEntry.C.
References dict, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::getVariableOrDie(), Foam::stringOps::inplaceExpand(), Foam::stringOps::inplaceTrim(), New(), Foam::nl, s(), entry::stream(), and ITstream::toString().
Referenced by expand(), exprString::inplaceExpand(), and ~expressionEntry().


|
static |
Expand expression with dictionary entries.
Definition at line 264 of file expressionEntry.C.
References dict, inplaceExpand(), and s().
Referenced by ~expressionEntry().


To string. Normally with comma separators.
Reimplemented in boolEntry, dimensionedScalarEntry, dimensionedSphericalTensorEntry, dimensionedSymmTensorEntry, dimensionedTensorEntry, dimensionedVectorEntry, sphericalTensorEntry, stringEntry, symmTensorEntry, tensorEntry, and vectorEntry.
Definition at line 178 of file expressionEntry.H.
References e, evaluate(), and toExpr().
Referenced by toExpr().


|
inline |
Definition at line 35 of file expressionEntryI.H.
References Foam::component(), and OStringStream::str().

|
inline |
Definition at line 53 of file expressionEntryI.H.
References toExprStr(), and Foam::Zero.
