Convert dictionary entry to a stringified expression. More...
Public Member Functions | |
TypeNameNoDebug ("expressionEntry") | |
declareRunTimeSelectionTable (autoPtr, expressionEntry, empty,(),()) | |
expressionEntry ()=default | |
virtual | ~expressionEntry ()=default |
virtual string | toExpr (const entry &e) const |
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) |
static string | evaluate (const entry &e) |
static void | inplaceExpand (std::string &s, const dictionary &dict) |
static expressions::exprString | expand (const std::string &str, const dictionary &dict) |
Static Protected Member Functions | |
template<class Type > | |
static string | toExprStr (const Type &data) |
template<class Type > | |
static string | toExprStr (ITstream &is) |
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.
|
default |
|
virtualdefault |
|
staticprotected |
TypeNameNoDebug | ( | "expressionEntry" | ) |
declareRunTimeSelectionTable | ( | autoPtr | , |
expressionEntry | , | ||
empty | , | ||
() | , | ||
() | |||
) |
|
static |
Definition at line 111 of file expressionEntry.C.
References Foam::exit(), Foam::FatalError, FatalErrorInLookup, and Foam::name().
|
inlinestatic |
Definition at line 27 of file expressionEntryI.H.
References Foam::constant::electromagnetic::e.
Referenced by expressionEntry::toExpr().
|
static |
Definition at line 134 of file expressionEntry.C.
References dict, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::getVariableOrDie(), Foam::stringOps::inplaceExpand(), Foam::stringOps::inplaceTrim(), Foam::New(), Foam::nl, s, entry::stream(), and ITstream::toString().
|
static |
Definition at line 274 of file expressionEntry.C.
References dict, Foam::stringOps::inplaceExpand(), and s.
Reimplemented in dimensionedSphericalTensorEntry, dimensionedSymmTensorEntry, sphericalTensorEntry, dimensionedTensorEntry, symmTensorEntry, dimensionedVectorEntry, stringEntry, tensorEntry, dimensionedScalarEntry, vectorEntry, and boolEntry.
Definition at line 157 of file expressionEntry.H.
References Foam::constant::electromagnetic::e, and expressionEntry::evaluate().
|
inline |
Definition at line 35 of file expressionEntryI.H.
References Foam::component(), and StringStreamAllocator< StreamType >::str().
|
inline |
Definition at line 53 of file expressionEntryI.H.
References Foam::Zero.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.