Go to the documentation of this file.
41 typedef typename VolFieldType::Internal IntVolFieldType;
45 obr_.foundObject<VolFieldType>(fieldName)
46 || obr_.foundObject<IntVolFieldType>(fieldName)
55 const word& fieldName,
60 typedef typename VolFieldType::Internal IntVolFieldType;
62 if (obr_.foundObject<VolFieldType>(fieldName))
64 return filterField(obr_.lookupObject<VolFieldType>(fieldName));
66 else if (obr_.foundObject<IntVolFieldType>(fieldName))
68 return filterField(obr_.lookupObject<IntVolFieldType>(fieldName));
74 <<
"Field " << fieldName <<
" not found in database" <<
nl
115 if (is_weightedOp() && canWeight(weightField))
127 case opWeightedAverage:
129 if (is_weightedOp() && canWeight(weightField))
143 case opWeightedVolAverage:
145 if (is_weightedOp() && canWeight(weightField))
148 /(
gSum(weightField*V) + ROOTVSMALL);
158 case opWeightedVolIntegrate:
160 if (is_weightedOp() && canWeight(weightField))
173 const scalar sumV =
gSum(V);
177 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
180 const scalar mean =
component(meanValue, d);
183 res =
sqrt(
gSum(V*
sqr(vals - mean))/sumV)/(mean + ROOTVSMALL);
199 const word& fieldName,
204 const bool ok = validField<Type>(fieldName);
212 word outName = fieldName +
'_' + regionTypeNames_[regionType_];
213 if (this->volRegion::regionName_ != polyMesh::defaultRegion)
215 outName = outName +
'-' + this->volRegion::regionName_;
223 obr_.time().timeName(),
230 : scaleFactor_*weightField*
values
234 if (operation_ != opNone)
239 Type result = processValues(
values, V, weightField);
241 switch (postOperation_)
246 for (
direction d=0; d < pTraits<Type>::nComponents; ++d)
262 if (postOperation_ != postOpNone)
265 prefix += postOperationTypeNames_[postOperation_];
270 prefix += operationTypeNames_[operation_];
276 if (this->volRegion::regionName_ != polyMesh::defaultRegion)
278 regionPrefix = this->volRegion::regionName_ +
',';
281 word resultName = prefix + regionPrefix + fieldName + suffix;
283 Log <<
" " << prefix << this->volRegion::regionName_ << suffix
284 <<
" of " << fieldName <<
" = ";
291 bool alwaysScalar(operation_ & typeScalar);
297 if (postOperation_ == postOpMag)
299 sresult =
mag(sresult);
302 else if (postOperation_ == postOpMag)
304 sresult =
mag(result);
311 file()<<
tab << sresult;
315 this->setResult(resultName, sresult);
319 file()<<
tab << result;
323 this->setResult(resultName, result);
339 if (this->volRegion::useAllCells())
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)
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)
tmp< Field< Type > > getFieldValues(const word &fieldName, const bool mandatory=false) const
Insert field values into values list.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Type gMin(const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)