parseDriver Class Reference

Driver for volume, surface, point field expressions. More...

Inheritance diagram for parseDriver:
[legend]
Collaboration diagram for parseDriver:
[legend]

Public Member Functions

 ClassName ("volumeExpr::driver")
 
 parseDriver (const parseDriver &)=delete
 
void operator= (const parseDriver &)=delete
 
 parseDriver (const fvMesh &mesh, const dictionary &dict=dictionary::null)
 Construct for specified mesh, with dictionary information. More...
 
 parseDriver (const fvMesh &mesh, const parseDriver &driver, const dictionary &dict)
 Construct for specified mesh with copy of driver context. More...
 
 parseDriver (const word &meshName, const fvMesh &mesh)
 Construct with meshName for the given mesh. More...
 
 parseDriver (const dictionary &dict, const fvMesh &mesh)
 Construct with patchName and region specified in dictionary. More...
 
virtual ~parseDriver ()=default
 Destructor. More...
 
virtual const fvMeshmesh () const
 The mesh we are attached to. More...
 
virtual label size () const
 The natural field size for the expression. More...
 
virtual label pointSize () const
 The point field size for the expression. More...
 
label size (const FieldAssociation geoType) const
 Field size associated with different geometric field types. More...
 
bool hasDimensions () const noexcept
 Apply dimensions() to geometric fields. More...
 
const dimensionSetdimensions () const noexcept
 The preferred result dimensions (if any) More...
 
void clearField ()
 Clear out local copies of the field. More...
 
virtual bool readDict (const dictionary &dict)
 Read variables, tables etc. More...
 
virtual unsigned parse (const std::string &expr, size_t pos=0, size_t len=std::string::npos)
 Execute the parser. More...
 
const wordresultType () const noexcept
 The result type-name. More...
 
FieldAssociation fieldAssociation () const noexcept
 The geometric field association. More...
 
bool isLogical () const noexcept
 A logical (bool-like) field. Actually stored as a scalar. More...
 
bool isVolumeData () const noexcept
 A volume field. More...
 
bool isFaceData () const noexcept
 A surface field. More...
 
bool isPointData () const noexcept
 A point field. More...
 
template<class GeoField >
const GeoField * isResultType () const
 Test if stored result pointer is the specified type. More...
 
template<class GeoField >
const GeoField * isResultType (bool logical, bool dieOnNull=false) const
 
autoPtr< regIOobjectdupZeroField () const
 A zero-initialized field with the same type as the result field. More...
 
template<class Type >
void setResult (GeometricField< Type, fvPatchField, volMesh > *ptr, bool logical=false)
 Set result (vol field) More...
 
template<class Type >
void setResult (GeometricField< Type, fvsPatchField, surfaceMesh > *ptr, bool logical=false)
 Set result (surface field) More...
 
template<class Type >
void setResult (GeometricField< Type, pointPatchField, pointMesh > *ptr, bool logical=false)
 Set result (point field) More...
 
template<class Type >
tmp< GeometricField< Type, fvPatchField, volMesh > > newVolField (const Type &val=pTraits< Type >::zero) const
 Return a new volume field with the mesh size. More...
 
template<class Type >
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > newSurfaceField (const Type &val=pTraits< Type >::zero) const
 Return a new surface field with the mesh nInternalFaces size. More...
 
template<class Type >
tmp< GeometricField< Type, pointPatchField, pointMesh > > newPointField (const Type &val=pTraits< Type >::zero) const
 Return a new point field with the mesh nPoints size. More...
 
template<class Type >
tmp< GeometricField< Type, fvPatchField, volMesh > > getVolField (const word &fldName, bool getOldTime=false)
 Retrieve field (vol field) More...
 
template<class Type >
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > getSurfaceField (const word &fldName, bool getOldTime=false)
 Retrieve field (surface field) More...
 
template<class Type >
tmp< GeometricField< Type, pointPatchField, pointMesh > > getPointField (const word &fldName, bool getOldTime=false)
 Retrieve field (surface field) More...
 
template<class Type >
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > cellToFace (const GeometricField< Type, fvPatchField, volMesh > &field) const
 Interpolate cell to face values. More...
 
template<class Type >
tmp< GeometricField< Type, pointPatchField, pointMesh > > cellToPoint (const GeometricField< Type, fvPatchField, volMesh > &field) const
 Interpolate cell to point values. More...
 
template<class Type >
tmp< GeometricField< Type, fvPatchField, volMesh > > pointToCell (const GeometricField< Type, pointPatchField, pointMesh > &field) const
 Interpolate point to cell values. More...
 
template<class Type >
Type volAverage (GeometricField< Type, fvPatchField, volMesh > &fld) const
 The volume-weighted average of a field. More...
 
template<class Type >
Type volSum (GeometricField< Type, fvPatchField, volMesh > &fld) const
 The volume-weighted sum of a field. More...
 
template<class Type >
Type areaAverage (GeometricField< Type, fvsPatchField, surfaceMesh > &fld) const
 The area-weighted average of a field. More...
 
template<class Type >
Type areaSum (GeometricField< Type, fvsPatchField, surfaceMesh > &fld) const
 The area-weighted sum of a field. More...
 
tmp< volScalarFieldfield_cellVolume () const
 The cell volumes - (swak = vol) More...
 
tmp< volVectorFieldfield_cellCentre () const
 The cell centres - (swak = pos) More...
 
tmp< surfaceScalarFieldfield_faceArea () const
 The face area magnitudes [magSf] - (swak = area) More...
 
