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);
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);
List< labelList > labelListList
A List of labelList.
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 inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const distributionMap & globalEdgeSlavesMap() const
const labelListList & globalEdgeSlaves() const
createShellMesh(const primitiveFacePatch &patch, const faceList &pointRegions, const labelList ®ionPoints)
Construct from mesh.
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
const labelList & reverseFaceMap() const
Reverse face map.
A list of faces which address into the list of points.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
face reverseFace() const
Return face with reverse direction.
void topoChange(const polyTopoChangeMap &)
Update any locally stored mesh information.
An ordered pair of two objects of type <T> with first() and second() elements.
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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const labelListList & edgeFaces() const
Return edge-face addressing.
const labelList & reversePointMap() const
Reverse point map.
Pair< label > labelPair
Label pair.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
static const label labelMax
label addPoint(const point &, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
label constructSize() const
Constructed data size.
label nEdges() const
Return number of edges in patch.
static direction size()
Return the number of elements in the VectorSpace = Ncmpts.
static void syncData(List< Type > &pointData, const labelListList &slaves, const labelListList &transformedSlaves, const distributionMap &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
defineTypeNameAndDebug(combustionModel, 0)
Database for solution and other reduced data.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
const labelList & reverseCellMap() const
Reverse cell map.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
void setSize(const label)
Reset size of List.
label toGlobal(const label i) const
From local to global.
Class containing processor-to-processor mapping information.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const labelListList & faceEdges() const
Return face-edge addressing.
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.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const doubleScalar e
Elementary charge.
T & last()
Return the last element of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
const labelListList & globalEdgeTransformedSlaves() const
void operator()(labelPair &x, const labelPair &y) const
label localSize() const
My local size.