Go to the documentation of this file.
63 #ifndef expressions_fvExprDriver_H
64 #define expressions_fvExprDriver_H
83 class exprDriverWriter;
91 public expressions::exprDriver
96 static const fvMesh *defaultMeshPtr_;
99 static bool cacheSets_;
107 List<word> globalScopes_;
110 HashTable<exprResultDelayed> delayedVariables_;
113 List<exprResultStored> storedVariables_;
116 label specialVariablesIndex_;
122 dlLibraryTable libs_;
125 autoPtr<exprDriverWriter> writer_;
131 static word getHeaderClassName
133 const polyMesh&
mesh,
176 return "zeroGradient";
187 GeometricField<Type, fvPatchField, volMesh>&
fld
190 fld.correctBoundaryConditions();
199 virtual const fvMesh&
mesh()
const = 0;
207 globalScopes_ = scopes;
219 label expectedSize = -1
233 bool isPointVal =
false,
234 label expectSize = -1
239 template<
class GeomField>
243 bool mandatory =
true,
244 bool getOldTime =
false
248 template<
class GeomField>
252 bool mandatory =
true,
253 bool getOldTime =
false
257 template<
class GeomField,
class MeshRef>
261 const MeshRef& meshRef,
262 bool mandatory =
true,
263 bool getOldTime =
false
267 template<
class GeomField,
class MeshRef>
271 const MeshRef& meshRef
284 const bool gaussian =
false
343 const bool force =
false
428 virtual label
size()
const = 0;
449 bool cacheSets()
const {
return cacheSets_; }
468 bool isPointVal =
false,
469 label expectSize = -1
483 const bool mandatory =
true
575 bool isPointVal =
false,
576 label expectSize = -1
int debug
Static debugging option.
bool cacheSets() const
Status of cache-sets (static variable)
tmp< GeomField > getOrReadFieldImpl(const word &name, const MeshRef &meshRef, bool mandatory=true, bool getOldTime=false)
Retrieve field from memory or disk (implementation)
static word defaultBoundaryType(const T &)
Default boundary type is calculated.
static autoPtr< fvExprDriver > New(const dictionary &dict, const fvMesh &mesh)
Return a reference to the selected value driver.
sourceType
Enumeration defining the types of sources.
A table of dynamically loaded libraries.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
tmp< Field< Type > > getVariable(const word &name, label expectSize, const bool mandatory=true) const
Retrieve local/global variable as a tmp field.
A class for handling words, derived from Foam::string.
static const fvMesh * resetDefaultMesh(const fvMesh &mesh, const bool force=false)
Set the default mesh (if not already set)
virtual bool hasDataToWrite() const
Do we need a data file to be written.
A class for managing temporary objects.
static const fvMesh & defaultMesh()
Get the default mesh, if one is defined.
virtual label size() const =0
The underlying field size for the expression.
bool isCellSet(const word &name) const
Test if name is a known cellSet.
virtual autoPtr< fvExprDriver > clone() const =0
Clone.
bool isVariable(const word &name, bool isPointVal=false, label expectSize=-1) const
Test existence of a local/global variable.
bool foundField(const word &name) const
Test if specified field can be found in memory or disk.
word getFieldClassName(const word &name) const
Lookup the field class name (memory or read from disk)
void fill_random(scalarField &field, label seed=0, const bool gaussian=false) const
Create a random field.
const Time & runTime() const
The Time associated with the mesh.
UList< word > wordUList
A UList of words.
tmp< GeomField > getOrReadPointField(const word &name, bool mandatory=true, bool getOldTime=false)
Retrieve point field from memory or disk.
Base driver for parsing value expressions associated with an fvMesh.
bool isPointZone(const word &name) const
Test if name is a known pointZone.
virtual word timeName() const
The current time name.
bool searchInMemory() const
virtual void evaluateVariableRemote(string remote, const word &varName, const expressions::exprString &expr)
virtual label pointSize() const =0
The underlying point field size for the expression.
Mesh consisting of general polyhedral cells.
bool isGlobalVariable(const word &name, bool isPointVal, label expectedSize=-1) const
Test existence of a global variable.
virtual void prepareData(dictionary &dict) const
fvExprDriver(bool cacheReadFields=false, bool searchInMemory=true, bool searchFiles=false, const dictionary &dict=dictionary::null)
Null constructor, and null construct with search preferences.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
TypeName("fvExprDriver")
Runtime type information.
bool cacheReadFields() const
labelList getTopoSetLabels(const word &name, enum topoSetSource::sourceType setType) const
Read and return labels associated with the topo set.
word getTypeOfField(const word &fieldName) const
Read the IOobject for fieldName and return its headerClassName.
A polymorphic field/result from evaluating an expression.
virtual ~fvExprDriver()
Destructor.
virtual bool hasVariable(const word &name) const
True if named variable exists.
virtual const fvMesh & mesh() const =0
The mesh we are attached to.
tmp< GeomField > getOrReadField(const word &name, bool mandatory=true, bool getOldTime=false)
Retrieve field from memory or disk.
word name(const complex &c)
Return string representation of complex.
Ostream & writeCommon(Ostream &os, bool debug=false) const
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual scalar timeValue() const
The current time value.
static void correctField(T &)
Apply correctBoundaryConditions (volume fields only)
virtual void updateSpecialVariables(bool force=false)
Examine current variable values and update stored variables.
Base driver for parsing (field) values.
topoSetSource::sourceType topoSourceType(const word &name) const
Return cell/face/point zone/set type or unknown.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool isFaceZone(const word &name) const
Test if name is a known faceZone.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
tmp< GeomField > readAndRegister(const word &name, const MeshRef &meshRef)
Helper function for getOrReadField.
bool isPointSet(const word &name) const
Test if name is a known pointSet.
const exprResult & lookupGlobal(const word &name) const
Return the global variable if available or a null result.
Mesh data needed to do the Finite Volume discretisation.
virtual void evaluateVariable(const word &varName, const expressions::exprString &expr)
autoPtr< T > getTopoSet(const fvMesh &mesh, const word &setName, SetOrigin &origin) const
Get topoSet.
A HashTable similar to std::unordered_map.
void createWriterAndRead(const word &name)
Create a writer for this object.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
bool isCellZone(const word &name) const
Test if name is a known cellZone.
virtual exprResult & variable(const word &name)
Non-const access to the named variable (sub-classes only)
bool isFaceSet(const word &name) const
Test if name is a known faceSet.
const dictionary & dict() const
The dictionary with all input data/specification.
Macros to ease declaration of run-time selection tables.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
topoSetSource::sourceType topoSetType(const word &name) const
Return cell/face/point set type or unknown.
bool isField(const word &name, bool isPointVal=false, label expectSize=-1) const
Test for the existence of a mesh field.
topoSetSource::sourceType topoZoneType(const word &name) const
Return cell/face/point zone type or unknown.
declareRunTimeSelectionTable(autoPtr, fvExprDriver, dictionary,(const dictionary &dict, const fvMesh &mesh),(dict, mesh))
Registered input/output for an expressions::fvExprDriver.
bool updateSet(autoPtr< T > &setPtr, const word &setName, SetOrigin origin) const
Update topoSet.
virtual void getData(const dictionary &dict)
Read data from dictionary, normally via the reader/writer.
virtual void clearVariables()
Clear temporary variables and resets from expression strings.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static const fvMesh & regionMesh(const dictionary &dict, const fvMesh &mesh, bool readIfNecessary)
void setGlobalScopes(const wordUList &scopes)
Define scopes for global variables.
bool isVariableOrField(const word &name, bool isPointVal=false, label expectSize=-1) const
Test for existence of a local/global variable or a field.
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
SetOrigin
The origin of the topoSet.