tmp< surfaceVectorFieldfield_faceCentre () const
 The face centres - (swak = fpos) More...
 
tmp< surfaceVectorFieldfield_areaNormal () const
 The face areas with their vector direction [Sf] - (swak = face) More...
 
tmp< pointVectorFieldfield_pointField () const
 The mesh point locations - (swak = pts) More...
 
tmp< volScalarFieldfield_cellSet (const word &name) const
 Cell selection (set) More...
 
tmp< volScalarFieldfield_cellZone (const word &name) const
 Cell selection (zone) More...
 
tmp< surfaceScalarFieldfield_faceSet (const word &name) const
 Face selection (set) More...
 
tmp< surfaceScalarFieldfield_faceZone (const word &name) const
 Face selection (zone) More...
 
tmp< pointScalarFieldfield_pointSet (const word &name) const
 Point selection (set) More...
 
tmp< pointScalarFieldfield_pointZone (const word &name) const
 Point selection (zone) More...
 
tmp< volScalarFieldfield_rand (label seed=0, bool gaussian=false) const
 A uniform random field. More...
 
tmp< volScalarFieldfield_randGaussian (label seed=0) const
 A Gaussian random field. More...
 
template<class GeomField >
const GeomField * isResultType () const
 
template<class GeomField >
const GeomField * isResultType (bool logical, bool dieOnNull) const
 
template<class Type >
Foam::tmp< Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > > newVolField (const Type &val) const
 
template<class Type >
Foam::tmp< Foam::GeometricField< Type, Foam::fvsPatchField, Foam::surfaceMesh > > newSurfaceField (const Type &val) const
 
template<class Type >
Foam::tmp< Foam::GeometricField< Type, Foam::pointPatchField, Foam::pointMesh > > newPointField (const Type &val) const
 
template<class Type >
Foam::tmp< Foam::GeometricField< Type, Foam::fvsPatchField, Foam::surfaceMesh > > cellToFace (const GeometricField< Type, fvPatchField, volMesh > &field) const
 
template<class Type >
Foam::tmp< Foam::GeometricField< Type, Foam::pointPatchField, Foam::pointMesh > > cellToPoint (const GeometricField< Type, fvPatchField, volMesh > &field) const
 
template<class Type >
Foam::tmp< Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > > pointToCell (const GeometricField< Type, pointPatchField, pointMesh > &field) const
 
- Public Member Functions inherited from genericRagelLemonDriver
 genericRagelLemonDriver ()
 Construct null. More...
 
 genericRagelLemonDriver (const genericRagelLemonDriver &rhs)=default
 Copy construct. More...
 
 genericRagelLemonDriver (genericRagelLemonDriver &&rhs)=default
 Move construct. More...
 
virtual ~genericRagelLemonDriver ()=default
 Destructor. More...
 
void clear ()
 Reset references. More...
 
const std::string & content () const
 Get reference to the input buffer content. More...
 
void content (const std::string &s, size_t pos=0, size_t len=std::string::npos)
 
std::string::const_iterator cbegin () const
 Iterator to begin of content (sub)string. More...
 
std::string::const_iterator cend () const
 Iterator to end of content (sub)string. More...
 
size_t parsePosition () const
 The relative parse position with the content (sub)string. More...
 
size_t & parsePosition ()
 The relative parse position with the content (sub)string. More...
 
OstreamprintBuffer (Ostream &os) const
 Output the input buffer string content. More...
 
void reportFatal (const std::string &msg) const
 Report FatalError. More...
 
void reportFatal (const std::string &msg, size_t pos) const
 Report FatalError at parser position. More...
 
- Public Member Functions inherited from fvExprDriver
 TypeName ("fvExprDriver")
 Runtime type information. More...
 
 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. More...
 
 fvExprDriver (const fvExprDriver &rhs, const dictionary &dict)
 Copy construct with dictionary reference. More...
 
 fvExprDriver (const dictionary &dict)
 Construct from a dictionary. More...
 
virtual autoPtr< fvExprDriverclone ()=delete
 Not generally clonable. More...
 
virtual ~fvExprDriver ()
 Destructor. More...
 
bool cacheSets () const
 Status of cache-sets (static variable) More...
 
virtual void clearVariables ()
 Clear temporary variables, reset from expression strings. More...
 
virtual bool hasVariable (const word &name) const
 True if named variable exists. More...
 
virtual const exprResultvariable (const word &name) const
 Return const-access to the named variable. More...
 
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. More...
 
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. More...
 
word getFieldClassName (const word &name) const
 Lookup the field class name (memory or read from disk) More...
 
topoSetSource::sourceType topoSetType (const word &name) const
 Return cell/face/point set type or unknown. More...
 
topoSetSource::sourceType topoZoneType (const word &name) const
 Return cell/face/point zone type or unknown. More...
 
topoSetSource::sourceType topoSourceType (const word &name) const
 Return cell/face/point zone/set type or unknown. More...
 
refPtr< labelListgetTopoSetLabels (const word &name, enum topoSetSource::sourceType setType) const
 Get the labels associated with the topo set. More...
 
bool isCellZone (const word &name) const
 Test if name is a known cellZone. More...
 
bool isFaceZone (const word &name) const
 Test if name is a known faceZone. More...
 
bool isPointZone (const word &name) const
 Test if name is a known pointZone. More...
 
bool isCellSet (const word &name) const
 Test if name is a known cellSet. More...
 
