88 const labelList& faceOwner = mesh_.faceOwner();
89 const labelList& faceNeighbour = mesh_.faceNeighbour();
94 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
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];
126 mesh_.nBoundaryFaces(),
127 mesh_.nInternalFaces()
151 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
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,
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?"
296 bool zoneFlip =
false;
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?"
344 bool zoneFlip =
false;
374 label facei = pp.start();
378 if (newPatchID[facei] != -1)
385 bool zoneFlip =
false;
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);
486 return getExposedFaces(removeCell);
498 bitSet removedCell(mesh_.nCells(), cellsToRemove);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
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 List obtained as a section of another List.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements 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 globalCellID) const
Helper function to re-direct to zone::localID(...)
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 additional search methods and registered IO.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
Mesh consisting of general polyhedral cells.
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.
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.
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
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneID
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.