60 if (
x.size() !=
y.size())
94Foam::label Foam::addPatchCellLayer::nbrFace
96 const labelListList& edgeFaces,
101 const labelList& eFaces = edgeFaces[edgei];
103 if (eFaces.size() == 2)
105 return (eFaces[0] != facei ? eFaces[0] : eFaces[1]);
114void Foam::addPatchCellLayer::addVertex
127 if (
f[fp-1] != pointi &&
f[0] != pointi)
137bool Foam::addPatchCellLayer::sameEdgeNeighbour
142 const label thisGlobalFacei,
143 const label nbrGlobalFacei,
152 addedPoints_[
e[0]].size()
153 || addedPoints_[
e[1]].size()
156 nbrFace(globalEdgeFaces, edgei, thisGlobalFacei)
170 const label patchFacei,
171 const label globalFacei
182 const label edgei = fEdges[fp];
188 && ( addedPoints_[
e[0]].size() || addedPoints_[
e[1]].size() )
200 const label nbrGlobalFacei = nbrFace
207 if (nbrGlobalFacei == -1)
219 const label initFp = startFp;
222 label prevFp = fEdges.rcIndex(startFp);
224 if (prevFp == initFp)
230 <<
"On face:" << patchFacei
232 <<
" vertices:" << localF
235 <<
" edges:" << fEdges
236 <<
" All edges of face seem to have same neighbour "
238 <<
" starting walking from edge " <<
e
264 label nextFp = fEdges.fcIndex(endFp);
290Foam::label Foam::addPatchCellLayer::addSideFace
295 const label newPatchID,
298 const label inflateFacei,
300 const label ownFacei,
301 const label nbrFacei,
302 const label meshEdgei,
304 const label numEdgeFaces,
311 label addedFacei = -1;
325 if (addedCells[ownFacei].size() < numEdgeFaces)
327 label offset = numEdgeFaces - addedCells[ownFacei].size();
328 if (layeri <= offset)
334 layerOwn = layeri - offset;
350 addedFacei = meshMod.setAction
355 addedCells[ownFacei][layerOwn],
377 if (addedCells[ownFacei].size() > addedCells[nbrFacei].size())
380 addedCells[ownFacei].size() - addedCells[nbrFacei].size();
384 if (layeri <= offset)
390 layerNbr = layeri - offset;
393 else if (addedCells[nbrFacei].size() > addedCells[ownFacei].size())
396 addedCells[nbrFacei].size() - addedCells[ownFacei].size();
400 if (layeri <= offset)
406 layerOwn = layeri - offset;
418 label inflateEdgei = -1;
423 if (mesh_.isInternalFace(meshFaces[i]))
426 inflateEdgei = meshEdgei;
433 addedFacei = meshMod.setAction
438 addedCells[ownFacei][layerOwn],
439 addedCells[nbrFacei][layerNbr],
462void Foam::addPatchCellLayer::setFaceProps
483void Foam::addPatchCellLayer::setFaceProps
506 if (patchI != -1 || zoneI != -1)
508 inflateFaceI = faceI;
525 const edge e(
f[fp],
f.nextLabel(fp));
535 zoneFlip = !zoneFlip;
544 <<
"Problem: cannot find patch edge " << ppEdgeI
545 <<
" with mesh vertices " << patchEdge
547 <<
" in face " << faceI <<
" with mesh vertices "
551 <<
"Continuing with potentially incorrect faceZone orientation"
619Foam::addPatchCellLayer::addPatchCellLayer
622 const bool addToMesh,
627 addToMesh_(addToMesh),
644 forAll(layerFaces, patchFacei)
650 labelList& added = layerCells[patchFacei];
653 for (label i = 0; i <
faceLabels.size()-1; i++)
693 for (
const label patchFacei : edgeFaces[edgeI])
695 const label facei =
pp.addressing()[patchFacei];
701 || !ppFlip[patchFacei]
702 ||
mesh.isInternalFace(facei)
709 globalEdgeFaces[meshEdges[edgeI]] = std::move(faceIDs);
738void Foam::addPatchCellLayer::markPatchEdges
740 const polyMesh&
mesh,
746 bitSet& isPatchBoundaryEdge
753 isPatchEdge.setSize(
mesh.nEdges());
755 isPatchEdge.set(meshEdges);
761 orEqOp<unsigned int>(),
765 isPatchBoundaryEdge.setSize(
mesh.nEdges());
766 isPatchBoundaryEdge =
false;
767 forAll(edgeGlobalFaces, edgei)
773 if (edgeGlobalFaces[edgei].size() == 1)
775 isPatchBoundaryEdge.set(meshEdges[edgei]);
789void Foam::addPatchCellLayer::globalEdgeInfo
791 const bool zoneFromAnyFace,
825 for (
const label edgei : isBoundaryEdge)
827 isBoundaryEdgeSet.insert(
mesh.
edges()[edgei], edgei);
830 for (
const label edgei : isExtrudeEdge)
832 isExtrudeEdgeSet.insert(
mesh.
edges()[edgei], edgei);
854 faceToFlip[addressing[i]] = fm[i];
871 const bitSet isInternalOrCoupled
879 for (
const label facei : isInternalOrCoupled)
888 label prevPointi =
f.
last();
889 for (
const label pointi :
f)
891 const edge e(prevPointi, pointi);
895 const auto eFnd = isExtrudeEdgeSet.cfind(
e);
898 const label edgei = eFnd();
900 if (faceToZone[facei] != -1)
903 meshEdgeToFace[edgei] = globalFaces.toGlobal(facei);
904 meshEdgeToZone[edgei] = faceToZone[facei];
909 meshEdgeToFlip[edgei] = faceToFlip[facei];
913 meshEdgeToFlip[edgei] = !faceToFlip[facei];
949 const label facei =
pp.start()+i;
951 if (!isPpFace[facei])
955 label prevPointi =
f.
last();
956 for (
const label pointi :
f)
958 const edge e(prevPointi, pointi);
962 ? isExtrudeEdgeSet.cfind(
e)
963 : isBoundaryEdgeSet.cfind(
e)
967 const label edgei = eFnd();
968 if (meshEdgeToFace[edgei] == -1)
975 meshEdgeToFace[edgei] =
976 globalFaces.toGlobal(facei);
981 if (meshEdgeToPatch[edgei] == -1)
983 meshEdgeToPatch[edgei] =
pp.index();
987 if (meshEdgeToZone[edgei] == -1)
989 meshEdgeToZone[edgei] =
995 meshEdgeToFlip[edgei] =
1000 meshEdgeToFlip[edgei] =
1012 prevPointi = pointi;
1136 patchEdgeToFlip.setSize(meshEdges.size());
1137 patchEdgeToFlip =
false;
1140 patchEdgeToFlip[i] = meshEdgeToFlip[meshEdges[i]];
1147 const bool zoneFromAnyFace,
1149 const polyMesh&
mesh,
1150 const globalIndex& globalFaces,
1156 Map<label>& nbrProcToPatch,
1157 Map<label>& patchToNbrProc,
1163 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
1164 const globalMeshData& gd =
mesh.globalData();
1169 edgePatchID.setSize(
pp.nEdges());
1172 nbrProcToPatch.clear();
1173 patchToNbrProc.clear();
1174 edgeZoneID.setSize(
pp.nEdges());
1176 edgeFlip.setSize(
pp.nEdges());
1178 inflateFaceID.setSize(
pp.nEdges(), -1);
1194 forAll(globalEdgeFaces, edgei)
1196 const labelList& eGlobalFaces = globalEdgeFaces[edgei];
1199 eGlobalFaces.size() == 2
1200 &&
pp.edgeFaces()[edgei].size() == 1
1206 label f0 = eGlobalFaces[0];
1207 label f1 = eGlobalFaces[1];
1209 label otherProci = -1;
1210 if (globalFaces.isLocal(f0) && !globalFaces.isLocal(f1))
1212 otherProci = globalFaces.whichProcID(f1);
1214 else if (!globalFaces.isLocal(f0) && globalFaces.isLocal(f1))
1216 otherProci = globalFaces.whichProcID(f0);
1220 if (otherProci != -1)
1225 gd.topology().procPatchLookup(otherProci);
1231 procPatchi = nbrProcToPatch.lookup(otherProci, -1);
1240 nbrProcToPatch.insert(otherProci, procPatchi);
1241 patchToNbrProc.insert(procPatchi, otherProci);
1245 edgePatchID[edgei] = procPatchi;
1281 if (edgePatchID[edgei] == -1)
1283 if (edgeFaces[edgei].size() == 2)
1288 if (globalFaces.isLocal(edgeToFace[edgei]))
1290 inflateFaceID[edgei] =
1291 globalFaces.toLocal(edgeToFace[edgei]);
1293 edgeZoneID[edgei] = edgeToZone[edgei];
1294 edgeFlip[edgei] = edgeToFlip[edgei];
1301 if (globalFaces.isLocal(edgeToFace[edgei]))
1303 inflateFaceID[edgei] =
1304 globalFaces.toLocal(edgeToFace[edgei]);
1306 edgePatchID[edgei] = edgeToPatch[edgei];
1307 edgeZoneID[edgei] = edgeToZone[edgei];
1308 edgeFlip[edgei] = edgeToFlip[edgei];
1320 if (edgeFaces[edgei].size() == 1 && edgePatchID[edgei] == -1)
1324 <<
"Have no sidePatchID for edge " << edgei <<
" points "
1340 edgeFaces[edgei].size() == 1
1341 && globalEdgeFaces[edgei].size() == 2
1342 && edgePatchID[edgei] != -1
1343 && inflateFaceID[edgei] == -1
1351 label meshEdgei = meshEdges[edgei];
1360 label facei = meshFaces[
k];
1376 inflateFaceID[edgei]
1401 bitSet sameEdgeOrientation;
1412 labelList cppEdgeZoneID(cpp.nEdges(), -1);
1413 boolList cppEdgeFlip(cpp.nEdges(),
false);
1416 label cppEdgei = coupledEdges[i];
1417 label ppEdgei = patchEdges[i];
1419 cppEdgeZoneID[cppEdgei] = edgeZoneID[ppEdgei];
1420 if (sameEdgeOrientation[i])
1422 cppEdgeFlip[cppEdgei] = edgeFlip[ppEdgei];
1426 cppEdgeFlip[cppEdgei] = !edgeFlip[ppEdgei];
1437 gd.globalEdgeSlaves(),
1438 gd.globalEdgeTransformedSlaves(),
1447 gd.globalEdgeSlaves(),
1448 gd.globalEdgeTransformedSlaves(),
1458 label cppEdgei = coupledEdges[i];
1459 label ppEdgei = patchEdges[i];
1461 edgeZoneID[ppEdgei] = cppEdgeZoneID[cppEdgei];
1462 if (sameEdgeOrientation[i])
1464 edgeFlip[ppEdgei] = cppEdgeFlip[cppEdgei];
1468 edgeFlip[ppEdgei] = !cppEdgeFlip[cppEdgei];
1497 Pout<<
"addPatchCellLayer::setRefinement : Adding up to "
1498 <<
gMax(nPointLayers)
1499 <<
" layers of cells to indirectPrimitivePatch with "
1507 ||
pp.
size() != nFaceLayers.size()
1508 ||
pp.
size() != ppFlip.size()
1512 <<
"Size of new points is not same as number of points used by"
1513 <<
" the face subset" <<
endl
1515 <<
" displacement:" << firstLayerDisp.size()
1516 <<
" nPointLayers:" << nPointLayers.size() <<
nl
1517 <<
" patch.nFaces:" <<
pp.
size()
1518 <<
" flip map:" << ppFlip.size()
1519 <<
" nFaceLayers:" << nFaceLayers.size()
1528 <<
"In generating stand-alone mesh the flip map should be empty"
1529 <<
". Instead it is " << ppFlip.count()
1542 labelList stateAndFlip(mesh_.nBoundaryFaces(), 0);
1545 if (nFaceLayers[patchFacei] > 0)
1548 const label bFacei = meshFacei-mesh_.nInternalFaces();
1551 stateAndFlip[bFacei] = label(ppFlip[patchFacei]);
1556 for (
const auto& patch : mesh_.boundaryMesh())
1558 if (!
patch.coupled())
1562 label& state = stateAndFlip[
patch.offset()+i];
1563 state = (state == 0 ? 1 : 0);
1571 if (nFaceLayers[patchFacei] > 0)
1574 const label bFacei = meshFacei-mesh_.nInternalFaces();
1577 if (stateAndFlip[bFacei] == -1)
1580 <<
"At extruded face:" << meshFacei
1581 <<
" at:" << mesh_.faceCentres()[meshFacei]
1582 <<
" locally have nLayers:"
1583 << nFaceLayers[patchFacei]
1586 else if (stateAndFlip[bFacei] == label(ppFlip[patchFacei]))
1589 <<
"At extruded face:" << meshFacei
1590 <<
" at:" << mesh_.faceCentres()[meshFacei]
1591 <<
" locally have flip:" << ppFlip[patchFacei]
1592 <<
" which is not the opposite of coupled version "
1593 << stateAndFlip[bFacei]
1604 if (nPointLayers[i] < 0)
1607 <<
"Illegal number of layers " << nPointLayers[i]
1613 if (nFaceLayers[i] < 0)
1616 <<
"Illegal number of layers " << nFaceLayers[i]
1621 forAll(globalEdgeFaces, edgei)
1623 if (globalEdgeFaces[edgei].size() > 2)
1627 if (nPointLayers[
e[0]] > 0 || nPointLayers[
e[1]] > 0)
1630 <<
"Trying to extrude edge "
1632 <<
" which is non-manifold (has "
1633 << globalEdgeFaces[edgei].
size()
1634 <<
" local or coupled faces using it)"
1672 label meshPointi = meshPoints[i];
1674 if (
n[meshPointi] != nPointLayers[i])
1677 <<
"At mesh point:" << meshPointi
1678 <<
" coordinate:" << mesh_.points()[meshPointi]
1679 <<
" specified nLayers:" << nPointLayers[i] <<
endl
1680 <<
"On coupled point a different nLayers:"
1681 <<
n[meshPointi] <<
" was specified."
1696 label pointi =
f[fp];
1698 nFromFace[pointi] =
max(nFromFace[pointi], nFaceLayers[i]);
1711 label meshPointi = meshPoints[i];
1716 && nPointLayers[i] != nFromFace[meshPointi]
1720 <<
"At mesh point:" << meshPointi
1721 <<
" coordinate:" << mesh_.points()[meshPointi]
1722 <<
" specified nLayers:" << nPointLayers[i] <<
endl
1723 <<
"but the max nLayers of surrounding faces is:"
1724 << nFromFace[meshPointi]
1743 label meshPointi = meshPoints[i];
1745 if (
mag(d[meshPointi] - firstLayerDisp[i]) > SMALL)
1748 <<
"At mesh point:" << meshPointi
1749 <<
" coordinate:" << mesh_.points()[meshPointi]
1750 <<
" specified displacement:" << firstLayerDisp[i]
1752 <<
"On coupled point a different displacement:"
1753 << d[meshPointi] <<
" was specified."
1769 if (nPointLayers[
e[0]] > 0 || nPointLayers[
e[1]] > 0)
1776 if (eFaces.size() != 1)
1779 <<
"boundary-edge-to-be-extruded:"
1782 <<
" has more than two faces using it:" << eFaces
1854 label nTruncated = 0;
1856 forAll(nPointLayers, patchPointi)
1858 if (nPointLayers[patchPointi] > 0)
1860 addedPoints_[patchPointi].setSize(nPointLayers[patchPointi]);
1870 Pout<<
"Not adding points at " << nTruncated <<
" out of "
1884 faceList baseFaces(mesh_.nFaces());
1887 forAll(nPointLayers, patchPointi)
1889 if (nPointLayers[patchPointi] > 0)
1891 isDupPatchPoint.set(patchPointi);
1896 forAll(nFaceLayers, patchFacei)
1898 if (nFaceLayers[patchFacei] == 0)
1901 for (
const label patchPointi :
f)
1903 if (isDupPatchPoint[patchPointi])
1905 isDupPatchPoint.unset(patchPointi);
1911 findDuplicatedPoints
1934 copiedPatchPoints.setSize(firstLayerDisp.size());
1935 forAll(firstLayerDisp, patchPointi)
1937 if (addedPoints_[patchPointi].size())
1939 label meshPointi = meshPoints[patchPointi];
1940 label zoneI = mesh_.pointZones().whichZone(meshPointi);
1941 copiedPatchPoints[patchPointi] = meshMod.setAction
1945 mesh_.points()[meshPointi],
1957 forAll(firstLayerDisp, patchPointi)
1959 if (addedPoints_[patchPointi].size())
1961 const label meshPointi = meshPoints[patchPointi];
1962 const label zoneI = mesh_.pointZones().whichZone(meshPointi);
1964 point pt = mesh_.points()[meshPointi];
1966 vector disp = firstLayerDisp[patchPointi];
1968 forAll(addedPoints_[patchPointi], i)
1972 const label addedVertI = meshMod.setAction
1977 (addToMesh_ ? meshPointi : -1),
1989 addedPoints_[patchPointi][i] = addedVertI;
1991 disp *= expansionRatio[patchPointi];
2005 if (nFaceLayers[patchFacei] > 0)
2009 label extrudeCelli = -2;
2014 const label ownCelli = mesh_.faceOwner()[meshFacei];
2015 extrudeZonei = mesh_.cellZones().whichZone(ownCelli);
2017 else if (!ppFlip[patchFacei])
2020 extrudeCelli = mesh_.faceOwner()[meshFacei];
2021 extrudeZonei = mesh_.cellZones().whichZone(extrudeCelli);
2023 else if (mesh_.isInternalFace(meshFacei))
2028 extrudeCelli = mesh_.faceNeighbour()[meshFacei];
2029 extrudeZonei = mesh_.cellZones().whichZone(extrudeCelli);
2032 if (extrudeCelli != -2)
2034 addedCells[patchFacei].setSize(nFaceLayers[patchFacei]);
2036 for (label i = 0; i < nFaceLayers[patchFacei]; i++)
2040 addedCells[patchFacei][i] = meshMod.setAction
2069 layerFaces_.setSize(
pp.
size());
2075 if (addedCells[patchFacei].size())
2077 layerFaces_[patchFacei].setSize(addedCells[patchFacei].size() + 1);
2084 forAll(addedCells[patchFacei], i)
2088 if (addedPoints_[
f[fp]].empty())
2095 : copiedPatchPoints[
f[fp]]
2102 addedPoints_[
f[fp]].size()
2103 - addedCells[patchFacei].size();
2104 newFace[fp] = addedPoints_[
f[fp]][i+offset];
2118 bool zoneFlip =
false;
2119 bool fluxFlip =
false;
2121 if (i == addedCells[patchFacei].size()-1)
2130 zonei = mesh_.faceZones().whichZone(meshFacei);
2133 const faceZone& fz = mesh_.faceZones()[zonei];
2134 zoneFlip = fz.flipMap()[fz.whichFace(meshFacei)];
2143 ? mesh_.faceNeighbour()[meshFacei]
2144 : mesh_.faceOwner()[meshFacei]
2146 nei = addedCells[patchFacei][i];
2147 if (!ppFlip[patchFacei])
2149 newFace = newFace.reverseFace();
2152 zoneFlip = !zoneFlip;
2160 own = addedCells[patchFacei][i];
2174 ? mesh_.faceOwner()[meshFacei]
2175 : mesh_.faceNeighbour()[meshFacei]
2177 nei = addedCells[patchFacei][i];
2178 if (ppFlip[patchFacei])
2181 newFace = newFace.reverseFace();
2184 zoneFlip = !zoneFlip;
2194 own = addedCells[patchFacei][i];
2195 nei = addedCells[patchFacei][i+1];
2197 if (ppFlip[patchFacei])
2200 newFace = newFace.reverseFace();
2205 layerFaces_[patchFacei][i+1] = meshMod.setAction
2214 (addToMesh_ ? meshFacei : -1),
2244 if (addedCells[patchFacei].size())
2248 layerFaces_[patchFacei][0] = meshFacei;
2249 const face&
f =
pp[patchFacei];
2256 ? mesh_.faceOwner()[meshFacei]
2257 : mesh_.faceNeighbour()[meshFacei]
2259 const label nei = addedCells[patchFacei][0];
2265 (ppFlip[patchFacei] ?
f.reverseFace() :
f),
2295 if (!ppFlip[patchFacei])
2299 own = mesh_.faceNeighbour()[meshFacei];
2300 nei = addedCells[patchFacei].first();
2305 own = addedCells[patchFacei].first();
2312 own = mesh_.faceOwner()[meshFacei];
2313 nei = addedCells[patchFacei].first();
2317 own = addedCells[patchFacei].first();
2321 if (zonei != -1 && flip)
2323 zoneOrient = !zoneOrient;
2330 (flip ?
f.reverseFace() :
f),
2360 if (addedCells[patchFacei].size())
2363 label zoneI = mesh_.faceZones().whichZone(meshFacei);
2364 bool zoneFlip =
false;
2367 const faceZone& fz = mesh_.faceZones()[zoneI];
2368 zoneFlip = !fz.flipMap()[fz.whichFace(meshFacei)];
2375 f[fp] = copiedPatchPoints[
f[fp]];
2378 layerFaces_[patchFacei][0] = meshMod.setAction
2383 addedCells[patchFacei][0],
2389 exposedPatchID[patchFacei],
2415 labelList meshEdgeLayers(mesh_.nEdges(), -1);
2419 const edge&
e = edges[edgei];
2421 label meshEdgei = meshEdges[edgei];
2423 if ((nPointLayers[
e[0]] == 0) && (nPointLayers[
e[1]] == 0))
2425 meshEdgeLayers[meshEdgei] = 0;
2433 meshEdgeLayers[meshEdgei] =
max
2435 nFaceLayers[eFaces[i]],
2436 meshEdgeLayers[meshEdgei]
2452 edgeLayers[edgei] = meshEdgeLayers[meshEdges[edgei]];
2466 const labelList& fEdges = faceEdges[patchFacei];
2489 const label startFp = indexPair[0];
2490 const label endFp = indexPair[1];
2497 const face&
f = localFaces[patchFacei];
2500 if (endFp >= startFp)
2502 stringedVerts.setSize(endFp-startFp+2);
2506 stringedVerts.setSize(endFp+
f.
size()-startFp+2);
2511 for (label i = 0; i < stringedVerts.size()-1; i++)
2513 stringedVerts[i] =
f[fp];
2514 doneEdge[fEdges[fp]] =
true;
2517 stringedVerts.last() =
f[fp];
2527 const label startEdgei = fEdges[startFp];
2529 const label meshEdgei = meshEdges[startEdgei];
2531 const label numEdgeSideFaces = edgeLayers[startEdgei];
2533 for (label i = 0; i < numEdgeSideFaces; i++)
2535 const label vEnd = stringedVerts.last();
2536 const label vStart = stringedVerts[0];
2539 label newFp = 2*stringedVerts.size();
2545 if (addedPoints_[vEnd].size())
2548 addedPoints_[vEnd].size() - numEdgeSideFaces;
2550 if (addedPoints_[vStart].size())
2553 addedPoints_[vStart].size() - numEdgeSideFaces;
2557 face newFace(newFp);
2565 forAll(stringedVerts, stringedI)
2567 const label v = stringedVerts[stringedI];
2573 : copiedPatchPoints[v]
2582 forAll(stringedVerts, stringedI)
2584 const label v = stringedVerts[stringedI];
2585 if (addedPoints_[v].size())
2587 const label offset =
2588 addedPoints_[v].size() - numEdgeSideFaces;
2591 addedPoints_[v][i+offset-1],
2603 : copiedPatchPoints[v]
2613 if (numEdgeSideFaces < addedPoints_[vEnd].size())
2615 if (i == 0 && addedPoints_[vEnd].size())
2617 const label offset =
2618 addedPoints_[vEnd].size() - numEdgeSideFaces;
2619 for (label ioff = 0; ioff < offset; ioff++)
2623 addedPoints_[vEnd][ioff],
2633 const label v = stringedVerts[stringedI];
2634 if (addedPoints_[v].size())
2636 const label offset =
2637 addedPoints_[v].size() - numEdgeSideFaces;
2640 addedPoints_[v][i+offset],
2652 : copiedPatchPoints[v]
2662 if (numEdgeSideFaces < addedPoints_[vStart].size())
2664 if (i == 0 && addedPoints_[vStart].size())
2666 const label offset =
2667 addedPoints_[vStart].size() - numEdgeSideFaces;
2668 for (label ioff = offset-1; ioff >= 0; ioff--)
2672 addedPoints_[vStart][ioff],
2685 newFace.setSize(newFp);
2689 if (extrude_ == ppFlip[patchFacei])
2691 newFace = newFace.reverseFace();
2699 if (!verts.insert(newFace[fp]))
2702 <<
"Duplicate vertex in face"
2703 <<
" to be added." <<
nl
2704 <<
"newFace:" << newFace <<
nl
2712 <<
" out of:" << numEdgeSideFaces <<
nl
2713 <<
"ExtrudeEdge:" << meshEdgei
2715 << mesh_.edges()[meshEdgei].line
2719 <<
"string:" << stringedVerts
2737 label nbrFacei = nbrFace
2744 const labelList& meshFaces = mesh_.edgeFaces
2753 bool zoneFlip =
false;
2754 if (edgeZoneID[startEdgei] != -1)
2756 zoneFlip = !edgeFlip[startEdgei];
2765 edgePatchID[startEdgei],
2766 edgeZoneID[startEdgei],
2768 inflateFaceID[startEdgei],
2795 forAll(mesh_.faces(), facei)
2797 const face&
f = mesh_.faces()[facei];
2798 const face& baseF = baseFaces[facei];
2810 const label meshPointi =
f[fp];
2811 if (baseF[fp] != -1)
2818 const label patchPointi = pointFnd();
2819 const label addedPointi =
2820 addedPoints_[patchPointi].last();
2823 newFace[fp] = addedPointi;
2826 displacement[meshPointi] =
2827 meshMod.points()[addedPointi]
2828 -mesh_.points()[meshPointi];
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],
2924 const face&
f = mesh_.faces()[facei];
2925 const face& baseF = baseFaces[facei];
2936 if (baseF[fp] != -1)
2939 const label meshPointi =
f[fp];
2949 mesh_.points()[meshPointi]
2950 + displacement[meshPointi]
2956 mesh_.pointZones().whichZone(meshPointi),
2961 displacement[meshPointi] =
Zero;
3211 const labelList& added = addedPoints_[oldPointi];
3228 addedPoints_.transfer(newAddedPoints);
3234 forAll(newLayerFaces, newFacei)
3236 label oldFacei =
faceMap[newFacei];
3238 const labelList& added = layerFaces_[oldFacei];
3240 labelList& newAdded = newLayerFaces[newFacei];
3241 newAdded.
setSize(added.size());
3250 newAdded[newI++] = newFacei;
3253 newAdded.setSize(newI);
3255 layerFaces_.transfer(newLayerFaces);
3267 const bitSet& isDupPatchPoint,
3277 if (ppFlip.size() !=
pp.
size() || isDupPatchPoint.size() !=
pp.
nPoints())
3296 isDupMeshPoint =
face();
3300 forAll(localFaces, patchFacei)
3302 const face&
f = localFaces[patchFacei];
3305 const label patchPointi =
f[fp];
3306 if (isDupPatchPoint[patchPointi])
3309 face& baseF = isDupMeshPoint[meshFacei];
3314 if (extrude == ppFlip[patchFacei])
3320 isAffectedCell.set(owner[meshFacei]);
3325 isAffectedCell.set(neighbour[meshFacei]);
3346 for (
const label celli : isAffectedCell)
3352 minPointValue.
clear();
3353 for (
const label facei : cFaces)
3355 const face& baseF = isDupMeshPoint[facei];
3360 if (baseF[fp] != -1)
3367 if (mpm && !isDupPatchPoint[mpm()])
3380 minPointValue.insert(
f[fp], baseF[fp]);
3388 for (
const label facei : cFaces)
3391 face& baseF = isDupMeshPoint[facei];
3393 const label oldNChanged = nChanged;
3396 const auto fnd = minPointValue.
find(
f[fp]);
3400 if (mpm && !isDupPatchPoint[mpm()])
3407 if (baseF[fp] == -1)
3422 newIsAffectedCell.set(owner[facei]);
3425 newIsAffectedCell.set(neighbour[facei]);
3434 Pout<<
"isAffectedCell:" << isAffectedCell.count() <<
endl;
3435 Pout<<
"newIsAffectedCell:" << newIsAffectedCell.count()
3437 Pout<<
"nChanged:" << nChanged <<
endl;
3462 if (l[bFacei].size())
3469 l[bFacei] = isDupMeshPoint[facei];
3479 Foam::dummyTransform()
3493 const labelUList& oldVts = isDupMeshPoint[facei];
3495 if (newVts != oldVts)
3497 const label own = owner[facei];
3498 if (!isAffectedCell[own])
3500 newIsAffectedCell.set(own);
3506 isDupMeshPoint[facei] = l[bFacei];
3511 isAffectedCell = newIsAffectedCell;
labelList faceLabels(nFaceLabels)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
Map from edge (expressed as its endpoints) to value. Hashing (and ==) on an edge is symmetric.
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 found(const Key &key) const
Same as contains().
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()
Remove all entries from table.
const Addr & addressing() const noexcept
The addressing used for the list.
label size() const noexcept
The number of elements in the list.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void setSize(label n)
Alias for resize().
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
void setSize(const label n, unsigned int val=0u)
Alias for resize().
label size() const noexcept
Number of entries.
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
Return labels of patch edges in the global edge list using cell addressing.
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 Field< point_type > & faceCentres() const
Return face centres for patch.
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 with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
T & last()
Access last element of the list, position [size()-1].
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...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Adds layers of cells to outside (or inside) of polyMesh. Can optionally create stand-alone extruded m...
static labelListList addedCells(const polyMesh &, const labelListList &layerFaces)
Helper: get added cells per patch face.
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.
const labelListList & layerFaces() const
Layer faces per patch face. See above.
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp, const bitSet &orientation)
Per patch edge the pp faces (in global indices) using it.
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
static void findDuplicatedPoints(const polyMesh &mesh, const indirectPrimitivePatch &pp, const bitSet &ppFlip, const bitSet &isBlockedFace, const bitSet &isDupPatchPoint, const bool extrude, faceList &isDupMeshPoint)
Helper: given patch and points on patch that are extruded.
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.
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.
bitSet & unset(const bitSet &other)
Unset (subtract) the bits specified in the other bitset, which is a set difference corresponds to the...
static const bitSet & null() noexcept
Return a null bitSet (reference to a nullObject).
A cell is defined as a list of faces with extra functionality.
void operator()(face &x, const face &y) const
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge 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 meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
label find(const Foam::edge &e) const
Find the edge within the face.
face reverseFace() const
Return face with reverse direction.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label toLocal(const label proci, const label i) const
From global to local on proci.
label whichProcID(const label proci, const label i) const
Which processor does global id come from? Checks proci first (assumed to occur reasonably frequently)...
bool isLocal(const label proci, const label i) const
Is on processor proci.
label toGlobal(const label proci, const label i) const
From local to global on proci.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelListList & globalEdgeTransformedSlaves() const
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 & reverseFaceMap() const noexcept
Reverse face map.
const labelList & reversePointMap() const noexcept
Reverse point map.
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 registered IO, a reference to the associated polyMesh,...
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info (demand-driven).
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
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, const bool multiZone=false)
Modify vertices or cell of face.
void modifyPoint(const label pointi, const point &pt, const label zoneID, const bool inCell, const bool multiZone=false)
Modify coordinate.
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.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces).
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
label nInternalFaces() const noexcept
Number of internal faces.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
const labelListList & edgeFaces() const
const cellList & cells() const
label nEdges() const
Number of mesh edges.
label procPatchLookup(const label proci) const
Which local boundary is attached to specified neighbour processor.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const bitSet isBlockedFace(intersectedFaces())
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
const std::string patch
OpenFOAM patch number as a std::string.
List< edge > edgeList
List of edge.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Pair< label > labelPair
A pair of labels.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
UIndirectList< label > labelUIndList
UIndirectList of labels.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
Type gMax(const FieldField< Field, Type > &f)
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.