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" },
79 { postOperationType::postOpNone,
"none" },
80 { postOperationType::postOpMag,
"mag" },
81 { postOperationType::postOpSqrt,
"sqrt" },
108 return (operation_ & typeAbsolute);
115 return (operation_ & typeWeighted);
138 if (weightFieldName_ !=
"none")
140 writeHeaderValue(os,
"Weight field", weightFieldName_);
143 writeCommented(os,
"Time");
147 for (
const word& fieldName : fields_)
149 os <<
tab << operationTypeNames_[operation_]
150 <<
"(" << fieldName <<
")";
163 label nProcessed = 0;
165 for (
const word& fieldName : fields_)
169 writeValues<scalar>(fieldName, V, weightField)
170 || writeValues<vector>(fieldName, V, weightField)
171 || writeValues<sphericalTensor>(fieldName, V, weightField)
172 || writeValues<symmTensor>(fieldName, V, weightField)
173 || writeValues<tensor>(fieldName, V, weightField)
181 <<
"Requested field " << fieldName
182 <<
" not found in database and not processed"
202 operation_(operationTypeNames_.get(
"operation",
dict)),
205 postOperationTypeNames_.getOrDefault
209 postOperationType::postOpNone,
213 weightFieldName_(
"none")
216 writeFileHeader(file());
229 operation_(operationTypeNames_.get(
"operation",
dict)),
232 postOperationTypeNames_.getOrDefault
236 postOperationType::postOpNone,
240 weightFieldName_(
"none")
255 weightFieldName_ =
"none";
259 if (
dict.readIfPresent(
"weightField", weightFieldName_))
261 Info<<
" weight field = " << weightFieldName_;
267 <<
"The '" << operationTypeNames_[operation_]
268 <<
"' operation is missing a weightField." <<
nl
269 <<
"Either provide the weightField, "
270 <<
"use weightField 'none' to suppress weighting," <<
nl
271 <<
"or use a different operation."
290 writeCurrentTime(file());
302 if (weightFieldName_ !=
"none")
304 weightField = getFieldValues<scalar>(weightFieldName_,
true);
307 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.
postOperationType
Post-operation type enumeration.
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.
static const Enum< postOperationType > postOperationTypeNames_
Operation type names.
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.
bool usesMag() const
True if the operation variant uses mag.
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.
Intermediate class for handling 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.
bool usesVol() const
True if the operation needs the cell-volume.