Go to the documentation of this file.
57 #ifndef expressions_exprResult_H
58 #define expressions_exprResult_H
119 singleValue(
const singleValue&
val);
126 inline const T& get()
const
135 inline const T& set(
const T&
val)
150 autoPtr<regIOobject> objectPtr_;
158 inline bool deleteChecked();
166 inline bool readChecked
169 const dictionary&
dict,
177 bool getUniformChecked
187 bool getUniformCheckedBool
202 bool setAverageValueCheckedBool(
const bool parRun =
Pstream::parRun());
207 bool duplicateFieldChecked(
const void* ptr);
212 bool writeSingleValueChecked(Ostream& os)
const;
217 bool writeValueFieldChecked(Ostream& os)
const;
222 bool writeEntryChecked(
const word& keyword, Ostream& os)
const;
232 bool multiplyEqChecked(
const scalar&
b);
236 inline void setResultImpl(Field<Type>*,
bool isPointVal=
false);
239 inline void setResultImpl(
const Field<Type>&,
bool isPointVal=
false);
242 inline void setResultImpl(Field<Type>&&,
bool isPointVal=
false);
245 inline void setResultImpl(
const Type&
val,
const label len);
248 inline void setSingleValueImpl(
const Type&
val);
251 inline void setObjectResultImpl(Type* ptr);
254 inline void setObjectResultImpl(autoPtr<Type>& ap);
257 inline void setObjectResultImpl(autoPtr<Type>&& ap);
272 bool reset(
bool force=
false);
296 const dictionary&
dict
326 const bool needsValue =
false
349 #undef exprResult_Construct
350 #define exprResult_Construct(Type) \
352 explicit exprResult(const Type& val) : exprResult() \
354 setSingleValue(val); \
364 #undef exprResult_Construct
394 inline bool isPointValue(
const bool isPointVal =
true)
const;
401 inline bool isType()
const;
404 inline bool isBool()
const;
424 void noReset() { noReset_ =
true; }
499 template<
template<
class>
class BinaryOp,
class Type>
502 const BinaryOp<Type>& bop,
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
label ListType::const_reference val
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars.
bool isObject() const
True if the object pointer is being used.
void writeDict(Ostream &os, const bool subDict=true) const
Write entry as dictionary contents.
virtual exprResult & target()
Simulate virtual templated methods.
A class for handling words, derived from Foam::string.
label size() const
The field or object size.
Type getReduced(const BinaryOp< Type > &bop, const Type &initial=pTraits< Type >::zero)
Get a reduced result.
A class for managing temporary objects.
Reference counter for various OpenFOAM components.
void testIfSingleValue(const bool parRun=Pstream::parRun())
Test if field corresponds to a single-value and thus uniform.
TypeName("exprResult")
Runtime type information.
Tensor< scalar > tensor
Tensor of scalars.
const word & valueType() const
Basic type for the field or single value.
tmp< Field< Type > > getResult(bool cacheCopy=false)
static bool & parRun()
Is this a parallel run?
void setResult(Field< Type > *, bool isPointVal=false)
Set result field, taking ownership of the pointer.
Istream & operator>>(Istream &, directionInfo &)
bool isBool() const
True if valueType is a bool.
virtual void operator=(const exprResult &rhs)
Copy assignment.
bool reset(bool force=false)
Reset at new timestep according to type.
exprResult & operator+=(const exprResult &b)
Addition of results.
void noReset()
Change reset behaviour.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A polymorphic field/result from evaluating an expression.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Generic templated field type.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
Field< Type > & ref()
Return non-const reference to the field.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void writeValue(Ostream &os) const
Write the single value, or the first value from field.
void setSingleValue(const Type &val)
Set single-value uniform result.
SymmTensor< scalar > symmTensor
SymmTensor of scalars.
A globally available registry of expression results.
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< Type > getObjectResult(bool cacheCopy=false)
bool hasValue() const
Has a value?
bool isUniform() const
True if single, uniform value.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual void resetImpl()
Reset at new timestep according to the derived class type.
void needsReset(bool val)
Adjusts the internal needsReset value.
Generic dimensioned Type class.
friend class exprResultGlobals
Friendship with globals.
const Field< Type > & cref() const
Return const reference to the field.
bool isType() const
True if valueType corresponds to the given Type.
Vector< scalar > vector
A scalar version of the templated Vector.
Field< Type > & getRef() const
Return non-const reference to the field, casting away constness.
exprResult getUniform(const label size, const bool noWarn, const bool parRun=Pstream::parRun()) const
Construct a uniform field from the current results.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
declareRunTimeSelectionTable(autoPtr, exprResult, dictionary,(const dictionary &dict),(dict))
exprResult()
Construct null.
void clear()
Clear (zero) the result.
Macros to ease declaration of run-time selection tables.
void allowReset()
Change reset behaviour.
Traits class for primitives.
void writeEntry(const word &keyword, Ostream &os) const
Forwarding to Field::writeEntry.
virtual ~exprResult()
Destructor.
exprResult & operator*=(const scalar &b)
Scalar multiplication.
bool isPointValue(const bool isPointVal=true) const
True if representing point values, or test if same as isPointVal.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define exprResult_Construct(Type)
virtual autoPtr< exprResult > clone() const
Clone.
#define WarningInFunction
Report a warning using Foam::Warning.
void setObjectResult(autoPtr< Type > &o)
Database for solution data, solver performance and other reduced data.
Ostream & operator<<(Ostream &, const boundaryPatch &)
const void * dataAddress() const
The address of the field data content.