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
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 367 exprDriver::searchControls::DEFAULT_SEARCH,
414 virtual label
size()
const = 0;
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
void setGlobalScopes(const wordUList &scopes)
Define scopes for global variables.
word getFieldClassName(const word &name) const
Lookup the field class name (memory or read from disk)
virtual void prepareData(dictionary &dict) const
Prepare/update special variables and add to dictionary, normally via the reader/writer.
fvExprDriver(enum exprDriver::searchControls search=exprDriver::searchControls::DEFAULT_SEARCH, const dictionary &dict=dictionary::null)
Default construct, and default construct with search preferences.
SetOrigin
The origin of the topoSet.
bool updateSet(autoPtr< T > &setPtr, const word &setName, SetOrigin origin) const
Update topoSet.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
refPtr< labelList > getTopoSetLabels(const word &name, enum topoSetSource::sourceType setType) const
Get the labels associated with the topo set.
A polymorphic field/result from evaluating an expression.
bool cacheSets() const
Status of cache-sets (static variable)
virtual autoPtr< fvExprDriver > clone()=delete
Not generally clonable.
static const fvMesh & regionMesh(const dictionary &dict, const fvMesh &mesh, bool readIfNecessary)
Determine mesh or region mesh as specified in the dictionary with the keyword "region".
static word defaultBoundaryType(const T &)
Default boundary type is calculated.
UList< word > wordUList
UList of word.
word getTypeOfField(const word &fieldName) const
Read the IOobject for fieldName and return its headerClassName.
virtual const fvMesh & mesh() const =0
The mesh we are attached to.
virtual ~fvExprDriver()
Destructor.
virtual bool hasVariable(const word &name) const
True if named variable exists.
bool isField(const word &name, const bool wantPointData=false, const label expectSize=-1) const
Test for the existence of a mesh field.
static void correctField(T &)
Apply correctBoundaryConditions (volume fields only)
Generic GeometricField class.
static autoPtr< fvExprDriver > New(const dictionary &dict, const fvMesh &mesh)
Return a reference to the selected value driver.
topoSetSource::sourceType topoSourceType(const word &name) const
Return cell/face/point zone/set type or unknown.
Base driver for parsing value expressions associated with an fvMesh.
A class for managing references or pointers (no reference counting)
virtual label size() const =0
The natural field size for the expression.
tmp< GeomField > readAndRegister(const word &name, const MeshRef &meshRef)
Helper function for getOrReadField.
virtual void updateSpecialVariables(bool force=false)
Examine current variable values and update stored variables.
searchControls
Search/caching controls.
virtual bool hasDataToWrite() const
Do we need a data file to be written.
autoPtr< T > getTopoSet(const fvMesh &mesh, const word &setName, SetOrigin &origin) const
Get topoSet.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static const fvMesh & defaultMesh()
Get the default mesh, if one is defined.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
bool isFaceSet(const word &name) const
Test if name is a known faceSet.
virtual label pointSize() const =0
The point field size for the expression.
A class for handling words, derived from Foam::string.
void tryWrite() const
Write data if appropriate Should enable exact restarts.
virtual void evaluateVariable(const word &varName, const expressions::exprString &expr)
Evaluate the expression and save as the specified named variable.
bool isGlobalVariable(const word &name, const bool wantPointData=false, const label expectedSize=-1) const
Test existence of a global variable.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Registered input/output for an expressions::fvExprDriver.
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)
virtual void evaluateVariableRemote(string remote, const word &varName, const expressions::exprString &expr)
Evaluate an expression on a remote and save as the specified named variable.
tmp< Field< Type > > getVariable(const word &name, const label expectSize, const bool mandatory=true) const
Retrieve local/global variable as a tmp field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
topoSetSource::sourceType topoSetType(const word &name) const
Return cell/face/point set type or unknown.
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
bool isVariable(const word &name, bool wantPointData=false, label expectSize=-1) const
Test existence of a local/global variable.
TypeName("fvExprDriver")
Runtime type information.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
topoSetSource::sourceType topoZoneType(const word &name) const
Return cell/face/point zone type or unknown.
tmp< GeomField > getOrReadFieldImpl(const word &name, const MeshRef &meshRef, const bool mandatory=true, const bool getOldTime=false)
Retrieve field from memory or disk (implementation)
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))
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.
bool isPointSet(const word &name) const
Test if name is a known pointSet.
bool isFaceZone(const word &name) const
Test if name is a known faceZone.
Ostream & writeCommon(Ostream &os, bool debug=false) const
Write "variables", "storedVariables", "delayedVariables", "globalScopes" if they are present...
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
sourceType
Enumeration defining the types of sources.
Mesh data needed to do the Finite Volume discretisation.
tmp< GeomField > getOrReadPointField(const word &name, const bool mandatory=true, const bool getOldTime=false)
Retrieve point field from memory or disk.
const dictionary & dict() const noexcept
The dictionary with all input data/specification.
static const fvMesh * resetDefaultMesh(const fvMesh &mesh, const bool force=false)
Set the default mesh (if not already set)
const exprResult & lookupGlobal(const word &name) const
Return the global variable if available or a null result.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
void createWriterAndRead(const word &name)
Create a writer for this object.
Mesh consisting of general polyhedral cells.
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
bool isCellSet(const word &name) const
Test if name is a known cellSet.
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 foundField(const word &name) const
Test if specified field can be found in memory or disk.
tmp< GeomField > getOrReadField(const word &name, const bool mandatory=true, const bool getOldTime=false)
Retrieve field from memory or disk.
declareRunTimeSelectionTable(autoPtr, fvExprDriver, dictionary,(const dictionary &dict, const fvMesh &mesh),(dict, mesh))
bool isPointZone(const word &name) const
Test if name is a known pointZone.