39 if (obr_.foundObject<vf>(fieldName))
52 const word& fieldName,
58 if (obr_.foundObject<vf>(fieldName))
60 return filterField(obr_.lookupObject<vf>(fieldName));
66 <<
"Field " << fieldName <<
" not found in database" 97 result =
sum(values)/values.
size();
100 case opWeightedAverage:
102 result =
sum(weightField*values)/
sum(weightField);
107 result =
sum(V*values)/
sum(V);
110 case opWeightedVolAverage:
112 result =
sum(weightField*V*values)/
sum(weightField*V);
117 result =
sum(V*values);
122 result =
min(values);
127 result =
max(values);
132 Type meanValue =
sum(values*V)/
sum(V);
160 const word& fieldName
163 const bool ok = validField<Type>(fieldName);
167 Field<Type> values(setFieldValues<Type>(fieldName));
171 if (weightFieldName_ !=
"none")
173 weightField = setFieldValues<scalar>(weightFieldName_,
true);
177 combineFields(values);
179 combineFields(weightField);
181 if (Pstream::master())
183 Type result = processValues(values, V, weightField);
186 resultDict_.add(fieldName, result,
true);
194 fieldName +
"_" + regionTypeNames_[regionType_] +
"-" 196 obr_.time().timeName(),
206 file()<<
tab << result;
208 Log <<
" " << operationTypeNames_[operation_]
209 <<
"(" << regionName_ <<
") of " << fieldName
210 <<
" = " << result <<
endl;
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< Field< Type > > filterField(const Field< Type > &field) const
Filter a field according to cellIds.
void size(const label)
Override size to be inconsistent with allocated storage.
bool writeValues(const word &fieldName)
Templated helper function to output field values.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
Generic GeometricField class.
bool validField(const word &fieldName) const
Return true if the field name is valid.
tmp< Field< Type > > setFieldValues(const word &fieldName, const bool mustGet=false) const
Insert field values into values list.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Pre-declare SubField and related Field type.
A class for handling words, derived from string.
errorManip< error > abort(error &err)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual bool write() const
Write using setting from DB.
#define Log
Report write to Foam::Info if the local log switch is true.
A class for managing temporary objects.
label & setComponent(label &l, const direction)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A primitive field of type <T> with automated input and output.
Type processValues(const Field< Type > &values, const scalarField &V, const scalarField &weightField) const
Apply the 'operation' to the values.