57 #ifndef Foam_expressions_exprResult_H 58 #define Foam_expressions_exprResult_H 115 singleValue(
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
172 bool getUniformChecked
182 bool getUniformCheckedBool
197 bool setAverageValueCheckedBool(
const bool parRun =
Pstream::parRun());
202 bool duplicateFieldChecked(
const void* ptr);
207 bool writeSingleValueChecked(Ostream&
os)
const;
213 bool writeFieldChecked(
const word& keyword, Ostream&
os)
const;
218 bool writeEntryChecked(
const word& keyword, Ostream&
os)
const;
228 bool multiplyEqChecked(
const scalar&
b);
232 inline void setResultImpl(Field<Type>*,
bool wantPointData=
false);
235 inline void setResultImpl(
const Field<Type>&,
bool wantPointData=
false);
238 inline void setResultImpl(Field<Type>&&,
bool wantPointData=
false);
241 inline void setResultImpl(
const Type& val,
const label len);
244 inline void setSingleValueImpl(
const Type& val);
252 inline virtual expressions::exprResult&
target() {
return *
this; }
259 bool reset(
bool force=
false);
262 void needsReset(
bool val) { needsReset_ = val; }
283 const dictionary&
dict 311 const dictionary&
dict,
312 const bool uniform =
false,
313 const bool needsValue =
false 333 explicit exprResult(
const dimensioned<Type>& dt);
335 #undef exprResult_Construct 336 #define exprResult_Construct(Type) \ 338 explicit exprResult(const Type& val) : exprResult() \ 340 setSingleValue(val); \ 350 #undef exprResult_Construct 356 static autoPtr<exprResult>
New(
const dictionary&
dict);
359 static autoPtr<exprResult>
New(Istream& is);
362 virtual autoPtr<exprResult>
clone()
const 384 inline
bool isPointData(const
bool wantPointData=true) const;
403 inline label
size() const;
481 template<
template<
class>
class BinaryOp,
class Type>
484 const BinaryOp<Type>& bop,
485 const Type& initial = pTraits<Type>::zero
bool hasValue() const
Has a value?
Type getReduced(const BinaryOp< Type > &bop, const Type &initial=pTraits< Type >::zero)
Get a reduced result.
bool is_bool() const
True if valueType is a bool.
void writeValue(Ostream &os) const
Write the single value, or the first value from field.
exprResult & operator+=(const exprResult &b)
Addition of results.
Field< Type > & ref()
Return non-const reference to the field.
void allowReset() noexcept
Change reset behaviour.
#define exprResult_Construct(Type)
bool isUniform() const
True if single, uniform value.
A polymorphic field/result from evaluating an expression.
tmp< Field< Type > > getResult(bool cacheCopy=false)
Return tmp field of the contents, optionally keeping a copy in cache.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
void clear()
Clear (zero) the result.
bool isType() const
True if valueType corresponds to the given Type.
A traits class, which is primarily used for primitives.
static bool & parRun() noexcept
Test if this a parallel run.
const word & valueType() const noexcept
Basic type for the field or single value.
virtual ~exprResult()
Destructor.
Field< Type > & constCast() const
Return non-const reference to the field, casting away constness.
const void * dataAddress() const
The address of the field data content.
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
const Field< Type > & cref() const
Return const reference to the field.
const dimensionedScalar e
Elementary charge.
void writeField(Ostream &os, const word &keyword="") const
Write the field, optionally as an entry.
Generic templated field type.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
A class for handling words, derived from Foam::string.
Istream & operator>>(Istream &, directionInfo &)
exprResult getUniform(const label size, const bool noWarn, const bool parRun=Pstream::parRun()) const
Construct a uniform field from the current results.
exprResult()
Default construct.
void testIfSingleValue(const bool parRun=Pstream::parRun())
Test if field corresponds to a single-value and thus uniform.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
Database for solution data, solver performance and other reduced data.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void needsReset(bool val)
Adjusts the internal needsReset value.
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))
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
label size() const
The field or object size.
TypeName("exprResult")
Runtime type information.
#define WarningInFunction
Report a warning using Foam::Warning.
bool reset(bool force=false)
Reset at new timestep according to type.
void setSingleValue(const Type &val)
Set single-value uniform result.
void setResult(Field< Type > *, bool wantPointData=false)
Set result field, taking ownership of the pointer.
exprResult & operator*=(const scalar &b)
Scalar multiplication.
virtual void operator=(const exprResult &rhs)
Copy assignment.
static const exprResult null
An empty result.
virtual autoPtr< exprResult > clone() const
Clone.
void writeEntry(const word &keyword, Ostream &os) const
Forwarding to Field::writeEntry.
virtual expressions::exprResult & target()
Simulate virtual templated methods.
bool isPointData(const bool wantPointData=true) const
True if representing point data, or test for same value as wantPointData argument.
Macros to ease declaration of run-time selection tables.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
declareRunTimeSelectionTable(autoPtr, exprResult, dictionary,(const dictionary &dict),(dict))
friend class exprResultGlobals
Friendship with globals.
A class for managing temporary objects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
void writeDict(Ostream &os, const bool subDict=true) const
Write entry as dictionary contents.
Type getValue() const
Return a single value when isUniform() is true, or Zero when it is non-uniform or if the type mismatc...
void noReset() noexcept
Change reset behaviour.
virtual void resetImpl()
Reset at new timestep according to the derived class type.