bool isFaceSet (const word &name) const
 Test if name is a known faceSet. More...
 
bool isPointSet (const word &name) const
 Test if name is a known pointSet. More...
 
virtual void evaluateVariable (const word &varName, const expressions::exprString &expr)
 
virtual void evaluateVariableRemote (string remote, const word &varName, const expressions::exprString &expr)
 
template<class Type >
bool isVariable (const word &name, bool wantPointData=false, label expectSize=-1) const
 Test existence of a local/global variable. More...
 
template<class Type >
bool foundField (const word &name) const
 Test if specified field can be found in memory or disk. More...
 
word getTypeOfField (const word &fieldName) const
 Read the IOobject for fieldName and return its headerClassName. More...
 
OstreamwriteCommon (Ostream &os, bool debug=false) const
 
void createWriterAndRead (const word &name)
 Create a writer for this object. More...
 
void tryWrite () const
 
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. More...
 
 exprDriver (const exprDriver &)=delete
 No copy construct. More...
 
void operator= (const exprDriver &)=delete
 No copy assignment. More...
 
 exprDriver (enum searchControls search=searchControls::DEFAULT_SEARCH, const dictionary &dict=dictionary::null)
 Default construct, and default construct with search preferences. More...
 
 exprDriver (const exprDriver &rhs, const dictionary &dict)
 Copy construct with new dictionary reference. More...
 
 exprDriver (const dictionary &dict)
 Construct from a dictionary. More...
 
virtual ~exprDriver ()=default
 Destructor. More...
 
const TimeStatetimeState () const noexcept
 Reference to the current time-state (can be nullptr) More...
 
virtual scalar timeValue () const
 The current time value. More...
 
virtual scalar deltaT () const
 The current deltaT value. More...
 
const dictionarydict () const noexcept
 The dictionary with all input data/specification. More...
 
const exprResultresult () const noexcept
 Const access to expression result. More...
 
exprResultresult () noexcept
 Non-const access to expression result. More...
 
void clearResult ()
 Clear the result. More...
 
template<class Type >
tmp< Field< Type > > getResult (bool wantPointData=false)
 Return the expression result as a tmp field. More...
 
const wordgetResultType () const noexcept
 The result type as word - same as result().valueType() More...
 
void resetDb (const objectRegistry *obrPtr=nullptr)
 Reset the objectRegistry (for functions) More...
 
void resetDb (const objectRegistry &db)
 Reset the objectRegistry (for functions) More...
 
scalar argValue () const noexcept
 Get special-purpose scalar reference argument. More...
 
int stashedTokenId () const noexcept
 Get "look-behind" parsing context (internal bookkeeping) More...
 
int resetStashedTokenId (int tokenId=0) const noexcept
 Reset "look-behind" parsing context (mutable operation) More...
 
void setDebugging (bool scannerDebug, bool parserDebug)
 Set the scanner/parser debug. More...
 
void setDebugging (const exprDriver &rhs)
 Set the scanner/parser debug to match the input. More...
 
bool setCaching (bool on) noexcept
 Toggle CACHE_READ_FIELDS control. More...
 
void setSearchBehaviour (enum searchControls search, const bool caching=false)
 
void setSearchBehaviour (const exprDriver &rhs)
 Set search behaviour to be identical to rhs. More...
 
bool debugScanner () const noexcept
 Read access to scanner debug. More...
 
bool debugParser () const noexcept
 Read access to parser debug. More...
 
bool prevIterIsOldTime () const
 
void setArgument (const scalar val) noexcept
 Set special-purpose scalar reference argument. More...
 
void addVariables (const expressions::exprString &expr, bool clear=true)
 Add/set string expressions for variables. More...
 
void addVariables (const UList< expressions::exprString > &list, bool clear=true)
 Add/set string expressions for variables. More...
 
template<class T >
void addUniformVariable (const word &name, const T &val)
 Add a uniform variable from an outside caller. More...
 
bool hasContextObjects () const
 True if any context fields are defined. More...
 
const regIOobjectcfindContextIOobject (const word &name) const
 Find named context field, if it exists. More...
 
template<class ObjType >
const ObjType * cfindContextObject (const word &name) const
 Find context field object of specified type. More...
 
void addContextObject (const word &name, const regIOobject *)
 Add the object to the context. More...
 
void addContextObject (const regIOobject *)
 Add the object to the context. More...
 
void removeContextObject (const word &name)
 Remove the object from the context. More...
 
void removeContextObject (const regIOobject *)
 Remove the object from the context. More...
 
const contextObjectTableTypecontextObjects () const noexcept
 Read access to the object context. More...
 
contextObjectTableTypecontextObjects () noexcept
 Write access to the object context. More...
 
template<class Type >
bool isFunction (const word &name) const
 Named mapping with given type exists. More...
 
template<class Type >
Type getFunctionValue (const word &name, const scalar x) const
 
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. More...
 
template<class T >
bool isLocalVariable (const word &name, bool wantPointData=false, label expectedSize=-1) const
 Test existence of a local variable. More...
 
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. More...
 
template<class Type >
tmp< Field< Type > > evaluate (const expressions::exprString &expr, bool wantPointData=false)
 Evaluate the expression and return the field. More...
 
template<class Type >
Type evaluateUniform (const expressions::exprString &expr, bool wantPointData=false)
 Evaluate the expression and return a single value. More...
 
void evaluateVariable (const word &varName, const expressions::exprString &expr)
 
