35 const word callerName,
41 if (userBounds.
good() && !userBounds.
overlaps(meshBounds))
45 <<
" : Bounds " << userBounds
46 <<
" do not overlap the mesh bounding box " << meshBounds
55 const boundBox& userBounds,
56 const wordRes& zoneNames,
83 const auto& cellCentres =
static_cast<const fvMesh&
>(
mesh).
C();
85 if (userBounds.empty())
94 for (
const label celli : cellsToSelect)
96 const point& cc = cellCentres[celli];
108 for (
const label celli : cellsToSelect)
110 const point& cc = cellCentres[celli];
114 if (!userBounds.contains(cc))
116 cellsToSelect.unset(celli);
128 cellsToSelect.resize(len);
130 for (label celli=0; celli < len; ++celli)
132 const point& cc = cellCentres[celli];
134 if (userBounds.contains(cc))
136 cellsToSelect.set(celli);
141 return cellsToSelect;
147 const polyMesh&
mesh,
148 const boundBox& userBounds,
149 const wordRes& zoneNames,
150 const word callerName,
156 bitSet cellsToSelect =
159 mesh, userBounds, zoneNames, meshBounds
164 checkOverlap(callerName, meshBounds, userBounds);
167 return cellsToSelect;
label findIndex(const wordRe &key) const
Zone index for the first match, return -1 if not found.
constexpr char nl
The newline '\n' character (0x0a)
static bitSet cellSelection(const polyMesh &mesh, const boundBox &userBounds, const wordRes &zoneNames, boundBox &meshBounds)
Define cell selection from bounding-box and zones.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A bounding box defined in terms of min/max extrema points.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
static void checkOverlap(const word callerName, const boundBox &meshBounds, const boundBox &userBounds)
Check and warn if bounding boxes do not intersect.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
vector point
Point is a vector.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define WarningInFunction
Report a warning using Foam::Warning.
label nCells() const noexcept
Number of mesh cells.
bool good() const
Bounding box is non-inverted.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
bitSet selection(const labelUList &zoneIds) const
Return all elements (cells, faces, points) contained in the listed zones.
const boundBox & bounds() const noexcept
Return mesh bounding box.
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?