39 bool Foam::layerAdditionRemoval::validCollapse()
const 46 Pout<<
"Checking layer collapse for object " <<
name() <<
endl;
55 label nBoundaryHits = 0;
61 !mesh.isInternalFace(mf[facei])
62 && !mesh.isInternalFace(ftc[facei])
72 Pout<<
"Finished checking layer collapse for object " 73 <<
name() <<
". Number of boundary-on-boundary hits: " 74 << nBoundaryHits <<
endl;
88 void Foam::layerAdditionRemoval::removeCellLayer
103 Pout<<
"Removing the cell layer for object " <<
name() <<
endl;
109 const labelList& nei = mesh.faceNeighbour();
116 mesh.faceZones()[faceZoneID_.
index()].masterCells();
120 label slaveSideCell = own[ftc[facei]];
122 if (mesh.isInternalFace(ftc[facei]) && slaveSideCell == mc[facei])
126 slaveSideCell = nei[ftc[facei]];
129 ref.setAction(polyRemoveCell(mc[facei], slaveSideCell));
136 const cellList& cells = mesh.cells();
140 const cell& curCell = cells[mc[celli]];
147 mesh.faceZones().whichZone(curCell[facei])
148 != faceZoneID_.
index()
151 facesToRemoveMap.insert(curCell[facei]);
158 ref.setAction(polyRemoveFace(iter.key()));
164 ref.setAction(polyRemovePoint(ptc[pointi]));
174 Map<label> removedPointMap(2*ptc.size());
177 mesh.faceZones()[faceZoneID_.
index()]().meshPoints();
181 removedPointMap.insert(ptc[pointi], meshPoints[pointi]);
186 const faceList& faces = mesh.faces();
193 const labelList& curFaces = pf[ptc[pointi]];
197 if (!facesToRemoveMap.found(curFaces[facei]))
199 facesToModify.insert(curFaces[facei]);
208 Pout<<
"faces to modify: " << ftm <<
endl;
216 label curFaceID = ftm[facei];
218 face newFace(faces[curFaceID]);
223 removedPointMap.find(newFace[pointi]);
225 if (rpmIter != removedPointMap.end())
228 newFace[pointi] = rpmIter();
234 Pout<<
"face label: " << curFaceID
235 <<
" old face: " << faces[curFaceID]
236 <<
" new face: " << newFace <<
endl;
240 label modifiedFaceZone = mesh.faceZones().whichZone(curFaceID);
241 bool modifiedFaceZoneFlip =
false;
243 if (modifiedFaceZone >= 0)
245 const faceZone& fz = mesh.faceZones()[modifiedFaceZone];
246 modifiedFaceZoneFlip = fz.flipMap()[fz.whichFace(curFaceID)];
249 label newNeighbour = -1;
251 if (curFaceID < mesh.nInternalFaces())
253 newNeighbour = nei[curFaceID];
266 mesh.boundaryMesh().whichPatch(curFaceID),
277 const boolList& mfFlip = mesh.faceZones()[faceZoneID_.
index()].flipMap();
283 label masterSideCell = own[mf[facei]];
285 if (masterSideCell == mc[facei])
287 if (mesh.isInternalFace(mf[facei]))
291 masterSideCell = nei[mf[facei]];
299 label slaveSideCell = own[ftc[facei]];
301 if (slaveSideCell == mc[facei])
303 if (mesh.isInternalFace(ftc[facei]))
307 slaveSideCell = nei[ftc[facei]];
317 label newNeighbour = -1;
318 bool flipFace =
false;
319 label newPatchID = -1;
320 label newZoneID = -1;
326 if (!mesh.isInternalFace(mf[facei]))
329 newOwner = slaveSideCell;
332 newPatchID = mesh.boundaryMesh().whichPatch(mf[facei]);
333 newZoneID = mesh.faceZones().whichZone(mf[facei]);
335 else if (!mesh.isInternalFace(ftc[facei]))
338 newOwner = slaveSideCell;
342 if (own[mf[facei]] == slaveSideCell)
351 newPatchID = mesh.boundaryMesh().whichPatch(ftc[facei]);
354 newZoneID = mesh.faceZones().whichZone(mf[facei]);
360 newOwner =
min(masterSideCell, slaveSideCell);
361 newNeighbour =
max(masterSideCell, slaveSideCell);
363 if (newOwner == own[mf[facei]] || newNeighbour == nei[mf[facei]])
375 newZoneID = mesh.faceZones().whichZone(mf[facei]);
379 face newFace = faces[mf[facei]];
380 bool zoneFlip = mfFlip[facei];
385 zoneFlip = !zoneFlip;
390 Pout<<
"Modifying face " << mf[facei]
391 <<
" newFace: " << newFace <<
nl 392 <<
" newOwner: " << newOwner
393 <<
" newNeighbour: " << newNeighbour
394 <<
" flipFace: " << flipFace
395 <<
" newPatchID: " << newPatchID
396 <<
" newZoneID: " << newZoneID <<
nl 397 <<
" oldOwn: " << own[mf[facei]]
398 <<
" oldNei: " << nei[mf[facei]] <<
endl;
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
HashTable< label, label, Hash< label > >::iterator iterator
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const unsigned facesPerPoint_
Estimated number of faces per point.
List< bool > boolList
Bool container classes.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
static const unsigned facesPerCell_
Estimated number of faces per cell.
List< label > labelList
A List of labels.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label index() const
Return index of first matching zone.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
prefixOSstream Pout(cout, "Pout")
const word & name() const
Return name of this modifier.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const polyMesh & mesh() const
Return the mesh reference.
List< cell > cellList
list of cells