template<class Type >
tmp< Field< Type > > newField (const Type &val=pTraits< Type >::zero) const
 Return a new field with the size() More...
 
template<class Type >
tmp< Field< Type > > newPointField (const Type &val=pTraits< Type >::zero) const
 Return a new field with the pointSize() More...
 
expressions::exprString readExpression (const word &name)
 
label setVariableStrings (const dictionary &dict, bool mandatory=false)
 Read "variables" and assigns to the list of expression strings. More...
 
OstreamwriteVariableStrings (Ostream &os, const word &keyword="") const
 Write "variables". More...
 
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 Member Functions

template<class Type >
void setInternalFieldResult (const Field< Type > &fld)
 Deep-copy the internalField as a result. More...
 
tmp< volScalarFieldfield_cellSelection (const word &name, enum topoSetSource::sourceType setType) const
 Cell selections (as logical) More...
 
tmp< surfaceScalarFieldfield_faceSelection (const word &name, enum topoSetSource::sourceType setType) const
 Face selections (as logical) More...
 
tmp< pointScalarFieldfield_pointSelection (const word &name, enum topoSetSource::sourceType setType) const
 Point selections (as logical) More...
 
- Protected Member Functions inherited from fvExprDriver
void setGlobalScopes (const wordUList &scopes)
 Define scopes for global variables. More...
 
virtual exprResultvariable (const word &name)
 Non-const access to the named variable (sub-classes only) More...
 
template<class T >
bool isGlobalVariable (const word &name, const bool wantPointData=false, const label expectedSize=-1) const
 Test existence of a global variable. More...
 
const exprResultlookupGlobal (const word &name) const
 Return the global variable if available or a null result. More...
 
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. More...
 
template<class GeomField >
tmp< GeomField > getOrReadField (const word &name, const bool mandatory=true, const bool getOldTime=false)
 Retrieve field from memory or disk. More...
 
template<class GeomField >
tmp< GeomField > getOrReadPointField (const word &name, const bool mandatory=true, const bool getOldTime=false)
 Retrieve point field from memory or disk. More...
 
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) More...
 
template<class GeomField , class MeshRef >
tmp< GeomField > readAndRegister (const word &name, const MeshRef &meshRef)
 Helper function for getOrReadField. More...
 
template<class T >
autoPtr< TgetTopoSet (const fvMesh &mesh, const word &setName, SetOrigin &origin) const
 Get topoSet. More...
 
template<class T >
bool updateSet (autoPtr< T > &setPtr, const word &setName, SetOrigin origin) const
 Update topoSet. More...
 
virtual void updateSpecialVariables (bool force=false)
 Examine current variable values and update stored variables. More...
 
virtual bool hasDataToWrite () const
 Do we need a data file to be written. More...
 
virtual void prepareData (dictionary &dict) const
 
virtual void getData (const dictionary &dict)
 Read data from dictionary, normally via the reader/writer. More...
 
- 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. More...
 
void resetTimeReference (const TimeState &ts)
 Reset the time-state reference. More...
 
void writeFunctions (Ostream &os) const
 Write scalar/vector Function1 entries in dictionary format. More...
 
void fill_random (scalarField &field, label seed=0, const bool gaussian=false) const
 Fill a random field. More...
 
virtual bool update ()
 Update things. More...
 
virtual exprResult getRemoteResult (const exprDriver &other) const
 Get the result from another driver. More...
 

Protected Attributes

const fvMeshmesh_
 The referenced mesh. More...
 
autoPtr< regIOobjectresultField_
 The results (volume, surface, point) More...
 
word resultType_
 The result type-name. More...
 
bool isLogical_
 A logical (bool-like) field (but actually a scalar) More...
 
bool hasDimensions_
 Requested use of dimensions. More...
 
expressions::FieldAssociation fieldGeoType_
 A volume/surface/point field. More...
 
dimensionSet resultDimensions_
 The result dimensions. More...
 
- Protected Attributes inherited from genericRagelLemonDriver
std::reference_wrapper< const std::string > content_
 Reference to the input string. More...
 
size_t start_
 Start position within input string. More...
 
size_t length_
 Length of input (sub)string. More...
 
size_t position_
 The last known parser position. More...
 
- Protected Attributes inherited from exprDriver
const dictionarydict_
 The dictionary with all input data/specification. More...
 
exprResult result_
 The result. More...
 
List< expressions::exprStringvariableStrings_
 Variable definitions, as read from a dictionary. More...
 
HashTable< exprResultvariables_
 The variables table. More...
 
HashTable< refPtr< Function1< scalar > > > scalarFuncs_
 
HashTable< refPtr< Function1< vector > > > vectorFuncs_
 
contextObjectTableType contextObjects_
 Externally defined context fields. More...
 
scalar arg1Value_
 Special-purpose scalar reference argument. More...
 
const TimeStatetimeStatePtr_
 Reference to the time-state. More...
 
const objectRegistryobrPtr_
 Pointer to an object registry (for functions etc). More...
 
int stashedTokenId_
 Internal bookkeeping as "look-behind" parsing context. More...
 
bool debugScanner_
 Request debugging for scanner. More...
 
bool debugParser_
 Request debugging for parser. More...
 
bool allowShadowing_
 Allow variable names to mask field names. More...
 
bool prevIterIsOldTime_
 Use value of previous iteration when oldTime is requested. More...
 
searchControls searchCtrl_
 Registry/disk/caching control. More...
 

Additional Inherited Members

