62#ifndef expressions_fvExprDriver_H
63#define expressions_fvExprDriver_H
81class fvExprDriverWriter;
89 public expressions::exprDriver
94 static const fvMesh *defaultMeshPtr_;
97 static bool cacheSets_;
105 List<word> globalScopes_;
108 HashTable<exprResultDelayed> delayedVariables_;
111 List<exprResultStored> storedVariables_;
114 label specialVariablesIndex_;
120 autoPtr<fvExprDriverWriter> writer_;
126 static word getHeaderClassName
128 const polyMesh&
mesh,
133 static word getSetClassName
135 const polyMesh&
mesh,
172 return "zeroGradient";
183 VolumeField<Type>&
fld
186 fld.correctBoundaryConditions();
195 virtual const fvMesh&
mesh()
const = 0;
203 globalScopes_ = scopes;
214 const bool wantPointData =
false,
215 const label expectedSize = -1
229 const bool wantPointData =
false,
230 const label expectSize = -1
235 template<
class GeomField>
239 const bool mandatory =
true,
240 const bool getOldTime =
false
244 template<
class GeomField>
248 const bool mandatory =
true,
249 const bool getOldTime =
false
253 template<
class GeomField,
class MeshRef>
257 const MeshRef& meshRef,
258 const bool mandatory =
true,
259 const bool getOldTime =
false
263 template<
class GeomField,
class MeshRef>
267 const MeshRef& meshRef
326 const bool force =
false
414 virtual label
size()
const = 0;
423 bool cacheSets()
const {
return cacheSets_; }
442 const bool wantPointData =
false,
443 const label expectSize = -1
456 const label expectSize,
457 const bool mandatory =
true
549 bool wantPointData =
false,
550 label expectSize = -1
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic GeometricField class.
A HashTable similar to std::unordered_map.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
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,...
Base driver for parsing (field) values.
searchControls
Search/caching controls.
const dictionary & dict() const noexcept
The dictionary with all input data/specification.
A polymorphic field/result from evaluating an expression.
Registered input/output for an expressions::fvExprDriver.
Base driver for parsing value expressions associated with an fvMesh.
TypeName("fvExprDriver")
Runtime type information.
static autoPtr< fvExprDriver > New(const dictionary &dict, const fvMesh &mesh)
Return a reference to the selected value driver.
bool isPointSet(const word &name) const
Test if name is a known pointSet.
bool isFaceSet(const word &name) const
Test if name is a known faceSet.
virtual exprResult & variable(const word &name)
Non-const access to the named variable (sub-classes only)
virtual void updateSpecialVariables(bool force=false)
Examine current variable values and update stored variables.
tmp< GeomField > getOrReadPointField(const word &name, const bool mandatory=true, const bool getOldTime=false)
Retrieve point field from memory or disk.
static void correctField(VolumeField< Type > &fld)
bool foundField(const word &name) const
Test if specified field can be found in memory or disk.
void setGlobalScopes(const wordUList &scopes)
Define scopes for global variables.
virtual void prepareData(dictionary &dict) const
tmp< Field< Type > > getVariable(const word &name, const label expectSize, const bool mandatory=true) const
Retrieve local/global variable as a tmp field.
static const fvMesh & regionMesh(const dictionary &dict, const fvMesh &mesh, bool readIfNecessary)
tmp< GeomField > readAndRegister(const word &name, const MeshRef &meshRef)
Helper function for getOrReadField.
virtual bool hasDataToWrite() const
Do we need a data file to be written.
const exprResult & lookupGlobal(const word &name) const
Return the global variable if available or a null result.
static const fvMesh & defaultMesh()
Get the default mesh, if one is defined.
bool isCellSet(const word &name) const
Test if name is a known cellSet.
declareRunTimeSelectionTable(autoPtr, fvExprDriver, idName,(const word &ident, const fvMesh &mesh),(ident, mesh))
tmp< GeomField > getOrReadFieldImpl(const word &name, const MeshRef &meshRef, const bool mandatory=true, const bool getOldTime=false)
Retrieve field from memory or disk (implementation)
virtual label pointSize() const =0
The point field size for the expression.
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.
bool isPointZone(const word &name) const
Test if name is a known pointZone.
virtual const fvMesh & mesh() const =0
The mesh we are attached to.
virtual void evaluateVariableRemote(string remote, const word &varName, const expressions::exprString &expr)
topoSetSource::sourceType topoZoneType(const word &name) const
Return cell/face/point zone type or unknown.
virtual autoPtr< fvExprDriver > clone()=delete
Not generally clonable.
static word defaultBoundaryType(const T &)
Default boundary type is calculated.
bool isField(const word &name, const bool wantPointData=false, const label expectSize=-1) const
Test for the existence of a mesh field.
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
static void correctField(T &)
Apply correctBoundaryConditions (volume fields only)
word getFieldClassName(const word &name) const
Lookup the field class name (memory or read from disk)
declareRunTimeSelectionTable(autoPtr, fvExprDriver, dictionary,(const dictionary &dict, const fvMesh &mesh),(dict, mesh))
autoPtr< T > getTopoSet(const fvMesh &mesh, const word &setName, SetOrigin &origin) const
Get topoSet.
bool isCellZone(const word &name) const
Test if name is a known cellZone.
void createWriterAndRead(const word &name)
Create a writer for this object.
bool isVariable(const word &name, bool wantPointData=false, label expectSize=-1) const
Test existence of a local/global variable.
static word defaultBoundaryType(const VolumeField< Type > &)
virtual label size() const =0
The natural field size for the expression.
bool isFaceZone(const word &name) const
Test if name is a known faceZone.
virtual void evaluateVariable(const word &varName, const expressions::exprString &expr)
topoSetSource::sourceType topoSetType(const word &name) const
Return cell/face/point set type or unknown.
virtual ~fvExprDriver()
Destructor.
virtual void clearVariables()
Clear temporary variables, reset from expression strings.
static const fvMesh * resetDefaultMesh(const fvMesh &mesh, const bool force=false)
Set the default mesh (if not already set)
virtual bool hasVariable(const word &name) const
True if named variable exists.
bool cacheSets() const
Status of cache-sets (static variable)
Ostream & writeCommon(Ostream &os, bool debug=false) const
bool updateSet(autoPtr< T > &setPtr, const word &setName, SetOrigin origin) const
Update topoSet.
tmp< GeomField > getOrReadField(const word &name, const bool mandatory=true, const bool getOldTime=false)
Retrieve field from memory or disk.
topoSetSource::sourceType topoSourceType(const word &name) const
Return cell/face/point zone/set type or unknown.
virtual void getData(const dictionary &dict)
Read data from dictionary, normally via the reader/writer.
refPtr< labelList > getTopoSetLabels(const word &name, enum topoSetSource::sourceType setType) const
Get the labels associated with the topo set.
word getTypeOfField(const word &fieldName) const
Read the IOobject for fieldName and return its headerClassName.
SetOrigin
The origin of the topoSet.
bool isGlobalVariable(const word &name, const bool wantPointData=false, const label expectedSize=-1) const
Test existence of a global variable.
Mesh data needed to do the Finite Volume discretisation.
Mesh consisting of general polyhedral cells.
A class for managing references or pointers (no reference counting)
A class for managing temporary objects.
sourceType
Enumeration defining the types of sources.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
UList< word > wordUList
A UList of words.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.