Go to the documentation of this file.
41 typedef typename VolFieldType::Internal IntVolFieldType;
45 obr_.foundObject<VolFieldType>(fieldName)
46 || obr_.foundObject<IntVolFieldType>(fieldName)
60 const word& fieldName,
65 typedef typename VolFieldType::Internal IntVolFieldType;
67 if (obr_.foundObject<VolFieldType>(fieldName))
69 return filterField(obr_.lookupObject<VolFieldType>(fieldName));
71 else if (obr_.foundObject<IntVolFieldType>(fieldName))
73 return filterField(obr_.lookupObject<IntVolFieldType>(fieldName));
79 <<
"Field " << fieldName <<
" not found in database"
120 if (canWeight(weightField))
132 case opWeightedAverage:
134 if (canWeight(weightField))
148 case opWeightedVolAverage:
150 if (canWeight(weightField))
153 /(
gSum(weightField*V) + ROOTVSMALL);
163 case opWeightedVolIntegrate:
165 if (canWeight(weightField))
178 const scalar sumV =
gSum(V);
182 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
185 const scalar mean =
component(meanValue, d);
188 res =
sqrt(
gSum(V*
sqr(vals - mean))/sumV)/(mean + ROOTVSMALL);
204 const word& fieldName,
209 const bool ok = validField<Type>(fieldName);
218 combineFields(allValues);
220 if (Pstream::master())
222 word outName = fieldName +
'_' + regionTypeNames_[regionType_];
223 if (this->volRegion::regionName_ != polyMesh::defaultRegion)
225 outName = outName +
'-' + this->volRegion::regionName_;
233 obr_.time().timeName(),
238 scaleFactor_*weightField*allValues
243 if (operation_ != opNone)
248 Type result = processValues(
values, V, weightField);
250 switch (postOperation_)
255 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
271 if (postOperation_ != postOpNone)
274 prefix += postOperationTypeNames_[postOperation_];
279 prefix += operationTypeNames_[operation_];
285 if (this->volRegion::regionName_ != polyMesh::defaultRegion)
287 regionPrefix = this->volRegion::regionName_ +
',';
290 word resultName = prefix + regionPrefix + fieldName + suffix;
292 Log <<
" " << prefix << this->volRegion::regionName_ << suffix
293 <<
" of " << fieldName <<
" = ";
300 bool alwaysScalar(operation_ & typeScalar);
306 if (postOperation_ == postOpMag)
308 sresult =
mag(sresult);
311 else if (postOperation_ == postOpMag)
313 sresult =
mag(result);
320 file()<<
tab << sresult;
324 this->setResult(resultName, sresult);
328 file()<<
tab << result;
332 this->setResult(resultName, result);
348 if (volRegion::vrtAll == this->volRegion::regionType())
Defines the attributes of an object for which implicit objectRegistry management is supported,...
label & setComponent(label &l, const direction)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A class for handling words, derived from Foam::string.
A primitive field of type <T> with automated input and output.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Type processValues(const Field< Type > &values, const scalarField &V, const scalarField &weightField) const
Apply the 'operation' to the values.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
tmp< Field< Type > > getFieldValues(const word &fieldName, const bool mustGet=false) const
Insert field values into values list.
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
bool validField(const word &fieldName) const
Return true if the field name is valid.
Generic templated field type.
bool writeValues(const word &fieldName, const scalarField &V, const scalarField &weightField)
Templated helper function to output field values.
tmp< Field< Type > > filterField(const Field< Type > &field) const
Filter a field according to cellIds.
errorManip< error > abort(error &err)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Type gMin(const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)