- Public Types inherited from genericRagelLemonDriver
typedef size_t location_type
 Type for linear addressing within parse content. More...
 
- 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. More...
 
- Static Public Member Functions inherited from fvExprDriver
static const fvMeshdefaultMesh ()
 Get the default mesh, if one is defined. More...
 
static const fvMeshresetDefaultMesh (const fvMesh &mesh, const bool force=false)
 Set the default mesh (if not already set) More...
 
static autoPtr< fvExprDriverNew (const dictionary &dict, const fvMesh &mesh)
 Return a reference to the selected value driver. More...
 
static autoPtr< fvExprDriverNew (const dictionary &dict)
 Return a reference to the selected value driver. More...
 
static autoPtr< fvExprDriverNew (const word &type, const word &id, const fvMesh &mesh)
 Return a reference to the selected value driver. More...
 
- Static Public Member Functions inherited from exprDriver
static expressions::exprString readExpression (const word &name, const dictionary &dict)
 Read an expression string and do substitutions. More...
 
static List< expressions::exprStringreadVariableStrings (const dictionary &dict, const word &name="variables", bool mandatory=false)
 Read the list of variable strings. More...
 
- Protected Types inherited from fvExprDriver
enum  SetOrigin {
  INVALID = 0, NEW, FILE, MEMORY,
  CACHE
}
 The origin of the topoSet. More...
 
- Static Protected Member Functions inherited from fvExprDriver
static const fvMeshregionMesh (const dictionary &dict, const fvMesh &mesh, bool readIfNecessary)
 
template<class T >
static word defaultBoundaryType (const T &)
 Default boundary type is calculated. More...
 
template<class Type >
static word defaultBoundaryType (const GeometricField< Type, fvPatchField, volMesh > &)
 
template<class T >
static void correctField (T &)
 Apply correctBoundaryConditions (volume fields only) More...
 
template<class Type >
static void correctField (GeometricField< Type, fvPatchField, volMesh > &fld)
 
- Static Protected Member Functions inherited from exprDriver
template<class Type >
static Type weightedAverage (const scalarField &weights, const Field< Type > &fld)
 The (global) weighted average of a field, with stabilisation. More...
 
template<class Type >
static Type weightedSum (const scalarField &weights, const Field< Type > &fld)
 The (global) weighted sum (integral) of a field. More...
 
static point getPositionOfMinimum (const scalarField &vals, const pointField &locs)
 Return the location of the min value. More...
 
static point getPositionOfMaximum (const scalarField &vals, const pointField &locs)
 Return the location of the max value. More...
 

Detailed Description

Driver for volume, surface, point field expressions.

Additional Properties

Property Description Required Default
dimensions Dimensions for the expression result no

In addition to the standard mathematical functions, operations and logical and relational operations, the volume expressions support the following driver-specific functions:

Functions

Function Description Number of arguments
vol The cell volumes 0
pos The cell centres 0
pts The cell points 0
area The face area magnitudes 0
fpos The face centres 0
weightAverage Volume or area weighted average 1
weightSum Volume or area weighted sum 1
face The face areaNormal vectors 0
face A surface-field face value 1
point A point-field point value 1
cellToFace Interpolate cell values onto faces 1
cellToPoint Interpolate cell values onto points 1
pointToCell Interpolate point values onto cells 1
reconstruct Reconstruct cell vector from surface scalar 1
rand Random field 0/1

Selections

Function Description Number of arguments
cset Logical vol field corresponding to cellSet 1
fset Logical surf field corresponding to faceSet 1
pset Logical point field corresponding to pointSet 1
czone Logical vol field corresponding to cellZone 1
fzone Logical surf field corresponding to faceZone 1
pzone Logical point field corresponding to pointZone 1
Note
Use namespace debug switch volumeExpr for scanner (2), parser (4) or dictionary controls as per Foam::expressions::exprDriver.
Source files

Definition at line 230 of file volumeExprDriver.H.

Constructor & Destructor Documentation

◆ parseDriver() [1/5]

parseDriver ( const parseDriver )
delete

◆ parseDriver() [2/5]

parseDriver ( const fvMesh mesh,
const dictionary dict = dictionary::null 
)
explicit

Construct for specified mesh, with dictionary information.

Definition at line 87 of file volumeExprDriver.C.

◆ parseDriver() [3/5]

parseDriver ( const fvMesh mesh,
const parseDriver driver,
const dictionary dict 
)

Construct for specified mesh with copy of driver context.

Definition at line 107 of file volumeExprDriver.C.

◆ parseDriver() [4/5]

parseDriver ( const word meshName,
const fvMesh mesh 
)

Construct with meshName for the given mesh.

Definition at line 128 of file volumeExprDriver.C.

◆ parseDriver() [5/5]

parseDriver ( const dictionary dict,
const fvMesh mesh 
)

Construct with patchName and region specified in dictionary.

Definition at line 140 of file volumeExprDriver.C.

◆ ~parseDriver()

virtual ~parseDriver ( )
virtualdefault

Destructor.

Member Function Documentation

◆ setInternalFieldResult()

void setInternalFieldResult ( const Field< Type > &  fld)
protected

Deep-copy the internalField as a result.

Uses the isLogical() and isPointData() values to handle additional bookkeeping. For isLogical(), renames the resultType_ from '*Scalar*' to '*Logical*' (eg, volLogicalField)

Definition at line 38 of file volumeExprDriverTemplates.C.

References Foam::FieldOps::assign(), Foam::HashSetOps::bools(), and fld.

