38 namespace functionObjects
51 { regionTypes::vrtAll,
"all" },
52 { regionTypes::vrtCellSet,
"cellSet" },
53 { regionTypes::vrtCellZone,
"cellZone" },
59 void Foam::functionObjects::volRegion::calculateCache()
65 requireUpdate_ =
false;
72 V_ =
gSum(volMesh_.
V());
79 cellIds_ = cellSet(volMesh_,
regionName_).sortedToc();
87 if (regionIDs_.
empty())
98 if (regionIDs_.
size() > 1)
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;
void size(const label n)
Older name for setAddressableSize.
defineTypeNameAndDebug(ObukhovLength, 0)
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...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void writeFileHeader(const writeFile &wf, Ostream &file) const
Output file header information.
static const Enum< regionTypes > regionTypeNames_
Region type names.
virtual bool read(const dictionary &dict)
Read from dictionary.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) zone indices for all matches.
void clear()
Clear the list, i.e. set size to zero.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
regionTypes
Region type enumeration.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
wordRe regionName_
Region name (cellSet, cellZone, ...)
label nTotalCells() const noexcept
Total global number of mesh cells.
volRegion(const fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
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.
const labelList & cellIDs() const
Return the local list of cell IDs.
Mesh data needed to do the Finite Volume discretisation.
bool update()
Update the cached values as required.
wordList groupNames() const
A list of the zone group names (if any)
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
regionTypes regionType_
Region type.
wordList names() const
A list of the zone names.
bitSet selection(const labelUList &zoneIds) const
Return all elements (cells, faces, points) contained in the listed zones.
Mesh consisting of general polyhedral cells.
Omanip< int > setw(const int i)
List< label > labelList
A List of labels.
static const List< label > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
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)