Go to the documentation of this file.
62 #ifndef expressions_fvExprDriver_H
63 #define expressions_fvExprDriver_H
81 class 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 GeometricField<Type, fvPatchField, volMesh>&
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
367 exprDriver::searchControls::DEFAULT_SEARCH,
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
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.
Registered input/output for an expressions::fvExprDriver.
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 natural field size for the expression.
bool isCellSet(const word &name) const
Test if name is a known cellSet.
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)
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.
refPtr< labelList > getTopoSetLabels(const word &name, enum topoSetSource::sourceType setType) const
Get the labels associated with the topo set.
virtual void evaluateVariableRemote(string remote, const word &varName, const expressions::exprString &expr)
virtual label pointSize() const =0
The point field size for the expression.
virtual autoPtr< fvExprDriver > clone()=delete
Not generally clonable.
Mesh consisting of general polyhedral cells.
virtual void prepareData(dictionary &dict) const
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.
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.
searchControls
Search/caching controls.
Ostream & writeCommon(Ostream &os, bool debug=false) const
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
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.
OBJstream os(runTime.globalPath()/outputName)
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 noexcept
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.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
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))
bool updateSet(autoPtr< T > &setPtr, const word &setName, SetOrigin origin) const
Update topoSet.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual void getData(const dictionary &dict)
Read data from dictionary, normally via the reader/writer.
virtual void clearVariables()
Clear temporary variables, reset 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.
fvExprDriver(enum exprDriver::searchControls search=exprDriver::searchControls::DEFAULT_SEARCH, const dictionary &dict=dictionary::null)
Default construct, and default construct with search preferences.
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.
A class for managing references or pointers (no reference counting)