Here is the call graph for this function:

◆ field_cellSelection()

Foam::tmp< Foam::volScalarField > field_cellSelection ( const word name,
enum topoSetSource::sourceType  setType 
) const
protected

Cell selections (as logical)

Definition at line 36 of file volumeExprDriverFields.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, Foam::name(), Foam::New(), Foam::nl, and Foam::Zero.

Here is the call graph for this function:

◆ field_faceSelection()

Foam::tmp< Foam::surfaceScalarField > field_faceSelection ( const word name,
enum topoSetSource::sourceType  setType 
) const
protected

Face selections (as logical)

Definition at line 77 of file volumeExprDriverFields.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, Foam::name(), Foam::New(), Foam::nl, WarningInFunction, and Foam::Zero.

Here is the call graph for this function:

◆ field_pointSelection()

Foam::tmp< Foam::pointScalarField > field_pointSelection ( const word name,
enum topoSetSource::sourceType  setType 
) const
protected

Point selections (as logical)

Definition at line 153 of file volumeExprDriverFields.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, fld, mesh, Foam::name(), Foam::New(), Foam::nl, and Foam::Zero.

Here is the call graph for this function:

◆ ClassName()

ClassName ( "volumeExpr::driver"  )

◆ operator=()

void operator= ( const parseDriver )
delete

◆ mesh()

virtual const fvMesh& mesh ( ) const
inlinevirtual

The mesh we are attached to.

Implements fvExprDriver.

Definition at line 342 of file volumeExprDriver.H.

References parseDriver::mesh_.

Referenced by parseDriver::field_cellVolume().

Here is the caller graph for this function:

◆ size() [1/2]

virtual label size ( ) const
inlinevirtual

The natural field size for the expression.

Implements fvExprDriver.

Definition at line 348 of file volumeExprDriver.H.

References parseDriver::mesh_, and primitiveMesh::nCells().

Here is the call graph for this function:

◆ pointSize()

virtual label pointSize ( ) const
inlinevirtual

The point field size for the expression.

Implements fvExprDriver.

Definition at line 354 of file volumeExprDriver.H.

References parseDriver::mesh_, and primitiveMesh::nPoints().

Here is the call graph for this function:

◆ size() [2/2]

Foam::label size ( const FieldAssociation  geoType) const
inline

Field size associated with different geometric field types.

Definition at line 31 of file volumeExprDriverI.H.

References Foam::expressions::FACE_DATA, Foam::expressions::POINT_DATA, and Foam::expressions::VOLUME_DATA.

◆ hasDimensions()

bool hasDimensions ( ) const
inlinenoexcept

Apply dimensions() to geometric fields.

Definition at line 53 of file volumeExprDriverI.H.

References parseDriver::hasDimensions_.

◆ dimensions()

const Foam::dimensionSet & dimensions ( ) const
inlinenoexcept

The preferred result dimensions (if any)

Definition at line 61 of file volumeExprDriverI.H.

◆ clearField()

void clearField ( )

◆ readDict()

bool readDict ( const dictionary dict)
virtual

Read variables, tables etc.

Adds support for "dimensions"

Reimplemented from fvExprDriver.

Definition at line 161 of file volumeExprDriver.C.

References dict.

◆ parse()

unsigned parse ( const std::string &  expr,
size_t  pos = 0,
size_t  len = std::string::npos 
)
virtual

Execute the parser.

The return value currently has no meaning.

Implements exprDriver.

Definition at line 183 of file volumeExprDriver.C.

References Foam::pos(), and scanner::process().

Here is the call graph for this function:

◆ resultType()

const word& resultType ( ) const
inlinenoexcept

The result type-name.

Normally volScalarField, surfaceVectorField etc, but Scalar is modified for logical as volScalarField etc

Definition at line 400 of file volumeExprDriver.H.

◆ fieldAssociation()

FieldAssociation fieldAssociation ( ) const
inlinenoexcept

The geometric field association.

Definition at line 406 of file volumeExprDriver.H.

References parseDriver::fieldGeoType_.

◆ isLogical()

bool isLogical ( ) const
inlinenoexcept

A logical (bool-like) field. Actually stored as a scalar.

Definition at line 412 of file volumeExprDriver.H.

References parseDriver::isLogical_.

◆ isVolumeData()

bool isVolumeData ( ) const
inlinenoexcept

A volume field.

Definition at line 418 of file volumeExprDriver.H.

References parseDriver::fieldGeoType_, and Foam::expressions::VOLUME_DATA.

◆ isFaceData()

bool isFaceData ( ) const
inlinenoexcept

A surface field.

Definition at line 424 of file volumeExprDriver.H.

References Foam::expressions::FACE_DATA, and parseDriver::fieldGeoType_.

◆ isPointData()

bool isPointData ( ) const
inlinenoexcept

A point field.

Definition at line 430 of file volumeExprDriver.H.

References parseDriver::fieldGeoType_, and Foam::expressions::POINT_DATA.

◆ isResultType() [1/4]

const GeoField* isResultType ( ) const

Test if stored result pointer is the specified type.

◆ isResultType() [2/4]

const GeoField* isResultType ( bool  logical,
bool  dieOnNull = false 
) const

Test if stored result pointer is the specified type and matches the specified logical type

◆ dupZeroField()

Foam::autoPtr< Foam::regIOobject > dupZeroField ( ) const

A zero-initialized field with the same type as the result field.

Definition at line 209 of file volumeExprDriver.C.

