Go to the documentation of this file.
63 #ifndef expressions_fvExprDriver_H
64 #define expressions_fvExprDriver_H
82 class exprDriverWriter;
90 public expressions::exprDriver
95 static const fvMesh *defaultMeshPtr_;
98 static bool cacheSets_;
106 List<word> globalScopes_;
109 HashTable<exprResultDelayed> delayedVariables_;
112 List<exprResultStored> storedVariables_;
115 label specialVariablesIndex_;
121 autoPtr<exprDriverWriter> writer_;
127 static word getHeaderClassName
129 const polyMesh&
mesh,
134 static word getSetClassName
136 const polyMesh&
mesh,
173 return "zeroGradient";
184 GeometricField<Type, fvPatchField, volMesh>&
fld
187 fld.correctBoundaryConditions();
196 virtual const fvMesh&
mesh()
const = 0;
204 globalScopes_ = scopes;
215 const bool wantPointData =
false,
216 const label expectedSize = -1
230 const bool wantPointData =
false,
231 const label expectSize = -1
236 template<
class GeomField>
240 const bool mandatory =
true,
241 const bool getOldTime =
false
245 template<
class GeomField>
249 const bool mandatory =
true,
250 const bool getOldTime =
false
254 template<
class GeomField,
class MeshRef>
258 const MeshRef& meshRef,
259 const bool mandatory =
true,
260 const bool getOldTime =
false
264 template<
class GeomField,
class MeshRef>
268 const MeshRef& meshRef
281 const bool gaussian =
false
340 const bool force =
false
425 virtual label
size()
const = 0;
446 bool cacheSets()
const {
return cacheSets_; }
465 const bool wantPointData =
false,
466 const label expectSize = -1
479 const label expectSize,
480 const bool mandatory =
true
572 bool wantPointData =
false,
573 label expectSize = -1
int debug
Static debugging option.
bool cacheSets() const
Status of cache-sets (static variable)
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.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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)
tmp< GeomField > getOrReadField(const word &name, const bool mandatory=true, const bool getOldTime=false)
Retrieve field from memory or disk.
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 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.
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.
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.
bool isGlobalVariable(const word &name, const bool wantPointData=false, const label expectedSize=-1) const
Test existence of a global variable.
bool isVariable(const word &name, bool wantPointData=false, label expectSize=-1) const
Test existence of a local/global variable.
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< Field< Type > > getVariable(const word &name, const label expectSize, const bool mandatory=true) const
Retrieve local/global variable as a tmp field.
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))
tmp< GeomField > getOrReadFieldImpl(const word &name, const MeshRef &meshRef, const bool mandatory=true, const bool getOldTime=false)
Retrieve field from memory or disk (implementation)
tmp< GeomField > getOrReadPointField(const word &name, const bool mandatory=true, const bool getOldTime=false)
Retrieve point field from memory or disk.
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.
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.
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.
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.
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
SetOrigin
The origin of the topoSet.
bool isField(const word &name, const bool wantPointData=false, const label expectSize=-1) const
Test for the existence of a mesh field.