71 <<
"Field " << fieldName <<
" not found in database"
82 const scalar emptyVal,
93 if (op(values[j], values[i]))
99 result.
value = values[i];
100 result.
celli = zone_.celli(i);
105 result.
value = emptyVal;
115 return op(a.
value,
b.value) ? a :
b;
121 template<
class Type,
class ResultType>
143 return processValuesTypeType(values, weights, V, result);
158 case operationType::minMag:
163 case operationType::maxMag:
202 case operationType::volAverage:
207 case operationType::volIntegrate:
222 case operationType::CoV:
224 const scalar sumWeightsV =
max(
gSum(weights*V), vSmall);
226 const Type meanValue =
gSum(weights*V*values)/sumWeightsV;
233 const scalar mean =
component(meanValue, d);
238 sqrt(
gSum(weights*V*
sqr(vals - mean))/sumWeightsV),
245 case operationType::UI:
247 const scalar sumWeightsV =
max(
gSum(weights*V), vSmall);
249 const Type meanValue =
gSum(weights*V*values)/sumWeightsV;
256 const scalar mean =
component(meanValue, d);
261 gSum(weights*V*
mag(vals - mean))/sumWeightsV,
285 const word& fieldName,
290 const bool ok = validField<Type>(fieldName);
295 Field<Type> values(getFieldValues<Type>(fieldName));
304 fieldName +
'_' + zone_.name(),
310 (weights*values).ref()
318 values *= scaleFactor_;
322 #define writeValuesFieldType(fieldType, none) \
325 || writeValues<Type, fieldType> \
333 #undef writeValuesFieldType
338 <<
"Operation " << operationTypeNames_[operation_]
339 <<
" not available for values of type "
350 template<
class Type,
class ResultType>
353 const word& fieldName,
361 if (processValues(values, weights, V, result))
364 resultDict_.add(fieldName, result.value,
true);
370 Log <<
" " << operationTypeNames_[operation_]
371 <<
"(" << zone_.name() <<
") of " << fieldName
372 <<
" = " << result.value;
374 if (result.celli != -1)
376 Log <<
" at location " << result.cc;
377 if (writeLocation_)
file() <<
tab << result.cc;
380 if (result.celli != -1)
382 Log <<
" in cell " << result.celli;
383 if (writeLocation_)
file() <<
tab << result.celli;
386 if (result.proci != -1)
388 Log <<
" on processor " << result.proci;
389 if (writeLocation_)
file() <<
tab << result.proci;
#define forAll(list, i)
Loop across all elements in list.
Generic GeometricField class.
A primitive field of type <Type> with automated input and output.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void size(const label)
Override size to be inconsistent with allocated storage.
static bool master(const label communicator=0)
Am I the master process.
static bool & parRun()
Is this a parallel run?
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
bool writeValues(const word &fieldName, const scalarField &weights, const scalarField &V)
Templated helper function to output field values.
bool processValuesTypeType(const Field< Type > &values, const scalarField &weights, const scalarField &V, Result< Type > &result) const
Apply a Type -> Type operation to the values.
tmp< Field< Type > > getFieldValues(const word &fieldName) const
Insert field values into values list.
tmp< Field< Type > > filterField(const Field< Type > &field) const
Filter a field according to cellIds.
bool validField(const word &fieldName) const
Return true if the field name is valid.
bool processValues(const Field< Type > &values, const scalarField &weights, const scalarField &V, Result< ResultType > &result) const
Apply the operation to the values, and return true if successful.
void compareScalars(const scalarField &values, const scalar emptyVal, Result< scalar > &result, const Op &op) const
Apply a comparison operation to the values, returning the limiting.
const fvMesh & mesh_
Reference to the fvMesh.
const objectRegistry & obr_
Reference to the objectRegistry.
const volVectorField & C() const
Return cell centres.
bool foundObject(const word &name) const
Is the named Type in registry.
Traits class for primitives.
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for managing temporary objects.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define Log
Report write to Foam::Info if the local log switch is true.
Type gMin(const UList< Type > &f, const label comm)
Scalar protectedDivide(const Scalar a, const Scalar b)
Divide two numbers and protect the result from overflowing.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label & setComponent(label &l, const direction)
errorManip< error > abort(error &err)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
dimensioned< scalar > sumMag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Type gSum(const UList< Type > &f, const label comm)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
typename VolField< Type >::Internal VolInternalField
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Type gMax(const UList< Type > &f, const label comm)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< Type, GeoMesh, Field > > cmptMag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Forward declare the result structure.
#define writeValuesFieldType(fieldType, none)