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();
89 void Foam::layerAdditionRemoval::addCellLayer
110 Pout<<
"void layerAdditionRemoval::addCellLayer(" 111 <<
"polyTopoChange& ref) const for object " <<
name() <<
" : " 112 <<
"Adding cell layer" <<
endl;
117 const polyMesh&
mesh = topoChanger().mesh();
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();
202 const face oldFace = zoneFaces[facei].reverseFace();
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(2*
mp.size());
569 masterLayerPointMap.insert
577 const labelList masterCellFaces = masterCellFaceMap.toc();
579 forAll(masterCellFaces, facei)
584 const label curFaceID = masterCellFaces[facei];
586 const face& oldFace = faces[curFaceID];
588 face newFace(oldFace.size());
590 bool changed =
false;
594 if (masterLayerPointMap.found(oldFace[pointi]))
598 newFace[pointi] = masterLayerPointMap.find(oldFace[pointi])();
602 newFace[pointi] = oldFace[pointi];
611 bool modifiedFaceZoneFlip =
false;
613 if (modifiedFaceZone >= 0)
615 modifiedFaceZoneFlip =
642 Pout<<
"modifying stick-out face. Internal Old face: " 644 <<
" new face: " << newFace
645 <<
" own: " << own[curFaceID]
646 <<
" nei: " << nei[curFaceID]
671 Pout<<
"modifying stick-out face. Boundary Old face: " 673 <<
" new face: " << newFace
674 <<
" own: " << own[curFaceID]
685 Pout<<
"void layerAdditionRemoval::addCellLayer(polyTopoChange&) const " 686 <<
" for object " <<
name() <<
": " 687 <<
"Finished adding cell layer" <<
endl;
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
List< cell > cellList
List of cell.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
List< edge > edgeList
List of edge.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
List< labelList > labelListList
List of labelList.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< face > faceList
List of faces.
static const unsigned facesPerCell_
Estimated number of faces per cell.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
errorManip< error > abort(error &err)
label index() const
The index of the first matching items, -1 if no matches.
int debug
Static debugging option.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
const word & name() const
Return name of this modifier.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static int compare(const face &a, const face &b)
Compare faces.
List< label > labelList
A List of labels.
A class for managing temporary objects.
const polyMesh & mesh() const
Return the mesh reference.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const dimensionedScalar mp
Proton mass.
const labelListList & edgeFaces() const