59 void Foam::createShellMesh::syncEdges
61 const globalMeshData& globalData,
65 const PackedBoolList& sameEdgeOrientation,
66 const bool syncNonCollocated,
68 PackedBoolList& isChangedEdge,
69 DynamicList<label>& changedEdges,
73 const distributionMap& map = globalData.globalEdgeSlavesMap();
74 const PackedBoolList& cppOrientation = globalData.globalEdgeOrientation();
85 label patchEdgeI = patchEdges[i];
86 label coupledEdgeI = coupledEdges[i];
88 if (isChangedEdge[patchEdgeI])
90 const labelPair& data = allEdgeData[patchEdgeI];
95 if (sameEdgeOrientation[i] == cppOrientation[coupledEdgeI])
97 cppEdgeData[coupledEdgeI] = data;
101 cppEdgeData[coupledEdgeI] =
labelPair(data[1], data[0]);
110 globalData.globalEdgeSlaves(),
113 ? globalData.globalEdgeTransformedSlaves()
123 label patchEdgeI = patchEdges[i];
124 label coupledEdgeI = coupledEdges[i];
128 const labelPair& data = cppEdgeData[coupledEdgeI];
130 if (sameEdgeOrientation[i] == cppOrientation[coupledEdgeI])
132 allEdgeData[patchEdgeI] = data;
136 allEdgeData[patchEdgeI] =
labelPair(data[1], data[0]);
139 if (!isChangedEdge[patchEdgeI])
141 changedEdges.append(patchEdgeI);
142 isChangedEdge[patchEdgeI] =
true;
154 const bool syncNonCollocated,
183 label nMaxRegions = 0;
187 nMaxRegions +=
f.
size();
195 pointGlobalRegions.
setSize(patch.size());
196 forAll(pointGlobalRegions, facei)
199 labelList& pRegions = pointGlobalRegions[facei];
203 pRegions[fp] = globalRegions.
toGlobal(nRegions++);
218 if (!nonManifoldEdge[edgeI])
229 pointGlobalRegions[facei][fp0],
230 pointGlobalRegions[facei][fp1]
232 if (!isChangedEdge[edgeI])
234 changedEdges.
append(edgeI);
235 isChangedEdge[edgeI] =
true;
268 forAll(changedEdges, changedI)
270 label edgeI = changedEdges[changedI];
271 const labelPair& edgeData = allEdgeData[edgeI];
278 label facei = eFaces[i];
283 if (pointGlobalRegions[facei][fp0] > edgeData[0])
285 pointGlobalRegions[facei][fp0] = edgeData[0];
286 if (!isChangedFace[facei])
288 isChangedFace[facei] =
true;
289 changedFaces.
append(facei);
294 if (pointGlobalRegions[facei][fp1] > edgeData[1])
296 pointGlobalRegions[facei][fp1] = edgeData[1];
297 if (!isChangedFace[facei])
299 isChangedFace[facei] =
true;
300 changedFaces.
append(facei);
308 if (nChangedFaces == 0)
317 isChangedEdge =
false;
318 changedEdges.
clear();
322 label facei = changedFaces[i];
328 label edgeI = fEdges[fp];
330 if (!nonManifoldEdge[edgeI])
334 label region0 = pointGlobalRegions[facei][fp0];
336 label region1 = pointGlobalRegions[facei][fp1];
340 (allEdgeData[edgeI][0] > region0)
341 || (allEdgeData[edgeI][1] > region1)
344 allEdgeData[edgeI] =
labelPair(region0, region1);
345 if (!isChangedEdge[edgeI])
347 changedEdges.
append(edgeI);
348 isChangedEdge[edgeI] =
true;
371 if (nChangedEdges == 0)
383 pointLocalRegions.
setSize(patch.size());
389 face& pRegions = pointLocalRegions[facei];
393 label globalRegionI = pointGlobalRegions[facei][fp];
397 if (fnd != globalToLocalRegion.
end())
400 pRegions[fp] = fnd();
405 label localRegionI = globalToLocalRegion.
size();
406 pRegions[fp] = localRegionI;
407 globalToLocalRegion.
insert(globalRegionI, localRegionI);
408 dynLocalToGlobalRegion.
append(globalRegionI);
412 localToGlobalRegion.
transfer(dynLocalToGlobalRegion);
426 pointRegions_(pointRegions),
427 regionPoints_(regionPoints)
429 if (pointRegions_.
size() != patch_.size())
432 <<
"nFaces:" << patch_.size()
433 <<
" pointRegions:" << pointRegions.
size()
444 const scalar expansionRatio,
452 if (firstLayerDisp.
size() != regionPoints_.size())
455 <<
"nRegions:" << regionPoints_.size()
456 <<
" firstLayerDisp:" << firstLayerDisp.
size()
462 topPatchID.
size() != patch_.size()
463 && bottomPatchID.
size() != patch_.size()
467 <<
"nFaces:" << patch_.size()
468 <<
" topPatchID:" << topPatchID.
size()
469 <<
" bottomPatchID:" << bottomPatchID.
size()
473 if (extrudeEdgePatches.
size() != patch_.nEdges())
476 <<
"nEdges:" << patch_.nEdges()
477 <<
" extrudeEdgePatches:" << extrudeEdgePatches.
size()
488 (nLayers+1)*(patch_.size()+patch_.nEdges())
499 labelList addedCells(nLayers*patch_.size());
502 for (
label layerI = 0; layerI < nLayers; layerI++)
504 addedCells[nLayers*facei+layerI] = meshMod.
addCell
508 cellToFaceMap.
append(facei);
517 forAll(patch_.localPoints(), pointi)
522 patch_.localPoints()[pointi],
523 pointToPointMap.
size(),
526 pointToPointMap.
append(pointi);
538 labelList addedPoints(nLayers*regionPoints_.size());
539 forAll(regionPoints_, regionI)
541 label pointi = regionPoints_[regionI];
543 point pt = patch_.localPoints()[pointi];
544 point disp = firstLayerDisp[regionI];
545 for (
label layerI = 0; layerI < nLayers; layerI++)
549 addedPoints[nLayers*regionI+layerI] = meshMod.
addPoint
552 pointToPointMap.
size(),
555 pointToPointMap.
append(pointi);
557 disp *= expansionRatio;
563 forAll(patch_.localFaces(), facei)
567 patch_.localFaces()[facei].reverseFace(),
568 addedCells[nLayers*facei],
570 faceToFaceMap.
size(),
575 faceToFaceMap.
append(-facei-1);
580 forAll(patch_.localFaces(), facei)
583 const face&
f = patch_.localFaces()[facei];
587 for (
label layerI = 0; layerI < nLayers; layerI++)
592 label region = pointRegions_[facei][fp];
593 newF[fp] = addedPoints[region*nLayers+layerI];
596 label own = addedCells[facei*nLayers+layerI];
599 if (layerI == nLayers-1)
602 patchi = topPatchID[facei];
606 nei = addedCells[facei*nLayers+layerI+1];
615 faceToFaceMap.
size(),
620 faceToFaceMap.
append(facei+1);
632 forAll(extrudeEdgePatches, edgeI)
634 const labelList& eFaces = patch_.edgeFaces()[edgeI];
635 const labelList& ePatches = extrudeEdgePatches[edgeI];
637 if (ePatches.
size() == 0)
640 if (eFaces.
size() != 2)
644 <<
" not internal but does not have side-patches defined."
650 if (eFaces.
size() != ePatches.
size())
653 <<
"external/feature edge:" << edgeI
654 <<
" has " << eFaces.
size() <<
" connected extruded faces "
655 <<
" but only " << ePatches.
size()
663 const face&
f = patch_.localFaces()[eFaces[0]];
664 const edge&
e = patch_.edges()[edgeI];
677 for (
label layerI = 0; layerI < nLayers; layerI++)
679 label region0 = pointRegions_[eFaces[0]][fp0];
680 label region1 = pointRegions_[eFaces[0]][fp1];
687 newF[2] = addedPoints[nLayers*region1+layerI];
688 newF[3] = addedPoints[nLayers*region0+layerI];
692 newF[0] = addedPoints[nLayers*region0+layerI-1];
693 newF[1] = addedPoints[nLayers*region1+layerI-1];
694 newF[2] = addedPoints[nLayers*region1+layerI];
695 newF[3] = addedPoints[nLayers*region0+layerI];
706 for (
label i = 0; i < newF.
size()-1; i++)
708 newF[i] = newF[newF.
fcIndex(i)];
714 label minCelli = addedCells[nLayers*eFaces[0]+layerI];
717 if (ePatches.
size() == 0)
719 maxCelli = addedCells[nLayers*eFaces[1]+layerI];
720 if (minCelli > maxCelli)
723 Swap(minCelli, maxCelli);
740 faceToFaceMap.
size(),
746 faceToEdgeMap.
append(edgeI);
751 forAll(extrudeEdgePatches, edgeI)
753 const labelList& eFaces = patch_.edgeFaces()[edgeI];
754 const labelList& ePatches = extrudeEdgePatches[edgeI];
756 if (ePatches.
size() >= 2)
758 for (
label i = 1; i < ePatches.
size(); i++)
761 label minFacei = eFaces[i];
764 const face&
f = patch_.localFaces()[minFacei];
766 const edge&
e = patch_.edges()[edgeI];
777 for (
label layerI = 0; layerI < nLayers; layerI++)
779 label region0 = pointRegions_[minFacei][fp0];
780 label region1 = pointRegions_[minFacei][fp1];
786 newF[2] = addedPoints[nLayers*region1+layerI];
787 newF[3] = addedPoints[nLayers*region0+layerI];
791 newF[0] = addedPoints[nLayers*region0+layerI-1];
792 newF[1] = addedPoints[nLayers*region1+layerI-1];
793 newF[2] = addedPoints[nLayers*region1+layerI];
794 newF[3] = addedPoints[nLayers*region0+layerI];
806 for (
label i = 0; i < newF.
size()-1; i++)
808 newF[i] = newF[newF.
fcIndex(i)];
817 addedCells[nLayers*minFacei+layerI],
819 faceToFaceMap.
size(),
824 faceToEdgeMap.
append(edgeI);
831 cellToFaceMap_.transfer(cellToFaceMap);
832 faceToFaceMap_.transfer(faceToFaceMap);
833 faceToEdgeMap_.transfer(faceToEdgeMap);
834 pointToPointMap_.transfer(pointToPointMap);
#define forAll(list, i)
Loop across all elements in list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A list of faces which address into the list of points.
label nEdges() const
Return number of edges in patch.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
const labelListList & edgeFaces() const
Return edge-face addressing.
const labelListList & faceEdges() const
Return face-edge addressing.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
T & last()
Return the last element of the list.
Creates mesh by extruding a patch.
void topoChange(const polyTopoChangeMap &)
Update any locally stored mesh information.
createShellMesh(const primitiveFacePatch &patch, const faceList &pointRegions, const labelList ®ionPoints)
Construct from mesh.
static void calcPointRegions(const globalMeshData &globalData, const primitiveFacePatch &patch, const PackedBoolList &nonManifoldEdge, const bool syncNonCollocated, faceList &pointGlobalRegions, faceList &pointLocalRegions, labelList &localToGlobalRegion)
Helper: calculate point regions. The point region is the.
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 point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
face reverseFace() const
Return face with reverse direction.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label localSize() const
My local size.
label toGlobal(const label i) const
From local to global.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
void operator()(labelPair &x, const labelPair &y) const
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
const labelList & reverseCellMap() const
Reverse cell map.
const labelList & reverseFaceMap() const
Reverse face map.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label addCell(const label masterCellID)
Add cell and return new cell index.
label addPoint(const point &, const label masterPointID, const bool inCell)
Add point and return new point index.
label addFace(const face &f, const label own, const label nei, const label masterFaceID, const bool flipFaceFlux, const label patchID)
Add face to cells and return new face index.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< labelPair > labelPairList
List of labelPairs.
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static const label labelMax
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable