Loading...
Searching...
No Matches
fvExprDriver Class Referenceabstract

Base driver for parsing value expressions associated with an fvMesh. More...

#include <fvExprDriver.H>

Inheritance diagram for fvExprDriver:
Collaboration diagram for fvExprDriver:

Public Member Functions

 TypeName ("fvExprDriver")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, fvExprDriver, dictionary,(const dictionary &dict, const fvMesh &mesh),(dict, mesh))
 declareRunTimeSelectionTable (autoPtr, fvExprDriver, idName,(const word &ident, const fvMesh &mesh),(ident, mesh))
 fvExprDriver (enum exprDriver::searchControls search=exprDriver::searchControls::DEFAULT_SEARCH, const dictionary &dict=dictionary::null)
 Default construct, and default construct with search preferences.
 fvExprDriver (const fvExprDriver &rhs, const dictionary &dict)
 Copy construct with dictionary reference.
 fvExprDriver (const dictionary &dict)
 Construct from a dictionary.
virtual autoPtr< fvExprDriverclone ()=delete
 Not generally clonable.
virtual ~fvExprDriver ()
 Destructor.
virtual label size () const =0
 The natural field size for the expression.
virtual label pointSize () const =0
 The point field size for the expression.
bool cacheSets () const
 Status of cache-sets (static variable).
virtual void clearVariables ()
 Clear temporary variables, reset from expression strings.
virtual bool hasVariable (const word &name) const
 True if named variable exists.
virtual const exprResultvariable (const word &name) const
 Return const-access to the named variable.
template<class Type>
bool isVariableOrField (const word &name, const bool wantPointData=false, const label expectSize=-1) const
 Test for existence of a local/global variable or a field.
template<class Type>
tmp< Field< Type > > getVariable (const word &name, const label expectSize, const bool mandatory=true) const
 Retrieve local/global variable as a tmp field.
word getFieldClassName (const word &name) const
 Lookup the field class name (memory or read from disk).
topoSetSource::sourceType topoSetType (const word &name) const
 Return cell/face/point set type or unknown.
topoSetSource::sourceType topoZoneType (const word &name) const
 Return cell/face/point zone type or unknown.
topoSetSource::sourceType topoSourceType (const word &name) const
 Return cell/face/point zone/set type or unknown.
refPtr< labelListgetTopoSetLabels (const word &name, enum topoSetSource::sourceType setType) const
 Get the labels associated with the topo set.
bool isCellZone (const word &name) const
 Test if name is a known cellZone.
bool isFaceZone (const word &name) const
 Test if name is a known faceZone.
bool isPointZone (const word &name) const
 Test if name is a known pointZone.
bool isCellSet (const word &name) const
 Test if name is a known cellSet.
bool isFaceSet (const word &name) const
 Test if name is a known faceSet.
bool isPointSet (const word &name) const
 Test if name is a known pointSet.
virtual 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>
bool isVariable (const word &name, bool wantPointData=false, label expectSize=-1) const
 Test existence of a local/global variable.
template<class Type>
bool foundField (const word &name) const
 Test if specified field can be found in memory or disk.
word getTypeOfField (const word &fieldName) const
 Read the IOobject for fieldName and return its headerClassName.
virtual bool readDict (const dictionary &dict)
 Read variables, tables etc.
OstreamwriteCommon (Ostream &os, bool debug=false) const
 Write "variables", "storedVariables", "delayedVariables", "globalScopes" if they are present.
void createWriterAndRead (const word &name)
 Create a writer for this object.
void tryWrite () const
 Write data if appropriate Should enable exact restarts.
