Base driver for parsing (field) values. More...
#include <exprDriver.H>


Public Types | |
| enum | searchControls { NO_SEARCH = 0 , SEARCH_REGISTRY = 1 , SEARCH_FILES = 2 , CACHE_READ_FIELDS = 4 , DEFAULT_SEARCH = (SEARCH_REGISTRY) } |
| Search/caching controls. More... | |
| typedef HashTable< const regIOobject * > | contextObjectTableType |
| Externally defined context fields. | |
Public Member Functions | |
| TypeName ("exprDriver") | |
| Runtime type information. | |
| exprDriver (const exprDriver &)=delete | |
| No copy construct. | |
| void | operator= (const exprDriver &)=delete |
| No copy assignment. | |
| exprDriver (enum searchControls search=searchControls::DEFAULT_SEARCH, const dictionary &dict=dictionary::null) | |
| Default construct, and default construct with search preferences. | |
| exprDriver (const exprDriver &rhs, const dictionary &dict) | |
| Copy construct with new dictionary reference. | |
| exprDriver (const dictionary &dict) | |
| Construct from a dictionary. | |
| virtual | ~exprDriver ()=default |
| Destructor. | |
| virtual label | size () const |
| The natural field size for the expression. | |
| virtual label | pointSize () const |
| The point field size for the expression. | |
| const TimeState * | timeState () const noexcept |
| Reference to the current time-state (can be nullptr). | |
| virtual scalar | timeValue () const |
| The current time value. | |
| virtual scalar | deltaT () const |
| The current deltaT value. | |
| const dictionary & | dict () const noexcept |
| The dictionary with all input data/specification. | |
| const exprResult & | result () const noexcept |
| Const access to expression result. | |
| exprResult & | result () noexcept |
| Non-const access to expression result. | |
| void | clearResult () |
| Clear the result. | |
| template<class Type> | |
| tmp< Field< Type > > | getResult (bool wantPointData=false) |
| Return the expression result as a tmp field. | |
| const word & | getResultType () const noexcept |
| The result type as word - same as result().valueType(). | |
| void | resetDb (const objectRegistry *obrPtr=nullptr) |
| Reset the objectRegistry (for functions). | |
| void | resetDb (const objectRegistry &db) |
| Reset the objectRegistry (for functions). | |
| scalar | argValue () const noexcept |
| Get special-purpose scalar reference argument. | |
| int | stashedTokenId () const noexcept |
| Get "look-behind" parsing context (internal bookkeeping). | |
| int | resetStashedTokenId (int tokenId=0) const noexcept |
| Reset "look-behind" parsing context (mutable operation). | |
| void | setDebugging (bool scannerDebug, bool parserDebug) |
| Set the scanner/parser debug. | |
| void | setDebugging (const exprDriver &rhs) |
| Set the scanner/parser debug to match the input. | |
| bool | setCaching (bool on) noexcept |
| Toggle CACHE_READ_FIELDS control. | |
| void | setSearchBehaviour (enum searchControls search, const bool caching=false) |
| Set search behaviour, with additional CACHE_READ_FIELDS toggle on. | |
| void | setSearchBehaviour (const exprDriver &rhs) |
| Set search behaviour to be identical to rhs. | |
| bool | debugScanner () const noexcept |
| Read access to scanner debug. | |
| bool | debugParser () const noexcept |
| Read access to parser debug. | |
| bool | prevIterIsOldTime () const |
| virtual void | clearVariables () |
| Clear temporary variables, reset from expression strings. | |
| void | setArgument (const scalar val) noexcept |
| Set special-purpose scalar reference argument. | |
| virtual bool | hasVariable (const word &name) const |
| True if named variable exists. | |
| virtual const exprResult & | variable (const word &name) const |
| Return const-access to the named variable. | |
| void | addVariables (const expressions::exprString &expr, bool clear=true) |
| Add/set string expressions for variables. | |
| void | addVariables (const UList< expressions::exprString > &list, bool clear=true) |
| Add/set string expressions for variables. | |
| template<class T> | |
| void | addUniformVariable (const word &name, const T &val) |
| Add a uniform variable from an outside caller. | |
| bool | hasContextObjects () const |
| True if any context fields are defined. | |
| const regIOobject * | cfindContextIOobject (const word &name) const |
| Find named context field, if it exists. | |
| template<class ObjType> | |
| const ObjType * | cfindContextObject (const word &name) const |
| Find context field object of specified type. | |
| void | addContextObject (const word &name, const regIOobject *) |
| Add the object to the context. | |
| void | addContextObject (const regIOobject *) |
| Add the object to the context. | |
| void | removeContextObject (const word &name) |
| Remove the object from the context. | |
| void | removeContextObject (const regIOobject *) |
| Remove the object from the context. | |
| const contextObjectTableType & | contextObjects () const noexcept |
| Read access to the object context. | |
| contextObjectTableType & | contextObjects () noexcept |
| Write access to the object context. | |
| template<class Type> | |
| bool | isFunction (const word &name) const |
| Named mapping with given type exists. | |
| template<class Type> | |
| Type | getFunctionValue (const word &name, const scalar x) const |
| Evaluate named mapping for the given time/value. Zero for undefined/unknown. | |
| template<class Type> | |
| void | fillFunctionValues (Field< Type > &result, const word &name, const scalarField &input) const |
| Fill result with values remapped according to the named Function1. | |
| template<class T> | |
| bool | isLocalVariable (const word &name, bool wantPointData=false, label expectedSize=-1) const |
| Test existence of a local variable. | |
| template<class Type> | |
| tmp< Field< Type > > | getLocalVariable (const word &name, label expectSize, const bool mandatory=true) const |
| Retrieve local/global variable as a tmp field. | |
| virtual unsigned | parse (const std::string &expr, size_t pos=0, size_t len=std::string::npos)=0 |
| Execute the parser. | |
| template<class Type> | |
| tmp< Field< Type > > | evaluate (const expressions::exprString &expr, bool wantPointData=false) |
| Evaluate the expression and return the field. | |
| template<class Type> | |
| Type | evaluateUniform (const expressions::exprString &expr, bool wantPointData=false) |
| Evaluate the expression and return a single value. | |
| void | evaluateVariable (const word &varName, const expressions::exprString &expr) |
| Evaluate the expression and save as the specified named variable. | |
| virtual void | evaluateVariableRemote (string remote, const word &varName, const expressions::exprString &expr) |
| Evaluate an expression on a remote and save as the specified named variable. | |
| template<class Type> | |
| tmp< Field< Type > > | newField (const Type &val=pTraits< Type >::zero) const |
| Return a new field with the size(). | |
| template<class Type> | |
| tmp< Field< Type > > | newPointField (const Type &val=pTraits< Type >::zero) const |
| Return a new field with the pointSize(). | |
| expressions::exprString | readExpression (const word &name) |
| Read an expression string (with the current dictionary) and do substitutions. | |
| virtual bool | readDict (const dictionary &dict) |
| Read variables, tables etc. | |
| label | setVariableStrings (const dictionary &dict, bool mandatory=false) |
| Read "variables" and assigns to the list of expression strings. | |
| Ostream & | writeVariableStrings (Ostream &os, const word &keyword="") const |
| Write "variables". | |
| template<class Type> | |
| void | addUniformVariable (const word &name, const Type &val) |
| template<class Type> | |
| Foam::tmp< Foam::Field< Type > > | evaluate (const expressions::exprString &expr, bool wantPointData) |
| template<class Type> | |
| Foam::tmp< Foam::Field< Type > > | getResult (bool wantPointData) |
| template<class Type> | |
| const Foam::Function1< Type > * | getFunction1Ptr (const word &name, const HashTable< refPtr< Function1< Type > > > &tbl, wordList *listFailure) |
| template<class Type> | |
| Foam::tmp< Foam::Field< Type > > | newField (const Type &val) const |
| template<class Type> | |
| Foam::tmp< Foam::Field< Type > > | newPointField (const Type &val) const |
Static Public Member Functions | |
| static expressions::exprString | readExpression (const word &name, const dictionary &dict) |
| Read an expression string and do substitutions. | |
| static List< expressions::exprString > | readVariableStrings (const dictionary &dict, const word &name="variables", bool mandatory=false) |
| Read the list of variable strings. | |
Protected Member Functions | |
| bool | searchRegistry () const noexcept |
| bool | searchFiles () const noexcept |
| bool | cacheReadFields () const noexcept |
| void | resetTimeReference (const TimeState *ts) |
| Reset the time-state reference. | |
| void | resetTimeReference (const TimeState &ts) |
| Reset the time-state reference. | |
| void | writeFunctions (Ostream &os) const |
| Write scalar/vector Function1 entries in dictionary format. | |
| virtual exprResult & | variable (const word &name) |
| Non-const access to the named variable (sub-classes only). | |
| void | fill_random (scalarField &field, label seed=0, const bool gaussian=false) const |
| Fill a random field. | |
| virtual bool | update () |
| Update things. | |
| virtual void | updateSpecialVariables (bool force=false) |
| Examine current variable values and update stored variables. | |
| virtual exprResult | getRemoteResult (const exprDriver &other) const |
| Get the result from another driver. | |
Static Protected Member Functions | |
| static point | getPositionOfMinimum (const scalarField &vals, const pointField &locs) |
| Return the location of the min value. | |
| static point | getPositionOfMaximum (const scalarField &vals, const pointField &locs) |
| Return the location of the max value. | |
Protected Attributes | |
| const dictionary & | dict_ |
| The dictionary with all input data/specification. | |
| exprResult | result_ |
| The result. | |
| List< expressions::exprString > | variableStrings_ |
| Variable definitions, as read from a dictionary. | |
| HashTable< exprResult > | variables_ |
| The variables table. | |
| HashTable< refPtr< Function1< scalar > > > | scalarFuncs_ |
| Function1 mappings/timelines (scalar), evaluated at the simulation time or with arbitrary scalars. | |
| HashTable< refPtr< Function1< vector > > > | vectorFuncs_ |
| Function1 mappings/timelines (vector), evaluated at the simulation time or with arbitrary scalars. | |
| contextObjectTableType | contextObjects_ |
| Externally defined context fields. | |
| scalar | arg1Value_ |
| Special-purpose scalar reference argument. | |
| const TimeState * | timeStatePtr_ |
| Reference to the time-state. | |
| const objectRegistry * | obrPtr_ |
| Pointer to an object registry (for functions etc). | |
| int | stashedTokenId_ |
| Internal bookkeeping as "look-behind" parsing context. | |
| bool | debugScanner_ |
| Request debugging for scanner. | |
| bool | debugParser_ |
| Request debugging for parser. | |
| bool | allowShadowing_ |
| Allow variable names to mask field names. | |
| bool | prevIterIsOldTime_ |
| Use value of previous iteration when oldTime is requested. | |
| searchControls | searchCtrl_ |
| Registry/disk/caching control. | |
Base driver for parsing (field) values.
Largely based on code and ideas from swak4foam
Properties
| Property | Description | Required | Default |
|---|---|---|---|
variables | List of variables for expressions | no | () |
functions<scalar> | Dictionary of scalar Function1 | no | {} |
functions<vector> | Dictionary of vector Function1 | no | {} |
allowShadowing | Allow variables to shadow field names | no | false |
Debug Properties
| Property | Description | Required | Default |
|---|---|---|---|
debug.driver | Debug level (int) for base driver | no | |
debug.scanner | Add debug for scanner | no | false |
debug.parser | Add debug for parser | no | false |
The functions<scalar> and functions<vector> entries are dictionaries of Foam::Function1 definitions that can either be used to establish a time-varying quantity, to remap a field of scalar values, or both.
Definition at line 136 of file exprDriver.H.
| typedef HashTable<const regIOobject*> contextObjectTableType |
Externally defined context fields.
Definition at line 158 of file exprDriver.H.
| enum searchControls |
Search/caching controls.
| Enumerator | |
|---|---|
| NO_SEARCH | |
| SEARCH_REGISTRY | Search registry before disk. |
| SEARCH_FILES | Search disk (eg, standalone app). |
| CACHE_READ_FIELDS | Cache fields read from disk. |
| DEFAULT_SEARCH | |
Definition at line 145 of file exprDriver.H.
|
delete |
No copy construct.
References exprDriver().
Referenced by exprDriver(), exprDriver(), exprDriver(), fvExprDriver::fvExprDriver(), fvExprDriver::fvExprDriver(), fvExprDriver::fvExprDriver(), getRemoteResult(), operator=(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), setDebugging(), setSearchBehaviour(), and ~exprDriver().


