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" 87 result =
gSum(values);
90 case operationType::weightedSum:
92 result =
gSum(weightField*values);
102 result =
gSum(values)/nCells();
105 case operationType::weightedAverage:
107 result =
gSum(weightField*values)/
max(
gSum(weightField), vSmall);
110 case operationType::volAverage:
112 result =
gSum(V*values)/this->V();
115 case operationType::weightedVolAverage:
118 gSum(weightField*V*values)/
max(
gSum(weightField*V), vSmall);
121 case operationType::volIntegrate:
123 result =
gSum(V*values);
126 case operationType::weightedVolIntegrate:
128 result =
gSum(weightField*V*values);
133 result =
gMin(values);
138 result =
gMax(values);
141 case operationType::CoV:
143 Type meanValue =
gSum(values*V)/this->V();
153 res =
sqrt(
gSum(V*
sqr(vals - mean))/this->V())/mean;
158 case operationType::none:
171 const word& fieldName
174 const bool ok = validField<Type>(fieldName);
178 Field<Type> values(setFieldValues<Type>(fieldName));
182 forAll(weightFieldNames_, i)
184 weightField *= setFieldValues<scalar>(weightFieldNames_[i],
true);
187 Type result = processValues(values, V, weightField);
189 if (Pstream::master())
192 resultDict_.add(fieldName, result,
true);
200 fieldName +
'_' + regionTypeNames_[regionType_]
201 +
'-' + volRegion::regionName_,
202 obr_.time().timeName(),
207 (weightField*values).ref()
214 Log <<
" " << operationTypeNames_[operation_]
215 <<
"(" << volRegion::regionName_ <<
") of " << fieldName
216 <<
" = " << result <<
endl;
#define forAll(list, i)
Loop across all elements in list.
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.
Type gMin(const FieldField< Field, Type > &f)
tmp< Field< Type > > setFieldValues(const word &fieldName, const bool mustGet=false) const
Insert field values into values list.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
Generic GeometricField class.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
Type gSum(const FieldField< Field, Type > &f)
Pre-declare SubField and related Field type.
bool validField(const word &fieldName) const
Return true if the field name is valid.
A class for handling words, derived from string.
tmp< Field< Type > > filterField(const Field< Type > &field) const
Filter a field according to cellIds.
Type processValues(const Field< Type > &values, const scalarField &V, const scalarField &weightField) const
Apply the 'operation' to the values.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManip< error > abort(error &err)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define Log
Report write to Foam::Info if the local log switch is true.
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
A class for managing temporary objects.
bool writeValues(const word &fieldName)
Templated helper function to output field values.
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.
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh > &df)