57#ifndef expressions_exprResult_H
58#define expressions_exprResult_H
115 singleValue(
const singleValue& val);
118 void operator=(
const singleValue& val);
122 inline const T&
get()
const
125 <<
"Not implemented for type "
133 inline const T& set(
const T& val)
136 <<
"Not implemented for type "
154 inline bool deleteChecked();
162 inline bool readChecked
165 const dictionary&
dict,
173 bool getUniformChecked
183 bool getUniformCheckedBool
198 bool setAverageValueCheckedBool(
const bool parRun =
Pstream::parRun());
203 bool duplicateFieldChecked(
const void* ptr);
208 bool writeSingleValueChecked(Ostream&
os)
const;
214 bool writeFieldChecked(
const word& keyword, Ostream&
os)
const;
219 bool writeEntryChecked(
const word& keyword, Ostream&
os)
const;
229 bool multiplyEqChecked(
const scalar&
b);
233 inline void setResultImpl(Field<Type>*,
bool wantPointData=
false);
236 inline void setResultImpl(
const Field<Type>&,
bool wantPointData=
false);
239 inline void setResultImpl(Field<Type>&&,
bool wantPointData=
false);
242 inline void setResultImpl(
const Type& val,
const label len);
245 inline void setSingleValueImpl(
const Type& val);
253 inline virtual expressions::exprResult&
target() {
return *
this; }
260 bool reset(
bool force=
false);
263 void needsReset(
bool val) { needsReset_ = val; }
284 const dictionary&
dict
314 const bool needsValue =
false
336 #undef exprResult_Construct
337 #define exprResult_Construct(Type) \
339 explicit exprResult(const Type& val) : exprResult() \
341 setSingleValue(val); \
351 #undef exprResult_Construct
385 inline
bool isPointData(const
bool wantPointData=true) const;
392 inline
bool isType() const;
404 inline label
size() const;
482 template<
template<
class>
class BinaryOp,
class Type>
485 const BinaryOp<Type>& bop,
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 templated field type.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Database for solution data, solver performance and other reduced data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Generic dimensioned Type class.
A globally available registry of expression results. These are currently registered on Time (may chan...
A polymorphic field/result from evaluating an expression.
Field< Type > & constCast() const
Return non-const reference to the field, casting away constness.
const word & valueType() const noexcept
Basic type for the field or single value.
exprResult(Istream &is)
Construct from Istream as dictionary content.
Type getReduced(const BinaryOp< Type > &bop, const Type &initial=pTraits< Type >::zero)
Get a reduced result.
void writeDict(Ostream &os, const bool subDict=true) const
Write entry as dictionary contents.
exprResult & operator+=(const exprResult &b)
Addition of results.
tmp< Field< Type > > getResult(bool cacheCopy=false)
exprResult getUniform(const label size, const bool noWarn, const bool parRun=Pstream::parRun()) const
Construct a uniform field from the current results.
static const exprResult null
An empty result.
virtual void resetImpl()
Reset at new timestep according to the derived class type.
virtual expressions::exprResult & target()
Simulate virtual templated methods.
label size() const
The field or object size.
bool isType() const
True if valueType corresponds to the given Type.
Field< Type > & ref()
Return non-const reference to the field.
declareRunTimeSelectionTable(autoPtr, exprResult, empty,(),())
void allowReset() noexcept
Change reset behaviour.
void testIfSingleValue(const bool parRun=Pstream::parRun())
Test if field corresponds to a single-value and thus uniform.
void writeValue(Ostream &os) const
Write the single value, or the first value from field.
void noReset() noexcept
Change reset behaviour.
bool is_bool() const
True if valueType is a bool.
void writeEntry(const word &keyword, Ostream &os) const
Forwarding to Field::writeEntry.
virtual autoPtr< exprResult > clone() const
Clone.
exprResult(autoPtr< Type > &&obj)
Construct for an IOobject.
const Field< Type > & cref() const
Return const reference to the field.
void setSingleValue(const Type &val)
Set single-value uniform result.
TypeName("exprResult")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, exprResult, dictionary,(const dictionary &dict),(dict))
virtual void operator=(const exprResult &rhs)
Copy assignment.
void needsReset(bool val)
Adjusts the internal needsReset value.
void setResult(Field< Type > *, bool wantPointData=false)
Set result field, taking ownership of the pointer.
exprResult()
Default construct.
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
void clear()
Clear (zero) the result.
friend class exprResultGlobals
Friendship with globals.
virtual ~exprResult()
Destructor.
bool isUniform() const
True if single, uniform value.
bool isPointData(const bool wantPointData=true) const
const void * dataAddress() const
The address of the field data content.
exprResult & operator*=(const scalar &b)
Scalar multiplication.
bool reset(bool force=false)
Reset at new timestep according to type.
bool hasValue() const
Has a value?
void writeField(Ostream &os, const word &keyword="") const
Write the field, optionally as an entry.
A traits class, which is primarily used for primitives.
Reference counter for various OpenFOAM components.
Tensor of scalars, i.e. Tensor<scalar>.
A class for managing temporary objects.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define exprResult_Construct(Type)
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Istream & operator>>(Istream &, directionInfo &)
constexpr char nl
The newline '\n' character (0x0a)
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)
A non-counting (dummy) refCount.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.