82#ifndef expressions_volumeExprDriver_H
83#define expressions_volumeExprDriver_H
108 public parsing::genericRagelLemonDriver,
109 public expressions::fvExprDriver
218 virtual const fvMesh&
mesh()
const
224 virtual label
size()
const
263 virtual
unsigned parse
265 const std::
string& expr,
267 size_t len = std::
string::npos
312 template<
class GeoField>
317 template<
class GeoField>
318 const GeoField*
isResultType(
bool logical,
bool dieOnNull=
false)
const;
413 fld.mesh().magSf().primitiveField(),
424 fld.mesh().magSf().primitiveField(),
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
const dictionary & dict() const noexcept
The dictionary with all input data/specification.
Base driver for parsing value expressions associated with an fvMesh.
Driver for volume, surface, point field expressions.
virtual label size() const
The natural field size for the expression.
Type volAverage(VolumeField< Type > &fld) const
The volume-weighted average of a field.
const fvMesh & mesh_
The referenced mesh.
const word & resultType() const noexcept
The result type-name.
tmp< volScalarField > field_cellVolume() const
The cell volumes - (swak = vol).
tmp< volScalarField > field_randGaussian(label seed=0) const
A Gaussian random field.
tmp< VolumeField< Type > > newVolField(const Type &val=pTraits< Type >::zero) const
Return a new volume field with the mesh size.
autoPtr< regIOobject > dupZeroField() const
A zero-initialized field with the same type as the result field.
FieldAssociation fieldAssociation() const noexcept
The geometric field association.
expressions::FieldAssociation fieldGeoType_
A volume/surface/point field.
tmp< surfaceScalarField > field_faceArea() const
The face area magnitudes [magSf] - (swak = area).
bool isPointData() const noexcept
A point field.
tmp< VolumeField< Type > > pointToCell(const PointField< Type > &field) const
Interpolate point to cell values.
virtual label pointSize() const
The point field size for the expression.
ClassName("volumeExpr::driver")
tmp< PointField< Type > > getPointField(const word &fldName, bool getOldTime=false)
Retrieve field (surface field).
virtual unsigned parse(const std::string &expr, size_t pos=0, size_t len=std::string::npos)
Execute the parser.
tmp< pointVectorField > field_pointField() const
The mesh point locations - (swak = pts).
void operator=(const parseDriver &)=delete
tmp< PointField< Type > > newPointField(const Type &val=pTraits< Type >::zero) const
Return a new point field with the mesh nPoints size.
tmp< surfaceScalarField > field_faceZone(const word &name) const
Face selection (zone).
tmp< pointScalarField > field_pointSet(const word &name) const
Point selection (set).
const GeoField * isResultType(bool logical, bool dieOnNull=false) const
Test if stored result pointer is the specified type and matches the specified logical type.
bool isLogical() const noexcept
A logical (bool-like) field. Actually stored as a scalar.
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
Type volSum(VolumeField< Type > &fld) const
The volume-weighted sum of a field.
parseDriver(const parseDriver &)=delete
tmp< pointScalarField > field_pointZone(const word &name) const
Point selection (zone).
const GeoField * isResultType() const
Test if stored result pointer is the specified type.
tmp< VolumeField< Type > > getVolField(const word &fldName, bool getOldTime=false)
Retrieve field (vol field).
tmp< surfaceScalarField > field_faceSelection(const word &name, enum topoSetSource::sourceType setType) const
Face selections (as logical).
tmp< SurfaceField< Type > > cellToFace(const VolumeField< Type > &field) const
Interpolate cell to face values.
bool hasDimensions_
Requested use of dimensions.
tmp< surfaceVectorField > field_areaNormal() const
The face areas with their vector direction [Sf] - (swak = face).
bool hasDimensions() const noexcept
Apply dimensions() to geometric fields.
tmp< SurfaceField< Type > > newSurfaceField(const Type &val=pTraits< Type >::zero) const
Return a new surface field with the mesh nInternalFaces size.
tmp< PointField< Type > > cellToPoint(const VolumeField< Type > &field) const
Interpolate cell to point values.
tmp< surfaceScalarField > field_faceSet(const word &name) const
Face selection (set).
tmp< volScalarField > field_cellSet(const word &name) const
Cell selection (set).
tmp< surfaceVectorField > field_faceCentre() const
The face centres - (swak = fpos).
tmp< volScalarField > field_cellSelection(const word &name, enum topoSetSource::sourceType setType) const
Cell selections (as logical).
tmp< volScalarField > field_cellZone(const word &name) const
Cell selection (zone).
tmp< volScalarField > field_rand(label seed=0, bool gaussian=false) const
A uniform random field.
tmp< SurfaceField< Type > > getSurfaceField(const word &fldName, bool getOldTime=false)
Retrieve field (surface field).
void setInternalFieldResult(const Field< Type > &fld)
Deep-copy the internalField as a result.
Type areaSum(SurfaceField< Type > &fld) const
The area-weighted sum of a field.
tmp< volVectorField > field_cellCentre() const
The cell centres - (swak = pos).
virtual const fvMesh & mesh() const
The mesh we are attached to.
word resultType_
The result type-name.
bool isFaceData() const noexcept
A surface field.
bool isVolumeData() const noexcept
A volume field.
autoPtr< regIOobject > resultField_
The results (volume, surface, point).
bool isLogical_
A logical (bool-like) field (but actually a scalar).
const dimensionSet & dimensions() const noexcept
The preferred result dimensions (if any).
Type areaAverage(SurfaceField< Type > &fld) const
The area-weighted average of a field.
virtual ~parseDriver()=default
Destructor.
tmp< pointScalarField > field_pointSelection(const word &name, enum topoSetSource::sourceType setType) const
Point selections (as logical).
void setResult(VolumeField< Type > *ptr, bool logical=false)
Set result (vol field).
void clearField()
Clear out local copies of the field.
dimensionSet resultDimensions_
The result dimensions.
Mesh data needed to do the Finite Volume discretisation.
A traits class, which is primarily used for primitives and vector-space.
Generic interface code for Ragel/Lemon combination Subclasses should implement one or more process() ...
const std::string & content() const
Get reference to the input buffer content.
genericRagelLemonDriver()
Construct null.
label nPoints() const noexcept
Number of mesh points.
A class for managing temporary objects.
sourceType
Enumeration defining the types of sources.
A class for handling words, derived from Foam::string.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Namespace for volume field expressions parsing and evaluation.
A namespace for expression-related classes/traits etc.
@ VOLUME_DATA
Volume data.
dimensionedScalar pos(const dimensionedScalar &ds)
GeometricField< Type, fvPatchField, volMesh > VolumeField
A volume field for a given type.
Type gWeightedAverage(const UList< scalar > &weights, const UList< Type > &fld, const label comm)
The global weighted average of a field, using the mag() of the weights.
Type gWeightedSum(const UList< scalar > &weights, const UList< Type > &fld, const label comm)
The global weighted sum (integral) of a field, using the mag() of the weights.
GeometricField< Type, pointPatchField, pointMesh > PointField
A point field for a given type.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
GeometricField< Type, fvsPatchField, surfaceMesh > SurfaceField
A (volume) surface field for a given type.