|
explicit |
Default construct, and default construct with search preferences.
Definition at line 166 of file exprDriver.C.
References allowShadowing_, arg1Value_, contextObjects_, debugParser_, debugScanner_, dict(), dict_, obrPtr_, prevIterIsOldTime_, result_, scalarFuncs_, Foam::search(), searchCtrl_, stashedTokenId_, timeStatePtr_, variables_, variableStrings_, and vectorFuncs_.

| exprDriver | ( | const exprDriver & | rhs, |
| const dictionary & | dict ) |
Copy construct with new dictionary reference.
Definition at line 193 of file exprDriver.C.
References allowShadowing_, arg1Value_, contextObjects_, debugParser_, debugScanner_, dict(), dict_, exprDriver(), obrPtr_, prevIterIsOldTime_, result_, Foam::rhs(), scalarFuncs_, searchCtrl_, Foam::shallowCloneFunctions(), stashedTokenId_, timeStatePtr_, variables_, variableStrings_, and vectorFuncs_.

|
explicit |
Construct from a dictionary.
Definition at line 230 of file exprDriver.C.
References dict(), exprDriver(), and readDict().

|
virtualdefault |
|
inlineprotectednoexcept |
Definition at line 137 of file exprDriverI.H.
References Foam::noexcept, SEARCH_REGISTRY, and searchCtrl_.
Referenced by fvExprDriver::foundField(), fvExprDriver::getFieldClassName(), fvExprDriver::getOrReadFieldImpl(), and setSearchBehaviour().

