40 void Foam::removeCells::uncount
74 boolList removedCell(mesh_.nCells(),
false);
79 removedCell[cellLabels[i]] =
true;
83 const labelList& faceOwner = mesh_.faceOwner();
84 const labelList& faceNeighbour = mesh_.faceNeighbour();
87 labelList nCellsUsingFace(mesh_.nFaces(), 0);
89 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
91 label own = faceOwner[facei];
92 label nei = faceNeighbour[facei];
94 if (!removedCell[own])
96 nCellsUsingFace[facei]++;
98 if (!removedCell[nei])
100 nCellsUsingFace[facei]++;
104 for (
label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); facei++)
106 label own = faceOwner[facei];
108 if (!removedCell[own])
110 nCellsUsingFace[facei]++;
136 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
138 if (nCellsUsingFace[facei] == 1)
140 exposedFaces.
append(facei);
156 label own = faceOwner[facei];
158 if (nCellsUsingFace[facei] == 1 && !removedCell[own])
162 exposedFaces.
append(facei);
170 return exposedFaces.
shrink();
184 if (exposedFaceLabels.
size() != exposedPatchIDs.
size())
187 <<
"Size of exposedFaceLabels " << exposedFaceLabels.
size()
188 <<
" differs from size of exposedPatchIDs "
189 << exposedPatchIDs.
size()
194 labelList newPatchID(mesh_.nFaces(), -1);
196 forAll(exposedFaceLabels, i)
203 <<
"Invalid patch " <<
patchi
204 <<
" for exposed face " << exposedFaceLabels[i] <<
endl
212 <<
"Trying to put exposed face " << exposedFaceLabels[i]
215 <<
"This is illegal."
219 newPatchID[exposedFaceLabels[i]] =
patchi;
224 boolList removedCell(mesh_.nCells(),
false);
230 label celli = cellLabels[i];
232 removedCell[celli] =
true;
244 const faceList& faces = mesh_.faces();
245 const labelList& faceOwner = mesh_.faceOwner();
246 const labelList& faceNeighbour = mesh_.faceNeighbour();
250 labelList nFacesUsingPoint(mesh_.nPoints(), 0);
254 const face&
f = faces[facei];
258 nFacesUsingPoint[
f[fp]]++;
263 for (
label facei = 0; facei < mesh_.nInternalFaces(); facei++)
265 const face&
f = faces[facei];
266 label own = faceOwner[facei];
267 label nei = faceNeighbour[facei];
269 if (removedCell[own])
271 if (removedCell[nei])
278 uncount(
f, nFacesUsingPoint);
282 if (newPatchID[facei] == -1)
285 <<
"No patchID provided for exposed face " << facei
286 <<
" on cell " << nei <<
nl
287 <<
"Did you provide patch IDs for all exposed faces?"
304 else if (removedCell[nei])
306 if (newPatchID[facei] == -1)
309 <<
"No patchID provided for exposed face " << facei
310 <<
" on cell " << own <<
nl
311 <<
"Did you provide patch IDs for all exposed faces?"
341 if (newPatchID[facei] != -1)
353 else if (removedCell[faceOwner[facei]])
361 uncount(faces[facei], nFacesUsingPoint);
373 if (newPatchID[facei] != -1)
376 <<
"new patchID provided for boundary face " << facei
377 <<
" even though it is not on a coupled face."
381 if (removedCell[faceOwner[facei]])
389 uncount(faces[facei], nFacesUsingPoint);
401 forAll(nFacesUsingPoint, pointi)
403 if (nFacesUsingPoint[pointi] == 0)
410 else if (nFacesUsingPoint[pointi] == 1)
413 <<
"point " << pointi <<
" at coordinate "
414 << mesh_.points()[pointi]
415 <<
" is only used by 1 face after removing cells."
416 <<
" 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 size() const
Return the number of elements in the UPtrList.
A face is a list of labels corresponding to mesh vertices.
Mesh consisting of general polyhedral cells.
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.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void removePoint(const label, const label)
Remove point / merge points.
void removeFace(const label, const label)
Remove face / merge faces.
void removeCell(const label, const label)
Remove cell / merge cells.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID)
Modify vertices or cell of face.
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)