38namespace functionObjects
51 { regionTypes::vrtAll,
"all" },
52 { regionTypes::vrtCellSet,
"cellSet" },
53 { regionTypes::vrtCellZone,
"cellZone" },
59void 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
140 file<<
setw(1) <<
':' <<
setw(1) <<
' '
141 << regionTypeNames_[regionType_] <<
' ' << regionName_ <<
endl;
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 the list, i.e. set size to zero.
static const List< label > & null()
Return a null List.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool read()
Re-read model coefficients if they have changed.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
bitSet selection(const labelUList &zoneIds) const
wordList groupNames() const
A list of the zone group names (if any)
wordList names() const
A list of the zone names.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) zone indices for all matches.
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Volume (cell) region selection class.
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.
regionTypes regionType_
Region type.
regionTypes
Region type enumeration.
void writeFileHeader(const writeFile &wf, Ostream &file) const
Output file header information.
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.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void movePoints()
Update for new mesh geometry.
void updateMesh()
Update for new mesh topology.
Mesh consisting of general polyhedral cells.
const globalMeshData & globalData() const
Return parallel info.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
#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.
Type gSum(const FieldField< Field, Type > &f)
List< label > labelList
A List of labels.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)