36 #define checkField(fld1, fld2, op) \ 37 if (&(fld1).mesh() != &(fld2).mesh()) \ 39 FatalErrorInFunction \ 40 << "Different mesh for fields " \ 41 << (fld1).name() << " and " << (fld2).name() \ 42 << " during operation " << op \ 43 << abort(FatalError); \ 49 template<
class Type,
class GeoMesh>
52 const label fieldSize = this->size();
55 const label meshSize = GeoMesh::size(this->mesh_);
56 if (fieldSize != meshSize)
59 <<
"size of field = " << fieldSize
60 <<
" is not the same as the size of mesh = " 70 template<
class Type,
class GeoMesh>
89 template<
class Type,
class GeoMesh>
107 template<
class Type,
class GeoMesh>
125 template<
class Type,
class GeoMesh>
135 Field<Type>(tfield.constCast(), tfield.movable()),
145 template<
class Type,
class GeoMesh>
151 const bool checkIOFlags
167 template<
class Type,
class GeoMesh>
173 const dimensionSet& dims,
174 const bool checkIOFlags
178 Field<Type>(GeoMesh::size(
mesh), value),
190 template<
class Type,
class GeoMesh>
195 const dimensioned<Type>& dt,
196 const bool checkIOFlags
199 DimensionedField<Type, GeoMesh>
210 template<
class Type,
class GeoMesh>
219 dimensions_(df.dimensions_),
220 oriented_(df.oriented_)
224 template<
class Type,
class GeoMesh>
234 template<
class Type,
class GeoMesh>
242 Field<Type>(df, reuse),
244 dimensions_(df.dimensions_),
245 oriented_(df.oriented_)
249 template<
class Type,
class GeoMesh>
261 template<
class Type,
class GeoMesh>
271 dimensions_(df.dimensions_),
272 oriented_(df.oriented_)
276 template<
class Type,
class GeoMesh>
287 template<
class Type,
class GeoMesh>
296 Field<Type>(df, reuse),
298 dimensions_(df.dimensions_),
299 oriented_(df.oriented_)
303 template<
class Type,
class GeoMesh>
316 template<
class Type,
class GeoMesh>
326 dimensions_(df.dimensions_),
327 oriented_(df.oriented_)
331 template<
class Type,
class GeoMesh>
342 template<
class Type,
class GeoMesh>
351 Field<Type>(df, reuse),
353 dimensions_(df.dimensions_),
354 oriented_(df.oriented_)
358 template<
class Type,
class GeoMesh>
371 template<
class Type,
class GeoMesh>
381 template<
class Type,
class GeoMesh>
407 template<
class Type,
class GeoMesh>
411 const DimensionedField
413 typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh
417 Field<Type>::replace(d, df);
421 template<
class Type,
class GeoMesh>
429 typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh
439 template<
class Type,
class GeoMesh>
456 template<
class Type,
class GeoMesh>
462 this->
name() +
".average()",
469 template<
class Type,
class GeoMesh>
478 this->
name() +
".weightedAverage(weights)",
485 template<
class Type,
class GeoMesh>
492 tweightField.clear();
499 template<
class Type,
class GeoMesh>
512 dimensions_ = df.dimensions();
513 oriented_ = df.oriented();
518 template<
class Type,
class GeoMesh>
524 auto& df = tdf.constCast();
533 dimensions_ = df.dimensions();
534 oriented_ = df.oriented();
540 template<
class Type,
class GeoMesh>
547 Field<Type>::operator=(dt.
value());
551 #define COMPUTED_ASSIGNMENT(TYPE, op) \ 553 template<class Type, class GeoMesh> \ 554 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 556 const DimensionedField<TYPE, GeoMesh>& df \ 559 checkField(*this, df, #op); \ 561 dimensions_ op df.dimensions(); \ 562 oriented_ op df.oriented(); \ 563 Field<Type>::operator op(df); \ 566 template<class Type, class GeoMesh> \ 567 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 569 const tmp<DimensionedField<TYPE, GeoMesh>>& tdf \ 572 operator op(tdf()); \ 576 template<class Type, class GeoMesh> \ 577 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 579 const dimensioned<TYPE>& dt \ 582 dimensions_ op dt.dimensions(); \ 583 Field<Type>::operator op(dt.value()); \ 591 #undef COMPUTED_ASSIGNMENT tmp< DimensionedField< Type, GeoMesh > > clone() const
Clone.
const Type & value() const noexcept
Return const reference to value.
dimensioned< Type > average() const
Calculate and return arithmetic average.
void replace(const direction d, const DimensionedField< cmptType, GeoMesh > &df)
Replace a component field of the field.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &field)
Construct from components, copy initial field content.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Generic dimensioned Type class.
Field< Type >::cmptType cmptType
Component type of the field elements.
tmp< DimensionedField< cmptType, GeoMesh > > component(const direction d) const
Return a component field of the field.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Generic templated field type.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
tmp< DimensionedField< Type, GeoMesh > > T() const
Return the field transpose (only defined for second rank tensors)
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
errorManip< error > abort(error &err)
#define COMPUTED_ASSIGNMENT(TYPE, op)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
#define checkField(fld1, fld2, op)
Type gAverage(const FieldField< Field, Type > &f)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
meshDefDict readIfPresent("polyMeshPatches", polyPatchNames)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh > &weightField) const
Calculate and return weighted average.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)