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)
204 if (patchi < 0 || patchi >= patches.
size())
207 <<
"Invalid patch " << patchi
208 <<
" for exposed face " << exposedFaceLabels[i] <<
endl 209 <<
"Valid patches 0.." << patches.
size()-1
213 if (patches[patchi].coupled())
216 <<
"Trying to put exposed face " << exposedFaceLabels[i]
217 <<
" into a coupled patch : " << patches[
patchi].
name()
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." const fvPatchList & patches
Class containing data for face removal.
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
Class describing modification of a face.
A face is a list of labels corresponding to mesh vertices.
void setRefinement(const labelList &cellsToRemove, const labelList &facesToExpose, const labelList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
const boolList & flipMap() const
Return face flip map.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
face reverseFace() const
Return face with reverse direction.
Class containing data for cell removal.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
void append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
removeCells(const polyMesh &mesh, const bool syncPar=true)
Construct from mesh. syncPar: do parallel synchronisation.
defineTypeNameAndDebug(combustionModel, 0)
label size() const
Return the number of elements in the UPtrList.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
#define WarningInFunction
Report a warning using Foam::Warning.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label start() const
Return start label of this patch in the polyMesh face list.
Mesh consisting of general polyhedral cells.
labelList getExposedFaces(const labelList &cellsToRemove) const
Get labels of exposed faces.
A subset of mesh faces organised as a primitive patch.
A patch is a list of labels that address the faces in the global face list.
Class containing data for point removal.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.