96 const label own = faceOwner[facei];
97 const label nei = faceNeighbour[facei];
99 if (!removedCell[own])
101 ++nCellsUsingFace[facei];
103 if (!removedCell[nei])
105 ++nCellsUsingFace[facei];
111 const label own = faceOwner[facei];
113 if (!removedCell[own])
115 ++nCellsUsingFace[facei];
123 SubList<label> bndValues
149 DynamicList<label> exposedFaces(mesh_.
nFaces()/10);
153 if (nCellsUsingFace[facei] == 1)
155 exposedFaces.append(facei);
165 label facei =
pp.start();
169 const label own = faceOwner[facei];
171 if (nCellsUsingFace[facei] == 1 && !removedCell[own])
175 exposedFaces.
append(facei);
183 return exposedFaces.shrink();
189 const bitSet& removedCell,
192 polyTopoChange& meshMod
195 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
197 if (exposedFaceLabels.size() != exposedPatchIDs.size())
200 <<
"Size of exposedFaceLabels " << exposedFaceLabels.size()
201 <<
" differs from size of exposedPatchIDs " 202 << exposedPatchIDs.size()
207 labelList newPatchID(mesh_.nFaces(), -1);
209 forAll(exposedFaceLabels, i)
211 const label facei = exposedFaceLabels[i];
212 const label patchi = exposedPatchIDs[i];
217 <<
"Invalid patch " << patchi
218 <<
" for exposed face " << facei <<
nl 226 <<
"Trying to put exposed face " << facei
227 <<
" into a coupled patch : " <<
patches[patchi].
name()
229 <<
"This is illegal." 233 newPatchID[facei] = patchi;
238 for (
const label celli : removedCell)
243 meshMod.setAction(polyRemoveCell(celli));
250 const faceList& faces = mesh_.faces();
251 const labelList& faceOwner = mesh_.faceOwner();
252 const labelList& faceNeighbour = mesh_.faceNeighbour();
259 for (
const face&
f : faces)
261 incrCount(
f, nFacesUsingPoint);
265 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
267 const face&
f = faces[facei];
268 const label own = faceOwner[facei];
269 const label nei = faceNeighbour[facei];
271 if (removedCell[own])
273 if (removedCell[nei])
279 meshMod.setAction(polyRemoveFace(facei));
280 decrCount(
f, nFacesUsingPoint);
284 if (newPatchID[facei] == -1)
287 <<
"No patchID provided for exposed face " << facei
288 <<
" on cell " << nei <<
nl 289 <<
"Did you provide patch IDs for all exposed faces?" 295 const label zoneID = faceZones.whichZone(facei);
296 bool zoneFlip =
false;
300 const faceZone& fZone = faceZones[zoneID];
303 zoneFlip = !fZone.flipMap()[fZone.whichFace(facei)];
327 else if (removedCell[nei])
329 if (newPatchID[facei] == -1)
332 <<
"No patchID provided for exposed face " << facei
333 <<
" on cell " << own <<
nl 334 <<
"Did you provide patch IDs for all exposed faces?" 343 const label zoneID = faceZones.whichZone(facei);
344 bool zoneFlip =
false;
348 const faceZone& fZone = faceZones[zoneID];
349 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
374 label facei =
pp.start();
378 if (newPatchID[facei] != -1)
384 const label zoneID = faceZones.whichZone(facei);
385 bool zoneFlip =
false;
389 const faceZone& fZone = faceZones[zoneID];
390 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
409 else if (removedCell[faceOwner[facei]])
416 meshMod.setAction(polyRemoveFace(facei));
417 decrCount(faces[facei], nFacesUsingPoint);
425 label facei =
pp.start();
429 if (newPatchID[facei] != -1)
432 <<
"new patchID provided for boundary face " << facei
433 <<
" even though it is not on a coupled face." 437 if (removedCell[faceOwner[facei]])
444 meshMod.setAction(polyRemoveFace(facei));
445 decrCount(faces[facei], nFacesUsingPoint);
457 forAll(nFacesUsingPoint, pointi)
459 if (nFacesUsingPoint[pointi] == 0)
464 meshMod.setAction(polyRemovePoint(pointi));
466 else if (nFacesUsingPoint[pointi] == 1)
469 <<
"point " << pointi <<
" at coordinate " 470 << mesh_.points()[pointi]
471 <<
" is only used by 1 face after removing cells." 472 <<
" This probably results in an illegal mesh." 484 bitSet removeCell(mesh_.nCells(), cellsToRemove);
486 return getExposedFaces(removeCell);
498 bitSet removedCell(mesh_.nCells(), cellsToRemove);
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label nFaces() const noexcept
Number of mesh faces.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
label size() const noexcept
The number of entries in the list.
virtual const labelList & faceOwner() const
Return face owner.
label nInternalFaces() const noexcept
Number of internal faces.
errorManip< error > abort(error &err)
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
removeCells(const polyMesh &mesh, const bool syncPar=true)
Construct from mesh. Parallel synchronized by default.
defineTypeNameAndDebug(combustionModel, 0)
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.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const polyBoundaryMesh & patches
List< label > labelList
A List of labels.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)