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
129 <<
"Not implemented for type "
137 inline const T&
set(
const T& val)
140 <<
"Not implemented for type "
153 autoPtr<regIOobject> objectPtr_;
161 inline bool deleteChecked();
169 inline bool readChecked
172 const dictionary&
dict,
180 bool getUniformChecked
190 bool getUniformCheckedBool
205 bool setAverageValueCheckedBool(
const bool parRun =
Pstream::parRun());
210 bool duplicateFieldChecked(
const void* ptr);
215 bool writeSingleValueChecked(Ostream& os)
const;
220 bool writeValueFieldChecked(Ostream& os)
const;
225 bool writeEntryChecked(
const word& keyword, Ostream& os)
const;
235 bool multiplyEqChecked(
const scalar&
b);
239 inline void setResultImpl(Field<Type>*,
bool wantPointData=
false);
242 inline void setResultImpl(
const Field<Type>&,
bool wantPointData=
false);
245 inline void setResultImpl(Field<Type>&&,
bool wantPointData=
false);
248 inline void setResultImpl(
const Type& val,
const label len);
251 inline void setSingleValueImpl(
const Type& val);
254 inline void setObjectResultImpl(Type* ptr);
262 inline virtual expressions::exprResult&
target() {
return *
this; }
269 bool reset(
bool force=
false);
272 void needsReset(
bool val) { needsReset_ = val; }
293 const dictionary&
dict
323 const bool needsValue =
false
342 #undef exprResult_Construct
343 #define exprResult_Construct(Type) \
345 explicit exprResult(const Type& val) : exprResult() \
347 setSingleValue(val); \
357 #undef exprResult_Construct
388 inline bool isPointData(
const bool wantPointData=
true)
const;
395 inline bool isType()
const;
410 inline label
size()
const;
424 void noReset() { noReset_ =
true; }
497 template<
template<
class>
class BinaryOp,
class Type>
500 const BinaryOp<Type>& bop,
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
bool isObject() const
True if the object pointer is being used.
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
void writeDict(Ostream &os, const bool subDict=true) const
Write entry as dictionary contents.
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.
bool isPointData(const bool wantPointData=true) const
void testIfSingleValue(const bool parRun=Pstream::parRun())
Test if field corresponds to a single-value and thus uniform.
TypeName("exprResult")
Runtime type information.
const word & valueType() const
Basic type for the field or single value.
tmp< Field< Type > > getResult(bool cacheCopy=false)
static bool & parRun()
Test if this a parallel run, or allow modify access.
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 setObjectResult(autoPtr< Type > &&obj)
Set result object.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
void noReset()
Change reset behaviour.
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, i.e. SymmTensor<scalar>.
A globally available registry of expression results. These are currently registered on Time (may chan...
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()
Default construct.
void clear()
Clear (zero) the result.
Macros to ease declaration of run-time selection tables.
void allowReset()
Change reset behaviour.
virtual expressions::exprResult & target()
Simulate virtual templated methods.
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define exprResult_Construct(Type)
void setResult(Field< Type > *, bool wantPointData=false)
Set result field, taking ownership of the pointer.
virtual autoPtr< exprResult > clone() const
Clone.
#define WarningInFunction
Report a warning using Foam::Warning.
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Database for solution data, solver performance and other reduced data.
const void * dataAddress() const
The address of the field data content.