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 118 if (is_weightedOp() && canWeight(weightField))
130 case opWeightedAverage:
132 if (is_weightedOp() && canWeight(weightField))
146 case opWeightedVolAverage:
148 if (is_weightedOp() && canWeight(weightField))
151 /(
gSum(weightField*V) + ROOTVSMALL);
161 case opWeightedVolIntegrate:
163 if (is_weightedOp() && canWeight(weightField))
176 const scalar sumV =
gSum(V);
182 tmp<scalarField> vals(
values.component(d));
183 const scalar mean =
component(meanValue, d);
186 res =
sqrt(
gSum(V*
sqr(vals - mean))/sumV)/(mean + ROOTVSMALL);
202 const word& fieldName,
207 const bool ok = validField<Type>(fieldName);
215 word outName = fieldName +
'_' + regionTypeNames_[regionType_];
226 obr_.time().timeName(),
233 : scaleFactor_*weightField*
values 237 if (operation_ != opNone)
242 Type result = processValues(
values, V, weightField);
244 switch (postOperation_)
265 if (postOperation_ != postOpNone)
268 prefix += postOperationTypeNames_[postOperation_];
273 prefix += operationTypeNames_[operation_];
284 word resultName = prefix + regionPrefix + fieldName + suffix;
287 <<
" of " << fieldName <<
" = ";
294 bool alwaysScalar(operation_ & typeScalar);
300 if (postOperation_ == postOpMag)
302 sresult =
mag(sresult);
305 else if (postOperation_ == postOpMag)
307 sresult =
mag(result);
314 file()<<
tab << sresult;
318 this->setResult(resultName, sresult);
322 file()<<
tab << result;
326 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 List is empty (ie, size() is zero)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
constexpr char tab
The tab '\t' character(0x09)
Generic GeometricField class.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Ignore writing from objectRegistry::writeObject()
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)