Driver for generic primitive field expressions. More...
#include <fieldExprDriver.H>


Public Member Functions | |
| ClassName ("fieldExpr::driver") | |
| parseDriver (const parseDriver &)=delete | |
| void | operator= (const parseDriver &)=delete |
| parseDriver (const label len=1) | |
| Default construct (size=1), or with specified size. | |
| parseDriver (const label len, const dictionary &dict) | |
| Construct for specified size with given dictionary. | |
| parseDriver (const label len, const parseDriver &rhs, const dictionary &dict) | |
| Construct for specified size, copy of driver context. | |
| virtual | ~parseDriver ()=default |
| Destructor. | |
| virtual label | size () const |
| The natural field size for the expression. | |
| virtual label | pointSize () const |
| The point field size for the expression. | |
| virtual unsigned | parse (const std::string &expr, size_t pos=0, size_t len=std::string::npos) |
| Execute the parser. | |
| template<class Type> | |
| void | setResult (Field< Type > *ptr, bool pointVal=false) |
| Set result. | |
| template<class Type> | |
| tmp< Field< Type > > | getField (const word &fieldName) const |
| Return named field (variable) if available. | |
| tmp< scalarField > | field_rand (label seed=0, bool gaussian=false) const |
| A uniform random field. | |
| tmp< scalarField > | field_randGaussian (label seed=0) const |
| A Gaussian random field. | |
| Public Member Functions inherited from genericRagelLemonDriver | |
| genericRagelLemonDriver () | |
| Construct null. | |
| genericRagelLemonDriver (const genericRagelLemonDriver &rhs)=default | |
| Copy construct. | |
| genericRagelLemonDriver (genericRagelLemonDriver &&rhs)=default | |
| Move construct. | |
| virtual | ~genericRagelLemonDriver ()=default |
| Destructor. | |
| void | clear () |
| Reset references. | |
| const std::string & | content () const |
| Get reference to the input buffer content. | |
| void | content (const std::string &s, size_t pos=0, size_t len=std::string::npos) |
| Set reference to the input buffer content, which acts like a std::string_view. | |
| std::string::const_iterator | cbegin () const |
| Iterator to begin of content (sub)string. | |
| std::string::const_iterator | cend () const |
| Iterator to end of content (sub)string. | |
| size_t | parsePosition () const |
| The relative parse position with the content (sub)string. | |
| size_t & | parsePosition () |
| The relative parse position with the content (sub)string. | |
| Ostream & | printBuffer (Ostream &os) const |
| Output the input buffer string content. | |
| void | reportFatal (const std::string &msg) const |
| Report FatalError. | |
| void | reportFatal (const std::string &msg, size_t pos) const |
| Report FatalError at parser position. | |
| Public Member Functions inherited from exprDriver | |
| 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. | |
| 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. | |
| 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 |
Protected Attributes | |
| label | size_ |
| The field size. | |
| Protected Attributes inherited from genericRagelLemonDriver | |
| std::reference_wrapper< const std::string > | content_ |
| Reference to the input string. | |
| size_t | start_ |
| Start position within input string. | |
| size_t | length_ |
| Length of input (sub)string. | |
| size_t | position_ |
| The last known parser position. | |
| Protected Attributes inherited from exprDriver | |
| 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. | |
Additional Inherited Members | |
| Public Types inherited from genericRagelLemonDriver | |
| typedef size_t | location_type |
| Type for linear addressing within parse content. | |
| Public Types inherited from exprDriver | |
| 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. | |
| Static Public Member Functions inherited from exprDriver | |
| 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 inherited from exprDriver | |
| 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 inherited from exprDriver | |
| 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. | |
Driver for generic primitive field expressions.
In addition to the standard mathematical functions, operations and logical and relational operations, the volume expression support the following driver-specific functions:
Functions
| Function | Description | Number of arguments | |
|---|---|---|---|
rand | Random field | 0/1 |
fieldExpr for scanner (2), parser (4)Definition at line 78 of file fieldExprDriver.H.
|
delete |
References parseDriver().
Referenced by operator=(), parseDriver(), and parseDriver().


|
explicit |
Default construct (size=1), or with specified size.
Definition at line 45 of file fieldExprDriver.C.
References exprDriver::exprDriver(), genericRagelLemonDriver::genericRagelLemonDriver(), Foam::max(), and size_.

| parseDriver | ( | const label | len, |
| const dictionary & | dict ) |
Construct for specified size with given dictionary.
Definition at line 56 of file fieldExprDriver.C.
References exprDriver::dict(), exprDriver::exprDriver(), genericRagelLemonDriver::genericRagelLemonDriver(), and size_.

| parseDriver | ( | const label | len, |
| const parseDriver & | rhs, | ||
| const dictionary & | dict ) |
Construct for specified size, copy of driver context.
Definition at line 68 of file fieldExprDriver.C.
References exprDriver::dict(), exprDriver::exprDriver(), genericRagelLemonDriver::genericRagelLemonDriver(), parseDriver(), Foam::rhs(), and size_.

|
virtualdefault |
Destructor.
| ClassName | ( | "fieldExpr::driver" | ) |
|
delete |
References exprDriver::dict(), parseDriver(), and Foam::rhs().

|
inlinevirtual |
The natural field size for the expression.
Reimplemented from exprDriver.
Definition at line 139 of file fieldExprDriver.H.
References size_.
Referenced by field_rand(), and getField().

|
inlinevirtual |
The point field size for the expression.
Reimplemented from exprDriver.
Definition at line 147 of file fieldExprDriver.H.
References size_.
Referenced by getField().

|
virtual |
Execute the parser.
The return value currently has no meaning.
Implements exprDriver.
Definition at line 83 of file fieldExprDriver.C.
References exprDriver::debugScanner(), Foam::pos(), and scanner::process().

|
inline |
Set result.
Definition at line 179 of file fieldExprDriver.H.
References exprDriver::result(), and exprResult::setResult().

Return named field (variable) if available.
| Foam::tmp< Foam::scalarField > field_rand | ( | label | seed = 0, |
| bool | gaussian = false ) const |
A uniform random field.
Definition at line 26 of file fieldExprDriverFields.C.
References exprDriver::fill_random(), tmp< T >::New(), and size().
Referenced by field_randGaussian().


|
inline |
A Gaussian random field.
Definition at line 204 of file fieldExprDriver.H.
References field_rand().

|
protected |
The field size.
Definition at line 90 of file fieldExprDriver.H.
Referenced by parseDriver(), parseDriver(), parseDriver(), pointSize(), and size().