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 fvMesh &mesh, bool cacheReadFields=false)
 Construct for specified mesh. More...
 
 parseDriver (const fvMesh &mesh, const dictionary &dict)
 Construct for specified mesh with given dictionary. More...
 
 parseDriver (const fvMesh &mesh, const parseDriver &driver)
 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 autoPtr< expressions::fvExprDriverclone () const
 Clone. More...
 
virtual ~parseDriver ()=default
 Destructor. More...
 
virtual const fvMeshmesh () const
 The mesh we are attached to. More...
 
virtual label size () const
 The underlying field size for the expression. More...
 
virtual label pointSize () const
 The underlying point field size for the expression. More...
 
label size (const FieldAssociation geoType) const
 Field size associated with different geometric field types. 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
 The result type-name. More...
 
FieldAssociation fieldAssociation () const
 The geometric field association. More...
 
bool isLogical () const
 A logical (bool-like) field. Actually stored as a scalar. More...
 
bool isVolumeData () const
 A volume field. More...
 
bool isSurfaceData () const
 A surface field. More...
 
bool isPointData () const
 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
 
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 (bool cacheReadFields=false, bool searchInMemory=true, bool searchFiles=false, const dictionary &dict=dictionary::null)
 Null constructor, and null construct with search preferences. More...
 
 fvExprDriver (const fvExprDriver &)
 Copy construct. More...
 
 fvExprDriver (const dictionary &dict)
 Construct from a dictionary. More...
 
virtual ~fvExprDriver ()
 Destructor. More...
 
const TimerunTime () const
 The Time associated with the mesh. More...
 
virtual word timeName () const
 The current time name. More...
 
virtual scalar timeValue () const
 The current time value. More...
 
bool cacheSets () const
 Status of cache-sets (static variable) More...
 
virtual void clearVariables ()
 Clear temporary variables and resets 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...
 
labelList getTopoSetLabels (const word &name, enum topoSetSource::sourceType setType) const
 Read and return 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 (bool cacheReadFields=false, bool searchInMemory=true, bool searchFiles=false, const dictionary &dict=dictionary::null)
 Null constructor, and null construct with search preferences. More...
 
 exprDriver (const exprDriver &)
 Copy construct. More...
 
 exprDriver (const dictionary &dict)
 Construct from a dictionary. More...
 
virtual ~exprDriver ()=default
 Destructor. More...
 
const dictionarydict () const
 The dictionary with all input data/specification. More...
 
virtual const exprResultresult () const
 Const access to expression result. More...
 
virtual exprResultresult ()
 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...
 
virtual word getResultType () const
 The result type as word - same as result().valueType() More...
 
scalar argValue () const
 Set special-purpose scalar reference argument. More...
 
int stashedTokenId () const
 Get "look-behind" parsing context (internal bookkeeping) More...
 
int resetStashedTokenId (int tokenId=0) const
 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...
 
void setSearchBehaviour (bool cacheReadFields, bool searchInMemory, bool searchFiles)
 Set search behaviour. More...
 
void setSearchBehaviour (const exprDriver &rhs)
 Set search behaviour to be identical to rhs. More...
 
bool debugScanner () const
 Read access to scanner debug. More...
 
bool debugParser () const
 Read access to parser debug. More...
 
bool cacheReadFields () const
 
bool searchInMemory () const
 
bool searchFiles () const
 
bool prevIterIsOldTime () const
 
virtual void setArgument (const scalar val)
 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...
 
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 >
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...
 
 parseDriver (const parseDriver &)=delete
 
void operator= (const parseDriver &)=delete
 
- 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...
 
void fill_random (scalarField &field, label seed=0, const bool gaussian=false) const
 Create a random field. 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
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...
 
void operator= (const exprDriver &)=delete
 No copy assignment. 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...
 
enum FieldAssociation fieldGeoType_
 A volume/surface/point field. More...
 
dimensionSet resultDimension_
 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...
 
scalar arg1Value_
 Special-purpose scalar reference argument. 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...
 
bool cacheReadFields_
 Keep fields read from disc in memory. More...
 
bool searchInMemory_
 Search in registry before looking on disk. More...
 
bool searchFiles_
 Search on disk (eg, for a standalone application) More...
 

Additional Inherited Members

- Public Types inherited from genericRagelLemonDriver
typedef size_t location_type
 Type for linear addressing within parse content. 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<typename TableType >
static bool readTable (const word &name, const dictionary &dict, HashTable< TableType > &tbl, bool clear=true)
 Read an interpolation table. More...
 
template<class TableType >
static void writeTable (Ostream &os, const word &name, const HashTable< TableType > &tbl)
 Write an interpolation table. More...
 
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 229 of file volumeExprDriver.H.

Constructor & Destructor Documentation

◆ parseDriver() [1/6]

parseDriver ( const parseDriver )
protecteddelete

Referenced by parseDriver::clone().

Here is the caller graph for this function:

◆ parseDriver() [2/6]

parseDriver ( const fvMesh mesh,
bool  cacheReadFields = false 
)
explicit

Construct for specified mesh.

Definition at line 87 of file volumeExprDriver.C.

