53 x[0] =
min(x[0], y[0]);
54 x[1] =
min(x[1], y[1]);
63 void Foam::createShellMesh::syncEdges
70 const bool syncNonCollocated,
89 label patchEdgeI = patchEdges[i];
90 label coupledEdgeI = coupledEdges[i];
92 if (isChangedEdge[patchEdgeI])
99 if (sameEdgeOrientation[i] == cppOrientation[coupledEdgeI])
101 cppEdgeData[coupledEdgeI] = data;
105 cppEdgeData[coupledEdgeI] =
labelPair(data[1], data[0]);
127 label patchEdgeI = patchEdges[i];
128 label coupledEdgeI = coupledEdges[i];
134 if (sameEdgeOrientation[i] == cppOrientation[coupledEdgeI])
136 allEdgeData[patchEdgeI] = data;
140 allEdgeData[patchEdgeI] =
labelPair(data[1], data[0]);
143 if (!isChangedEdge[patchEdgeI])
145 changedEdges.
append(patchEdgeI);
146 isChangedEdge[patchEdgeI] =
true;
158 const bool syncNonCollocated,
187 label nMaxRegions = 0;
191 nMaxRegions += f.
size();
199 pointGlobalRegions.
setSize(patch.size());
200 forAll(pointGlobalRegions, faceI)
203 labelList& pRegions = pointGlobalRegions[faceI];
207 pRegions[fp] = globalRegions.
toGlobal(nRegions++);
222 if (!nonManifoldEdge[edgeI])
233 pointGlobalRegions[faceI][fp0],
234 pointGlobalRegions[faceI][fp1]
236 if (!isChangedEdge[edgeI])
238 changedEdges.
append(edgeI);
239 isChangedEdge[edgeI] =
true;
272 forAll(changedEdges, changedI)
274 label edgeI = changedEdges[changedI];
275 const labelPair& edgeData = allEdgeData[edgeI];
282 label faceI = eFaces[i];
287 if (pointGlobalRegions[faceI][fp0] > edgeData[0])
289 pointGlobalRegions[faceI][fp0] = edgeData[0];
290 if (!isChangedFace[faceI])
292 isChangedFace[faceI] =
true;
293 changedFaces.append(faceI);
298 if (pointGlobalRegions[faceI][fp1] > edgeData[1])
300 pointGlobalRegions[faceI][fp1] = edgeData[1];
301 if (!isChangedFace[faceI])
303 isChangedFace[faceI] =
true;
304 changedFaces.append(faceI);
312 if (nChangedFaces == 0)
321 isChangedEdge =
false;
322 changedEdges.
clear();
326 label faceI = changedFaces[i];
332 label edgeI = fEdges[fp];
334 if (!nonManifoldEdge[edgeI])
338 label region0 = pointGlobalRegions[faceI][fp0];
340 label region1 = pointGlobalRegions[faceI][fp1];
344 (allEdgeData[edgeI][0] > region0)
345 || (allEdgeData[edgeI][1] > region1)
348 allEdgeData[edgeI] =
labelPair(region0, region1);
349 if (!isChangedEdge[edgeI])
351 changedEdges.
append(edgeI);
352 isChangedEdge[edgeI] =
true;
375 if (nChangedEdges == 0)
387 pointLocalRegions.
setSize(patch.size());
393 face& pRegions = pointLocalRegions[faceI];
397 label globalRegionI = pointGlobalRegions[faceI][fp];
401 if (fnd != globalToLocalRegion.
end())
404 pRegions[fp] = fnd();
409 label localRegionI = globalToLocalRegion.size();
410 pRegions[fp] = localRegionI;
411 globalToLocalRegion.insert(globalRegionI, localRegionI);
412 dynLocalToGlobalRegion.
append(globalRegionI);
416 localToGlobalRegion.
transfer(dynLocalToGlobalRegion);
422 Foam::createShellMesh::createShellMesh
430 pointRegions_(pointRegions),
431 regionPoints_(regionPoints)
433 if (pointRegions_.size() != patch_.size())
436 <<
"nFaces:" << patch_.size()
437 <<
" pointRegions:" << pointRegions.
size()
448 const scalar expansionRatio,
456 if (firstLayerDisp.
size() != regionPoints_.size())
459 <<
"nRegions:" << regionPoints_.size()
460 <<
" firstLayerDisp:" << firstLayerDisp.
size()
466 topPatchID.
size() != patch_.size()
467 && bottomPatchID.
size() != patch_.size()
471 <<
"nFaces:" << patch_.size()
472 <<
" topPatchID:" << topPatchID.
size()
473 <<
" bottomPatchID:" << bottomPatchID.
size()
477 if (extrudeEdgePatches.
size() != patch_.nEdges())
480 <<
"nEdges:" << patch_.nEdges()
481 <<
" extrudeEdgePatches:" << extrudeEdgePatches.
size()
492 (nLayers+1)*(patch_.size()+patch_.nEdges())
503 labelList addedCells(nLayers*patch_.size());
506 for (
label layerI = 0; layerI < nLayers; layerI++)
508 addedCells[nLayers*faceI+layerI] = meshMod.
addCell 513 cellToFaceMap.size(),
516 cellToFaceMap.append(faceI);
525 forAll(patch_.localPoints(), pointI)
530 patch_.localPoints()[pointI],
531 pointToPointMap.size(),
535 pointToPointMap.append(pointI);
547 labelList addedPoints(nLayers*regionPoints_.size());
548 forAll(regionPoints_, regionI)
550 label pointI = regionPoints_[regionI];
552 point pt = patch_.localPoints()[pointI];
553 point disp = firstLayerDisp[regionI];
554 for (
label layerI = 0; layerI < nLayers; layerI++)
558 addedPoints[nLayers*regionI+layerI] = meshMod.
addPoint 561 pointToPointMap.
size(),
565 pointToPointMap.append(pointI);
567 disp *= expansionRatio;
573 forAll(patch_.localFaces(), faceI)
577 patch_.localFaces()[faceI].reverseFace(),
578 addedCells[nLayers*faceI],
582 faceToFaceMap.
size(),
584 bottomPatchID[faceI],
588 faceToFaceMap.
append(-faceI-1);
602 forAll(patch_.localFaces(), faceI)
605 const face&
f = patch_.localFaces()[faceI];
609 for (
label layerI = 0; layerI < nLayers; layerI++)
614 label region = pointRegions_[faceI][fp];
615 newF[fp] = addedPoints[region*nLayers+layerI];
618 label own = addedCells[faceI*nLayers+layerI];
621 if (layerI == nLayers-1)
624 patchI = topPatchID[faceI];
628 nei = addedCells[faceI*nLayers+layerI+1];
639 faceToFaceMap.
size(),
645 faceToFaceMap.
append(faceI+1);
665 forAll(extrudeEdgePatches, edgeI)
667 const labelList& eFaces = patch_.edgeFaces()[edgeI];
668 const labelList& ePatches = extrudeEdgePatches[edgeI];
670 if (ePatches.
size() == 0)
673 if (eFaces.
size() != 2)
677 <<
" not internal but does not have side-patches defined." 683 if (eFaces.
size() != ePatches.
size())
686 <<
"external/feature edge:" << edgeI
687 <<
" has " << eFaces.
size() <<
" connected extruded faces " 688 <<
" but only " << ePatches.
size()
696 const face&
f = patch_.localFaces()[eFaces[0]];
697 const edge&
e = patch_.edges()[edgeI];
710 for (
label layerI = 0; layerI < nLayers; layerI++)
712 label region0 = pointRegions_[eFaces[0]][fp0];
713 label region1 = pointRegions_[eFaces[0]][fp1];
720 newF[2] = addedPoints[nLayers*region1+layerI];
721 newF[3] = addedPoints[nLayers*region0+layerI];
725 newF[0] = addedPoints[nLayers*region0+layerI-1];
726 newF[1] = addedPoints[nLayers*region1+layerI-1];
727 newF[2] = addedPoints[nLayers*region1+layerI];
728 newF[3] = addedPoints[nLayers*region0+layerI];
739 for (
label i = 0; i < newF.
size()-1; i++)
741 newF[i] = newF[newF.
fcIndex(i)];
747 label minCellI = addedCells[nLayers*eFaces[0]+layerI];
750 if (ePatches.
size() == 0)
752 maxCellI = addedCells[nLayers*eFaces[1]+layerI];
753 if (minCellI > maxCellI)
756 Swap(minCellI, maxCellI);
764 patchI = ePatches[0];
790 faceToFaceMap.
size(),
797 faceToEdgeMap.
append(edgeI);
802 forAll(extrudeEdgePatches, edgeI)
804 const labelList& eFaces = patch_.edgeFaces()[edgeI];
805 const labelList& ePatches = extrudeEdgePatches[edgeI];
807 if (ePatches.
size() >= 2)
809 for (
label i = 1; i < ePatches.
size(); i++)
812 label minFaceI = eFaces[i];
815 const face&
f = patch_.localFaces()[minFaceI];
817 const edge&
e = patch_.edges()[edgeI];
828 for (
label layerI = 0; layerI < nLayers; layerI++)
830 label region0 = pointRegions_[minFaceI][fp0];
831 label region1 = pointRegions_[minFaceI][fp1];
837 newF[2] = addedPoints[nLayers*region1+layerI];
838 newF[3] = addedPoints[nLayers*region0+layerI];
842 newF[0] = addedPoints[nLayers*region0+layerI-1];
843 newF[1] = addedPoints[nLayers*region1+layerI-1];
844 newF[2] = addedPoints[nLayers*region1+layerI];
845 newF[3] = addedPoints[nLayers*region0+layerI];
857 for (
label i = 0; i < newF.
size()-1; i++)
859 newF[i] = newF[newF.
fcIndex(i)];
881 addedCells[nLayers*minFaceI+layerI],
885 faceToFaceMap.
size(),
892 faceToEdgeMap.
append(edgeI);
899 cellToFaceMap_.transfer(cellToFaceMap);
900 faceToFaceMap_.transfer(faceToFaceMap);
901 faceToEdgeMap_.transfer(faceToEdgeMap);
902 pointToPointMap_.transfer(pointToPointMap);
const mapDistribute & globalEdgeSlavesMap() const
label size() const
Return the number of elements in the VectorSpace = nCmpt.
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.
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
const labelList & reverseFaceMap() const
Reverse face map.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
label localSize() const
My local size.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
An ordered pair of two objects of type <T> with first() and second() elements.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
face reverseFace() const
Return face with reverse direction.
static void matchEdges(const PrimitivePatch< Face1, FaceList1, PointField1, PointType1 > &p1, const PrimitivePatch< Face2, FaceList2, PointField2, PointType2 > &p2, labelList &p1EdgeLabels, labelList &p2EdgeLabels, PackedBoolList &sameOrientation)
Find corresponding edges on patches sharing the same points.
const labelListList & edgeFaces() const
Return edge-face addressing.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
Class containing processor-to-processor mapping information.
T & last()
Return the last element of the list.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void clear()
Clear the addressed list, i.e. set the size to zero.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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 size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Database for solution data, solver performance and other reduced data.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void operator()(labelPair &x, const labelPair &y) const
A face is a list of labels corresponding to mesh vertices.
const double e
Elementary charge.
void setSize(const label)
Reset size of List.
const labelListList & globalEdgeTransformedSlaves() const
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
label addPoint(const point &, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
const labelListList & globalEdgeSlaves() const
void updateMesh(const mapPolyMesh &)
Update any locally stored mesh information.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A list of faces which address into the list of points.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
label toGlobal(const label i) const
From local to global.
const labelListList & faceEdges() const
Return face-edge addressing.
Pair< label > labelPair
Label pair.
const labelList & reverseCellMap() const
Reverse cell map.
Direct mesh changes based on v1.3 polyTopoChange syntax.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
static void syncData(List< Type > &pointData, const labelListList &slaves, const labelListList &transformedSlaves, const mapDistribute &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
void append(const T &)
Append an element at the end of the list.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
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.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label nEdges() const
Return number of edges in patch.
List< labelList > labelListList
A List of labelList.
defineTypeNameAndDebug(combustionModel, 0)
label constructSize() const
Constructed data size.
static const label labelMax