44 void Foam::removeCells::uncount
78 boolList removedCell(mesh_.nCells(),
false);
83 removedCell[cellLabels[i]] =
true;
87 const labelList& faceOwner = mesh_.faceOwner();
88 const labelList& faceNeighbour = mesh_.faceNeighbour();
91 labelList nCellsUsingFace(mesh_.nFaces(), 0);
93 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
95 label own = faceOwner[facei];
96 label nei = faceNeighbour[facei];
98 if (!removedCell[own])
100 nCellsUsingFace[facei]++;
102 if (!removedCell[nei])
104 nCellsUsingFace[facei]++;
108 for (
label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); facei++)
110 label own = faceOwner[facei];
112 if (!removedCell[own])
114 nCellsUsingFace[facei]++;
140 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
142 if (nCellsUsingFace[facei] == 1)
144 exposedFaces.
append(facei);
160 label own = faceOwner[facei];
162 if (nCellsUsingFace[facei] == 1 && !removedCell[own])
166 exposedFaces.
append(facei);
174 return exposedFaces.
shrink();
188 if (exposedFaceLabels.
size() != exposedPatchIDs.
size())
191 <<
"Size of exposedFaceLabels " << exposedFaceLabels.
size()
192 <<
" differs from size of exposedPatchIDs "
193 << exposedPatchIDs.
size()
198 labelList newPatchID(mesh_.nFaces(), -1);
200 forAll(exposedFaceLabels, i)
207 <<
"Invalid patch " <<
patchi
208 <<
" for exposed face " << exposedFaceLabels[i] <<
endl
216 <<
"Trying to put exposed face " << exposedFaceLabels[i]
219 <<
"This is illegal."
223 newPatchID[exposedFaceLabels[i]] =
patchi;
228 boolList removedCell(mesh_.nCells(),
false);
234 label celli = cellLabels[i];
236 removedCell[celli] =
true;
248 const faceList& faces = mesh_.faces();
249 const labelList& faceOwner = mesh_.faceOwner();
250 const labelList& faceNeighbour = mesh_.faceNeighbour();
255 labelList nFacesUsingPoint(mesh_.nPoints(), 0);
259 const face&
f = faces[facei];
263 nFacesUsingPoint[
f[fp]]++;
268 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
270 const face&
f = faces[facei];
271 label own = faceOwner[facei];
272 label nei = faceNeighbour[facei];
274 if (removedCell[own])
276 if (removedCell[nei])
283 uncount(
f, nFacesUsingPoint);
287 if (newPatchID[facei] == -1)
290 <<
"No patchID provided for exposed face " << facei
291 <<
" on cell " << nei <<
nl
292 <<
"Did you provide patch IDs for all exposed faces?"
299 bool zoneFlip =
false;
303 const faceZone& fZone = faceZones[zoneID];
330 else if (removedCell[nei])
332 if (newPatchID[facei] == -1)
335 <<
"No patchID provided for exposed face " << facei
336 <<
" on cell " << own <<
nl
337 <<
"Did you provide patch IDs for all exposed faces?"
347 bool zoneFlip =
false;
351 const faceZone& fZone = faceZones[zoneID];
383 if (newPatchID[facei] != -1)
390 bool zoneFlip =
false;
394 const faceZone& fZone = faceZones[zoneID];
414 else if (removedCell[faceOwner[facei]])
422 uncount(faces[facei], nFacesUsingPoint);
434 if (newPatchID[facei] != -1)
437 <<
"new patchID provided for boundary face " << facei
438 <<
" even though it is not on a coupled face."
442 if (removedCell[faceOwner[facei]])
450 uncount(faces[facei], nFacesUsingPoint);
462 forAll(nFacesUsingPoint, pointi)
464 if (nFacesUsingPoint[pointi] == 0)
471 else if (nFacesUsingPoint[pointi] == 1)
474 <<
"point " << pointi <<
" at coordinate "
475 << mesh_.points()[pointi]
476 <<
" is only used by 1 face after removing cells."
477 <<
" This probably results in an illegal mesh."
#define forAll(list, i)
Loop across all elements in list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
void size(const label)
Override size to be inconsistent with allocated storage.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
label size() const
Return the number of elements in the UPtrList.
A subset of mesh faces organised as a primitive patch.
const boolList & flipMap() const
Return face flip map.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
A face is a list of labels corresponding to mesh vertices.
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.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label start() const
Return start label of this patch in the polyMesh 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.
void setRefinement(const labelList &cellsToRemove, const labelList &facesToExpose, const labelList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
removeCells(const polyMesh &mesh, const bool syncPar=true)
Construct from mesh. syncPar: do parallel synchronisation.
labelList getExposedFaces(const labelList &cellsToRemove) const
Get labels of exposed faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
defineTypeNameAndDebug(combustionModel, 0)