Go to the documentation of this file.
38 namespace functionObjects
56 { operationType::opNone,
"none" },
57 { operationType::opMin,
"min" },
58 { operationType::opMax,
"max" },
59 { operationType::opSum,
"sum" },
60 { operationType::opSumMag,
"sumMag" },
61 { operationType::opAverage,
"average" },
62 { operationType::opVolAverage,
"volAverage" },
63 { operationType::opVolIntegrate,
"volIntegrate" },
64 { operationType::opCoV,
"CoV" },
67 { operationType::opWeightedSum,
"weightedSum" },
68 { operationType::opWeightedAverage,
"weightedAverage" },
69 { operationType::opWeightedVolAverage,
"weightedVolAverage" },
70 { operationType::opWeightedVolIntegrate,
"weightedVolIntegrate" },
97 return (operation_ & typeWeighted);
119 weightFieldName_ =
"none";
122 if (
dict.readIfPresent(
"weightField", weightFieldName_))
124 Info<<
" weight field = " << weightFieldName_;
130 <<
"The '" << operationTypeNames_[operation_]
131 <<
"' operation is missing a weightField." <<
nl
132 <<
"Either provide the weightField, "
133 <<
"use weightField 'none' to suppress weighting," <<
nl
134 <<
"or use a different operation."
149 if (weightFieldName_ !=
"none")
151 writeHeaderValue(os,
"Weight field", weightFieldName_);
154 writeCommented(os,
"Time");
156 for (
const word& fieldName : fields_)
158 os <<
tab << operationTypeNames_[operation_]
159 <<
"(" << fieldName <<
")";
172 label nProcessed = 0;
174 for (
const word& fieldName : fields_)
178 writeValues<scalar>(fieldName, V, weightField)
179 || writeValues<vector>(fieldName, V, weightField)
180 || writeValues<sphericalTensor>(fieldName, V, weightField)
181 || writeValues<symmTensor>(fieldName, V, weightField)
182 || writeValues<tensor>(fieldName, V, weightField)
190 <<
"Requested field " << fieldName
191 <<
" not found in database and not processed"
211 operation_(operationTypeNames_.get(
"operation",
dict)),
212 weightFieldName_(
"none")
215 writeFileHeader(file());
228 operation_(operationTypeNames_.get(
"operation",
dict)),
229 weightFieldName_(
"none")
257 writeCurrentTime(file());
269 if (weightFieldName_ !=
"none")
271 weightField = getFieldValues<scalar>(weightFieldName_,
true);
274 writeAll(V, weightField);
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
addToRunTimeSelectionTable(functionObject, fieldValueDelta, dictionary)
A class for handling words, derived from Foam::string.
virtual bool read(const dictionary &dict)
Read from dictionary.
bool usesWeight() const
True if the operation variant uses a weight-field.
bool update()
Update the cached values as required.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Volume (cell) region selection class.
volFieldValue(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Weighted volume integral.
bool read(const char *buf, int32_t &val)
Same as readInt32.
defineTypeNameAndDebug(fieldValueDelta, 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool read(const dictionary &dict)
Read from dictionary.
Coefficient of variation.
operationType operation_
Operation to apply to values.
virtual bool write()
Calculate and write.
operationType
Operation type enumeration.
Registry of regIOobjects.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
virtual void writeFileHeader(Ostream &os) const
Output file header information.
static const Enum< operationType > operationTypeNames_
Operation type names.
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
Base class for field value-based function objects.
const fvMesh & mesh_
Reference to the fvMesh.
void writeFileHeader(const writeFile &wf, Ostream &file) const
Output file header information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool write()
Write.
bool canWeight(const scalarField &weightField) const
True if operation variant uses a weight-field that is available.
#define WarningInFunction
Report a warning using Foam::Warning.
label writeAll(const scalarField &V, const scalarField &weightField)
Helper function to output field values.
#define Log
Report write to Foam::Info if the local log switch is true.
bool usesVol() const
True if the operation needs the cell-volume.