87Foam::label Foam::addPatchCellLayer::nbrFace
89 const labelListList& edgeFaces,
94 const labelList& eFaces = edgeFaces[edgei];
96 if (eFaces.size() == 2)
98 return (eFaces[0] != facei ? eFaces[0] : eFaces[1]);
107void Foam::addPatchCellLayer::addVertex
120 if (
f[fp-1] != pointi &&
f[0] != pointi)
130bool Foam::addPatchCellLayer::sameEdgeNeighbour
135 const label thisGlobalFacei,
136 const label nbrGlobalFacei,
140 const edge&
e = pp.edges()[edgei];
145 addedPoints_[
e[0]].size()
146 || addedPoints_[
e[1]].size()
149 nbrFace(globalEdgeFaces, edgei, thisGlobalFacei)
163 const label patchFacei,
164 const label globalFacei
167 const labelList& fEdges = pp.faceEdges()[patchFacei];
175 label edgei = fEdges[fp];
176 const edge&
e = pp.edges()[edgei];
181 && ( addedPoints_[
e[0]].size() || addedPoints_[
e[1]].size() )
193 label nbrGlobalFacei = nbrFace
200 if (nbrGlobalFacei == -1)
212 const label initFp = startFp;
215 label prevFp = fEdges.rcIndex(startFp);
217 if (prevFp == initFp)
219 const edge&
e = pp.edges()[fEdges[initFp]];
220 const face& localF = pp.localFaces()[patchFacei];
223 <<
"On face:" << patchFacei
224 <<
" fc:" << pp.faceCentres()[patchFacei]
225 <<
" vertices:" << localF
227 << UIndirectList<point>(pp.points(), pp[patchFacei])
228 <<
" edges:" << fEdges
229 <<
" All edges of face seem to have same neighbour "
231 <<
" starting walking from edge " <<
e
257 label nextFp = fEdges.fcIndex(endFp);
283Foam::label Foam::addPatchCellLayer::addSideFace
288 const label newPatchID,
291 const label inflateFacei,
293 const label ownFacei,
294 const label nbrFacei,
295 const label meshEdgei,
297 const label numEdgeFaces,
299 polyTopoChange& meshMod
304 label addedFacei = -1;
318 if (addedCells[ownFacei].size() < numEdgeFaces)
320 label offset = numEdgeFaces - addedCells[ownFacei].size();
321 if (layeri <= offset)
327 layerOwn = layeri - offset;
343 addedFacei = meshMod.setAction
348 addedCells[ownFacei][layerOwn],
370 if (addedCells[ownFacei].size() > addedCells[nbrFacei].size())
373 addedCells[ownFacei].size() - addedCells[nbrFacei].size();
377 if (layeri <= offset)
383 layerNbr = layeri - offset;
386 else if (addedCells[nbrFacei].size() > addedCells[ownFacei].size())
389 addedCells[nbrFacei].size() - addedCells[ownFacei].size();
393 if (layeri <= offset)
399 layerOwn = layeri - offset;
411 label inflateEdgei = -1;
416 if (mesh_.isInternalFace(meshFaces[i]))
419 inflateEdgei = meshEdgei;
426 addedFacei = meshMod.setAction
431 addedCells[ownFacei][layerOwn],
432 addedCells[nbrFacei][layerNbr],
455Foam::label Foam::addPatchCellLayer::findProcPatch
457 const polyMesh&
mesh,
458 const label nbrProcID
469 refCast<const processorPolyPatch>(
patches[patchi]).neighbProcNo()
480void Foam::addPatchCellLayer::setFaceProps
482 const polyMesh&
mesh,
500void Foam::addPatchCellLayer::setFaceProps
502 const polyMesh&
mesh,
523 if (patchI != -1 || zoneI != -1)
525 inflateFaceI = faceI;
531 const edge& ppEdge = pp.edges()[ppEdgeI];
534 pp.meshPoints()[ppEdge[0]],
535 pp.meshPoints()[ppEdge[1]]
542 const edge
e(
f[fp],
f.nextLabel(fp));
552 zoneFlip = !zoneFlip;
561 <<
"Problem: cannot find patch edge " << ppEdgeI
562 <<
" with mesh vertices " << patchEdge
564 <<
" in face " << faceI <<
" with mesh vertices "
568 <<
"Continuing with potentially incorrect faceZone orientation"
576void Foam::addPatchCellLayer::findZoneFace
578 const bool useInternalFaces,
579 const bool useBoundaryFaces,
581 const polyMesh&
mesh,
600 label faceI = meshFaces[
k];
604 !excludeFaces.found(faceI)
624 if (zoneI != -1 || patchI != -1)
643 addToMesh_(addToMesh),
659 forAll(layerFaces, patchFacei)
661 const labelList& faceLabels = layerFaces[patchFacei];
663 if (faceLabels.
size())
665 labelList& added = layerCells[patchFacei];
668 for (label i = 0; i < faceLabels.
size()-1; i++)
680 return addedCells(mesh_, layerFaces_);
702 label meshEdgeI = meshEdges[edgeI];
704 const labelList& eFaces = edgeFaces[edgeI];
707 labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
711 globalEFaces[i] = globalFaces.
toGlobal(pp.addressing()[eFaces[i]]);
729void Foam::addPatchCellLayer::markPatchEdges
737 bitSet& isPatchBoundaryEdge
746 isPatchEdge.
set(meshEdges);
757 isPatchBoundaryEdge =
false;
758 forAll(edgeGlobalFaces, edgei)
764 if (edgeGlobalFaces[edgei].size() == 1)
766 isPatchBoundaryEdge.
set(meshEdges[edgei]);
774 orEqOp<unsigned int>(),
780void Foam::addPatchCellLayer::globalEdgeInfo
782 const bool zoneFromAnyFace,
784 const polyMesh&
mesh,
785 const globalIndex& globalFaces,
793 bitSet& patchEdgeToFlip
800 bitSet isExtrudeEdge;
801 bitSet isBoundaryEdge;
815 EdgeMap<label> isBoundaryEdgeSet(pp.nEdges());
816 for (
const label edgei : isBoundaryEdge)
818 isBoundaryEdgeSet.insert(
mesh.
edges()[edgei], edgei);
820 EdgeMap<label> isExtrudeEdgeSet(pp.nEdges());
821 for (
const label edgei : isExtrudeEdge)
823 isExtrudeEdgeSet.insert(
mesh.
edges()[edgei], edgei);
832 for (
const faceZone& fz: fzs)
835 UIndirectList<label>(faceToZone, addressing) = fz.index();
840 faceToFlip[addressing[i]] = fm[i];
857 const bitSet isInternalOrCoupled
865 for (
const label facei : isInternalOrCoupled)
869 label prevPointi =
f.
last();
870 for (
const label pointi :
f)
872 const edge
e(prevPointi, pointi);
876 const auto eFnd = isExtrudeEdgeSet.cfind(
e);
879 const label edgei = eFnd();
881 if (faceToZone[facei] != -1)
884 meshEdgeToFace[edgei] = globalFaces.toGlobal(facei);
885 meshEdgeToZone[edgei] = faceToZone[facei];
890 meshEdgeToFlip[edgei] = faceToFlip[facei];
894 meshEdgeToFlip[edgei] = !faceToFlip[facei];
920 isPpFace.set(pp.addressing());
923 for (
const polyPatch& pp :
patches)
933 const label facei = pp.start()+i;
935 if (!isPpFace[facei])
937 const face&
f = pp[i];
939 label prevPointi =
f.
last();
940 for (
const label pointi :
f)
942 const edge
e(prevPointi, pointi);
946 ? isExtrudeEdgeSet.cfind(
e)
947 : isBoundaryEdgeSet.cfind(
e)
951 const label edgei = eFnd();
952 if (meshEdgeToFace[edgei] == -1)
959 meshEdgeToFace[edgei] =
960 globalFaces.toGlobal(facei);
965 if (meshEdgeToPatch[edgei] == -1)
967 meshEdgeToPatch[edgei] = pp.index();
971 if (meshEdgeToZone[edgei] == -1)
973 meshEdgeToZone[edgei] =
979 meshEdgeToFlip[edgei] =
984 meshEdgeToFlip[edgei] =
1112 orEqOp<unsigned int>(),
1117 patchEdgeToFace = UIndirectList<label>(meshEdgeToFace, meshEdges);
1118 patchEdgeToPatch = UIndirectList<label>(meshEdgeToPatch, meshEdges);
1119 patchEdgeToZone = UIndirectList<label>(meshEdgeToZone, meshEdges);
1120 patchEdgeToFlip.setSize(meshEdges.size());
1121 patchEdgeToFlip =
false;
1124 patchEdgeToFlip[i] = meshEdgeToFlip[meshEdges[i]];
1131 const bool zoneFromAnyFace,
1176 forAll(globalEdgeFaces, edgei)
1178 const labelList& eGlobalFaces = globalEdgeFaces[edgei];
1181 eGlobalFaces.
size() == 2
1188 label f0 = eGlobalFaces[0];
1189 label f1 = eGlobalFaces[1];
1191 label otherProci = -1;
1194 otherProci = globalFaces.whichProcID(f1);
1198 otherProci = globalFaces.whichProcID(f0);
1202 if (otherProci != -1)
1213 procPatchi = nbrProcToPatch.
lookup(otherProci, -1);
1222 nbrProcToPatch.
insert(otherProci, procPatchi);
1223 patchToNbrProc.
insert(procPatchi, otherProci);
1227 edgePatchID[edgei] = procPatchi;
1263 if (edgePatchID[edgei] == -1)
1265 if (edgeFaces[edgei].size() == 2)
1270 if (globalFaces.
isLocal(edgeToFace[edgei]))
1272 inflateFaceID[edgei] =
1273 globalFaces.
toLocal(edgeToFace[edgei]);
1275 edgeZoneID[edgei] = edgeToZone[edgei];
1276 edgeFlip[edgei] = edgeToFlip[edgei];
1283 if (globalFaces.
isLocal(edgeToFace[edgei]))
1285 inflateFaceID[edgei] =
1286 globalFaces.
toLocal(edgeToFace[edgei]);
1288 edgePatchID[edgei] = edgeToPatch[edgei];
1289 edgeZoneID[edgei] = edgeToZone[edgei];
1290 edgeFlip[edgei] = edgeToFlip[edgei];
1302 if (edgeFaces[edgei].size() == 1 && edgePatchID[edgei] == -1)
1306 <<
"Have no sidePatchID for edge " << edgei <<
" points "
1322 edgeFaces[edgei].size() == 1
1323 && globalEdgeFaces[edgei].size() == 2
1324 && edgePatchID[edgei] != -1
1325 && inflateFaceID[edgei] == -1
1330 label myFaceI = pp.addressing()[edgeFaces[edgei][0]];
1333 label meshEdgei = meshEdges[edgei];
1342 label facei = meshFaces[
k];
1358 inflateFaceID[edgei]
1383 bitSet sameEdgeOrientation;
1398 label cppEdgei = coupledEdges[i];
1399 label ppEdgei = patchEdges[i];
1401 cppEdgeZoneID[cppEdgei] = edgeZoneID[ppEdgei];
1402 if (sameEdgeOrientation[i])
1404 cppEdgeFlip[cppEdgei] = edgeFlip[ppEdgei];
1408 cppEdgeFlip[cppEdgei] = !edgeFlip[ppEdgei];
1440 label cppEdgei = coupledEdges[i];
1441 label ppEdgei = patchEdges[i];
1443 edgeZoneID[ppEdgei] = cppEdgeZoneID[cppEdgei];
1444 if (sameEdgeOrientation[i])
1446 edgeFlip[ppEdgei] = cppEdgeFlip[cppEdgei];
1450 edgeFlip[ppEdgei] = !cppEdgeFlip[cppEdgei];
1479 Pout<<
"addPatchCellLayer::setRefinement : Adding up to "
1480 <<
gMax(nPointLayers)
1481 <<
" layers of cells to indirectPrimitivePatch with "
1489 || pp.size() != nFaceLayers.
size()
1490 || pp.size() != ppFlip.
size()
1494 <<
"Size of new points is not same as number of points used by"
1495 <<
" the face subset" <<
endl
1496 <<
" patch.nPoints:" << pp.
nPoints()
1497 <<
" displacement:" << firstLayerDisp.
size()
1498 <<
" nPointLayers:" << nPointLayers.
size() <<
nl
1499 <<
" patch.nFaces:" << pp.size()
1500 <<
" flip map:" << ppFlip.
size()
1501 <<
" nFaceLayers:" << nFaceLayers.
size()
1510 <<
"In generating stand-alone mesh the flip map should be empty"
1511 <<
". Instead it is " << ppFlip.
count()
1524 labelList stateAndFlip(mesh_.nBoundaryFaces(), 0);
1525 forAll(pp.addressing(), patchFacei)
1527 if (nFaceLayers[patchFacei] > 0)
1529 const label meshFacei = pp.addressing()[patchFacei];
1530 const label bFacei = meshFacei-mesh_.nInternalFaces();
1533 stateAndFlip[bFacei] = label(ppFlip[patchFacei]);
1538 for (
const auto& patch : mesh_.boundaryMesh())
1540 if (!patch.coupled())
1544 label& state = stateAndFlip[patch.offset()+i];
1545 state = (state == 0 ? 1 : 0);
1551 forAll(pp.addressing(), patchFacei)
1553 if (nFaceLayers[patchFacei] > 0)
1555 const label meshFacei = pp.addressing()[patchFacei];
1556 const label bFacei = meshFacei-mesh_.nInternalFaces();
1559 if (stateAndFlip[bFacei] == -1)
1562 <<
"At extruded face:" << meshFacei
1563 <<
" at:" << mesh_.faceCentres()[meshFacei]
1564 <<
" locally have nLayers:"
1565 << nFaceLayers[patchFacei]
1568 else if (stateAndFlip[bFacei] == label(ppFlip[patchFacei]))
1571 <<
"At extruded face:" << meshFacei
1572 <<
" at:" << mesh_.faceCentres()[meshFacei]
1573 <<
" locally have flip:" << ppFlip[patchFacei]
1574 <<
" which is not the opposite of coupled version "
1575 << stateAndFlip[bFacei]
1586 if (nPointLayers[i] < 0)
1589 <<
"Illegal number of layers " << nPointLayers[i]
1595 if (nFaceLayers[i] < 0)
1598 <<
"Illegal number of layers " << nFaceLayers[i]
1603 forAll(globalEdgeFaces, edgei)
1605 if (globalEdgeFaces[edgei].size() > 2)
1609 if (nPointLayers[
e[0]] > 0 || nPointLayers[
e[1]] > 0)
1612 <<
"Trying to extrude edge "
1614 <<
" which is non-manifold (has "
1615 << globalEdgeFaces[edgei].
size()
1616 <<
" local or coupled faces using it)"
1632 bitSet isBlockedFace(mesh_.nFaces());
1633 forAll(nFaceLayers, patchFacei)
1635 if (nFaceLayers[patchFacei] > 0)
1637 isBlockedFace.
set(pp.addressing()[patchFacei]);
1660 label meshPointi = meshPoints[i];
1662 if (
n[meshPointi] != nPointLayers[i])
1665 <<
"At mesh point:" << meshPointi
1666 <<
" coordinate:" << mesh_.points()[meshPointi]
1667 <<
" specified nLayers:" << nPointLayers[i] <<
endl
1668 <<
"On coupled point a different nLayers:"
1669 <<
n[meshPointi] <<
" was specified."
1680 const face&
f = pp[i];
1684 label pointi =
f[fp];
1686 nFromFace[pointi] =
max(nFromFace[pointi], nFaceLayers[i]);
1699 label meshPointi = meshPoints[i];
1704 && nPointLayers[i] != nFromFace[meshPointi]
1708 <<
"At mesh point:" << meshPointi
1709 <<
" coordinate:" << mesh_.points()[meshPointi]
1710 <<
" specified nLayers:" << nPointLayers[i] <<
endl
1711 <<
"but the max nLayers of surrounding faces is:"
1712 << nFromFace[meshPointi]
1731 label meshPointi = meshPoints[i];
1733 if (
mag(d[meshPointi] - firstLayerDisp[i]) > SMALL)
1736 <<
"At mesh point:" << meshPointi
1737 <<
" coordinate:" << mesh_.points()[meshPointi]
1738 <<
" specified displacement:" << firstLayerDisp[i]
1740 <<
"On coupled point a different displacement:"
1741 << d[meshPointi] <<
" was specified."
1757 if (nPointLayers[
e[0]] > 0 || nPointLayers[
e[1]] > 0)
1764 if (eFaces.
size() != 1)
1767 <<
"boundary-edge-to-be-extruded:"
1768 << pp.
points()[meshPoints[
e[0]]]
1769 << pp.
points()[meshPoints[
e[1]]]
1770 <<
" has more than two faces using it:" << eFaces
1831 label meshFacei = pp.addressing()[patchFacei];
1839 addedPoints_.setSize(pp.
nPoints());
1842 label nTruncated = 0;
1844 forAll(nPointLayers, patchPointi)
1846 if (nPointLayers[patchPointi] > 0)
1848 addedPoints_[patchPointi].setSize(nPointLayers[patchPointi]);
1858 Pout<<
"Not adding points at " << nTruncated <<
" out of "
1871 faceList baseFaces(mesh_.nFaces());
1872 bitSet isAffectedCell(mesh_.nCells());
1875 forAll(localFaces, patchFacei)
1877 const face&
f = localFaces[patchFacei];
1880 const label patchPointi =
f[fp];
1881 if (nPointLayers[patchPointi] > 0)
1883 const label meshFacei = pp.addressing()[patchFacei];
1884 face& baseF = baseFaces[meshFacei];
1889 if (ppFlip[patchFacei])
1892 const label celli = mesh_.faceOwner()[meshFacei];
1893 isAffectedCell.
set(celli);
1895 else if (mesh_.isInternalFace(meshFacei))
1898 const label celli = mesh_.faceNeighbour()[meshFacei];
1899 isAffectedCell.
set(celli);
1913 faceList oldBoundaryFaces(mesh_.nBoundaryFaces());
1917 bitSet newIsAffectedCell(mesh_.nCells());
1920 for (
const label celli : isAffectedCell)
1922 const cell& cFaces = mesh_.cells()[celli];
1926 minPointValue.
clear();
1927 for (
const label facei : cFaces)
1929 const face& baseF = baseFaces[facei];
1930 const face&
f = mesh_.faces()[facei];
1941 minPointValue.
insert(
f[fp], baseF[fp]);
1953 for (
const label facei : cFaces)
1955 const face&
f = mesh_.faces()[facei];
1956 face& baseF = baseFaces[facei];
1958 const label oldNChanged = nChanged;
1961 const auto fnd = minPointValue.
find(
f[fp]);
1981 if (!isBlockedFace(facei) && nChanged > oldNChanged)
1984 const label own = mesh_.faceOwner()[facei];
1985 if (!isAffectedCell[own])
1987 newIsAffectedCell.
set(own);
1989 if (mesh_.isInternalFace(facei))
1991 const label nei = mesh_.faceNeighbour()[facei];
1992 if (!isAffectedCell[nei])
1994 newIsAffectedCell.
set(nei);
2003 Pout<<
"isAffectedCell:" << isAffectedCell.count() <<
endl;
2004 Pout<<
"newIsAffectedCell:" << newIsAffectedCell.
count()
2006 Pout<<
"nChanged:" << nChanged <<
endl;
2021 mesh_.nBoundaryFaces(),
2022 mesh_.nInternalFaces()
2024 oldBoundaryFaces = l;
2038 const labelUList& oldVts = oldBoundaryFaces[bFacei];
2039 if (baseVts != oldVts)
2041 const label facei = mesh_.nInternalFaces()+bFacei;
2042 const label own = mesh_.faceOwner()[facei];
2043 if (!isAffectedCell[own])
2045 newIsAffectedCell.
set(own);
2050 isAffectedCell = newIsAffectedCell;
2064 forAll(firstLayerDisp, patchPointi)
2066 if (addedPoints_[patchPointi].size())
2068 label meshPointi = meshPoints[patchPointi];
2069 label zoneI = mesh_.pointZones().whichZone(meshPointi);
2070 copiedPatchPoints[patchPointi] = meshMod.
setAction
2074 mesh_.points()[meshPointi],
2086 forAll(firstLayerDisp, patchPointi)
2088 if (addedPoints_[patchPointi].size())
2090 const label meshPointi = meshPoints[patchPointi];
2091 const label zoneI = mesh_.pointZones().whichZone(meshPointi);
2093 point pt = mesh_.points()[meshPointi];
2095 vector disp = firstLayerDisp[patchPointi];
2097 forAll(addedPoints_[patchPointi], i)
2101 const label addedVertI = meshMod.
setAction
2106 (addToMesh_ ? meshPointi : -1),
2118 addedPoints_[patchPointi][i] = addedVertI;
2120 disp *= expansionRatio[patchPointi];
2134 if (nFaceLayers[patchFacei] > 0)
2136 const label meshFacei = pp.addressing()[patchFacei];
2138 label extrudeCelli = -2;
2143 const label ownCelli = mesh_.faceOwner()[meshFacei];
2144 extrudeZonei = mesh_.cellZones().whichZone(ownCelli);
2146 else if (!ppFlip[patchFacei])
2149 extrudeCelli = mesh_.faceOwner()[meshFacei];
2150 extrudeZonei = mesh_.cellZones().whichZone(extrudeCelli);
2152 else if (mesh_.isInternalFace(meshFacei))
2157 extrudeCelli = mesh_.faceNeighbour()[meshFacei];
2158 extrudeZonei = mesh_.cellZones().whichZone(extrudeCelli);
2161 if (extrudeCelli != -2)
2163 addedCells[patchFacei].
setSize(nFaceLayers[patchFacei]);
2165 for (label i = 0; i < nFaceLayers[patchFacei]; i++)
2169 addedCells[patchFacei][i] = meshMod.
setAction
2197 layerFaces_.setSize(pp.size());
2201 label meshFacei = pp.addressing()[patchFacei];
2203 if (addedCells[patchFacei].size())
2205 layerFaces_[patchFacei].setSize(addedCells[patchFacei].size() + 1);
2212 forAll(addedCells[patchFacei], i)
2216 if (addedPoints_[
f[fp]].empty())
2223 : copiedPatchPoints[
f[fp]]
2230 addedPoints_[
f[fp]].
size()
2231 - addedCells[patchFacei].
size();
2232 newFace[fp] = addedPoints_[
f[fp]][i+offset];
2242 label own = addedCells[patchFacei][i];
2247 bool fluxFlip =
false;
2249 if (i == addedCells[patchFacei].size()-1)
2260 ? mesh_.faceNeighbour()[meshFacei]
2261 : mesh_.faceOwner()[meshFacei]
2264 if (ppFlip[patchFacei])
2279 zoneI = mesh_.faceZones().whichZone(meshFacei);
2282 const faceZone& fz = mesh_.faceZones()[zoneI];
2289 nei = addedCells[patchFacei][i+1];
2293 if (nei != -1 && nei < own)
2297 std::swap(own, nei);
2310 layerFaces_[patchFacei][i+1] = meshMod.
setAction
2319 (addToMesh_ ? meshFacei : -1),
2348 if (addedCells[patchFacei].size())
2350 label meshFacei = pp.addressing()[patchFacei];
2352 layerFaces_[patchFacei][0] = meshFacei;
2353 const face&
f = pp[patchFacei];
2358 ? mesh_.faceOwner()[meshFacei]
2359 : mesh_.faceNeighbour()[meshFacei]
2361 const label nei = addedCells[patchFacei][0];
2367 (ppFlip[patchFacei] ?
f.reverseFace() :
f),
2395 if (addedCells[patchFacei].size())
2397 label meshFacei = pp.addressing()[patchFacei];
2398 label zoneI = mesh_.faceZones().whichZone(meshFacei);
2399 bool zoneFlip =
false;
2402 const faceZone& fz = mesh_.faceZones()[zoneI];
2410 f[fp] = copiedPatchPoints[
f[fp]];
2413 layerFaces_[patchFacei][0] = meshMod.
setAction
2418 addedCells[patchFacei][0],
2424 exposedPatchID[patchFacei],
2450 labelList meshEdgeLayers(mesh_.nEdges(), -1);
2454 const edge&
e = edges[edgei];
2456 label meshEdgei = meshEdges[edgei];
2458 if ((nPointLayers[
e[0]] == 0) && (nPointLayers[
e[1]] == 0))
2460 meshEdgeLayers[meshEdgei] = 0;
2468 meshEdgeLayers[meshEdgei] =
max
2470 nFaceLayers[eFaces[i]],
2471 meshEdgeLayers[meshEdgei]
2487 edgeLayers[edgei] = meshEdgeLayers[meshEdges[edgei]];
2500 const labelList& fEdges = faceEdges[patchFacei];
2514 globalFaces.
toGlobal(pp.addressing()[patchFacei])
2523 const label startFp = indexPair[0];
2524 const label endFp = indexPair[1];
2531 const face&
f = localFaces[patchFacei];
2534 if (endFp >= startFp)
2536 stringedVerts.
setSize(endFp-startFp+2);
2545 for (label i = 0; i < stringedVerts.
size()-1; i++)
2547 stringedVerts[i] =
f[fp];
2548 doneEdge[fEdges[fp]] =
true;
2551 stringedVerts.
last() =
f[fp];
2561 label startEdgei = fEdges[startFp];
2563 label meshEdgei = meshEdges[startEdgei];
2565 label numEdgeSideFaces = edgeLayers[startEdgei];
2567 for (label i = 0; i < numEdgeSideFaces; i++)
2569 label vEnd = stringedVerts.
last();
2570 label vStart = stringedVerts[0];
2573 label newFp = 2*stringedVerts.
size();
2579 if (addedPoints_[vEnd].size())
2582 addedPoints_[vEnd].size() - numEdgeSideFaces;
2584 if (addedPoints_[vStart].size())
2587 addedPoints_[vStart].size() - numEdgeSideFaces;
2591 face newFace(newFp);
2599 forAll(stringedVerts, stringedI)
2601 label v = stringedVerts[stringedI];
2607 : copiedPatchPoints[v]
2616 forAll(stringedVerts, stringedI)
2618 label v = stringedVerts[stringedI];
2619 if (addedPoints_[v].size())
2622 addedPoints_[v].
size() - numEdgeSideFaces;
2625 addedPoints_[v][i+offset-1],
2637 : copiedPatchPoints[v]
2647 if (numEdgeSideFaces < addedPoints_[vEnd].size())
2649 if (i == 0 && addedPoints_[vEnd].size())
2652 addedPoints_[vEnd].size() - numEdgeSideFaces;
2653 for (label ioff = 0; ioff < offset; ioff++)
2657 addedPoints_[vEnd][ioff],
2667 label v = stringedVerts[stringedI];
2668 if (addedPoints_[v].size())
2671 addedPoints_[v].
size() - numEdgeSideFaces;
2674 addedPoints_[v][i+offset],
2686 : copiedPatchPoints[v]
2696 if (numEdgeSideFaces < addedPoints_[vStart].size())
2698 if (i == 0 && addedPoints_[vStart].size())
2701 addedPoints_[vStart].size() - numEdgeSideFaces;
2702 for (label ioff = offset-1; ioff >= 0; ioff--)
2706 addedPoints_[vStart][ioff],
2723 if (ppFlip[patchFacei])
2733 if (!verts.
insert(newFace[fp]))
2736 <<
"Duplicate vertex in face"
2737 <<
" to be added." <<
nl
2738 <<
"newFace:" << newFace <<
nl
2746 <<
" out of:" << numEdgeSideFaces <<
nl
2747 <<
"ExtrudeEdge:" << meshEdgei
2749 << mesh_.edges()[meshEdgei].line
2753 <<
"string:" << stringedVerts
2771 label nbrFacei = nbrFace
2778 const labelList& meshFaces = mesh_.edgeFaces
2787 bool zoneFlip =
false;
2788 if (edgeZoneID[startEdgei] != -1)
2790 zoneFlip = !edgeFlip[startEdgei];
2799 edgePatchID[startEdgei],
2800 edgeZoneID[startEdgei],
2802 inflateFaceID[startEdgei],
2827 const face&
f = mesh_.faces()[facei];
2828 const face& baseF = baseFaces[facei];
2830 if (isBlockedFace(facei) || baseF.
empty())
2840 const label meshPointi =
f[fp];
2844 const label patchPointi = pp.
meshPointMap()[meshPointi];
2845 const label addedPointi = addedPoints_[patchPointi].last();
2854 newFace[fp] = addedPointi;
2870 label
zoneID = mesh_.faceZones().whichZone(facei);
2871 bool zoneFlip =
false;
2879 if (mesh_.isInternalFace(facei))
2885 mesh_.faceOwner()[facei],
2886 mesh_.faceNeighbour()[facei],
2899 mesh_.faceOwner()[facei],
2926 const labelList& added = addedPoints_[oldPointi];
2943 addedPoints_.transfer(newAddedPoints);
2949 forAll(newLayerFaces, newFacei)
2951 label oldFacei =
faceMap[newFacei];
2953 const labelList& added = layerFaces_[oldFacei];
2955 labelList& newAdded = newLayerFaces[newFacei];
2965 newAdded[newI++] = newFacei;
2970 layerFaces_.transfer(newLayerFaces);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
void clear()
Clear all entries from table.
void setSize(const label n)
Alias for resize()
A HashTable to objects of type <T> with a label key.
void setSize(const label n, unsigned int val=0u)
Alias for resize()
label size() const noexcept
Number of entries.
A list of faces which address into the list of points.
label nEdges() const
Number of edges in patch.
label nPoints() const
Number of points supporting patch faces.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
label nInternalEdges() const
Number of internal edges.
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
const Map< label > & meshPointMap() const
Mesh point map.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
const Field< point_type > & points() const noexcept
Return reference to global points.
const labelListList & edgeFaces() const
Return edge-face addressing.
const labelListList & faceEdges() const
Return face-edge addressing.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
A List obtained as a section of another List.
A List with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
T & last()
Return the last element of the list.
label fcIndex(const label i) const noexcept
static bool & parRun() noexcept
Test if this a parallel run.
label size() const noexcept
The number of elements in the list.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
void setRefinement(const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const bitSet &flip, const labelList &sidePatchID, const labelList &sideZoneID, const boolList &sideFlip, const labelList &inflateFaceID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layers on top.
static void calcExtrudeInfo(const bool zoneFromAnyFace, const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
Determine extrude information per patch edge:
labelListList addedCells() const
Added cells given current mesh & layerfaces.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A cell is defined as a list of faces with extra functionality.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static int compare(const edge &a, const edge &b)
Compare edges.
A subset of mesh faces organised as a primitive patch.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
const boolList & flipMap() const noexcept
Return face flip map.
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 toGlobal(const label i) const
From local to global index.
label toLocal(const label i) const
From global to local on current processor.
bool isLocal(const label i) const
Is on local processor.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelListList & globalEdgeTransformedSlaves() const
const labelList & processorPatches() const noexcept
Return list of processor patch labels.
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 globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
const labelListList & globalEdgeSlaves() const
const processorTopology & topology() const noexcept
The processor to processor topology.
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
const labelList & reverseFaceMap() const
Reverse face map.
void operator()(face &x, const face &y) const
void updateMesh()
Update for new mesh topology.
static const complex max
complex (VGREAT,VGREAT)
Class containing data for cell addition.
A face addition data class. A face can be inflated either from a point or from another face and can e...
Class containing data for point addition.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const faceList & faces() const
Return raw faces.
const globalMeshData & globalData() const
Return parallel info.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
Class describing modification of a face.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Modify vertices or cell of face.
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
label nFaces() const noexcept
Number of mesh faces.
const labelListList & edgeFaces() const
label nEdges() const
Number of mesh edges.
label procPatchLookup(const label proci) const
Which local boundary is attached to specified processor.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneID
#define WarningInFunction
Report a warning using Foam::Warning.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Pair< label > labelPair
A pair of labels.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
UIndirectList< label > labelUIndList
UIndirectList of labels.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
List helper to append y unique elements onto the end of x.