51 { regionTypes::vrtAll,
"all" },
52 { regionTypes::vrtCellSet,
"cellSet" },
53 { regionTypes::vrtCellZone,
"cellZone" },
59void Foam::functionObjects::volRegion::calculateCache()
65 requireUpdate_ =
false;
71 nCells_ = volMesh_.globalData().nTotalCells();
72 V_ =
gSum(volMesh_.V());
79 cellIds_ = cellSet(volMesh_,
regionName_).sortedToc();
85 regionIDs_ = volMesh_.cellZones().indices(
regionName_);
87 if (regionIDs_.empty())
98 if (regionIDs_.size() > 1)
101 volMesh_.cellZones().selection(regionIDs_).sortedToc();
112 for (
const label celli : selected)
114 V_ += volMesh_.V()[celli];
117 nCells_ =
returnReduce(selected.size(), sumOp<label>());
118 reduce(V_, sumOp<scalar>());
125 <<
" Region has no cells" <<
nl
139 wf.writeCommented(file,
"Region");
140 file<<
setw(1) <<
':' <<
setw(1) <<
' '
141 << regionTypeNames_[regionType_] <<
' ' << regionName_ <<
endl;
142 wf.writeHeaderValue(file,
"Cells", nCells_);
143 wf.writeHeaderValue(file,
"Volume", V_);
160 requireUpdate_(true),
163 regionTypeNames_.getOrDefault
170 regionName_(volMesh_.
name())
184 regionName_ = volMesh_.name();
191 dict.readEntry(
"name", regionName_);
198 <<
"Unknown region type. Valid region types: "
216 <<
"Retrieving cached values that are not up-to-date" <<
nl
231 if (regionIDs_.size() == 1)
233 return volMesh_.cellZones()[regionIDs_.first()];
264 requireUpdate_ =
true;
270 requireUpdate_ =
true;
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
void clear()
Clear all entries.
static const List< label > & null() noexcept
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Volume (cell) region selection class.
volRegion(const fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
wordRe regionName_
Region name (cellSet, cellZone, ...).
virtual bool read(const dictionary &dict)
Read from dictionary.
static const Enum< regionTypes > regionTypeNames_
Region type names.
bool update()
Update the cached values as required.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
regionTypes regionType_
Region type.
regionTypes
Region type enumeration.
void writeFileHeader(const writeFile &wf, Ostream &file) const
Output file header information.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
const labelList & cellIDs() const
Return the local list of cell IDs.
Base class for writing single files from the function objects.
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
Mesh data needed to do the Finite Volume discretisation.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Mesh consisting of general polyhedral cells.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Type gSum(const FieldField< Field, Type > &f)
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
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 ...
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).