References doLocalCode, Foam::expressions::FACE_DATA, Foam::expressions::POINT_DATA, and Foam::expressions::VOLUME_DATA.

◆ setResult() [1/3]

void setResult ( GeometricField< Type, fvPatchField, volMesh > *  ptr,
bool  logical = false 
)

Set result (vol field)

Definition at line 64 of file volumeExprDriverTemplates.C.

References GeometricField< Type, PatchField, GeoMesh >::primitiveField(), and Foam::expressions::VOLUME_DATA.

Here is the call graph for this function:

◆ setResult() [2/3]

void setResult ( GeometricField< Type, fvsPatchField, surfaceMesh > *  ptr,
bool  logical = false 
)

Set result (surface field)

Definition at line 93 of file volumeExprDriverTemplates.C.

References Foam::expressions::FACE_DATA, and GeometricField< Type, PatchField, GeoMesh >::primitiveField().

Here is the call graph for this function:

◆ setResult() [3/3]

void setResult ( GeometricField< Type, pointPatchField, pointMesh > *  ptr,
bool  logical = false 
)

Set result (point field)

Definition at line 122 of file volumeExprDriverTemplates.C.

References Foam::expressions::POINT_DATA, and GeometricField< Type, PatchField, GeoMesh >::primitiveField().

Here is the call graph for this function:

◆ newVolField() [1/2]

tmp<GeometricField<Type, fvPatchField, volMesh> > newVolField ( const Type &  val = pTraits< Type >::zero) const

Return a new volume field with the mesh size.

◆ newSurfaceField() [1/2]

tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > newSurfaceField ( const Type &  val = pTraits< Type >::zero) const

Return a new surface field with the mesh nInternalFaces size.

◆ newPointField() [1/2]

tmp<GeometricField<Type, pointPatchField, pointMesh> > newPointField ( const Type &  val = pTraits< Type >::zero) const

Return a new point field with the mesh nPoints size.

◆ getVolField()

tmp<GeometricField<Type, fvPatchField, volMesh> > getVolField ( const word fldName,
bool  getOldTime = false 
)

Retrieve field (vol field)

◆ getSurfaceField()

tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > getSurfaceField ( const word fldName,
bool  getOldTime = false 
)

Retrieve field (surface field)

◆ getPointField()

tmp<GeometricField<Type, pointPatchField, pointMesh> > getPointField ( const word fldName,
bool  getOldTime = false 
)

Retrieve field (surface field)

◆ cellToFace() [1/2]

tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > cellToFace ( const GeometricField< Type, fvPatchField, volMesh > &  field) const

Interpolate cell to face values.

◆ cellToPoint() [1/2]

Interpolate cell to point values.

◆ pointToCell() [1/2]

Interpolate point to cell values.

◆ volAverage()

Type volAverage ( GeometricField< Type, fvPatchField, volMesh > &  fld) const
inline

The volume-weighted average of a field.

Definition at line 541 of file volumeExprDriver.H.

References fld, and exprDriver::weightedAverage().

Here is the call graph for this function:

◆ volSum()

Type volSum ( GeometricField< Type, fvPatchField, volMesh > &  fld) const
inline

The volume-weighted sum of a field.

Definition at line 551 of file volumeExprDriver.H.

References fld, and exprDriver::weightedSum().

Here is the call graph for this function:

◆ areaAverage()

Type areaAverage ( GeometricField< Type, fvsPatchField, surfaceMesh > &  fld) const
inline

The area-weighted average of a field.

Definition at line 561 of file volumeExprDriver.H.

References fld, and exprDriver::weightedAverage().

Here is the call graph for this function:

◆ areaSum()

Type areaSum ( GeometricField< Type, fvsPatchField, surfaceMesh > &  fld) const
inline

The area-weighted sum of a field.

Definition at line 575 of file volumeExprDriver.H.

References fld, and exprDriver::weightedSum().

Here is the call graph for this function:

◆ field_cellVolume()

Foam::tmp< Foam::volScalarField > field_cellVolume ( ) const

The cell volumes - (swak = vol)

Definition at line 194 of file volumeExprDriverFields.C.

References Foam::dimVol, parseDriver::mesh(), and GeometricField< scalar, fvPatchField, volMesh >::New().

Here is the call graph for this function:

◆ field_cellCentre()

Foam::tmp< Foam::volVectorField > field_cellCentre ( ) const

The cell centres - (swak = pos)

Definition at line 207 of file volumeExprDriverFields.C.

References C, mesh, and tmp< T >::New().

Here is the call graph for this function:

◆ field_faceArea()

Foam::tmp< Foam::surfaceScalarField > field_faceArea ( ) const

The face area magnitudes [magSf] - (swak = area)

Definition at line 214 of file volumeExprDriverFields.C.

References Foam::dimless, mesh, and GeometricField< scalar, fvsPatchField, surfaceMesh >::New().

Here is the call graph for this function:

◆ field_faceCentre()

Foam::tmp< Foam::surfaceVectorField > field_faceCentre ( ) const

The face centres - (swak = fpos)

Definition at line 227 of file volumeExprDriverFields.C.

References Foam::dimless, mesh, and GeometricField< vector, fvsPatchField, surfaceMesh >::New().

Here is the call graph for this function:

◆ field_areaNormal()

Foam::tmp< Foam::surfaceVectorField > field_areaNormal ( ) const

The face areas with their vector direction [Sf] - (swak = face)

Definition at line 240 of file volumeExprDriverFields.C.

