35 #define checkField(df1, df2, op) \ 36 if (&(df1).mesh() != &(df2).mesh()) \ 38 FatalErrorInFunction \ 39 << "different mesh for fields " \ 40 << (df1).name() << " and " << (df2).name() \ 41 << " during operation " << op \ 42 << abort(FatalError); \ 48 template<
class Type,
class GeoMesh>
51 const label fieldSize = this->size();
54 const label meshSize = GeoMesh::size(this->mesh_);
55 if (fieldSize != meshSize)
58 <<
"size of field = " << fieldSize
59 <<
" is not the same as the size of mesh = " 69 template<
class Type,
class GeoMesh>
88 template<
class Type,
class GeoMesh>
106 template<
class Type,
class GeoMesh>
124 template<
class Type,
class GeoMesh>
134 Field<Type>(tfield.constCast(), tfield.movable()),
144 template<
class Type,
class GeoMesh>
150 const bool checkIOFlags
166 template<
class Type,
class GeoMesh>
171 const dimensioned<Type>& dt,
172 const bool checkIOFlags
176 Field<Type>(GeoMesh::size(
mesh), dt.value()),
178 dimensions_(dt.dimensions()),
188 template<
class Type,
class GeoMesh>
191 const DimensionedField<Type, GeoMesh>& df
197 dimensions_(df.dimensions_),
198 oriented_(df.oriented_)
202 template<
class Type,
class GeoMesh>
212 template<
class Type,
class GeoMesh>
220 Field<Type>(df, reuse),
222 dimensions_(df.dimensions_),
223 oriented_(df.oriented_)
227 template<
class Type,
class GeoMesh>
239 template<
class Type,
class GeoMesh>
249 dimensions_(df.dimensions_),
250 oriented_(df.oriented_)
254 template<
class Type,
class GeoMesh>
265 template<
class Type,
class GeoMesh>
274 Field<Type>(df, reuse),
276 dimensions_(df.dimensions_),
277 oriented_(df.oriented_)
281 template<
class Type,
class GeoMesh>
294 template<
class Type,
class GeoMesh>
304 dimensions_(df.dimensions_),
305 oriented_(df.oriented_)
309 template<
class Type,
class GeoMesh>
320 template<
class Type,
class GeoMesh>
329 Field<Type>(df, reuse),
331 dimensions_(df.dimensions_),
332 oriented_(df.oriented_)
336 template<
class Type,
class GeoMesh>
349 template<
class Type,
class GeoMesh>
359 template<
class Type,
class GeoMesh>
372 auto tresult = tmp<DimensionedField<cmptType, GeoMesh>>
::New 390 template<
class Type,
class GeoMesh>
394 const DimensionedField
396 typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh
400 Field<Type>::replace(d, df);
404 template<
class Type,
class GeoMesh>
412 typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh
422 template<
class Type,
class GeoMesh>
444 template<
class Type,
class GeoMesh>
450 this->
name() +
".average()",
457 template<
class Type,
class GeoMesh>
466 this->
name() +
".weightedAverage(weights)",
473 template<
class Type,
class GeoMesh>
480 tweightField.clear();
487 template<
class Type,
class GeoMesh>
500 dimensions_ = df.dimensions();
501 oriented_ = df.oriented();
506 template<
class Type,
class GeoMesh>
512 auto& df = tdf.constCast();
521 dimensions_ = df.dimensions();
522 oriented_ = df.oriented();
528 template<
class Type,
class GeoMesh>
535 Field<Type>::operator=(dt.value());
539 #define COMPUTED_ASSIGNMENT(TYPE, op) \ 541 template<class Type, class GeoMesh> \ 542 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 544 const DimensionedField<TYPE, GeoMesh>& df \ 547 checkField(*this, df, #op); \ 549 dimensions_ op df.dimensions(); \ 550 oriented_ op df.oriented(); \ 551 Field<Type>::operator op(df); \ 554 template<class Type, class GeoMesh> \ 555 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 557 const tmp<DimensionedField<TYPE, GeoMesh>>& tdf \ 560 operator op(tdf()); \ 564 template<class Type, class GeoMesh> \ 565 void Foam::DimensionedField<Type, GeoMesh>::operator op \ 567 const dimensioned<TYPE>& dt \ 570 dimensions_ op dt.dimensions(); \ 571 Field<Type>::operator op(dt.value()); \ 579 #undef COMPUTED_ASSIGNMENT tmp< DimensionedField< Type, GeoMesh > > clone() const
Clone.
dimensioned< Type > average() const
Calculate and return arithmetic average.
#define checkField(df1, df2, op)
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.
Generic dimensioned Type class.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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...
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
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)
propsDict readIfPresent("fields", acceptFields)
errorManip< error > abort(error &err)
#define COMPUTED_ASSIGNMENT(TYPE, op)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
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...
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.
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)
const dimensionSet & dimensions() const noexcept
Return dimensions.