42 bool Foam::layerAdditionRemoval::validCollapse()
const
49 Pout <<
"Checking layer collapse for object " <<
name() <<
endl;
58 label nBoundaryHits = 0;
64 !mesh.isInternalFace(mf[faceI])
65 && !mesh.isInternalFace(ftc[faceI])
75 Pout<<
"Finished checking layer collapse for object "
76 <<
name() <<
". Number of boundary-on-boundary hits: "
77 << nBoundaryHits <<
endl;
90 void Foam::layerAdditionRemoval::removeCellLayer
105 Pout <<
"Removing the cell layer for object " <<
name() <<
endl;
108 const polyMesh& mesh = topoChanger().mesh();
115 topoChanger().mesh().faceZones()[faceZoneID_.index()].masterCells();
119 ref.setAction(polyRemoveCell(mc[cellI]));
130 const cell& curCell = cells[mc[cellI]];
137 mesh.faceZones().whichZone(curCell[faceI])
138 != faceZoneID_.index()
141 facesToRemoveMap.insert(curCell[faceI]);
148 ref.setAction(polyRemoveFace(iter.key()));
154 ref.setAction(polyRemovePoint(ptc[pointI]));
164 Map<label> removedPointMap(2*ptc.size());
167 mesh.faceZones()[faceZoneID_.index()]().meshPoints();
171 removedPointMap.insert(ptc[pointI], meshPoints[pointI]);
176 const faceList& faces = mesh.faces();
178 const labelList& nei = mesh.faceNeighbour();
185 const labelList& curFaces = pf[ptc[pointI]];
189 if (!facesToRemoveMap.found(curFaces[faceI]))
191 facesToModify.insert(curFaces[faceI]);
205 label curFaceID = ftm[faceI];
207 face newFace(faces[curFaceID]);
212 removedPointMap.
find(newFace[pointI]);
214 if (rpmIter != removedPointMap.end())
217 newFace[pointI] = rpmIter();
226 label modifiedFaceZone = mesh.faceZones().whichZone(curFaceID);
227 bool modifiedFaceZoneFlip =
false;
229 if (modifiedFaceZone >= 0)
231 modifiedFaceZoneFlip =
232 mesh.faceZones()[modifiedFaceZone].flipMap()
234 mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
240 if (curFaceID < mesh.nInternalFaces())
242 newNei = nei[curFaceID];
259 mesh.boundaryMesh().whichPatch(curFaceID),
269 const labelList& mf = mesh.faceZones()[faceZoneID_.index()];
270 const boolList& mfFlip = mesh.faceZones()[faceZoneID_.index()].flipMap();
276 label masterSideCell = own[mf[faceI]];
278 if (masterSideCell == mc[faceI])
282 masterSideCell = nei[mf[faceI]];
285 label slaveSideCell = own[ftc[faceI]];
287 if (slaveSideCell == mc[faceI])
291 slaveSideCell = nei[ftc[faceI]];
296 label newNeighbour = -1;
297 bool flipFace =
false;
298 label newPatchID = -1;
299 label newZoneID = -1;
305 if (!mesh.isInternalFace(mf[faceI]))
308 newOwner = slaveSideCell;
311 newPatchID = mesh.boundaryMesh().whichPatch(mf[faceI]);
312 newZoneID = mesh.faceZones().whichZone(mf[faceI]);
314 else if (!mesh.isInternalFace(ftc[faceI]))
317 newOwner = slaveSideCell;
321 if (own[mf[faceI]] == slaveSideCell)
330 newPatchID = mesh.boundaryMesh().whichPatch(ftc[faceI]);
333 newZoneID = mesh.faceZones().whichZone(mf[faceI]);
339 newOwner =
min(masterSideCell, slaveSideCell);
340 newNeighbour =
max(masterSideCell, slaveSideCell);
342 if (newOwner == own[mf[faceI]] || newNeighbour == nei[mf[faceI]])
354 newZoneID = mesh.faceZones().whichZone(mf[faceI]);
358 face newFace = faces[mf[faceI]];
359 bool zoneFlip = mfFlip[faceI];
363 newFace = newFace.reverseFace();
364 zoneFlip = !zoneFlip;