◆ parseDriver() [3/6]

parseDriver ( const fvMesh mesh,
const dictionary dict 
)

Construct for specified mesh with given dictionary.

Definition at line 103 of file volumeExprDriver.C.

◆ parseDriver() [4/6]

parseDriver ( const fvMesh mesh,
const parseDriver driver 
)

Construct for specified mesh with copy of driver context.

Definition at line 119 of file volumeExprDriver.C.

◆ parseDriver() [5/6]

parseDriver ( const word meshName,
const fvMesh mesh 
)

Construct with meshName for the given mesh.

Definition at line 135 of file volumeExprDriver.C.

◆ parseDriver() [6/6]

parseDriver ( const dictionary dict,
const fvMesh mesh 
)

Construct with patchName and region specified in dictionary.

Definition at line 147 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 76 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 151 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:

◆ operator=()

void operator= ( const parseDriver )
protecteddelete

◆ ClassName()

ClassName ( "volumeExpr::driver"  )

◆ clone()

virtual autoPtr<expressions::fvExprDriver> clone ( ) const
inlinevirtual

Clone.

Implements fvExprDriver.

Definition at line 324 of file volumeExprDriver.H.

References parseDriver::parseDriver().

Here is the call graph for this function:

◆ mesh()

virtual const fvMesh& mesh ( ) const
inlinevirtual

The mesh we are attached to.

Implements fvExprDriver.

Definition at line 340 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 underlying field size for the expression.

Implements fvExprDriver.

Definition at line 346 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 underlying point field size for the expression.

Implements fvExprDriver.

Definition at line 352 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::patchExpr::POINT_DATA, Foam::expressions::patchExpr::SURFACE_DATA, and Foam::expressions::volumeExpr::VOLUME_DATA.

◆ readDict()

bool readDict ( const dictionary dict)
virtual

Read variables, tables etc.

Adds support for "dimensions"

Reimplemented from fvExprDriver.

Definition at line 165 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 179 of file volumeExprDriver.C.

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

Here is the call graph for this function:

◆ resultType()

const word& resultType ( ) const
inline

The result type-name.

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

Definition at line 388 of file volumeExprDriver.H.

◆ fieldAssociation()

FieldAssociation fieldAssociation ( ) const
inline

The geometric field association.

Definition at line 394 of file volumeExprDriver.H.

References parseDriver::fieldGeoType_.

◆ isLogical()

bool isLogical ( ) const
inline

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

Definition at line 400 of file volumeExprDriver.H.

References parseDriver::isLogical_.

◆ isVolumeData()

bool isVolumeData ( ) const
inline

A volume field.

Definition at line 406 of file volumeExprDriver.H.

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

◆ isSurfaceData()

bool isSurfaceData ( ) const
inline

A surface field.

Definition at line 412 of file volumeExprDriver.H.

References parseDriver::fieldGeoType_, and Foam::expressions::patchExpr::SURFACE_DATA.

◆ isPointData()

bool isPointData ( ) const
inline

A point field.

Definition at line 418 of file volumeExprDriver.H.

References parseDriver::fieldGeoType_, and Foam::expressions::patchExpr::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

◆ 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::volumeExpr::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 GeometricField< Type, PatchField, GeoMesh >::primitiveField(), and Foam::expressions::patchExpr::SURFACE_DATA.

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::patchExpr::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]

tmp<GeometricField<Type, pointPatchField, pointMesh> > cellToPoint ( const GeometricField< Type, fvPatchField, volMesh > &  field) const

Interpolate cell to point values.

◆ pointToCell() [1/2]

tmp<GeometricField<Type, fvPatchField, volMesh> > pointToCell ( const GeometricField< Type, pointPatchField, pointMesh > &  field) const

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 526 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 536 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 546 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 560 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 191 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 204 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 211 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 224 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 237 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 250 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 69 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 83 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 97 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 111 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 125 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 264 of file volumeExprDriverFields.C.

References Foam::dimless, fld, 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 613 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 GeometricField< Type, PatchField, GeoMesh >::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 260 of file volumeExprDriverTemplates.C.

References Foam::dimless, mesh, and GeometricField< Type, PatchField, GeoMesh >::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 276 of file volumeExprDriverTemplates.C.

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

Here is the call graph for this function:

◆ cellToFace() [2/2]

Definition at line 292 of file volumeExprDriverTemplates.C.

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

Here is the call graph for this function:

◆ cellToPoint() [2/2]

Definition at line 303 of file volumeExprDriverTemplates.C.

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

Here is the call graph for this function:

◆ pointToCell() [2/2]

Definition at line 315 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 239 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 242 of file volumeExprDriver.H.

Referenced by 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 247 of file volumeExprDriver.H.

◆ isLogical_

bool isLogical_
protected

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

Definition at line 250 of file volumeExprDriver.H.

Referenced by parseDriver::isLogical().

◆ fieldGeoType_

enum FieldAssociation fieldGeoType_
protected

◆ resultDimension_

dimensionSet resultDimension_
protected

The result dimensions.

Definition at line 256 of file volumeExprDriver.H.


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