template<class GeomField>
Foam::tmp< GeomField > getOrReadField (const word &name, const bool mandatory, const bool getOldTime)
template<class GeomField>
Foam::tmp< GeomField > getOrReadPointField (const word &name, const bool mandatory, const bool getOldTime)
template<class GeomField, class Mesh>
Foam::tmp< GeomField > readAndRegister (const word &name, const Mesh &meshRef)
template<class Type>
Foam::tmp< Foam::Field< Type > > getVariable (const word &name, const label expectedSize, const bool mandatory) const
template<class GeomField, class Mesh>
Foam::tmp< GeomField > getOrReadFieldImpl (const word &name, const Mesh &meshRef, bool mandatory, bool getOldTime)
template<class T>
Foam::autoPtr< TgetTopoSet (const fvMesh &mesh, const word &name, SetOrigin &origin) const
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 TimeStatetimeState () 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 dictionarydict () const noexcept
 The dictionary with all input data/specification.
const exprResultresult () const noexcept
 Const access to expression result.
exprResultresult () 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 wordgetResultType () 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
void setArgument (const scalar val) noexcept
 Set special-purpose scalar reference argument.
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 regIOobjectcfindContextIOobject (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 contextObjectTableTypecontextObjects () const noexcept
 Read access to the object context.
contextObjectTableTypecontextObjects () 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.
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.
label setVariableStrings (const dictionary &dict, bool mandatory=false)
 Read "variables" and assigns to the list of expression strings.
OstreamwriteVariableStrings (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 const fvMeshdefaultMesh ()
 Get the default mesh, if one is defined.
static const fvMeshresetDefaultMesh (const fvMesh &mesh, const bool force=false)
 Set the default mesh (if not already set).
static autoPtr< fvExprDriverNew (const dictionary &dict, const fvMesh &mesh)
 Return a reference to the selected value driver.
static autoPtr< fvExprDriverNew (const dictionary &dict)
 Return a reference to the selected value driver.
static autoPtr< fvExprDriverNew (const word &type, const word &id, const fvMesh &mesh)
 Return a reference to the selected value driver.
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::exprStringreadVariableStrings (const dictionary &dict, const word &name="variables", bool mandatory=false)
 Read the list of variable strings.

Protected Types

enum  SetOrigin {
  INVALID = 0 , NEW , FILE , MEMORY ,
  CACHE
}
 The origin of the topoSet. More...

Protected Member Functions

virtual const fvMeshmesh () const =0
 The mesh we are attached to.
void setGlobalScopes (const wordUList &scopes)
 Define scopes for global variables.
virtual exprResultvariable (const word &name)
 Non-const access to the named variable (sub-classes only).
template<class T>
bool isGlobalVariable (const word &name, const bool wantPointData=false, const label expectedSize=-1) const
 Test existence of a global variable.
const exprResultlookupGlobal (const word &name) const
 Return the global variable if available or a null result.
template<class Type>
bool isField (const word &name, const bool wantPointData=false, const label expectSize=-1) const
 Test for the existence of a mesh field.
template<class GeomField>
tmp< GeomField > getOrReadField (const word &name, const bool mandatory=true, const bool getOldTime=false)
 Retrieve field from memory or disk.
template<class GeomField>
tmp< GeomField > getOrReadPointField (const word &name, const bool mandatory=true, const bool getOldTime=false)
 Retrieve point field from memory or disk.
template<class GeomField, class MeshRef>
tmp< GeomField > getOrReadFieldImpl (const word &name, const MeshRef &meshRef, const bool mandatory=true, const bool getOldTime=false)
 Retrieve field from memory or disk (implementation).
template<class GeomField, class MeshRef>
tmp< GeomField > readAndRegister (const word &name, const MeshRef &meshRef)
 Helper function for getOrReadField.
template<class T>
autoPtr< TgetTopoSet (const fvMesh &mesh, const word &setName, SetOrigin &origin) const
 Get topoSet.
template<class T>
bool updateSet (autoPtr< T > &setPtr, const word &setName, SetOrigin origin) const
 Update topoSet.
virtual void updateSpecialVariables (bool force=false)
 Examine current variable values and update stored variables.
virtual bool hasDataToWrite () const
 Do we need a data file to be written.
virtual void prepareData (dictionary &dict) const
 Prepare/update special variables and add to dictionary, normally via the reader/writer.
virtual void getData (const dictionary &dict)
 Read data from dictionary, normally via the reader/writer.
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.
void fill_random (scalarField &field, label seed=0, const bool gaussian=false) const
 Fill a random field.
virtual bool update ()
 Update things.
virtual exprResult getRemoteResult (const exprDriver &other) const
 Get the result from another driver.

Static Protected Member Functions

static const fvMeshregionMesh (const dictionary &dict, const fvMesh &mesh, bool readIfNecessary)
 Determine mesh or region mesh as specified in the dictionary with the keyword "region".
template<class T>
static word defaultBoundaryType (const T &)
 Default boundary type is calculated.
template<class Type>
static word defaultBoundaryType (const VolumeField< Type > &)
 Default boundary type for volume fields is zeroGradient since they are essentially just internal fields.
template<class T>
static void correctField (T &)
 Apply correctBoundaryConditions (volume fields only).
template<class Type>
static void correctField (VolumeField< Type > &fld)
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.

Friends

class fvExprDriverWriter

Additional Inherited Members

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.
Protected Attributes inherited from exprDriver
const dictionarydict_
 The dictionary with all input data/specification.
exprResult result_
 The result.
List< expressions::exprStringvariableStrings_
 Variable definitions, as read from a dictionary.
HashTable< exprResultvariables_
 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 TimeStatetimeStatePtr_
 Reference to the time-state.
const objectRegistryobrPtr_
 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.

Detailed Description

Base driver for parsing value expressions associated with an fvMesh.

Largely based on code and ideas from swak4foam

Properties

Property Description Required Default
variables List of variables for expressions no ()
delayedVariables List of delayed variables no ()
storedVariables List of stored variables no ()
globalScopes Scopes for global variables 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
Source files

Definition at line 132 of file fvExprDriver.H.

Member Enumeration Documentation

◆ SetOrigin

enum SetOrigin
protected

The origin of the topoSet.

Enumerator
INVALID 
NEW 
FILE 
MEMORY 
CACHE 

Definition at line 371 of file fvExprDriver.H.

Constructor & Destructor Documentation

◆ fvExprDriver() [1/3]

Default construct, and default construct with search preferences.

Definition at line 88 of file fvExprDriver.C.

References exprDriver::dict(), exprDriver::exprDriver(), and Foam::search().

Referenced by declareRunTimeSelectionTable(), declareRunTimeSelectionTable(), fvExprDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), parseDriver::parseDriver(), prepareData(), and writeCommon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fvExprDriver() [2/3]

fvExprDriver ( const fvExprDriver & rhs,
const dictionary & dict )
explicit

Copy construct with dictionary reference.

Definition at line 104 of file fvExprDriver.C.

References exprDriver::dict(), exprDriver::exprDriver(), fvExprDriver(), and Foam::rhs().

Here is the call graph for this function:

◆ fvExprDriver() [3/3]

fvExprDriver ( const dictionary & dict)
explicit

Construct from a dictionary.

Definition at line 120 of file fvExprDriver.C.

References exprDriver::dict(), exprDriver::exprDriver(), and readDict().

Here is the call graph for this function:

◆ ~fvExprDriver()

~fvExprDriver ( )
virtual

Destructor.

Definition at line 139 of file fvExprDriver.C.

Member Function Documentation

◆ regionMesh()

const Foam::fvMesh & regionMesh ( const dictionary & dict,
const fvMesh & mesh,
bool readIfNecessary )
staticprotected

Determine mesh or region mesh as specified in the dictionary with the keyword "region".

Definition at line 501 of file fvExprDriver.C.

References DebugInFunction, exprDriver::dict(), Foam::endl(), FatalErrorInFunction, mesh(), meshPtr, IOobjectOption::MUST_READ, Foam::nl, IOobjectOption::NO_WRITE, regionName, IOobjectOption::REGISTER, and WarningInFunction.

Here is the call graph for this function:

◆ defaultBoundaryType() [1/2]

template<class T>
word defaultBoundaryType ( const T & )
inlinestaticprotected

Default boundary type is calculated.

Definition at line 230 of file fvExprDriver.H.

References Foam::T().

Referenced by getOrReadFieldImpl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ defaultBoundaryType() [2/2]

template<class Type>
word defaultBoundaryType ( const VolumeField< Type > & )
inlinestaticprotected

Default boundary type for volume fields is zeroGradient since they are essentially just internal fields.

Definition at line 240 of file fvExprDriver.H.

◆ correctField() [1/2]

template<class T>
void correctField ( T & )
inlinestaticprotected

Apply correctBoundaryConditions (volume fields only).

Definition at line 253 of file fvExprDriver.H.

References Foam::T().

Referenced by getOrReadFieldImpl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ correctField() [2/2]

template<class Type>
void correctField ( VolumeField< Type > & fld)
inlinestaticprotected

Definition at line 256 of file fvExprDriver.H.

References fld().

Here is the call graph for this function:

◆ mesh()

virtual const fvMesh & mesh ( ) const
protectedpure virtual

The mesh we are attached to.

Implemented in parseDriver, and parseDriver.

Referenced by declareRunTimeSelectionTable(), declareRunTimeSelectionTable(), fvExprDriverWriter, getTopoSet(), getTopoSet(), getTopoSetLabels(), New(), New(), regionMesh(), resetDefaultMesh(), and updateSet().

Here is the caller graph for this function:

◆ setGlobalScopes()

void setGlobalScopes ( const wordUList & scopes)
inlineprotected

Define scopes for global variables.

Definition at line 280 of file fvExprDriver.H.

◆ variable() [1/2]

Foam::expressions::exprResult & variable ( const word & name)
inlineprotectedvirtual

Non-const access to the named variable (sub-classes only).

Reimplemented from exprDriver.

Definition at line 51 of file fvExprDriverI.H.

References Foam::name(), and exprDriver::variables_.

Referenced by getOrReadFieldImpl(), getVariable(), and parseDriver::getVariableIfAvailable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isGlobalVariable()

template<class Type>
bool isGlobalVariable ( const word & name,
const bool wantPointData = false,
const label expectedSize = -1 ) const
protected

Test existence of a global variable.

Definition at line 30 of file fvExprDriverTemplates.C.

References DebugInfo, Foam::endl(), Foam::Info, lookupGlobal(), Foam::name(), exprDriver::result(), and Foam::returnReduceAnd().

Referenced by getOrReadFieldImpl(), getVariable(), parseDriver::getVariableIfAvailable(), and isVariable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookupGlobal()

const Foam::expressions::exprResult & lookupGlobal ( const word & name) const
protected

Return the global variable if available or a null result.

Definition at line 694 of file fvExprDriver.C.

References exprResultGlobals::get(), mesh, Foam::name(), and exprResultGlobals::New().

Referenced by getOrReadFieldImpl(), getVariable(), parseDriver::getVariableIfAvailable(), and isGlobalVariable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isField()

template<class Type>
bool isField ( const word & name,
const bool wantPointData = false,
const label expectSize = -1 ) const
protected

Test for the existence of a mesh field.

Parameters
expectSizeignored

Definition at line 214 of file fvExprDriverTemplates.C.

References Foam::endl(), foundField(), Foam::Info, and Foam::name().

Referenced by isVariableOrField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrReadField() [1/2]

template<class GeomField>
tmp< GeomField > getOrReadField ( const word & name,
const bool mandatory = true,
const bool getOldTime = false )
inlineprotected

Retrieve field from memory or disk.

References Foam::name().

Referenced by parseDriver::getSurfaceField(), and parseDriver::getVolField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrReadPointField() [1/2]

template<class GeomField>
tmp< GeomField > getOrReadPointField ( const word & name,
const bool mandatory = true,
const bool getOldTime = false )
inlineprotected

Retrieve point field from memory or disk.

References Foam::name().

Referenced by parseDriver::getPointField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrReadFieldImpl() [1/2]

template<class GeomField, class MeshRef>
tmp< GeomField > getOrReadFieldImpl ( const word & name,
const MeshRef & meshRef,
const bool mandatory = true,
const bool getOldTime = false )
protected

Retrieve field from memory or disk (implementation).

References Foam::name().

Referenced by getOrReadField(), and getOrReadPointField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAndRegister() [1/2]

template<class GeomField, class MeshRef>
tmp< GeomField > readAndRegister ( const word & name,
const MeshRef & meshRef )
inlineprotected

Helper function for getOrReadField.

References Foam::name().

Referenced by parseDriver::getField(), getOrReadFieldImpl(), parseDriver::patchInternalField(), parseDriver::patchNeighbourField(), and parseDriver::patchNormalField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTopoSet() [1/2]

template<class T>
autoPtr< T > getTopoSet ( const fvMesh & mesh,
const word & setName,
SetOrigin & origin ) const
protected

Get topoSet.

References exprDriver::dict(), and mesh().

Here is the call graph for this function:

◆ updateSet()

template<class T>
bool updateSet ( autoPtr< T > & setPtr,
const word & setName,
SetOrigin origin ) const
inlineprotected

◆ updateSpecialVariables()

void updateSpecialVariables ( bool force = false)
protectedvirtual

Examine current variable values and update stored variables.

Reimplemented from exprDriver.

Definition at line 233 of file fvExprDriver.C.

References DebugInfo, Foam::endl(), forAllIters, mesh, Foam::nl, exprDriver::parse(), exprDriver::result_, size(), update(), and exprDriver::variables_.

Referenced by clearVariables(), and writeCommon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasDataToWrite()

bool hasDataToWrite ( ) const
protectedvirtual

Do we need a data file to be written.

Definition at line 703 of file fvExprDriver.C.

Referenced by createWriterAndRead().

Here is the caller graph for this function:

◆ prepareData()

void prepareData ( dictionary & dict) const
protectedvirtual

Prepare/update special variables and add to dictionary, normally via the reader/writer.

Definition at line 718 of file fvExprDriver.C.

References exprDriver::dict(), and fvExprDriver().

Here is the call graph for this function:

◆ getData()

void getData ( const dictionary & dict)
protectedvirtual

Read data from dictionary, normally via the reader/writer.

Definition at line 709 of file fvExprDriver.C.

References exprDriver::dict().

Here is the call graph for this function:

◆ defaultMesh()

const Foam::fvMesh & defaultMesh ( )
static

Get the default mesh, if one is defined.

Definition at line 54 of file fvExprDriver.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Referenced by New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetDefaultMesh()

const Foam::fvMesh * resetDefaultMesh ( const fvMesh & mesh,
const bool force = false )
static

Set the default mesh (if not already set).

Parameters
forceForce reset, even if already set

Definition at line 69 of file fvExprDriver.C.

References mesh().

Referenced by New(), and New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TypeName()

TypeName ( "fvExprDriver" )

Runtime type information.

◆ declareRunTimeSelectionTable() [1/2]

declareRunTimeSelectionTable ( autoPtr ,
fvExprDriver ,
dictionary ,
(const dictionary &dict, const fvMesh &mesh) ,
(dict, mesh)  )

References exprDriver::dict(), fvExprDriver(), and mesh().

Here is the call graph for this function:

◆ declareRunTimeSelectionTable() [2/2]

declareRunTimeSelectionTable ( autoPtr ,
fvExprDriver ,
idName ,
(const word &ident, const fvMesh &mesh) ,
(ident, mesh)  )

References exprDriver::DEFAULT_SEARCH, exprDriver::dict(), fvExprDriver(), mesh(), dictionary::null, Foam::rhs(), and Foam::search().

Here is the call graph for this function:

◆ New() [1/3]

Foam::autoPtr< Foam::expressions::fvExprDriver > New ( const dictionary & dict,
const fvMesh & mesh )
static

Return a reference to the selected value driver.

Definition at line 41 of file fvExprDriverNew.C.

References DebugInFunction, exprDriver::dict(), Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, mesh(), and resetDefaultMesh().

Referenced by evaluateVariableRemote(), parseDriver::getVariableIfAvailable(), and New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ New() [2/3]

Return a reference to the selected value driver.

Definition at line 27 of file fvExprDriverNew.C.

References defaultMesh(), exprDriver::dict(), and New().

Here is the call graph for this function:

◆ New() [3/3]

Foam::autoPtr< Foam::expressions::fvExprDriver > New ( const word & type,
const word & id,
const fvMesh & mesh )
static

Return a reference to the selected value driver.

Definition at line 71 of file fvExprDriverNew.C.

References DebugInFunction, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInLookup, mesh(), and resetDefaultMesh().

Here is the call graph for this function:

◆ clone()

virtual autoPtr< fvExprDriver > clone ( )
virtualdelete

Not generally clonable.

◆ size()

virtual label size ( ) const
pure virtual

The natural field size for the expression.

Reimplemented from exprDriver.

Implemented in parseDriver, and parseDriver.

Referenced by updateSpecialVariables().

Here is the caller graph for this function:

◆ pointSize()

virtual label pointSize ( ) const
pure virtual

The point field size for the expression.

Reimplemented from exprDriver.

Implemented in parseDriver, and parseDriver.

◆ cacheSets()

bool cacheSets ( ) const
inline

Status of cache-sets (static variable).

Definition at line 560 of file fvExprDriver.H.

Referenced by getTopoSet().

Here is the caller graph for this function:

◆ clearVariables()

void clearVariables ( )
virtual

Clear temporary variables, reset from expression strings.

Reimplemented from exprDriver.

Definition at line 324 of file fvExprDriver.C.

References exprDriver::addVariables(), DebugInfo, Foam::endl(), forAllIters, mesh, update(), updateSpecialVariables(), exprDriver::variables_, and exprDriver::variableStrings_.

Here is the call graph for this function:

◆ hasVariable()

bool hasVariable ( const word & name) const
inlinevirtual

True if named variable exists.

Reimplemented from exprDriver.

Definition at line 26 of file fvExprDriverI.H.

References Foam::name(), and exprDriver::variables_.

Referenced by getOrReadFieldImpl(), getVariable(), and parseDriver::getVariableIfAvailable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ variable() [2/2]

const Foam::expressions::exprResult & variable ( const word & name) const
inlinevirtual

Return const-access to the named variable.

Reimplemented from exprDriver.

Definition at line 36 of file fvExprDriverI.H.

References Foam::name(), and exprDriver::variables_.

Here is the call graph for this function:

◆ isVariableOrField()

template<class Type>
bool isVariableOrField ( const word & name,
const bool wantPointData = false,
const label expectSize = -1 ) const
inline

Test for existence of a local/global variable or a field.

Definition at line 82 of file fvExprDriverI.H.

References isField(), isVariable(), and Foam::name().

Here is the call graph for this function:

◆ getVariable() [1/2]

template<class Type>
tmp< Field< Type > > getVariable ( const word & name,
const label expectSize,
const bool mandatory = true ) const

Retrieve local/global variable as a tmp field.

Parameters
nameThe name of the local/global field
expectSizeThe size check on the variable, -1 to ignore
mandatoryA missing variable is Fatal, or return an invalid tmp

References exprDriver::dict(), Foam::name(), and os().

Referenced by parseDriver::getPointField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFieldClassName()

Foam::word getFieldClassName ( const word & name) const

Lookup the field class name (memory or read from disk).

Return empty if the name cannot be resolved.

Definition at line 562 of file fvExprDriver.C.

References mesh, Foam::name(), word::null, exprDriver::searchFiles(), and exprDriver::searchRegistry().

Here is the call graph for this function:

◆ topoSetType()

Foam::topoSetSource::sourceType topoSetType ( const word & name) const

Return cell/face/point set type or unknown.

Definition at line 587 of file fvExprDriver.C.

References topoSetSource::CELLSET_SOURCE, topoSetSource::FACESET_SOURCE, topoSet::findIOobject(), io, mesh, topoSetSource::POINTSET_SOURCE, and topoSetSource::UNKNOWN_SOURCE.

Referenced by isCellSet(), isFaceSet(), isPointSet(), and topoSourceType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ topoZoneType()

Foam::topoSetSource::sourceType topoZoneType ( const word & name) const

Return cell/face/point zone type or unknown.

Definition at line 609 of file fvExprDriver.C.

References topoSetSource::CELLZONE_SOURCE, topoSetSource::FACEZONE_SOURCE, mesh, topoSetSource::POINTZONE_SOURCE, and topoSetSource::UNKNOWN_SOURCE.

Referenced by topoSourceType().

Here is the caller graph for this function:

◆ topoSourceType()

Foam::topoSetSource::sourceType topoSourceType ( const word & name) const

Return cell/face/point zone/set type or unknown.

Definition at line 631 of file fvExprDriver.C.

References topoSetType(), topoZoneType(), and topoSetSource::UNKNOWN_SOURCE.

Here is the call graph for this function:

◆ getTopoSetLabels()

◆ isCellZone()

bool isCellZone ( const word & name) const

Test if name is a known cellZone.

Definition at line 675 of file fvExprDriver.C.

References mesh, and Foam::name().

Here is the call graph for this function:

◆ isFaceZone()

bool isFaceZone ( const word & name) const

Test if name is a known faceZone.

Definition at line 681 of file fvExprDriver.C.

References mesh, and Foam::name().

Here is the call graph for this function:

◆ isPointZone()

bool isPointZone ( const word & name) const

Test if name is a known pointZone.

Definition at line 687 of file fvExprDriver.C.

References mesh, and Foam::name().

Here is the call graph for this function:

◆ isCellSet()

bool isCellSet ( const word & name) const

Test if name is a known cellSet.

Definition at line 645 of file fvExprDriver.C.

References topoSetSource::CELLSET_SOURCE, and topoSetType().

Here is the call graph for this function:

◆ isFaceSet()

bool isFaceSet ( const word & name) const

Test if name is a known faceSet.

Definition at line 655 of file fvExprDriver.C.

References topoSetSource::FACESET_SOURCE, and topoSetType().

Here is the call graph for this function:

◆ isPointSet()

bool isPointSet ( const word & name) const

Test if name is a known pointSet.

Definition at line 665 of file fvExprDriver.C.

References topoSetSource::POINTSET_SOURCE, and topoSetType().

Here is the call graph for this function:

◆ evaluateVariable()

void evaluateVariable ( const word & varName,
const expressions::exprString & expr )
virtual

Evaluate the expression and save as the specified named variable.

Definition at line 349 of file fvExprDriver.C.

References exprDriver::allowShadowing_, DebugInfo, Foam::endl(), IOobject::headerClassName(), mesh, Foam::nl, exprDriver::parse(), exprDriver::result_, exprDriver::variables_, and WarningInFunction.

Here is the call graph for this function:

◆ evaluateVariableRemote()

void evaluateVariableRemote ( string remote,
const word & varName,
const expressions::exprString & expr )
virtual

Evaluate an expression on a remote and save as the specified named variable.

The fully qualified form of the remote is given as follows

*     type'name/region
* 

If not specified, the default type is "patch", which means the following are equivalent

*     patch'name/region
*     name/region
* 

If region is identical to the current region, it can be omitted:

*     patch'name
*     name   (default is patch)
* 

Reimplemented from exprDriver.

Definition at line 397 of file fvExprDriver.C.

References objectRegistry::cfindObject(), DebugInfo, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, exprDriver::getRemoteResult(), exprResult::isUniform(), mesh, New(), Foam::nl, regionName, exprResult::testIfSingleValue(), fvMesh::time(), word::validate(), and exprDriver::variables_.

Here is the call graph for this function:

◆ isVariable()

template<class Type>
bool isVariable ( const word & name,
bool wantPointData = false,
label expectSize = -1 ) const
inline

Test existence of a local/global variable.

Definition at line 66 of file fvExprDriverI.H.

References isGlobalVariable(), exprDriver::isLocalVariable(), and Foam::name().

Referenced by isVariableOrField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ foundField()

template<class Type>
bool foundField ( const word & name) const

Test if specified field can be found in memory or disk.

Definition at line 128 of file fvExprDriverTemplates.C.

References exprDriver::cfindContextIOobject(), Foam::endl(), getTypeOfField(), IOobject::headerClassName(), Foam::Info, mesh, Foam::name(), Foam::nl, exprDriver::searchFiles(), and exprDriver::searchRegistry().

Referenced by isField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTypeOfField()

Foam::word getTypeOfField ( const word & fieldName) const

Read the IOobject for fieldName and return its headerClassName.

Empty if the field could not be found.

Definition at line 553 of file fvExprDriver.C.

References mesh.

Referenced by foundField(), parseDriver::getField(), getOrReadFieldImpl(), parseDriver::patchInternalField(), parseDriver::patchNeighbourField(), and parseDriver::patchNormalField().

Here is the caller graph for this function:

◆ readDict()

bool readDict ( const dictionary & dict)
virtual

Read variables, tables etc.

Also usable for objects not constructed from a dictionary.

Reimplemented from exprDriver.

Reimplemented in parseDriver.

Definition at line 145 of file fvExprDriver.C.

References exprDriver::dict(), Foam::endl(), keyType::LITERAL, exprDriver::readDict(), entry::stream(), and WarningInFunction.

Referenced by fvExprDriver(), and parseDriver::readDict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeCommon()

Foam::Ostream & writeCommon ( Ostream & os,
bool debug = false ) const

Write "variables", "storedVariables", "delayedVariables", "globalScopes" if they are present.

Definition at line 210 of file fvExprDriverIO.C.

References UList< T >::begin(), forAllConstIters, fvExprDriver(), os(), updateSpecialVariables(), exprDriver::variables_, exprDriver::writeFunctions(), and exprDriver::writeVariableStrings().

Here is the call graph for this function:

◆ createWriterAndRead()

void createWriterAndRead ( const word & name)

Create a writer for this object.

Definition at line 264 of file fvExprDriverIO.C.

References fvExprDriverWriter, hasDataToWrite(), Foam::name(), and Foam::type().

Here is the call graph for this function:

◆ tryWrite()

void tryWrite ( ) const

Write data if appropriate Should enable exact restarts.

Definition at line 273 of file fvExprDriverIO.C.

References mesh.

◆ getOrReadField() [2/2]

template<class GeomField>
Foam::tmp< GeomField > getOrReadField ( const word & name,
const bool mandatory,
const bool getOldTime )
inline

Definition at line 100 of file fvExprDriverI.H.

References getOrReadFieldImpl(), mesh, and Foam::name().

Here is the call graph for this function:

◆ getOrReadPointField() [2/2]

template<class GeomField>
Foam::tmp< GeomField > getOrReadPointField ( const word & name,
const bool mandatory,
const bool getOldTime )
inline

Definition at line 119 of file fvExprDriverI.H.

References getOrReadFieldImpl(), mesh, Foam::name(), and MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New().

Here is the call graph for this function:

◆ readAndRegister() [2/2]

template<class GeomField, class Mesh>
Foam::tmp< GeomField > readAndRegister ( const word & name,
const Mesh & meshRef )
inline

◆ getVariable() [2/2]

template<class Type>
Foam::tmp< Foam::Field< Type > > getVariable ( const word & name,
const label expectedSize,
const bool mandatory ) const

◆ getOrReadFieldImpl() [2/2]

◆ getTopoSet() [2/2]

template<class T>
Foam::autoPtr< T > getTopoSet ( const fvMesh & mesh,
const word & name,
SetOrigin & origin ) const

Definition at line 471 of file fvExprDriverTemplates.C.

References CACHE, cacheSets(), Foam::endl(), FILE, Foam::Info, INVALID, MEMORY, mesh(), IOobjectOption::MUST_READ, Foam::name(), Foam::nl, Foam::Pout, autoPtr< T >::reset(), Foam::T(), and T.

Here is the call graph for this function:

◆ fvExprDriverWriter

friend class fvExprDriverWriter
friend

Definition at line 423 of file fvExprDriver.H.

References fvExprDriverWriter, and mesh().

Referenced by createWriterAndRead(), and fvExprDriverWriter.


The documentation for this class was generated from the following files: