42 mesh.faceZones()[faceZoneID_.
index()]();
45 const labelList& mp = masterFaceLayer.meshPoints();
47 tmp<vectorField> textrusionDir(
new vectorField(mp.size()));
50 if (setLayerPairing())
54 Pout<<
"void layerAdditionRemoval::extrusionDir() const " 55 <<
" for object " <<
name() <<
" : " 56 <<
"Using edges for point insertion" <<
endl;
64 extrusionDir[mpI] = points[ptc[mpI]] - points[mp[mpI]];
71 Pout<<
"void layerAdditionRemoval::extrusionDir() const " 72 <<
" for object " <<
name() <<
" : " 73 <<
"A valid layer could not be found in front of " 74 <<
"the addition face layer. Using face-based " 75 <<
"point normals for point addition" 79 extrusionDir = minLayerThickness_*masterFaceLayer.pointNormals();
86 void Foam::layerAdditionRemoval::addCellLayer
107 Pout<<
"void layerAdditionRemoval::addCellLayer(" 108 <<
"polyTopoChange& ref) const for object " <<
name() <<
" : " 109 <<
"Adding cell layer" <<
endl;
116 mesh.faceZones()[faceZoneID_.
index()]();
119 const labelList& mp = masterFaceLayer.meshPoints();
132 addedPoints[pointi] =
138 + addDelta_*pointOffsets[pointi],
148 Pout<<
"mp: " << mp <<
" addedPoints: " << addedPoints <<
endl;
154 mesh.faceZones()[faceZoneID_.
index()].masterCells();
156 mesh.faceZones()[faceZoneID_.
index()].slaveCells();
159 const boolList& mfFlip = mesh.faceZones()[faceZoneID_.
index()].flipMap();
162 const labelList& nei = mesh.faceNeighbour();
168 label celli = mc[facei];
169 label zoneI = mesh.cellZones().whichZone(celli);
188 const faceList& zoneFaces = masterFaceLayer.localFaces();
199 const face oldFace = zoneFaces[facei].reverseFace();
201 face newFace(oldFace.size());
205 newFace[pointi] = addedPoints[oldFace[pointi]];
208 bool flipFaceFlux =
false;
213 !mesh.isInternalFace(mf[facei])
214 || mc[facei] == nei[mf[facei]]
240 Pout<<
"adding face: " << newFace
241 <<
" own: " << mc[facei]
242 <<
" nei: " << addedCells[facei]
249 const faceList& faces = mesh.faces();
255 const label curfaceID = mf[facei];
259 if (!mesh.isInternalFace(curfaceID))
270 mesh.boundaryMesh().whichPatch(curfaceID),
279 Pout<<
"Modifying a boundary face. Face: " << curfaceID
280 <<
" flip: " << mfFlip[facei]
288 else if (sc[facei] == own[curfaceID])
300 mesh.boundaryMesh().whichPatch(curfaceID),
309 Pout<<
"modify face, no flip " << curfaceID
310 <<
" own: " << own[curfaceID]
311 <<
" nei: " << addedCells[facei]
322 faces[curfaceID].reverseFace(),
327 mesh.boundaryMesh().whichPatch(curfaceID),
336 Pout<<
"modify face, with flip " << curfaceID
337 <<
" own: " << own[curfaceID]
338 <<
" nei: " << addedCells[facei]
346 const edgeList& zoneLocalEdges = masterFaceLayer.edges();
348 const labelListList& edgeFaces = masterFaceLayer.edgeFaces();
350 label nInternalEdges = masterFaceLayer.nInternalEdges();
353 mesh.faceZones()[faceZoneID_.
index()].meshEdges();
356 for (
label curEdgeID = 0; curEdgeID < nInternalEdges; curEdgeID++)
360 newFace[0] = mp[zoneLocalEdges[curEdgeID].start()];
361 newFace[1] = mp[zoneLocalEdges[curEdgeID].end()];
362 newFace[2] = addedPoints[zoneLocalEdges[curEdgeID].end()];
363 newFace[3] = addedPoints[zoneLocalEdges[curEdgeID].start()];
370 addedCells[edgeFaces[curEdgeID][0]],
371 addedCells[edgeFaces[curEdgeID][1]],
373 meshEdges[curEdgeID],
384 Pout<<
"Add internal face off edge: " << newFace
385 <<
" own: " << addedCells[edgeFaces[curEdgeID][0]]
386 <<
" nei: " << addedCells[edgeFaces[curEdgeID][1]]
408 label curEdgeID = nInternalEdges;
409 curEdgeID < zoneLocalEdges.size();
414 newFace[0] = mp[zoneLocalEdges[curEdgeID].start()];
415 newFace[1] = mp[zoneLocalEdges[curEdgeID].end()];
416 newFace[2] = addedPoints[zoneLocalEdges[curEdgeID].end()];
417 newFace[3] = addedPoints[zoneLocalEdges[curEdgeID].start()];
420 const labelList& curFaces = meshEdgeFaces[meshEdges[curEdgeID]];
427 const label cf = curFaces[facei];
429 if (!mesh.isInternalFace(cf))
432 if (meshZones.whichZone(cf) != faceZoneID_.
index())
435 patchID = mesh.boundaryMesh().whichPatch(cf);
436 zoneID = mesh.faceZones().whichZone(cf);
446 <<
"Cannot find patch for edge " << meshEdges[curEdgeID]
447 <<
". Edge: " << mesh.edges()[meshEdges[curEdgeID]]
456 addedCells[edgeFaces[curEdgeID][0]],
459 meshEdges[curEdgeID],
470 Pout<<
"add boundary face: " << newFace
471 <<
" into patch " << patchID
472 <<
" own: " << addedCells[edgeFaces[curEdgeID][0]]
493 const cellList& cells = mesh.cells();
497 const labelList& curFaces = cells[mc[celli]];
502 if (meshZones.whichZone(curFaces[facei]) != faceZoneID_.
index())
504 masterCellFaceMap.insert(curFaces[facei]);
510 Map<label> masterLayerPointMap(2*mp.size());
514 masterLayerPointMap.insert
522 const labelList masterCellFaces = masterCellFaceMap.toc();
524 forAll(masterCellFaces, facei)
529 const label curFaceID = masterCellFaces[facei];
531 const face& oldFace = faces[curFaceID];
533 face newFace(oldFace.size());
535 bool changed =
false;
539 if (masterLayerPointMap.found(oldFace[pointi]))
543 newFace[pointi] = masterLayerPointMap.find(oldFace[pointi])();
547 newFace[pointi] = oldFace[pointi];
555 label modifiedFaceZone = mesh.faceZones().whichZone(curFaceID);
556 bool modifiedFaceZoneFlip =
false;
558 if (modifiedFaceZone >= 0)
560 modifiedFaceZoneFlip =
561 mesh.faceZones()[modifiedFaceZone].flipMap()
563 mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
567 if (mesh.isInternalFace(curFaceID))
587 Pout<<
"modifying stick-out face. Internal Old face: " 589 <<
" new face: " << newFace
590 <<
" own: " << own[curFaceID]
591 <<
" nei: " << nei[curFaceID]
606 mesh.boundaryMesh().whichPatch(curFaceID),
616 Pout<<
"modifying stick-out face. Boundary Old face: " 618 <<
" new face: " << newFace
619 <<
" own: " << own[curFaceID]
621 << mesh.boundaryMesh().whichPatch(curFaceID)
630 Pout<<
"void layerAdditionRemoval::addCellLayer(polyTopoChange&) const " 631 <<
" for object " <<
name() <<
": " 632 <<
"Finished adding cell layer" <<
endl;
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
vectorField pointField
pointField is a vectorField.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
label index() const
Return index of first matching zone.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
Foam::primitiveFacePatch.
MeshZones< faceZone, polyMesh > meshFaceZones
A MeshZones with the type faceZone.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
prefixOSstream Pout(cout, "Pout")
const word & name() const
Return name of this modifier.
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
const polyMesh & mesh() const
Return the mesh reference.
List< cell > cellList
list of cells