41 typedef typename VolFieldType::Internal IntVolFieldType;
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)
179 tmp<scalarField> vals(
values.component(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_];
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_];
281 word resultName = prefix + regionPrefix + fieldName + 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);
bool writeValues(const word &fieldName, const scalarField &V, const scalarField &weightField)
Templated helper function to output field values.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char tab
The tab '\t' character(0x09)
Generic GeometricField class.
Ignore writing from objectRegistry::writeObject()
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
tmp< Field< Type > > getFieldValues(const word &fieldName, const bool mandatory=false) const
Insert field values into values list.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
bool useAllCells() const noexcept
Use all cells, not the cellIDs.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Type gSum(const FieldField< Field, Type > &f)
Generic templated field type.
bool validField(const word &fieldName) const
Return true if the field name is valid.
A class for handling words, derived from Foam::string.
static word defaultRegion
Return the default region name.
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.
errorManip< error > abort(error &err)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)
wordRe regionName_
Region name (cellSet, cellZone, ...)
const objectRegistry & obr_
Reference to the region objectRegistry.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
A class for managing temporary objects.
label & setComponent(label &val, const direction) noexcept
Non-const access to integer-type (has no components)
Defines the attributes of an object for which implicit objectRegistry management is supported...
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.
static constexpr const zero Zero
Global zero (0)