|
inlineprotectednoexcept |
Definition at line 143 of file exprDriverI.H.
References Foam::noexcept, SEARCH_FILES, and searchCtrl_.
Referenced by fvExprDriver::foundField(), parseDriver::getField(), fvExprDriver::getFieldClassName(), fvExprDriver::getOrReadFieldImpl(), parseDriver::patchInternalField(), parseDriver::patchNeighbourField(), parseDriver::patchNormalField(), and setSearchBehaviour().

|
inlineprotectednoexcept |
Definition at line 149 of file exprDriverI.H.
References CACHE_READ_FIELDS, Foam::noexcept, and searchCtrl_.
Referenced by fvExprDriver::readAndRegister(), and setSearchBehaviour().

|
protected |
Reset the time-state reference.
Definition at line 123 of file exprDriver.C.
References timeStatePtr_.
Referenced by parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), and parseDriver::parseDriver().

|
protected |
Reset the time-state reference.
Definition at line 129 of file exprDriver.C.
References timeStatePtr_.
|
protected |
Write scalar/vector Function1 entries in dictionary format.
Definition at line 215 of file exprDriverFunctions.C.
References dict_, os(), scalarFuncs_, vectorFuncs_, and Foam::writeFuncsImpl().
Referenced by fvExprDriver::writeCommon().


