87 Foam::label Foam::addPatchCellLayer::nbrFace
94 const labelList& eFaces = edgeFaces[edgei];
96 if (eFaces.size() == 2)
98 return (eFaces[0] != facei ? eFaces[0] : eFaces[1]);
107 void Foam::addPatchCellLayer::addVertex
120 if (
f[fp-1] != pointi &&
f[0] != pointi)
130 bool Foam::addPatchCellLayer::sameEdgeNeighbour
135 const label thisGlobalFacei,
136 const label nbrGlobalFacei,
145 addedPoints_[
e[0]].size()
146 || addedPoints_[
e[1]].size()
149 nbrFace(globalEdgeFaces, edgei, thisGlobalFacei)
163 const label patchFacei,
164 const label globalFacei
175 label edgei = fEdges[fp];
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]];
223 <<
"On face:" << 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);
283 Foam::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],
455 void Foam::addPatchCellLayer::setFaceProps
457 const polyMesh&
mesh,
475 void Foam::addPatchCellLayer::setFaceProps
477 const polyMesh&
mesh,
498 if (patchI != -1 || zoneI != -1)
500 inflateFaceI = faceI;
506 const edge& ppEdge =
pp.
edges()[ppEdgeI];
517 const edge
e(
f[fp],
f.nextLabel(fp));
527 zoneFlip = !zoneFlip;
536 <<
"Problem: cannot find patch edge " << ppEdgeI
537 <<
" with mesh vertices " << patchEdge
539 <<
" in face " << faceI <<
" with mesh vertices " 543 <<
"Continuing with potentially incorrect faceZone orientation" 551 void Foam::addPatchCellLayer::findZoneFace
553 const bool useInternalFaces,
554 const bool useBoundaryFaces,
556 const polyMesh&
mesh,
575 label faceI = meshFaces[
k];
579 !excludeFaces.found(faceI)
599 if (zoneI != -1 || patchI != -1)
611 Foam::addPatchCellLayer::addPatchCellLayer
618 addToMesh_(addToMesh),
634 forAll(layerFaces, patchFacei)
640 labelList& added = layerCells[patchFacei];
655 return addedCells(mesh_, layerFaces_);
677 label meshEdgeI = meshEdges[edgeI];
679 const labelList& eFaces = edgeFaces[edgeI];
682 labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
686 globalEFaces[i] = globalFaces.
toGlobal(
pp.addressing()[eFaces[i]]);
695 ListOps::uniqueEqOp<label>(),
700 return labelListList(UIndirectList<labelList>(globalEdgeFaces, meshEdges));
704 void Foam::addPatchCellLayer::markPatchEdges
706 const polyMesh&
mesh,
712 bitSet& isPatchBoundaryEdge
721 isPatchEdge.set(meshEdges);
727 orEqOp<unsigned int>(),
732 isPatchBoundaryEdge =
false;
733 forAll(edgeGlobalFaces, edgei)
739 if (edgeGlobalFaces[edgei].size() == 1)
741 isPatchBoundaryEdge.set(meshEdges[edgei]);
749 orEqOp<unsigned int>(),
755 void Foam::addPatchCellLayer::globalEdgeInfo
757 const bool zoneFromAnyFace,
759 const polyMesh&
mesh,
760 const globalIndex& globalFaces,
768 bitSet& patchEdgeToFlip
775 bitSet isExtrudeEdge;
776 bitSet isBoundaryEdge;
790 EdgeMap<label> isBoundaryEdgeSet(
pp.
nEdges());
791 for (
const label edgei : isBoundaryEdge)
793 isBoundaryEdgeSet.insert(
mesh.
edges()[edgei], edgei);
795 EdgeMap<label> isExtrudeEdgeSet(
pp.
nEdges());
796 for (
const label edgei : isExtrudeEdge)
798 isExtrudeEdgeSet.insert(
mesh.
edges()[edgei], edgei);
807 for (
const faceZone& fz: fzs)
810 UIndirectList<label>(faceToZone, addressing) = fz.index();
815 faceToFlip[addressing[i]] = fm[i];
832 const bitSet isInternalOrCoupled
840 for (
const label facei : isInternalOrCoupled)
844 label prevPointi =
f.
last();
845 for (
const label pointi :
f)
847 const edge
e(prevPointi, pointi);
851 const auto eFnd = isExtrudeEdgeSet.cfind(
e);
854 const label edgei = eFnd();
856 if (faceToZone[facei] != -1)
859 meshEdgeToFace[edgei] = globalFaces.toGlobal(facei);
860 meshEdgeToZone[edgei] = faceToZone[facei];
865 meshEdgeToFlip[edgei] = faceToFlip[facei];
869 meshEdgeToFlip[edgei] = !faceToFlip[facei];
895 isPpFace.
set(
pp.addressing());
908 const label facei =
pp.start()+i;
910 if (!isPpFace[facei])
912 const face&
f =
pp[i];
914 label prevPointi =
f.
last();
915 for (
const label pointi :
f)
917 const edge
e(prevPointi, pointi);
921 ? isExtrudeEdgeSet.cfind(
e)
922 : isBoundaryEdgeSet.cfind(
e)
926 const label edgei = eFnd();
927 if (meshEdgeToFace[edgei] == -1)
934 meshEdgeToFace[edgei] =
935 globalFaces.toGlobal(facei);
940 if (meshEdgeToPatch[edgei] == -1)
942 meshEdgeToPatch[edgei] =
pp.index();
946 if (meshEdgeToZone[edgei] == -1)
948 meshEdgeToZone[edgei] =
954 meshEdgeToFlip[edgei] =
959 meshEdgeToFlip[edgei] =
1087 orEqOp<unsigned int>(),
1092 patchEdgeToFace = UIndirectList<label>(meshEdgeToFace, meshEdges);
1093 patchEdgeToPatch = UIndirectList<label>(meshEdgeToPatch, meshEdges);
1094 patchEdgeToZone = UIndirectList<label>(meshEdgeToZone, meshEdges);
1095 patchEdgeToFlip.setSize(meshEdges.size());
1096 patchEdgeToFlip =
false;
1099 patchEdgeToFlip[i] = meshEdgeToFlip[meshEdges[i]];
1106 const bool zoneFromAnyFace,
1108 const polyMesh&
mesh,
1109 const globalIndex& globalFaces,
1115 Map<label>& nbrProcToPatch,
1116 Map<label>& patchToNbrProc,
1135 inflateFaceID.setSize(
pp.
nEdges(), -1);
1151 forAll(globalEdgeFaces, edgei)
1153 const labelList& eGlobalFaces = globalEdgeFaces[edgei];
1156 eGlobalFaces.size() == 2
1163 label f0 = eGlobalFaces[0];
1164 label f1 = eGlobalFaces[1];
1166 label otherProci = -1;
1167 if (globalFaces.isLocal(f0) && !globalFaces.isLocal(f1))
1169 otherProci = globalFaces.whichProcID(f1);
1171 else if (!globalFaces.isLocal(f0) && globalFaces.isLocal(f1))
1173 otherProci = globalFaces.whichProcID(f0);
1177 if (otherProci != -1)
1182 gd.topology().procPatchLookup(otherProci);
1188 procPatchi = nbrProcToPatch.lookup(otherProci, -1);
1197 nbrProcToPatch.insert(otherProci, procPatchi);
1198 patchToNbrProc.insert(procPatchi, otherProci);
1202 edgePatchID[edgei] = procPatchi;
1234 DynamicList<label> dynMeshEdgeFaces;
1238 if (edgePatchID[edgei] == -1)
1240 if (edgeFaces[edgei].size() == 2)
1245 if (globalFaces.isLocal(edgeToFace[edgei]))
1247 inflateFaceID[edgei] =
1248 globalFaces.toLocal(edgeToFace[edgei]);
1250 edgeZoneID[edgei] = edgeToZone[edgei];
1251 edgeFlip[edgei] = edgeToFlip[edgei];
1258 if (globalFaces.isLocal(edgeToFace[edgei]))
1260 inflateFaceID[edgei] =
1261 globalFaces.toLocal(edgeToFace[edgei]);
1263 edgePatchID[edgei] = edgeToPatch[edgei];
1264 edgeZoneID[edgei] = edgeToZone[edgei];
1265 edgeFlip[edgei] = edgeToFlip[edgei];
1277 if (edgeFaces[edgei].size() == 1 && edgePatchID[edgei] == -1)
1281 <<
"Have no sidePatchID for edge " << edgei <<
" points " 1297 edgeFaces[edgei].size() == 1
1298 && globalEdgeFaces[edgei].size() == 2
1299 && edgePatchID[edgei] != -1
1300 && inflateFaceID[edgei] == -1
1305 label myFaceI =
pp.addressing()[edgeFaces[edgei][0]];
1308 label meshEdgei = meshEdges[edgei];
1317 label facei = meshFaces[
k];
1333 inflateFaceID[edgei]
1358 bitSet sameEdgeOrientation;
1369 labelList cppEdgeZoneID(cpp.nEdges(), -1);
1370 boolList cppEdgeFlip(cpp.nEdges(),
false);
1373 label cppEdgei = coupledEdges[i];
1374 label ppEdgei = patchEdges[i];
1376 cppEdgeZoneID[cppEdgei] = edgeZoneID[ppEdgei];
1377 if (sameEdgeOrientation[i])
1379 cppEdgeFlip[cppEdgei] = edgeFlip[ppEdgei];
1383 cppEdgeFlip[cppEdgei] = !edgeFlip[ppEdgei];
1388 const globalIndexAndTransform& git = gd.globalTransforms();
1389 const mapDistribute& edgeMap = gd.globalEdgeSlavesMap();
1394 gd.globalEdgeSlaves(),
1395 gd.globalEdgeTransformedSlaves(),
1404 gd.globalEdgeSlaves(),
1405 gd.globalEdgeTransformedSlaves(),
1415 label cppEdgei = coupledEdges[i];
1416 label ppEdgei = patchEdges[i];
1418 edgeZoneID[ppEdgei] = cppEdgeZoneID[cppEdgei];
1419 if (sameEdgeOrientation[i])
1421 edgeFlip[ppEdgei] = cppEdgeFlip[cppEdgei];
1425 edgeFlip[ppEdgei] = !cppEdgeFlip[cppEdgei];
1434 const globalIndex& globalFaces,
1438 const bitSet& ppFlip,
1449 polyTopoChange& meshMod
1454 Pout<<
"addPatchCellLayer::setRefinement : Adding up to " 1455 <<
gMax(nPointLayers)
1456 <<
" layers of cells to indirectPrimitivePatch with " 1464 ||
pp.size() != nFaceLayers.size()
1465 ||
pp.size() != ppFlip.size()
1469 <<
"Size of new points is not same as number of points used by" 1470 <<
" the face subset" <<
endl 1472 <<
" displacement:" << firstLayerDisp.size()
1473 <<
" nPointLayers:" << nPointLayers.size() <<
nl 1474 <<
" patch.nFaces:" <<
pp.size()
1475 <<
" flip map:" << ppFlip.size()
1476 <<
" nFaceLayers:" << nFaceLayers.size()
1485 <<
"In generating stand-alone mesh the flip map should be empty" 1486 <<
". Instead it is " << ppFlip.count()
1499 labelList stateAndFlip(mesh_.nBoundaryFaces(), 0);
1500 forAll(
pp.addressing(), patchFacei)
1502 if (nFaceLayers[patchFacei] > 0)
1504 const label meshFacei =
pp.addressing()[patchFacei];
1505 const label bFacei = meshFacei-mesh_.nInternalFaces();
1508 stateAndFlip[bFacei] = label(ppFlip[patchFacei]);
1513 for (
const auto&
patch : mesh_.boundaryMesh())
1515 if (!
patch.coupled())
1519 label& state = stateAndFlip[
patch.offset()+i];
1520 state = (state == 0 ? 1 : 0);
1526 forAll(
pp.addressing(), patchFacei)
1528 if (nFaceLayers[patchFacei] > 0)
1530 const label meshFacei =
pp.addressing()[patchFacei];
1531 const label bFacei = meshFacei-mesh_.nInternalFaces();
1534 if (stateAndFlip[bFacei] == -1)
1537 <<
"At extruded face:" << meshFacei
1538 <<
" at:" << mesh_.faceCentres()[meshFacei]
1539 <<
" locally have nLayers:" 1540 << nFaceLayers[patchFacei]
1543 else if (stateAndFlip[bFacei] == label(ppFlip[patchFacei]))
1546 <<
"At extruded face:" << meshFacei
1547 <<
" at:" << mesh_.faceCentres()[meshFacei]
1548 <<
" locally have flip:" << ppFlip[patchFacei]
1549 <<
" which is not the opposite of coupled version " 1550 << stateAndFlip[bFacei]
1561 if (nPointLayers[i] < 0)
1564 <<
"Illegal number of layers " << nPointLayers[i]
1570 if (nFaceLayers[i] < 0)
1573 <<
"Illegal number of layers " << nFaceLayers[i]
1578 forAll(globalEdgeFaces, edgei)
1580 if (globalEdgeFaces[edgei].size() > 2)
1584 if (nPointLayers[
e[0]] > 0 || nPointLayers[
e[1]] > 0)
1587 <<
"Trying to extrude edge " 1589 <<
" which is non-manifold (has " 1590 << globalEdgeFaces[edgei].size()
1591 <<
" local or coupled faces using it)" 1607 bitSet isBlockedFace(mesh_.nFaces());
1608 forAll(nFaceLayers, patchFacei)
1610 if (nFaceLayers[patchFacei] > 0)
1612 isBlockedFace.set(
pp.addressing()[patchFacei]);
1617 DynamicList<label> ef;
1635 label meshPointi = meshPoints[i];
1637 if (
n[meshPointi] != nPointLayers[i])
1640 <<
"At mesh point:" << meshPointi
1641 <<
" coordinate:" << mesh_.points()[meshPointi]
1642 <<
" specified nLayers:" << nPointLayers[i] <<
endl 1643 <<
"On coupled point a different nLayers:" 1644 <<
n[meshPointi] <<
" was specified." 1655 const face&
f =
pp[i];
1659 label pointi =
f[fp];
1661 nFromFace[pointi] =
max(nFromFace[pointi], nFaceLayers[i]);
1674 label meshPointi = meshPoints[i];
1679 && nPointLayers[i] != nFromFace[meshPointi]
1683 <<
"At mesh point:" << meshPointi
1684 <<
" coordinate:" << mesh_.points()[meshPointi]
1685 <<
" specified nLayers:" << nPointLayers[i] <<
endl 1686 <<
"but the max nLayers of surrounding faces is:" 1687 << nFromFace[meshPointi]
1695 UIndirectList<point>(d, meshPoints) = firstLayerDisp;
1706 label meshPointi = meshPoints[i];
1708 if (
mag(d[meshPointi] - firstLayerDisp[i]) > SMALL)
1711 <<
"At mesh point:" << meshPointi
1712 <<
" coordinate:" << mesh_.points()[meshPointi]
1713 <<
" specified displacement:" << firstLayerDisp[i]
1715 <<
"On coupled point a different displacement:" 1716 << d[meshPointi] <<
" was specified." 1732 if (nPointLayers[
e[0]] > 0 || nPointLayers[
e[1]] > 0)
1739 if (eFaces.size() != 1)
1742 <<
"boundary-edge-to-be-extruded:" 1745 <<
" has more than two faces using it:" << eFaces
1799 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
1806 label meshFacei =
pp.addressing()[patchFacei];
1817 label nTruncated = 0;
1819 forAll(nPointLayers, patchPointi)
1821 if (nPointLayers[patchPointi] > 0)
1823 addedPoints_[patchPointi].setSize(nPointLayers[patchPointi]);
1833 Pout<<
"Not adding points at " << nTruncated <<
" out of " 1846 faceList baseFaces(mesh_.nFaces());
1847 bitSet isAffectedCell(mesh_.nCells());
1850 forAll(localFaces, patchFacei)
1852 const face&
f = localFaces[patchFacei];
1855 const label patchPointi =
f[fp];
1856 if (nPointLayers[patchPointi] > 0)
1858 const label meshFacei =
pp.addressing()[patchFacei];
1859 face& baseF = baseFaces[meshFacei];
1864 if (ppFlip[patchFacei])
1867 const label celli = mesh_.faceOwner()[meshFacei];
1868 isAffectedCell.
set(celli);
1870 else if (mesh_.isInternalFace(meshFacei))
1873 const label celli = mesh_.faceNeighbour()[meshFacei];
1874 isAffectedCell.set(celli);
1887 Map<label> minPointValue(128);
1888 faceList oldBoundaryFaces(mesh_.nBoundaryFaces());
1892 bitSet newIsAffectedCell(mesh_.nCells());
1895 for (
const label celli : isAffectedCell)
1897 const cell& cFaces = mesh_.cells()[celli];
1901 minPointValue.
clear();
1902 for (
const label facei : cFaces)
1904 const face& baseF = baseFaces[facei];
1905 const face&
f = mesh_.faces()[facei];
1916 minPointValue.insert(
f[fp], baseF[fp]);
1928 for (
const label facei : cFaces)
1930 const face&
f = mesh_.faces()[facei];
1931 face& baseF = baseFaces[facei];
1933 const label oldNChanged = nChanged;
1936 const auto fnd = minPointValue.find(
f[fp]);
1956 if (!isBlockedFace(facei) && nChanged > oldNChanged)
1959 const label own = mesh_.faceOwner()[facei];
1960 if (!isAffectedCell[own])
1962 newIsAffectedCell.set(own);
1964 if (mesh_.isInternalFace(facei))
1966 const label nei = mesh_.faceNeighbour()[facei];
1967 if (!isAffectedCell[nei])
1969 newIsAffectedCell.set(nei);
1978 Pout<<
"isAffectedCell:" << isAffectedCell.count() <<
endl;
1979 Pout<<
"newIsAffectedCell:" << newIsAffectedCell.count()
1981 Pout<<
"nChanged:" << nChanged <<
endl;
1996 mesh_.nBoundaryFaces(),
1997 mesh_.nInternalFaces()
1999 oldBoundaryFaces = l;
2013 const labelUList& oldVts = oldBoundaryFaces[bFacei];
2014 if (baseVts != oldVts)
2016 const label facei = mesh_.nInternalFaces()+bFacei;
2017 const label own = mesh_.faceOwner()[facei];
2018 if (!isAffectedCell[own])
2020 newIsAffectedCell.set(own);
2025 isAffectedCell = newIsAffectedCell;
2038 copiedPatchPoints.
setSize(firstLayerDisp.size());
2039 forAll(firstLayerDisp, patchPointi)
2041 if (addedPoints_[patchPointi].size())
2043 label meshPointi = meshPoints[patchPointi];
2044 label zoneI = mesh_.pointZones().whichZone(meshPointi);
2045 copiedPatchPoints[patchPointi] = meshMod.setAction
2049 mesh_.points()[meshPointi],
2061 forAll(firstLayerDisp, patchPointi)
2063 if (addedPoints_[patchPointi].size())
2065 const label meshPointi = meshPoints[patchPointi];
2066 const label zoneI = mesh_.pointZones().whichZone(meshPointi);
2068 point pt = mesh_.points()[meshPointi];
2070 vector disp = firstLayerDisp[patchPointi];
2072 forAll(addedPoints_[patchPointi], i)
2076 const label addedVertI = meshMod.setAction
2081 (addToMesh_ ? meshPointi : -1),
2093 addedPoints_[patchPointi][i] = addedVertI;
2095 disp *= expansionRatio[patchPointi];
2109 if (nFaceLayers[patchFacei] > 0)
2111 const label meshFacei =
pp.addressing()[patchFacei];
2113 label extrudeCelli = -2;
2118 const label ownCelli = mesh_.faceOwner()[meshFacei];
2119 extrudeZonei = mesh_.cellZones().whichZone(ownCelli);
2121 else if (!ppFlip[patchFacei])
2124 extrudeCelli = mesh_.faceOwner()[meshFacei];
2125 extrudeZonei = mesh_.cellZones().whichZone(extrudeCelli);
2127 else if (mesh_.isInternalFace(meshFacei))
2132 extrudeCelli = mesh_.faceNeighbour()[meshFacei];
2133 extrudeZonei = mesh_.cellZones().whichZone(extrudeCelli);
2136 if (extrudeCelli != -2)
2138 addedCells[patchFacei].setSize(nFaceLayers[patchFacei]);
2140 for (label i = 0; i < nFaceLayers[patchFacei]; i++)
2144 addedCells[patchFacei][i] = meshMod.setAction
2172 layerFaces_.setSize(
pp.size());
2176 label meshFacei =
pp.addressing()[patchFacei];
2178 if (addedCells[patchFacei].size())
2180 layerFaces_[patchFacei].setSize(addedCells[patchFacei].size() + 1);
2185 face newFace(
f.
size());
2187 forAll(addedCells[patchFacei], i)
2191 if (addedPoints_[
f[fp]].empty())
2198 : copiedPatchPoints[
f[fp]]
2205 addedPoints_[
f[fp]].size()
2206 - addedCells[patchFacei].size();
2207 newFace[fp] = addedPoints_[
f[fp]][i+offset];
2217 label own = addedCells[patchFacei][i];
2222 bool fluxFlip =
false;
2224 if (i == addedCells[patchFacei].size()-1)
2235 ? mesh_.faceNeighbour()[meshFacei]
2236 : mesh_.faceOwner()[meshFacei]
2239 if (ppFlip[patchFacei])
2241 newFace = newFace.reverseFace();
2254 zoneI = mesh_.faceZones().whichZone(meshFacei);
2257 const faceZone& fz = mesh_.faceZones()[zoneI];
2258 flip = fz.flipMap()[fz.whichFace(meshFacei)];
2264 nei = addedCells[patchFacei][i+1];
2268 if (nei != -1 && nei < own)
2271 newFace = newFace.reverseFace();
2272 std::swap(own, nei);
2285 layerFaces_[patchFacei][i+1] = meshMod.setAction
2294 (addToMesh_ ? meshFacei : -1),
2323 if (addedCells[patchFacei].size())
2325 label meshFacei =
pp.addressing()[patchFacei];
2327 layerFaces_[patchFacei][0] = meshFacei;
2328 const face&
f =
pp[patchFacei];
2333 ? mesh_.faceOwner()[meshFacei]
2334 : mesh_.faceNeighbour()[meshFacei]
2336 const label nei = addedCells[patchFacei][0];
2342 (ppFlip[patchFacei] ?
f.reverseFace() :
f),
2370 if (addedCells[patchFacei].size())
2372 label meshFacei =
pp.addressing()[patchFacei];
2373 label zoneI = mesh_.faceZones().whichZone(meshFacei);
2374 bool zoneFlip =
false;
2377 const faceZone& fz = mesh_.faceZones()[zoneI];
2378 zoneFlip = !fz.flipMap()[fz.whichFace(meshFacei)];
2385 f[fp] = copiedPatchPoints[
f[fp]];
2388 layerFaces_[patchFacei][0] = meshMod.setAction
2393 addedCells[patchFacei][0],
2399 exposedPatchID[patchFacei],
2425 labelList meshEdgeLayers(mesh_.nEdges(), -1);
2429 const edge&
e = edges[edgei];
2431 label meshEdgei = meshEdges[edgei];
2433 if ((nPointLayers[
e[0]] == 0) && (nPointLayers[
e[1]] == 0))
2435 meshEdgeLayers[meshEdgei] = 0;
2443 meshEdgeLayers[meshEdgei] =
max 2445 nFaceLayers[eFaces[i]],
2446 meshEdgeLayers[meshEdgei]
2462 edgeLayers[edgei] = meshEdgeLayers[meshEdges[edgei]];
2475 const labelList& fEdges = faceEdges[patchFacei];
2489 globalFaces.toGlobal(
pp.addressing()[patchFacei])
2498 const label startFp = indexPair[0];
2499 const label endFp = indexPair[1];
2506 const face&
f = localFaces[patchFacei];
2509 if (endFp >= startFp)
2511 stringedVerts.
setSize(endFp-startFp+2);
2515 stringedVerts.setSize(endFp+
f.
size()-startFp+2);
2520 for (label i = 0; i < stringedVerts.size()-1; i++)
2522 stringedVerts[i] =
f[fp];
2523 doneEdge[fEdges[fp]] =
true;
2526 stringedVerts.last() =
f[fp];
2536 label startEdgei = fEdges[startFp];
2538 label meshEdgei = meshEdges[startEdgei];
2540 label numEdgeSideFaces = edgeLayers[startEdgei];
2542 for (label i = 0; i < numEdgeSideFaces; i++)
2544 label vEnd = stringedVerts.
last();
2545 label vStart = stringedVerts[0];
2548 label newFp = 2*stringedVerts.size();
2554 if (addedPoints_[vEnd].size())
2557 addedPoints_[vEnd].size() - numEdgeSideFaces;
2559 if (addedPoints_[vStart].size())
2562 addedPoints_[vStart].size() - numEdgeSideFaces;
2566 face newFace(newFp);
2574 forAll(stringedVerts, stringedI)
2576 label v = stringedVerts[stringedI];
2582 : copiedPatchPoints[v]
2591 forAll(stringedVerts, stringedI)
2593 label v = stringedVerts[stringedI];
2594 if (addedPoints_[v].size())
2597 addedPoints_[v].size() - numEdgeSideFaces;
2600 addedPoints_[v][i+offset-1],
2612 : copiedPatchPoints[v]
2622 if (numEdgeSideFaces < addedPoints_[vEnd].size())
2624 if (i == 0 && addedPoints_[vEnd].size())
2627 addedPoints_[vEnd].size() - numEdgeSideFaces;
2628 for (label ioff = 0; ioff < offset; ioff++)
2632 addedPoints_[vEnd][ioff],
2642 label v = stringedVerts[stringedI];
2643 if (addedPoints_[v].size())
2646 addedPoints_[v].size() - numEdgeSideFaces;
2649 addedPoints_[v][i+offset],
2661 : copiedPatchPoints[v]
2671 if (numEdgeSideFaces < addedPoints_[vStart].size())
2673 if (i == 0 && addedPoints_[vStart].size())
2676 addedPoints_[vStart].size() - numEdgeSideFaces;
2677 for (label ioff = offset-1; ioff >= 0; ioff--)
2681 addedPoints_[vStart][ioff],
2694 newFace.setSize(newFp);
2698 if (ppFlip[patchFacei])
2700 newFace = newFace.reverseFace();
2708 if (!verts.insert(newFace[fp]))
2711 <<
"Duplicate vertex in face" 2712 <<
" to be added." <<
nl 2713 <<
"newFace:" << newFace <<
nl 2715 << UIndirectList<point>
2721 <<
" out of:" << numEdgeSideFaces <<
nl 2722 <<
"ExtrudeEdge:" << meshEdgei
2724 << mesh_.edges()[meshEdgei].line
2728 <<
"string:" << stringedVerts
2730 << UIndirectList<point>
2746 label nbrFacei = nbrFace
2753 const labelList& meshFaces = mesh_.edgeFaces
2762 bool zoneFlip =
false;
2763 if (edgeZoneID[startEdgei] != -1)
2765 zoneFlip = !edgeFlip[startEdgei];
2774 edgePatchID[startEdgei],
2775 edgeZoneID[startEdgei],
2777 inflateFaceID[startEdgei],
2802 const face&
f = mesh_.faces()[facei];
2803 const face& baseF = baseFaces[facei];
2805 if (isBlockedFace(facei) || baseF.empty())
2815 const label meshPointi =
f[fp];
2820 const label addedPointi = addedPoints_[patchPointi].last();
2829 newFace[fp] = addedPointi;
2845 label zoneID = mesh_.faceZones().whichZone(facei);
2846 bool zoneFlip =
false;
2849 const faceZone& fZone = mesh_.faceZones()[zoneID];
2850 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
2854 if (mesh_.isInternalFace(facei))
2860 mesh_.faceOwner()[facei],
2861 mesh_.faceNeighbour()[facei],
2874 mesh_.faceOwner()[facei],
2889 const mapPolyMesh& morphMap,
2901 const labelList& added = addedPoints_[oldPointi];
2904 newAdded.
setSize(added.size());
2909 label
newPointi = morphMap.reversePointMap()[added[i]];
2916 newAdded.setSize(newI);
2918 addedPoints_.transfer(newAddedPoints);
2924 forAll(newLayerFaces, newFacei)
2926 label oldFacei =
faceMap[newFacei];
2928 const labelList& added = layerFaces_[oldFacei];
2930 labelList& newAdded = newLayerFaces[newFacei];
2931 newAdded.
setSize(added.size());
2936 label newFacei = morphMap.reverseFaceMap()[added[i]];
2940 newAdded[newI++] = newFacei;
2943 newAdded.setSize(newI);
2945 layerFaces_.transfer(newLayerFaces);
label nPoints() const
Number of points supporting patch faces.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
void size(const label n)
Older name for setAddressableSize.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
List< edge > edgeList
List of edge.
const labelListList & pointEdges() const
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
constexpr char nl
The newline '\n' character (0x0a)
UIndirectList< label > labelUIndList
UIndirectList of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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:
static bool & parRun() noexcept
Test if this a parallel run.
label nInternalEdges() const
Number of internal edges.
label k
Boltzmann constant.
label nFaces() const noexcept
Number of mesh faces.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
labelList faceLabels(nFaceLabels)
List< labelList > labelListList
List of labelList.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
UList< label > labelUList
A UList of labels.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
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.
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...
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< face > faceList
List of faces.
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...
const Map< label > & meshPointMap() const
Mesh point map.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
void clear()
Clear the list, i.e. set size to zero.
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label size() const noexcept
The number of entries in the list.
const Field< point_type > & faceCentres() const
Return face centres for patch.
const labelListList & edgeFaces() const
Return edge-face addressing.
const globalMeshData & globalData() const
Return parallel info.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const Field< point_type > & points() const noexcept
Return reference to global points.
virtual const faceList & faces() const
Return raw faces.
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
label nEdges() const
Number of mesh edges.
label nEdges() const
Number of edges in patch.
int debug
Static debugging option.
Pair< label > labelPair
A pair of labels.
Type gMax(const FieldField< Field, Type > &f)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
T & last()
Access last element of the list, position [size()-1].
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
label toGlobal(const label i) const
From local to global index.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
void operator()(face &x, const face &y) const
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using cell addressing.
const polyBoundaryMesh & patches
const std::string patch
OpenFOAM patch number as a std::string.
const labelListList & faceEdges() const
Return face-edge addressing.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it.
labelListList addedCells() const
Added cells given current mesh & layerfaces.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Mesh consisting of general polyhedral cells.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
List< label > labelList
A List of labels.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const labelListList & edgeFaces() const
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static int compare(const edge &a, const edge &b)
Compare edges.
static constexpr const zero Zero
Global zero (0)