38 #define checkField(df1, df2, op) \
39 if (&(df1).mesh() != &(df2).mesh()) \
41 FatalErrorInFunction \
42 << "different mesh for fields " \
43 << (df1).name() << " and " << (df2).name() \
44 << " during operatrion " << op \
45 << abort(FatalError); \
51 template<
class Type,
class GeoMesh>
69 <<
"size of field = " << field.
size()
70 <<
" is not the same as the size of mesh = "
71 << GeoMesh::size(
mesh)
77 template<
class Type,
class GeoMesh>
83 const bool checkIOFlags
99 template<
class Type,
class GeoMesh>
105 const bool checkIOFlags
121 template<
class Type,
class GeoMesh>
131 dimensions_(df.dimensions_)
135 template<
class Type,
class GeoMesh>
143 Field<Type>(df, reuse),
146 dimensions_(df.dimensions_)
150 template<
class Type,
class GeoMesh>
157 Field<Type>(move(df)),
160 dimensions_(move(df.dimensions_))
164 template<
class Type,
class GeoMesh>
178 dimensions_(tdf().dimensions_)
184 template<
class Type,
class GeoMesh>
189 const bool checkIOFlags
196 dimensions_(df.dimensions_)
198 if (!checkIOFlags || !readIfPresent())
200 copyOldTimes(io, df);
205 template<
class Type,
class GeoMesh>
211 const bool checkIOFlags
218 dimensions_(df.dimensions_)
227 template<
class Type,
class GeoMesh>
232 const bool checkIOFlags
243 dimensions_(tdf().dimensions_)
254 template<
class Type,
class GeoMesh>
265 dimensions_(df.dimensions_)
267 copyOldTimes(newName, df);
271 template<
class Type,
class GeoMesh>
280 Field<Type>(df, reuse),
283 dimensions_(df.dimensions_)
287 template<
class Type,
class GeoMesh>
302 dimensions_(tdf().dimensions_)
308 template<
class Type,
class GeoMesh>
319 template<
class Type,
class GeoMesh>
329 const bool cacheTmp = mesh.thisDb().cacheTemporaryObject(
name);
338 mesh.thisDb().time().name(),
353 template<
class Type,
class GeoMesh>
362 const bool cacheTmp = mesh.thisDb().cacheTemporaryObject(
name);
371 mesh.thisDb().time().name(),
386 template<
class Type,
class GeoMesh>
395 const bool cacheTmp = mesh.thisDb().cacheTemporaryObject(
name);
404 mesh.thisDb().time().name(),
419 template<
class Type,
class GeoMesh>
450 template<
class Type,
class GeoMesh>
458 const bool cacheTmp = tdf().db().cacheTemporaryObject(newName);
483 template<
class Type,
class GeoMesh>
486 db().cacheTemporaryObject(*
this);
492 template<
class Type,
class GeoMesh>
501 template<
class Type,
class GeoMesh>
528 template<
class Type,
class GeoMesh>
529 void DimensionedField<Type, GeoMesh>::replace
532 const DimensionedField
533 <
typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>& df
536 Field<Type>::replace(d, df);
540 template<
class Type,
class GeoMesh>
541 void DimensionedField<Type, GeoMesh>::replace
547 <
typename DimensionedField<Type, GeoMesh>::cmptType, GeoMesh>
556 template<
class Type,
class GeoMesh>
557 tmp<DimensionedField<Type, GeoMesh>>
576 template<
class Type,
class GeoMesh>
581 this->
name() +
".average()",
590 template<
class Type,
class GeoMesh>
600 this->
name() +
".weightedAverage(weights)",
602 gSum(weightField*primitiveField())/
gSum(weightField)
608 template<
class Type,
class GeoMesh>
615 tweightField.clear();
620 template<
class Type,
class GeoMesh>
630 <<
"attempted assignment to self"
641 template<
class Type,
class GeoMesh>
651 <<
"attempted assignment to self"
662 template<
class Type,
class GeoMesh>
672 <<
"attempted assignment to self"
683 template<
class Type,
class GeoMesh>
695 <<
"attempted assignment to self"
705 this->transfer(tdf.ref());
716 template<
class Type,
class GeoMesh>
727 template<
class Type,
class GeoMesh>
734 template<
class Type,
class GeoMesh>
746 <<
"attempted assignment to self"
756 this->transfer(tdf.ref());
767 template<
class Type,
class GeoMesh>
778 template<
class Type,
class GeoMesh>
785 #define COMPUTED_ASSIGNMENT(TYPE, op) \
787 template<class Type, class GeoMesh> \
788 void DimensionedField<Type, GeoMesh>::operator op \
790 const DimensionedField<TYPE, GeoMesh>& df \
793 checkField(*this, df, #op); \
795 dimensions_ op df.dimensions(); \
796 Field<Type>::operator op(df); \
799 template<class Type, class GeoMesh> \
800 void DimensionedField<Type, GeoMesh>::operator op \
802 const tmp<DimensionedField<TYPE, GeoMesh>>& tdf \
805 operator op(tdf()); \
809 template<class Type, class GeoMesh> \
810 void DimensionedField<Type, GeoMesh>::operator op \
812 const dimensioned<TYPE>& dt \
815 dimensions_ op dt.dimensions(); \
816 Field<Type>::operator op(dt.value()); \
824 #undef COMPUTED_ASSIGNMENT
#define checkField(df1, df2, op)
#define COMPUTED_ASSIGNMENT(TYPE, op)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< Type > & primitiveFieldRef()
Return a reference to the internal field.
GeoMesh::Mesh Mesh
Type of mesh on which this DimensionedField is instantiated.
const dimensionSet & dimensions() const
Return dimensions.
const Mesh & mesh() const
Return mesh.
Field< Type >::cmptType cmptType
Component type of the elements of the field.
DimensionedField(const IOobject &, const Mesh &mesh, const dimensionSet &, const Field< Type > &)
Construct from components.
Pre-declare SubField and related Field type.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const fileName & local() const
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
const objectRegistry & db() const
Return the local objectRegistry.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
Class to add into field types to provide old-time storage and retrieval.
Dimension set for the base types.
Generic dimensioned Type class.
const dimensionSet & dimensions() const
Return const reference to dimensions.
const Type & value() const
Return const reference to value.
bool cacheTemporaryObject(const word &name) const
Return true if given name is in the cacheTemporaryObjects set.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
tmp< VolField< Type > > average(const SurfaceField< Type > &ssf)
Area-weighted average a surfaceField creating a volField.
Type gSum(const FieldField< Field, Type > &f)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
word name(const bool)
Return a word representation of a bool.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
errorManip< error > abort(error &err)
Type gAverage(const FieldField< Field, Type > &f)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)