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" },
113 if (weightFieldNames_.size())
123 writeCommented(
os,
"Time");
127 for (
const word& fieldName : fields_)
129 os <<
tab << operationTypeNames_[operation_]
130 <<
"(" << fieldName <<
")";
143 label nProcessed = 0;
145 for (
const word& fieldName : fields_)
149 writeValues<scalar>(fieldName, V, weightField)
150 || writeValues<vector>(fieldName, V, weightField)
151 || writeValues<sphericalTensor>(fieldName, V, weightField)
152 || writeValues<symmTensor>(fieldName, V, weightField)
153 || writeValues<tensor>(fieldName, V, weightField)
161 <<
"Requested field " << fieldName
162 <<
" not found in database and not processed" 182 operation_(operationTypeNames_.
get(
"operation",
dict)),
185 postOperationTypeNames_.getOrDefault
189 postOperationType::postOpNone,
196 writeFileHeader(file());
209 operation_(operationTypeNames_.
get(
"operation",
dict)),
212 postOperationTypeNames_.getOrDefault
216 postOperationType::postOpNone,
235 weightFieldNames_.clear();
242 if (
dict.readIfPresent(
"weightFields", weightFieldNames_))
248 weightFieldNames_.resize(1);
250 if (
dict.readIfPresent(
"weightField", weightFieldNames_.first()))
253 if (
"none" == weightFieldNames_.first())
256 weightFieldNames_.clear();
265 <<
"The '" << operationTypeNames_[operation_]
266 <<
"' operation is missing a weightField." <<
nl 267 <<
"Either provide the weightField, " 268 <<
"use weightField 'none' to suppress weighting," <<
nl 269 <<
"or use a different operation." 273 Info<<
" weight field = ";
274 if (weightFieldNames_.empty())
298 writeCurrentTime(file());
315 for (
const word& weightName : weightFieldNames_)
317 if (validField<scalar>(weightName))
319 tmp<scalarField> tfld = getFieldValues<scalar>(weightName,
true);
321 if (scalarWeights.empty())
323 scalarWeights = tfld;
327 scalarWeights *= tfld;
330 else if (weightName !=
"none")
338 <<
"weightField " << weightName
339 <<
" not found or an unsupported type" <<
nl 346 writeAll(V, scalarWeights);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
operationType operation_
Operation to apply to values.
Coefficient of variation.
static const Enum< operationType > operationTypeNames_
Operation type names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static const Enum< postOperationType > postOperationTypeNames_
Operation type names.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void writeFileHeader(const writeFile &wf, Ostream &file) const
Output file header information.
constexpr char nl
The newline '\n' character (0x0a)
virtual void writeFileHeader(Ostream &os) const
Output file header information.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool read(const dictionary &dict)
Read from dictionary.
Surround with '\0' and '\0' separate with ','.
volFieldValue(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
constexpr char tab
The tab '\t' character(0x09)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
const dictionary & dict() const noexcept
Return the reference to the construction dictionary.
bool read(const char *buf, int32_t &val)
Same as readInt32.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
addToRunTimeSelectionTable(fieldValue, surfaceFieldValue, runTime)
Weighted volume integral.
virtual bool read(const dictionary &dict)
Read from dictionary.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Volume (cell) region selection class.
OBJstream os(runTime.globalPath()/outputName)
postOperationType
Post-operation type enumeration.
label writeAll(const scalarField &V, const scalarField &weightField)
Helper function to output field values.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool update()
Update the cached values as required.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
operationType
Operation type enumeration.
messageStream Info
Information stream (stdout output on master, null elsewhere)
defineTypeNameAndDebug(surfaceFieldValue, 0)
Intermediate class for handling field value-based function objects.
Registry of regIOobjects.
virtual bool write()
Calculate and write.
const fvMesh & mesh_
Reference to the fvMesh.
bool usesVol() const noexcept
True if the operation needs the cell-volume.
virtual bool write()
Write.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...