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>
391 template<
class Type,
class GeoMesh>
417 template<
class Type,
class GeoMesh>
421 const DimensionedField
423 typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh
427 Field<Type>::replace(d, df);
431 template<
class Type,
class GeoMesh>
439 typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh
449 template<
class Type,
class GeoMesh>
466 template<
class Type,
class GeoMesh>
472 this->
name() +
".average()",
479 template<
class Type,
class GeoMesh>
488 this->
name() +
".weightedAverage(weights)",
495 template<
class Type,
class GeoMesh>
502 tweightField.clear();
509 template<
class Type,
class GeoMesh>
522 dimensions_ = df.dimensions();
523 oriented_ = df.oriented();
528 template<
class Type,
class GeoMesh>
534 auto& df = tdf.constCast();
543 dimensions_ = df.dimensions();
544 oriented_ = df.oriented();
550 template<
class Type,
class GeoMesh>
557 Field<Type>::operator=(dt.
value());
561 #define COMPUTED_ASSIGNMENT(TYPE, op) \ 563 template<class Type, class GeoMesh> \ 564 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 566 const DimensionedField<TYPE, GeoMesh>& df \ 569 checkField(*this, df, #op); \ 571 dimensions_ op df.dimensions(); \ 572 oriented_ op df.oriented(); \ 573 Field<Type>::operator op(df); \ 576 template<class Type, class GeoMesh> \ 577 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 579 const tmp<DimensionedField<TYPE, GeoMesh>>& tdf \ 582 operator op(tdf()); \ 586 template<class Type, class GeoMesh> \ 587 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 589 const dimensioned<TYPE>& dt \ 592 dimensions_ op dt.dimensions(); \ 593 Field<Type>::operator op(dt.value()); \ 601 #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 expressions::valueTypeCode::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.
virtual ~DimensionedField()
Destructor.
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)