47 void Foam::removeCells::uncount
86 boolList removedCell(mesh_.nCells(),
false);
91 removedCell[cellLabels[i]] =
true;
95 const labelList& faceOwner = mesh_.faceOwner();
96 const labelList& faceNeighbour = mesh_.faceNeighbour();
99 labelList nCellsUsingFace(mesh_.nFaces(), 0);
101 for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
103 label own = faceOwner[faceI];
104 label nei = faceNeighbour[faceI];
106 if (!removedCell[own])
108 nCellsUsingFace[faceI]++;
110 if (!removedCell[nei])
112 nCellsUsingFace[faceI]++;
116 for (label faceI = mesh_.nInternalFaces(); faceI < mesh_.nFaces(); faceI++)
118 label own = faceOwner[faceI];
120 if (!removedCell[own])
122 nCellsUsingFace[faceI]++;
149 for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
151 if (nCellsUsingFace[faceI] == 1)
153 exposedFaces.
append(faceI);
165 label faceI = pp.
start();
169 label own = faceOwner[faceI];
171 if (nCellsUsingFace[faceI] == 1 && !removedCell[own])
175 exposedFaces.
append(faceI);
183 return exposedFaces.shrink();
197 if (exposedFaceLabels.
size() != exposedPatchIDs.
size())
201 "removeCells::setRefinement(const labelList&"
202 ", const labelList&, const labelList&, polyTopoChange&)"
203 ) <<
"Size of exposedFaceLabels " << exposedFaceLabels.
size()
204 <<
" differs from size of exposedPatchIDs "
205 << exposedPatchIDs.
size()
210 labelList newPatchID(mesh_.nFaces(), -1);
212 forAll(exposedFaceLabels, i)
214 label patchI = exposedPatchIDs[i];
216 if (patchI < 0 || patchI >= patches.
size())
220 "removeCells::setRefinement(const labelList&"
221 ", const labelList&, const labelList&, polyTopoChange&)"
222 ) <<
"Invalid patch " << patchI
223 <<
" for exposed face " << exposedFaceLabels[i] <<
endl
224 <<
"Valid patches 0.." << patches.
size()-1
228 if (patches[patchI].coupled())
232 "removeCells::setRefinement(const labelList&"
233 ", const labelList&, const labelList&, polyTopoChange&)"
234 ) <<
"Trying to put exposed face " << exposedFaceLabels[i]
235 <<
" into a coupled patch : " << patches[patchI].
name()
237 <<
"This is illegal."
241 newPatchID[exposedFaceLabels[i]] = patchI;
246 boolList removedCell(mesh_.nCells(),
false);
252 label cellI = cellLabels[i];
254 removedCell[cellI] =
true;
266 const faceList& faces = mesh_.faces();
267 const labelList& faceOwner = mesh_.faceOwner();
268 const labelList& faceNeighbour = mesh_.faceNeighbour();
273 labelList nFacesUsingPoint(mesh_.nPoints(), 0);
277 const face&
f = faces[faceI];
281 nFacesUsingPoint[f[fp]]++;
286 for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
288 const face&
f = faces[faceI];
289 label own = faceOwner[faceI];
290 label nei = faceNeighbour[faceI];
292 if (removedCell[own])
294 if (removedCell[nei])
301 uncount(f, nFacesUsingPoint);
305 if (newPatchID[faceI] == -1)
309 "removeCells::setRefinement(const labelList&"
310 ", const labelList&, const labelList&"
312 ) <<
"No patchID provided for exposed face " << faceI
313 <<
" on cell " << nei <<
nl
314 <<
"Did you provide patch IDs for all exposed faces?"
320 label zoneID = faceZones.
whichZone(faceI);
321 bool zoneFlip =
false;
325 const faceZone& fZone = faceZones[zoneID];
352 else if (removedCell[nei])
354 if (newPatchID[faceI] == -1)
358 "removeCells::setRefinement(const labelList&"
359 ", const labelList&, const labelList&"
361 ) <<
"No patchID provided for exposed face " << faceI
362 <<
" on cell " << own <<
nl
363 <<
"Did you provide patch IDs for all exposed faces?"
372 label zoneID = faceZones.
whichZone(faceI);
373 bool zoneFlip =
false;
377 const faceZone& fZone = faceZones[zoneID];
405 label faceI = pp.
start();
409 if (newPatchID[faceI] != -1)
415 label zoneID = faceZones.
whichZone(faceI);
416 bool zoneFlip =
false;
420 const faceZone& fZone = faceZones[zoneID];
440 else if (removedCell[faceOwner[faceI]])
448 uncount(faces[faceI], nFacesUsingPoint);
456 label faceI = pp.
start();
460 if (newPatchID[faceI] != -1)
464 "removeCells::setRefinement(const labelList&"
465 ", const labelList&, const labelList&"
467 ) <<
"new patchID provided for boundary face " << faceI
468 <<
" even though it is not on a coupled face."
472 if (removedCell[faceOwner[faceI]])
480 uncount(faces[faceI], nFacesUsingPoint);
492 forAll(nFacesUsingPoint, pointI)
494 if (nFacesUsingPoint[pointI] == 0)
501 else if (nFacesUsingPoint[pointI] == 1)
505 "removeCells::setRefinement(const labelList&"
506 ", const labelList&, const labelList&"
508 ) <<
"point " << pointI <<
" at coordinate "
509 << mesh_.points()[pointI]
510 <<
" is only used by 1 face after removing cells."
511 <<
" This probably results in an illegal mesh."