66void Foam::createShellMesh::syncEdges
72 const bitSet& sameEdgeOrientation,
73 const bool syncNonCollocated,
92 label patchEdgeI = patchEdges[i];
93 label coupledEdgeI = coupledEdges[i];
95 if (isChangedEdge[patchEdgeI])
97 const labelPair& data = allEdgeData[patchEdgeI];
102 if (sameEdgeOrientation[i] == cppOrientation[coupledEdgeI])
104 cppEdgeData[coupledEdgeI] = data;
108 cppEdgeData[coupledEdgeI] =
labelPair(data[1], data[0]);
130 label patchEdgeI = patchEdges[i];
131 label coupledEdgeI = coupledEdges[i];
135 const labelPair& data = cppEdgeData[coupledEdgeI];
137 if (sameEdgeOrientation[i] == cppOrientation[coupledEdgeI])
139 allEdgeData[patchEdgeI] = data;
143 allEdgeData[patchEdgeI] =
labelPair(data[1], data[0]);
146 if (!isChangedEdge[patchEdgeI])
148 changedEdges.
append(patchEdgeI);
149 isChangedEdge.
set(patchEdgeI);
160 const bitSet& nonManifoldEdge,
161 const bool syncNonCollocated,
173 bitSet sameEdgeOrientation;
190 label nMaxRegions = 0;
194 nMaxRegions +=
f.
size();
202 pointGlobalRegions.setSize(
patch.size());
203 forAll(pointGlobalRegions, facei)
206 labelList& pRegions = pointGlobalRegions[facei];
207 pRegions.setSize(
f.
size());
210 pRegions[fp] = globalRegions.toGlobal(nRegions++);
225 if (!nonManifoldEdge[edgeI])
229 label facei =
patch.edgeFaces()[edgeI][0];
236 pointGlobalRegions[facei][fp0],
237 pointGlobalRegions[facei][fp1]
239 if (!isChangedEdge[edgeI])
241 changedEdges.
append(edgeI);
242 isChangedEdge.
set(edgeI);
275 forAll(changedEdges, changedI)
277 label edgeI = changedEdges[changedI];
278 const labelPair& edgeData = allEdgeData[edgeI];
285 label facei = eFaces[i];
290 if (pointGlobalRegions[facei][fp0] > edgeData[0])
292 pointGlobalRegions[facei][fp0] = edgeData[0];
293 if (!isChangedFace[facei])
295 isChangedFace.set(facei);
296 changedFaces.append(facei);
301 if (pointGlobalRegions[facei][fp1] > edgeData[1])
303 pointGlobalRegions[facei][fp1] = edgeData[1];
304 if (!isChangedFace[facei])
306 isChangedFace.set(facei);
307 changedFaces.append(facei);
323 isChangedEdge =
false;
324 changedEdges.
clear();
328 label facei = changedFaces[i];
334 label edgeI = fEdges[fp];
336 if (!nonManifoldEdge[edgeI])
340 label region0 = pointGlobalRegions[facei][fp0];
342 label region1 = pointGlobalRegions[facei][fp1];
346 (allEdgeData[edgeI][0] > region0)
347 || (allEdgeData[edgeI][1] > region1)
350 allEdgeData[edgeI] =
labelPair(region0, region1);
351 if (!isChangedEdge[edgeI])
353 changedEdges.
append(edgeI);
354 isChangedEdge.
set(edgeI);
388 pointLocalRegions.setSize(
patch.size());
389 Map<label> globalToLocalRegion(globalRegions.localSize()/4);
394 face& pRegions = pointLocalRegions[facei];
398 label globalRegionI = pointGlobalRegions[facei][fp];
400 const auto fnd = globalToLocalRegion.cfind(globalRegionI);
405 pRegions[fp] = fnd();
410 label localRegionI = globalToLocalRegion.size();
411 pRegions[fp] = localRegionI;
412 globalToLocalRegion.insert(globalRegionI, localRegionI);
413 dynLocalToGlobalRegion.append(globalRegionI);
417 localToGlobalRegion.transfer(dynLocalToGlobalRegion);
423Foam::createShellMesh::createShellMesh
431 pointRegions_(pointRegions),
432 regionPoints_(regionPoints)
434 if (pointRegions_.
size() != patch_.
size())
437 <<
"nFaces:" << patch_.size()
438 <<
" pointRegions:" << pointRegions.size()
449 const scalar expansionRatio,
457 if (firstLayerDisp.
size() != regionPoints_.size())
460 <<
"nRegions:" << regionPoints_.size()
461 <<
" firstLayerDisp:" << firstLayerDisp.
size()
467 topPatchID.
size() != patch_.size()
468 && bottomPatchID.
size() != patch_.size()
472 <<
"nFaces:" << patch_.size()
473 <<
" topPatchID:" << topPatchID.
size()
474 <<
" bottomPatchID:" << bottomPatchID.
size()
478 if (extrudeEdgePatches.
size() != patch_.nEdges())
481 <<
"nEdges:" << patch_.nEdges()
482 <<
" extrudeEdgePatches:" << extrudeEdgePatches.
size()
493 (nLayers+1)*(patch_.size()+patch_.nEdges())
504 labelList addedCells(nLayers*patch_.size());
507 for (label layerI = 0; layerI < nLayers; layerI++)
509 addedCells[nLayers*facei+layerI] = meshMod.
addCell
514 cellToFaceMap.size(),
517 cellToFaceMap.append(facei);
526 forAll(patch_.localPoints(), pointi)
531 patch_.localPoints()[pointi],
532 pointToPointMap.size(),
536 pointToPointMap.append(pointi);
548 labelList addedPoints(nLayers*regionPoints_.size());
549 forAll(regionPoints_, regionI)
551 label pointi = regionPoints_[regionI];
553 point pt = patch_.localPoints()[pointi];
554 point disp = firstLayerDisp[regionI];
555 for (label layerI = 0; layerI < nLayers; layerI++)
559 addedPoints[nLayers*regionI+layerI] = meshMod.
addPoint
562 pointToPointMap.size(),
566 pointToPointMap.append(pointi);
568 disp *= expansionRatio;
574 forAll(patch_.localFaces(), facei)
578 patch_.localFaces()[facei].reverseFace(),
579 addedCells[nLayers*facei],
583 faceToFaceMap.size(),
585 bottomPatchID[facei],
589 faceToFaceMap.append(-facei-1);
590 faceToEdgeMap.append(-1);
603 forAll(patch_.localFaces(), facei)
606 const face&
f = patch_.localFaces()[facei];
610 for (label layerI = 0; layerI < nLayers; layerI++)
615 label region = pointRegions_[facei][fp];
616 newF[fp] = addedPoints[region*nLayers+layerI];
619 label own = addedCells[facei*nLayers+layerI];
622 if (layerI == nLayers-1)
625 patchi = topPatchID[facei];
629 nei = addedCells[facei*nLayers+layerI+1];
640 faceToFaceMap.size(),
646 faceToFaceMap.append(facei+1);
647 faceToEdgeMap.append(-1);
666 forAll(extrudeEdgePatches, edgeI)
668 const labelList& eFaces = patch_.edgeFaces()[edgeI];
669 const labelList& ePatches = extrudeEdgePatches[edgeI];
671 if (ePatches.size() == 0)
674 if (eFaces.size() != 2)
678 <<
" not internal but does not have side-patches defined."
684 if (eFaces.size() != ePatches.size())
687 <<
"external/feature edge:" << edgeI
688 <<
" has " << eFaces.size() <<
" connected extruded faces "
689 <<
" but only " << ePatches.size()
697 const face&
f = patch_.localFaces()[eFaces[0]];
698 const edge&
e = patch_.edges()[edgeI];
711 for (label layerI = 0; layerI < nLayers; layerI++)
713 label region0 = pointRegions_[eFaces[0]][fp0];
714 label region1 = pointRegions_[eFaces[0]][fp1];
721 newF[2] = addedPoints[nLayers*region1+layerI];
722 newF[3] = addedPoints[nLayers*region0+layerI];
726 newF[0] = addedPoints[nLayers*region0+layerI-1];
727 newF[1] = addedPoints[nLayers*region1+layerI-1];
728 newF[2] = addedPoints[nLayers*region1+layerI];
729 newF[3] = addedPoints[nLayers*region0+layerI];
740 for (label i = 0; i < newF.size()-1; i++)
742 newF[i] = newF[newF.fcIndex(i)];
748 label minCelli = addedCells[nLayers*eFaces[0]+layerI];
751 if (ePatches.size() == 0)
753 maxCelli = addedCells[nLayers*eFaces[1]+layerI];
754 if (minCelli > maxCelli)
757 std::swap(minCelli, maxCelli);
765 patchi = ePatches[0];
791 faceToFaceMap.size(),
797 faceToFaceMap.append(0);
798 faceToEdgeMap.append(edgeI);
803 forAll(extrudeEdgePatches, edgeI)
805 const labelList& eFaces = patch_.edgeFaces()[edgeI];
806 const labelList& ePatches = extrudeEdgePatches[edgeI];
808 if (ePatches.size() >= 2)
810 for (label i = 1; i < ePatches.size(); i++)
813 label minFacei = eFaces[i];
816 const face&
f = patch_.localFaces()[minFacei];
818 const edge&
e = patch_.edges()[edgeI];
829 for (label layerI = 0; layerI < nLayers; layerI++)
831 label region0 = pointRegions_[minFacei][fp0];
832 label region1 = pointRegions_[minFacei][fp1];
838 newF[2] = addedPoints[nLayers*region1+layerI];
839 newF[3] = addedPoints[nLayers*region0+layerI];
843 newF[0] = addedPoints[nLayers*region0+layerI-1];
844 newF[1] = addedPoints[nLayers*region1+layerI-1];
845 newF[2] = addedPoints[nLayers*region1+layerI];
846 newF[3] = addedPoints[nLayers*region0+layerI];
858 for (label i = 0; i < newF.size()-1; i++)
860 newF[i] = newF[newF.fcIndex(i)];
882 addedCells[nLayers*minFacei+layerI],
886 faceToFaceMap.size(),
892 faceToFaceMap.append(0);
893 faceToEdgeMap.append(edgeI);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
void size(const label n)
Older name for setAddressableSize.
T & last()
Access last element of the list, position [size()-1].
label find(const T &val) const
Find index of the first occurrence of the value.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
Creates mesh by extruding a patch.
const labelList & faceToEdgeMap() const
From region side-face to patch edge. -1 for non-edge faces.
const labelList & pointToPointMap() const
From region point to patch point.
const labelList & faceToFaceMap() const
From region face to patch face. Contains turning index:
static void calcPointRegions(const globalMeshData &globalData, const primitiveFacePatch &patch, const bitSet &nonManifoldEdge, const bool syncNonCollocated, faceList &pointGlobalRegions, faceList &pointLocalRegions, labelList &localToGlobalRegion)
Helper: calculate point regions. The point region is the.
const labelList & cellToFaceMap() const
From region cell to patch face. Consecutively added so.
void updateMesh(const mapPolyMesh &)
Update any locally stored mesh information.
void setRefinement(const pointField &firstLayerThickness, const scalar expansionRatio, const label nLayers, const labelList &topPatchID, const labelList &bottomPatchID, const labelListList &extrudeEdgePatches, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layer mesh.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
void flip()
Flip the face in-place.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label toGlobal(const label proci, const label i) const
From local to global on proci.
label localSize(const label proci) const
Size of proci data.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const bitSet & globalEdgeOrientation() const
Is my edge same orientation as master edge.
const labelListList & globalEdgeTransformedSlaves() const
const mapDistribute & globalEdgeSlavesMap() const
static void syncData(List< Type > &elems, const labelListList &slaves, const labelListList &transformedSlaves, const mapDistribute &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
const labelListList & globalEdgeSlaves() const
label constructSize() const noexcept
Constructed data size.
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseCellMap() const noexcept
Reverse cell map.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
const labelList & reversePointMap() const noexcept
Reverse point map.
void operator()(labelPair &x, const labelPair &y) const
Direct mesh changes based on v1.3 polyTopoChange syntax.
label addPoint(const point &pt, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
label addFace(const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Add face to cells. Return new face label.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const std::string patch
OpenFOAM patch number as a std::string.
Pair< label > labelPair
A pair of labels.
List< labelPair > labelPairList
List of labelPair.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
List< face > faceList
List of faces.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.
void operator()(T &x, const T &y) const