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];
109 for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei)
111 const label own = faceOwner[facei];
113 if (!removedCell[own])
115 ++nCellsUsingFace[facei];
123 SubList<label> bndValues
126 mesh_.nBoundaryFaces(),
127 mesh_.nInternalFaces()
135 mapDistribute::transform(),
149 DynamicList<label> exposedFaces(mesh_.nFaces()/10);
151 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
153 if (nCellsUsingFace[facei] == 1)
155 exposedFaces.append(facei);
159 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
165 label facei =
pp.start();
169 const label own = faceOwner[facei];
171 if (nCellsUsingFace[facei] == 1 && !removedCell[own])
175 exposedFaces.append(facei);
183 return labelList(std::move(exposedFaces));
189 const bitSet& removedCell,
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)
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])
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]])
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]])
445 decrCount(faces[facei], nFacesUsingPoint);
457 forAll(nFacesUsingPoint, pointi)
459 if (nFacesUsingPoint[pointi] == 0)
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);
498 bitSet removedCell(mesh_.nCells(), cellsToRemove);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
const word & name() const noexcept
Return the object name.
A non-owning sub-view of a List (allocated or unallocated storage).
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A subset of mesh faces organised as a primitive patch.
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
virtual const labelList & faceOwner() const
Return face owner.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
Class containing data for cell removal.
Class containing data for face removal.
Class containing data for point removal.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
label nInternalFaces() const noexcept
Number of internal faces.
label nFaces() const noexcept
Number of mesh faces.
Given list of cells to remove, insert all the topology changes.
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
removeCells(const polyMesh &mesh, const bool syncPar=true)
Construct from mesh. Parallel synchronized by default.
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
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...
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.