|
inlineprotectedvirtual |
Non-const access to the named variable (sub-classes only).
Reimplemented in fvExprDriver.
Definition at line 56 of file exprDriverI.H.
References Foam::name(), and variables_.
Referenced by parseDriver::getField(), and isLocalVariable().


|
protected |
Fill a random field.
| field | the field to populate |
| seed | the seed value. If zero or negative, use as an offset to the current timeIndex (if a time-state is available) |
| gaussian | generate a Gaussian distribution |
Definition at line 28 of file exprDriverFields.C.
References Foam::FieldOps::assign(), field(), TimeState::timeIndex(), and timeState().
Referenced by parseDriver::field_rand().


|
staticprotected |
Return the location of the min value.
Definition at line 62 of file exprDriverFields.C.
References Foam::FieldOps::findMinData().

|
staticprotected |
Return the location of the max value.
Definition at line 72 of file exprDriverFields.C.
References Foam::FieldOps::findMaxData().

|
protectedvirtual |
Update things.
Definition at line 314 of file exprDriver.C.
|
protectedvirtual |
Examine current variable values and update stored variables.
Reimplemented in fvExprDriver.
Definition at line 320 of file exprDriver.C.
|
protectedvirtual |
Get the result from another driver.
Override to allow mapping
Definition at line 361 of file exprDriver.C.
References exprDriver(), exprResult::getUniform(), result(), and size().
Referenced by fvExprDriver::evaluateVariableRemote().


| TypeName | ( | "exprDriver" | ) |
Runtime type information.
References TypeName().
Referenced by TypeName().


|
delete |
No copy assignment.
References DEFAULT_SEARCH, dict(), exprDriver(), Foam::rhs(), and Foam::search().

|
inlinevirtual |
The natural field size for the expression.
Reimplemented in parseDriver, fvExprDriver, parseDriver, and parseDriver.
Definition at line 423 of file exprDriver.H.
References size().
Referenced by getRemoteResult(), newField(), and size().


|
inlinevirtual |
The point field size for the expression.
Reimplemented in parseDriver, fvExprDriver, parseDriver, and parseDriver.
Definition at line 431 of file exprDriver.H.
Referenced by newPointField().

|
noexcept |
Reference to the current time-state (can be nullptr).
Definition at line 247 of file exprDriver.C.
References Foam::noexcept, obrPtr_, and timeStatePtr_.
Referenced by fill_random().

|
virtual |
The current time value.
Definition at line 261 of file exprDriver.C.
References obrPtr_, and timeStatePtr_.
|
virtual |
The current deltaT value.
Definition at line 275 of file exprDriver.C.
References obrPtr_, and timeStatePtr_.
|
inlinenoexcept |
The dictionary with all input data/specification.
Definition at line 455 of file exprDriver.H.
References dict(), dict_, and Foam::noexcept.
Referenced by fvExprDriver::declareRunTimeSelectionTable(), fvExprDriver::declareRunTimeSelectionTable(), dict(), exprDriver(), exprDriver(), exprDriver(), fvExprDriver::fvExprDriver(), fvExprDriver::fvExprDriver(), fvExprDriver::fvExprDriver(), fvExprDriver::getData(), fvExprDriver::getTopoSet(), fvExprDriver::getVariable(), fvExprDriver::New(), fvExprDriver::New(), newPointField(), operator=(), parseDriver::operator=(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), fvExprDriver::prepareData(), readDict(), fvExprDriver::readDict(), parseDriver::readDict(), readExpression(), readVariableStrings(), fvExprDriver::regionMesh(), and setVariableStrings().


