39 namespace functionObjects
94 void Foam::functionObjects::fieldValues::volFieldValue::
95 writeFileHeaderLocation<Foam::scalar>()
101 case operationType::minMag:
102 case operationType::maxMag:
103 file() <<
tab <<
"location" <<
tab <<
"cell";
106 file() <<
tab <<
"processor";
122 zone_.writeFileHeader(*
this,
file());
124 writeCommented(
file(),
"Time");
126 if (writeNCells_)
file() <<
tab <<
"Cells";
127 if (writeVolume_)
file() <<
tab <<
"Volume";
131 file() <<
tab << operationTypeNames_[operation_] <<
"(";
133 forAll(weightFieldNames_, i)
135 file() << weightFieldNames_[i] <<
',';
138 file() << fields_[fieldi] <<
")";
142 #define writeFileHeaderLocationFieldType(fieldType, none) \
143 if (validField<fieldType>(fields_[fieldi])) \
145 writeFileHeaderLocation<fieldType>(); \
148 #undef writeHeaderLocationFieldType
172 case operationType::minMag:
182 case operationType::maxMag:
190 return processValuesTypeType(values, weights, V, result);
209 writeNCells_(
dict.lookupOrDefault(
"writeNumberOfCells", false)),
210 writeVolume_(
dict.lookupOrDefault(
"writeVolume", false)),
211 writeLocation_(
dict.lookupOrDefault(
"writeLocation", false))
228 writeNCells_(
dict.lookupOrDefault(
"writeNumberOfCells", false)),
229 writeVolume_(
dict.lookupOrDefault(
"writeVolume", false)),
230 writeLocation_(
dict.lookupOrDefault(
"writeLocation", false))
251 if (
dict.found(
"weightFields"))
253 dict.lookup(
"weightFields") >> weightFieldNames_;
255 else if (
dict.found(
"weightField"))
257 weightFieldNames_.setSize(1);
259 dict.lookup(
"weightField") >> weightFieldNames_[0];
262 dict.readIfPresent(
"scaleFactor", scaleFactor_);
265 Info<<
indent <<
"number of cells = " << zone_.nGlobalCells() <<
nl;
266 if (zone_.nGlobalCells())
270 Info<<
indent <<
"operation = " << operationTypeNames_[operation_] <<
nl;
271 if (weightFieldNames_.size() == 1)
273 Info<<
indent <<
"weight field = " << weightFieldNames_[0] <<
nl;
275 if (weightFieldNames_.size() > 1)
278 forAll(weightFieldNames_, i)
Info<<
' ' << weightFieldNames_[i];
281 if (scaleFactor_ != scalar(1))
283 Info<<
indent <<
"scale factor = " << scaleFactor_;
295 bool anyFields =
false;
298 #define validFieldType(fieldType, none) \
299 anyFields = anyFields || validField<fieldType>(fields_[i]);
301 #undef validFieldType
303 if (!anyFields && fields_.size() > 1)
305 cannotFindObjects(fields_);
325 file() <<
tab << zone_.nGlobalCells();
334 Log <<
" number of cells = " << zone_.nGlobalCells() <<
endl;
338 Log <<
" volume = " << zone_.V() <<
endl;
343 forAll(weightFieldNames_, i)
345 weights *= getFieldValues<scalar>(weightFieldNames_[i]);
352 const word& fieldName = fields_[i];
355 #define writeValuesFieldType(fieldType, none) \
356 ok = ok || writeValues<fieldType>(fieldName, weights, V);
358 #undef writeValuesFieldType
362 cannotFindObject(fieldName);
398 zone_.topoChange(map);
424 zone_.distribute(map);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Initialise the NamedEnum HashTable from the static list of names.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
static bool & parRun()
Is this a parallel run?
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Abstract base-class for Time/database functionObjects.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void movePoints(const polyMesh &mesh)
Update topology using the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
Base class for field value -based function objects.
const dictionary & dict() const
Return the reference to the construction dictionary.
virtual bool read(const dictionary &dict)
Read from dictionary.
virtual bool write()
Write.
Provides a 'fvCellZone' specialisation of the fieldValue function object.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
void writeFileHeaderLocation()
Output file header location information for a given type.
operationType operation_
Operation to apply to values.
volFieldValue(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
static const NamedEnum< operationType, 12 > operationTypeNames_
Operation type names.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void writeFileHeader(const label i)
Output file header information.
virtual void movePoints(const polyMesh &)
Update for mesh motion.
virtual ~volFieldValue()
Destructor.
virtual bool write()
Calculate and write.
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.
virtual bool read(const dictionary &)
Read from dictionary.
operationType
Operation type enumeration.
const fvMesh & mesh_
Reference to the fvMesh.
OFstream & file()
Return access to the file (if only 1)
Registry of regIOobjects.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const polyMesh & mesh() const
Return polyMesh.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
Mesh consisting of general polyhedral cells.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define Log
Report write to Foam::Info if the local log switch is true.
defineTypeNameAndDebug(fieldValueDelta, 0)
addToRunTimeSelectionTable(functionObject, fieldValueDelta, dictionary)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
bool read(const char *, int32_t &)
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.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Forward declare the result structure.
#define writeFileHeaderLocationFieldType(fieldType, none)
#define writeValuesFieldType(fieldType, none)
#define validFieldType(fieldType, none)