45 mesh.faceZones()[faceZoneID_.index()]();
51 auto& extrusionDir = textrusionDir.ref();
53 if (setLayerPairing())
57 Pout<<
"void layerAdditionRemoval::extrusionDir() const "
58 <<
" for object " <<
name() <<
" : "
59 <<
"Using edges for point insertion" <<
endl;
74 Pout<<
"void layerAdditionRemoval::extrusionDir() const "
75 <<
" for object " <<
name() <<
" : "
76 <<
"A valid layer could not be found in front of "
77 <<
"the addition face layer. Using face-based "
78 <<
"point normals for point addition"
82 extrusionDir = minLayerThickness_*masterFaceLayer.pointNormals();
89void Foam::layerAdditionRemoval::addCellLayer
110 Pout<<
"void layerAdditionRemoval::addCellLayer("
111 <<
"polyTopoChange& ref) const for object " <<
name() <<
" : "
112 <<
"Adding cell layer" <<
endl;
122 const labelList&
mp = masterFaceLayer.meshPoints();
135 addedPoints[pointi] =
141 + addDelta_*pointOffsets[pointi],
151 Pout<<
"mp: " <<
mp <<
" addedPoints: " << addedPoints <<
endl;
171 label celli = mc[facei];
191 const faceList& zoneFaces = masterFaceLayer.localFaces();
204 face newFace(oldFace.size());
208 newFace[pointi] = addedPoints[oldFace[pointi]];
211 bool flipFaceFlux =
false;
217 || mc[facei] == nei[mf[facei]]
243 Pout<<
"adding face: " << newFace
244 <<
" own: " << mc[facei]
245 <<
" nei: " << addedCells[facei]
258 const label curfaceID = mf[facei];
282 Pout<<
"Modifying a boundary face. Face: " << curfaceID
283 <<
" flip: " << mfFlip[facei]
291 else if (sc[facei] == own[curfaceID])
312 Pout<<
"modify face, no flip " << curfaceID
313 <<
" own: " << own[curfaceID]
314 <<
" nei: " << addedCells[facei]
325 faces[curfaceID].reverseFace(),
339 Pout<<
"modify face, with flip " << curfaceID
340 <<
" own: " << own[curfaceID]
341 <<
" nei: " << addedCells[facei]
349 const edgeList& zoneLocalEdges = masterFaceLayer.edges();
351 const labelListList& edgeFaces = masterFaceLayer.edgeFaces();
353 label nInternalEdges = masterFaceLayer.nInternalEdges();
359 for (label curEdgeID = 0; curEdgeID < nInternalEdges; curEdgeID++)
363 newFace[0] =
mp[zoneLocalEdges[curEdgeID].start()];
364 newFace[1] =
mp[zoneLocalEdges[curEdgeID].end()];
365 newFace[2] = addedPoints[zoneLocalEdges[curEdgeID].end()];
366 newFace[3] = addedPoints[zoneLocalEdges[curEdgeID].start()];
373 addedCells[edgeFaces[curEdgeID][0]],
374 addedCells[edgeFaces[curEdgeID][1]],
376 meshEdges[curEdgeID],
387 Pout<<
"Add internal face off edge: " << newFace
388 <<
" own: " << addedCells[edgeFaces[curEdgeID][0]]
389 <<
" nei: " << addedCells[edgeFaces[curEdgeID][1]]
411 label curEdgeID = nInternalEdges;
412 curEdgeID < zoneLocalEdges.size();
417 newFace[0] =
mp[zoneLocalEdges[curEdgeID].start()];
418 newFace[1] =
mp[zoneLocalEdges[curEdgeID].end()];
419 newFace[2] = addedPoints[zoneLocalEdges[curEdgeID].end()];
420 newFace[3] = addedPoints[zoneLocalEdges[curEdgeID].start()];
423 const labelList& curFaces = meshEdgeFaces[meshEdges[curEdgeID]];
427 label extrudeFaceID = -1;
429 forAll(curFaces, curFacei)
431 extrudeFaceID = curFaces[curFacei];
436 const label cfZone = zoneMesh.whichZone(extrudeFaceID);
437 if (cfZone != faceZoneID_.index())
451 <<
"Cannot find patch for edge " << meshEdges[curEdgeID]
452 <<
". Edge: " <<
mesh.
edges()[meshEdges[curEdgeID]]
461 addedCells[edgeFaces[curEdgeID][0]],
464 meshEdges[curEdgeID],
475 Pout<<
"add boundary face: " << newFace
477 <<
" own: " << addedCells[edgeFaces[curEdgeID][0]]
484 for (
const label cf : curFaces)
490 const label cfZone = zoneMesh.whichZone(cf);
493 cfZone != faceZoneID_.index()
507 addedCells[edgeFaces[curEdgeID][0]],
510 meshEdges[curEdgeID],
521 Pout<<
"add duplicate boundary face: " << newFace
524 << addedCells[edgeFaces[curEdgeID][0]] <<
endl;
557 if (zoneMesh.whichZone(curFaces[facei]) != faceZoneID_.index())
559 masterCellFaceMap.insert(curFaces[facei]);
565 Map<label> masterLayerPointMap(mp, addedPoints);
569 const labelList masterCellFaces = masterCellFaceMap.toc();
571 forAll(masterCellFaces, facei)
576 const label curFaceID = masterCellFaces[facei];
578 const face& oldFace = faces[curFaceID];
580 face newFace(oldFace.size());
582 bool changed =
false;
586 if (masterLayerPointMap.found(oldFace[pointi]))
590 newFace[pointi] = masterLayerPointMap.find(oldFace[pointi])();
594 newFace[pointi] = oldFace[pointi];
603 bool modifiedFaceZoneFlip =
false;
605 if (modifiedFaceZone >= 0)
607 modifiedFaceZoneFlip =
634 Pout<<
"modifying stick-out face. Internal Old face: "
636 <<
" new face: " << newFace
637 <<
" own: " << own[curFaceID]
638 <<
" nei: " << nei[curFaceID]
663 Pout<<
"modifying stick-out face. Boundary Old face: "
665 <<
" new face: " << newFace
666 <<
" own: " << own[curFaceID]
677 Pout<<
"void layerAdditionRemoval::addCellLayer(polyTopoChange&) const "
678 <<
" for object " <<
name() <<
": "
679 <<
"Finished adding cell layer" <<
endl;
A HashTable to objects of type <T> with a label key.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
A face is a list of labels corresponding to mesh vertices.
static int compare(const face &a, const face &b)
Compare faces.
face reverseFace() const
Return face with reverse direction.
Class containing data for cell addition.
A face addition data class. A face can be inflated either from a point or from another face and can e...
Class containing data for point addition.
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
const word & name() const
Return name of this modifier.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
Class describing modification of a face.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const polyMesh & mesh() const
Return the mesh reference.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
static const unsigned facesPerCell_
Estimated number of faces per cell.
const labelListList & edgeFaces() const
const cellList & cells() const
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar mp
Proton mass.
Namespace for handling debugging switches.
List< edge > edgeList
List of edge.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
List< cell > cellList
List of cell.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
#define forAll(list, i)
Loop across all elements in list.