|
inlinenoexcept |
Const access to expression result.
Definition at line 463 of file exprDriver.H.
References Foam::noexcept, and result_.
Referenced by addUniformVariable(), addUniformVariable(), parseDriver::field_cellSelection(), parseDriver::field_faceSelection(), fillFunctionValues(), getRemoteResult(), fvExprDriver::isGlobalVariable(), parseDriver::pointToCell(), parseDriver::setInternalFieldResult(), and parseDriver::setResult().

|
inlinenoexcept |
Non-const access to expression result.
Definition at line 471 of file exprDriver.H.
References Foam::noexcept, and result_.
| void clearResult | ( | ) |
Return the expression result as a tmp field.
This also clears the result and associated memory.
Referenced by evaluate().

|
inlinenoexcept |
The result type as word - same as result().valueType().
Definition at line 492 of file exprDriver.H.
References Foam::noexcept, and result_.
| void resetDb | ( | const objectRegistry * | obrPtr = nullptr | ) |
Reset the objectRegistry (for functions).
Definition at line 135 of file exprDriver.C.
References forAllIters, obrPtr_, scalarFuncs_, and vectorFuncs_.
Referenced by parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), and resetDb().

| void resetDb | ( | const objectRegistry & | db | ) |
Reset the objectRegistry (for functions).
Definition at line 158 of file exprDriver.C.
References resetDb().

|
inlinenoexcept |
Get special-purpose scalar reference argument.
Typically available as arg() in an expression and may correspond to table index, time value etc.
Definition at line 30 of file exprDriverI.H.
References arg1Value_, and Foam::noexcept.
|
inlinenoexcept |
Get "look-behind" parsing context (internal bookkeeping).
Definition at line 108 of file exprDriverI.H.
References Foam::noexcept, and stashedTokenId_.
|
inlinenoexcept |
Reset "look-behind" parsing context (mutable operation).
Definition at line 114 of file exprDriverI.H.
References stashedTokenId_.
| void setDebugging | ( | bool | scannerDebug, |
| bool | parserDebug ) |
Set the scanner/parser debug.
Definition at line 484 of file exprDriver.C.
References debugParser_, and debugScanner_.
| void setDebugging | ( | const exprDriver & | rhs | ) |
Set the scanner/parser debug to match the input.
Definition at line 495 of file exprDriver.C.
References debugParser_, debugScanner_, exprDriver(), and Foam::rhs().

|
noexcept |
Toggle CACHE_READ_FIELDS control.
Definition at line 505 of file exprDriver.C.
References CACHE_READ_FIELDS, SEARCH_FILES, SEARCH_REGISTRY, and searchCtrl_.
| void setSearchBehaviour | ( | enum searchControls | search, |
| const bool | caching = false ) |
Set search behaviour, with additional CACHE_READ_FIELDS toggle on.
Definition at line 533 of file exprDriver.C.
References CACHE_READ_FIELDS, cacheReadFields(), Foam::Info, Foam::nl, Foam::search(), SEARCH_FILES, SEARCH_REGISTRY, searchCtrl_, searchFiles(), and searchRegistry().

| void setSearchBehaviour | ( | const exprDriver & | rhs | ) |
Set search behaviour to be identical to rhs.
Definition at line 561 of file exprDriver.C.
References exprDriver(), Foam::rhs(), and searchCtrl_.

|
inlinenoexcept |
Read access to scanner debug.
Definition at line 125 of file exprDriverI.H.
References debugScanner_, and Foam::noexcept.
Referenced by parseDriver::parse().

|
inlinenoexcept |
Read access to parser debug.
Definition at line 131 of file exprDriverI.H.
References debugParser_, and Foam::noexcept.
|
inline |
Definition at line 577 of file exprDriver.H.
References prevIterIsOldTime(), and prevIterIsOldTime_.
Referenced by prevIterIsOldTime().


|
virtual |
Clear temporary variables, reset from expression strings.
Reimplemented in fvExprDriver.
Definition at line 324 of file exprDriver.C.
References addVariables(), variables_, and variableStrings_.
Referenced by addVariables(), and addVariables().


|
inlinenoexcept |
Set special-purpose scalar reference argument.
Typically available as arg() in an expression and may corrspond to table index, time value etc.
Definition at line 24 of file exprDriverI.H.
References arg1Value_.
|
inlinevirtual |
True if named variable exists.
Reimplemented in fvExprDriver.
Definition at line 36 of file exprDriverI.H.
References Foam::name(), and variables_.
Referenced by parseDriver::getField(), and isLocalVariable().


|
inlinevirtual |
Return const-access to the named variable.
Reimplemented in fvExprDriver.
Definition at line 46 of file exprDriverI.H.
References Foam::name(), and variables_.

| void addVariables | ( | const expressions::exprString & | expr, |
| bool | clear = true ) |
Add/set string expressions for variables.
Can include multiple definitions inline
| clear | Remove previously defined variables |
Definition at line 371 of file exprDriver.C.
References clear(), clearVariables(), dict_, evaluateVariable(), evaluateVariableRemote(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::FatalIOError, FatalIOErrorInFunction, Foam::stringOps::inplaceTrim(), Foam::nl, Foam::stringOps::split(), exprString::toExpr(), Foam::stringOps::trim(), and word::validate().
Referenced by addVariables(), clearVariables(), and fvExprDriver::clearVariables().


| void addVariables | ( | const UList< expressions::exprString > & | list, |
| bool | clear = true ) |
Add/set string expressions for variables.
Can include multiple definitions inline
| clear | Remove previously defined variables |
Definition at line 466 of file exprDriver.C.
References addVariables(), clear(), and clearVariables().

Add a uniform variable from an outside caller.
References contextObjects(), fillFunctionValues(), getFunctionValue(), isFunction(), isLocalVariable(), Foam::name(), Foam::noexcept, result(), Foam::T(), and x.

|
inline |
True if any context fields are defined.
Definition at line 23 of file exprDriverContextI.H.
References contextObjects_.
|
inline |
Find named context field, if it exists.
Definition at line 30 of file exprDriverContextI.H.
References contextObjects_, and Foam::name().
Referenced by cfindContextObject(), fvExprDriver::foundField(), parseDriver::getField(), parseDriver::patchInternalField(), parseDriver::patchNeighbourField(), and parseDriver::patchNormalField().


| const ObjType * cfindContextObject | ( | const word & | name | ) | const |
Find context field object of specified type.
Definition at line 106 of file exprDriverContextI.H.
References cfindContextIOobject(), and Foam::name().
Referenced by fvExprDriver::getOrReadFieldImpl().


|
inline |
Add the object to the context.
Definition at line 40 of file exprDriverContextI.H.
References contextObjects_, and Foam::name().
Referenced by addContextObject().


|
inline |
Add the object to the context.
Definition at line 57 of file exprDriverContextI.H.
References addContextObject(), and IOobject::name().

|
inline |
Remove the object from the context.
Definition at line 69 of file exprDriverContextI.H.
References contextObjects_, and Foam::name().

|
inline |
Remove the object from the context.
Definition at line 78 of file exprDriverContextI.H.
References contextObjects_, and IOobject::name().

|
inlinenoexcept |
Read access to the object context.
Definition at line 91 of file exprDriverContextI.H.
References contextObjects_, and Foam::noexcept.
Referenced by addUniformVariable().

|
inlinenoexcept |
Write access to the object context.
Definition at line 98 of file exprDriverContextI.H.
References contextObjects_, and Foam::noexcept.
| bool isFunction | ( | const word & | name | ) | const |
Named mapping with given type exists.
Definition at line 72 of file exprDriverTemplates.C.
References doLocalCode, Foam::name(), scalarFuncs_, and vectorFuncs_.
Referenced by addUniformVariable().


| Type getFunctionValue | ( | const word & | name, |
| const scalar | x ) const |
Evaluate named mapping for the given time/value. Zero for undefined/unknown.
Definition at line 97 of file exprDriverTemplates.C.
References doLocalCode, UList< T >::empty(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::flatOutput(), Foam::name(), Foam::nl, scalarFuncs_, Function1< Type >::value(), vectorFuncs_, and x.
Referenced by addUniformVariable().


| void fillFunctionValues | ( | Field< Type > & | result, |
| const word & | name, | ||
| const scalarField & | input ) const |
Fill result with values remapped according to the named Function1.
Definition at line 150 of file exprDriverTemplates.C.
References doLocalCode, UList< T >::empty(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::flatOutput(), Foam::min(), Foam::name(), Foam::nl, result(), scalarFuncs_, UList< T >::size(), Function1< Type >::value(), vectorFuncs_, and Foam::Zero.
Referenced by addUniformVariable().


| bool isLocalVariable | ( | const word & | name, |
| bool | wantPointData = false, | ||
| label | expectedSize = -1 ) const |
Test existence of a local variable.
Definition at line 221 of file exprDriverTemplates.C.
References DebugInfo, Foam::endl(), hasVariable(), Foam::Info, exprResult::isPointData(), exprResult::isType(), Foam::name(), Foam::returnReduceAnd(), exprResult::size(), exprResult::valueType(), and variable().
Referenced by addUniformVariable(), and fvExprDriver::isVariable().


| tmp< Field< Type > > getLocalVariable | ( | const word & | name, |
| label | expectSize, | ||
| const bool | mandatory = true ) const |
Retrieve local/global variable as a tmp field.
| name | The name of the local/global field |
| expectSize | The size check on the variable, -1 to ignore |
| mandatory | A missing variable is Fatal, or return an invalid tmp |
References getLocalVariable(), and Foam::name().
Referenced by getLocalVariable().


|
pure virtual |
Execute the parser.
The return value currently has no meaning.
Implemented in parseDriver, parseDriver, and parseDriver.
References parse(), and Foam::pos().
Referenced by evaluate(), evaluateUniform(), evaluateVariable(), fvExprDriver::evaluateVariable(), parse(), and fvExprDriver::updateSpecialVariables().


|
inline |
Evaluate the expression and return the field.
This also clears the result and associated memory.
References evaluate(), evaluateUniform(), evaluateVariable(), and evaluateVariableRemote().
Referenced by evaluate().


|
inline |
Evaluate the expression and return a single value.
Does not clear the result.
Definition at line 93 of file exprDriverI.H.
References parse(), and result_.
Referenced by evaluate().


| void evaluateVariable | ( | const word & | varName, |
| const expressions::exprString & | expr ) |
Evaluate the expression and save as the specified named variable.
Definition at line 331 of file exprDriver.C.
References DebugInfo, Foam::endl(), parse(), result_, and variables_.
Referenced by addVariables(), and evaluate().


|
virtual |
Evaluate an expression on a remote and save as the specified named variable.
Reimplemented in fvExprDriver.
Definition at line 349 of file exprDriver.C.
References NotImplemented.
Referenced by addVariables(), and evaluate().

| tmp< Field< Type > > newField | ( | const Type & | val = pTraits< Type >::zero | ) | const |
Return a new field with the size().
References newField().
Referenced by newField().


| tmp< Field< Type > > newPointField | ( | const Type & | val = pTraits< Type >::zero | ) | const |
Return a new field with the pointSize().
References dict(), Foam::name(), newPointField(), os(), readDict(), readExpression(), readVariableStrings(), setVariableStrings(), and writeVariableStrings().
Referenced by newPointField().


|
static |
Read an expression string and do substitutions.
Definition at line 67 of file exprDriverIO.C.
References dict(), and Foam::name().
Referenced by newPointField().


|
static |
Read the list of variable strings.
(or initialize with a single string)
Definition at line 88 of file exprDriverIO.C.
References dict(), and Foam::exprTools::getList().
Referenced by newPointField(), readDict(), and setVariableStrings().


| Foam::expressions::exprString readExpression | ( | const word & | name | ) |
Read an expression string (with the current dictionary) and do substitutions.
Definition at line 78 of file exprDriverIO.C.
References dict, and Foam::name().

|
virtual |
Read variables, tables etc.
Also usable for objects not constructed from a dictionary.
Reimplemented in fvExprDriver, and parseDriver.
Definition at line 289 of file exprDriver.C.
References dict(), readVariableStrings(), and variableStrings_.
Referenced by exprDriver(), newPointField(), and fvExprDriver::readDict().


| Foam::label setVariableStrings | ( | const dictionary & | dict, |
| bool | mandatory = false ) |
Read "variables" and assigns to the list of expression strings.
Definition at line 99 of file exprDriverIO.C.
References dict(), readVariableStrings(), and variableStrings_.
Referenced by newPointField().


| Foam::Ostream & writeVariableStrings | ( | Ostream & | os, |
| const word & | keyword = "" ) const |
Write "variables".
Definition at line 111 of file exprDriverIO.C.
References os(), and variableStrings_.
Referenced by newPointField(), and fvExprDriver::writeCommon().


|
inline |
Definition at line 66 of file exprDriverI.H.
References Foam::name(), result(), and variables_.

| Foam::tmp< Foam::Field< Type > > evaluate | ( | const expressions::exprString & | expr, |
| bool | wantPointData ) |
Definition at line 79 of file exprDriverI.H.
References getResult(), and parse().

| Foam::tmp< Foam::Field< Type > > getResult | ( | bool | wantPointData | ) |
Definition at line 28 of file exprDriverTemplates.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and result_.

| const Foam::Function1< Type > * getFunction1Ptr | ( | const word & | name, |
| const HashTable< refPtr< Function1< Type > > > & | tbl, | ||
| wordList * | listFailure ) |
Definition at line 46 of file exprDriverTemplates.C.
References Foam::name().

| Foam::tmp< Foam::Field< Type > > newField | ( | const Type & | val | ) | const |
Definition at line 266 of file exprDriverTemplates.C.
References Foam::New(), and size().

| Foam::tmp< Foam::Field< Type > > newPointField | ( | const Type & | val | ) | const |
Definition at line 277 of file exprDriverTemplates.C.
References Foam::New(), and pointSize().

|
protected |
The dictionary with all input data/specification.
Definition at line 196 of file exprDriver.H.
Referenced by addVariables(), dict(), exprDriver(), exprDriver(), and writeFunctions().
|
protected |
The result.
Definition at line 201 of file exprDriver.H.
Referenced by clearResult(), evaluateUniform(), evaluateVariable(), fvExprDriver::evaluateVariable(), exprDriver(), exprDriver(), getResult(), getResultType(), result(), result(), and fvExprDriver::updateSpecialVariables().
|
protected |
Variable definitions, as read from a dictionary.
Definition at line 206 of file exprDriver.H.
Referenced by clearVariables(), fvExprDriver::clearVariables(), exprDriver(), exprDriver(), readDict(), setVariableStrings(), and writeVariableStrings().
|
protected |
The variables table.
Definition at line 211 of file exprDriver.H.
Referenced by addUniformVariable(), clearVariables(), fvExprDriver::clearVariables(), evaluateVariable(), fvExprDriver::evaluateVariable(), fvExprDriver::evaluateVariableRemote(), exprDriver(), exprDriver(), hasVariable(), fvExprDriver::hasVariable(), fvExprDriver::updateSpecialVariables(), variable(), variable(), fvExprDriver::variable(), fvExprDriver::variable(), and fvExprDriver::writeCommon().
Function1 mappings/timelines (scalar), evaluated at the simulation time or with arbitrary scalars.
Definition at line 217 of file exprDriver.H.
Referenced by exprDriver(), exprDriver(), fillFunctionValues(), getFunctionValue(), isFunction(), resetDb(), and writeFunctions().
Function1 mappings/timelines (vector), evaluated at the simulation time or with arbitrary scalars.
Definition at line 223 of file exprDriver.H.
Referenced by exprDriver(), exprDriver(), fillFunctionValues(), getFunctionValue(), isFunction(), resetDb(), and writeFunctions().
|
protected |
Externally defined context fields.
Definition at line 228 of file exprDriver.H.
Referenced by addContextObject(), cfindContextIOobject(), contextObjects(), contextObjects(), exprDriver(), exprDriver(), hasContextObjects(), removeContextObject(), and removeContextObject().
|
protected |
Special-purpose scalar reference argument.
Definition at line 233 of file exprDriver.H.
Referenced by argValue(), exprDriver(), exprDriver(), and setArgument().
|
mutableprotected |
Reference to the time-state.
Definition at line 238 of file exprDriver.H.
Referenced by deltaT(), exprDriver(), exprDriver(), resetTimeReference(), resetTimeReference(), timeState(), and timeValue().
|
protected |
Pointer to an object registry (for functions etc).
Definition at line 243 of file exprDriver.H.
Referenced by deltaT(), exprDriver(), exprDriver(), resetDb(), timeState(), and timeValue().
|
mutableprotected |
Internal bookkeeping as "look-behind" parsing context.
Definition at line 251 of file exprDriver.H.
Referenced by exprDriver(), exprDriver(), resetStashedTokenId(), and stashedTokenId().
|
protected |
Request debugging for scanner.
Definition at line 256 of file exprDriver.H.
Referenced by debugScanner(), exprDriver(), exprDriver(), setDebugging(), and setDebugging().
|
protected |
Request debugging for parser.
Definition at line 261 of file exprDriver.H.
Referenced by debugParser(), exprDriver(), exprDriver(), setDebugging(), and setDebugging().
|
protected |
Allow variable names to mask field names.
Definition at line 266 of file exprDriver.H.
Referenced by fvExprDriver::evaluateVariable(), exprDriver(), and exprDriver().
|
protected |
Use value of previous iteration when oldTime is requested.
Definition at line 271 of file exprDriver.H.
Referenced by exprDriver(), exprDriver(), and prevIterIsOldTime().
|
protected |
Registry/disk/caching control.
Definition at line 276 of file exprDriver.H.
Referenced by cacheReadFields(), exprDriver(), exprDriver(), searchFiles(), searchRegistry(), setCaching(), setSearchBehaviour(), and setSearchBehaviour().