References Foam::dimless, mesh, and GeometricField< vector, fvsPatchField, surfaceMesh >::New().

Here is the call graph for this function:

◆ field_pointField()

Foam::tmp< Foam::pointVectorField > field_pointField ( ) const

The mesh point locations - (swak = pts)

Definition at line 253 of file volumeExprDriverFields.C.

References Foam::dimless, mesh, MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), GeometricField< vector, pointPatchField, pointMesh >::New(), and points.

Here is the call graph for this function:

◆ field_cellSet()

tmp<volScalarField> field_cellSet ( const word name) const
inline

Cell selection (set)

◆ field_cellZone()

Foam::tmp< Foam::volScalarField > field_cellZone ( const word name) const
inline

Cell selection (zone)

Definition at line 83 of file volumeExprDriverI.H.

References Foam::name().

Here is the call graph for this function:

◆ field_faceSet()

Foam::tmp< Foam::surfaceScalarField > field_faceSet ( const word name) const
inline

Face selection (set)

Definition at line 97 of file volumeExprDriverI.H.

References Foam::name().

Here is the call graph for this function:

◆ field_faceZone()

Foam::tmp< Foam::surfaceScalarField > field_faceZone ( const word name) const
inline

Face selection (zone)

Definition at line 111 of file volumeExprDriverI.H.

References Foam::name().

Here is the call graph for this function:

◆ field_pointSet()

Foam::tmp< Foam::pointScalarField > field_pointSet ( const word name) const
inline

Point selection (set)

Definition at line 125 of file volumeExprDriverI.H.

References Foam::name().

Here is the call graph for this function:

◆ field_pointZone()

Foam::tmp< Foam::pointScalarField > field_pointZone ( const word name) const
inline

Point selection (zone)

Definition at line 139 of file volumeExprDriverI.H.

References Foam::name().

Here is the call graph for this function:

◆ field_rand()

Foam::tmp< Foam::volScalarField > field_rand ( label  seed = 0,
bool  gaussian = false 
) const

A uniform random field.

Definition at line 267 of file volumeExprDriverFields.C.

References Foam::dimless, exprDriver::fill_random(), mesh, and GeometricField< scalar, fvPatchField, volMesh >::New().

Referenced by parseDriver::field_randGaussian().

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

◆ field_randGaussian()

tmp<volScalarField> field_randGaussian ( label  seed = 0) const
inline

A Gaussian random field.

Definition at line 628 of file volumeExprDriver.H.

References parseDriver::field_rand().

Here is the call graph for this function:

◆ isResultType() [3/4]

const GeomField* isResultType ( ) const

Definition at line 151 of file volumeExprDriverTemplates.C.

References parseDriver::resultField_.

◆ isResultType() [4/4]

const GeomField* isResultType ( bool  logical,
bool  dieOnNull 
) const

Definition at line 160 of file volumeExprDriverTemplates.C.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Here is the call graph for this function:

◆ newVolField() [2/2]

Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > newVolField ( const Type &  val) const

Definition at line 244 of file volumeExprDriverTemplates.C.

References Foam::dimless, mesh, and Foam::New().

Here is the call graph for this function:

◆ newSurfaceField() [2/2]

Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > newSurfaceField ( const Type &  val) const

Definition at line 262 of file volumeExprDriverTemplates.C.

References Foam::dimless, mesh, and Foam::New().

Here is the call graph for this function:

◆ newPointField() [2/2]

Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> > newPointField ( const Type &  val) const

Definition at line 280 of file volumeExprDriverTemplates.C.

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

Here is the call graph for this function:

◆ cellToFace() [2/2]

Definition at line 298 of file volumeExprDriverTemplates.C.

References field(), and Foam::fvc::interpolate().

Here is the call graph for this function:

◆ cellToPoint() [2/2]

Definition at line 309 of file volumeExprDriverTemplates.C.

References field(), volPointInterpolation::interpolate(), and mesh.

Here is the call graph for this function:

◆ pointToCell() [2/2]

Definition at line 321 of file volumeExprDriverTemplates.C.

References field(), forAll, and Foam::interpolatePointToCell().

Here is the call graph for this function:

Member Data Documentation

◆ mesh_

const fvMesh& mesh_
protected

The referenced mesh.

Definition at line 240 of file volumeExprDriver.H.

Referenced by parseDriver::mesh(), parseDriver::pointSize(), and parseDriver::size().

◆ resultField_

autoPtr<regIOobject> resultField_
protected

The results (volume, surface, point)

Definition at line 243 of file volumeExprDriver.H.

Referenced by parseDriver::clearField(), and parseDriver::isResultType().

◆ resultType_

word resultType_
protected

The result type-name.

Normally volScalarField, surfaceVectorField etc, but Scalar is modified for logical as volScalarField etc

Definition at line 248 of file volumeExprDriver.H.

Referenced by parseDriver::clearField().

◆ isLogical_

bool isLogical_
protected

A logical (bool-like) field (but actually a scalar)

Definition at line 251 of file volumeExprDriver.H.

Referenced by parseDriver::clearField(), and parseDriver::isLogical().

◆ hasDimensions_

bool hasDimensions_
protected

Requested use of dimensions.

Definition at line 254 of file volumeExprDriver.H.

Referenced by parseDriver::hasDimensions().

◆ fieldGeoType_

◆ resultDimensions_

dimensionSet resultDimensions_
protected

The result dimensions.

Definition at line 260 of file volumeExprDriver.H.


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