84 { debugType::MESH,
"mesh" },
85 { debugType::OBJINTERSECTIONS,
"intersections" },
86 { debugType::FEATURESEEDS,
"featureSeeds" },
87 { debugType::ATTRACTION,
"attraction" },
88 { debugType::LAYERINFO,
"layerInfo" },
108 { writeType::WRITEMESH,
"mesh" },
109 { writeType::NOWRITEREFINEMENT,
"noRefinement" },
110 { writeType::WRITELEVELS,
"scalarLevels" },
111 { writeType::WRITELAYERSETS,
"layerSets" },
112 { writeType::WRITELAYERFIELDS,
"layerFields" },
133 Foam::label Foam::meshRefinement::globalFaceCount(
const labelList& elems)
const 136 const bitSet isElem(mesh_.nFaces(), elems);
137 if (label(isElem.count()) != elems.size())
140 <<
" isElem:" << isElem.count()
141 <<
" elems:" << elems.size()
147 bitSet isElem2(isElem);
152 label facei = mesh_.nInternalFaces();
153 facei < mesh_.nFaces();
157 if (isElem2[facei] != isElem[facei])
160 <<
"at face:" << facei
161 <<
" at:" << mesh_.faceCentres()[facei]
162 <<
" patch:" << mesh_.boundaryMesh().whichPatch(facei)
163 <<
" isElem:" << isElem[facei]
164 <<
" isElem2:" << isElem2[facei]
173 for (
const label i : isElem)
184 void Foam::meshRefinement::calcNeighbourData
190 const labelList& cellLevel = meshCutter_.cellLevel();
191 const pointField& cellCentres = mesh_.cellCentres();
193 const label nBoundaryFaces = mesh_.nBoundaryFaces();
195 if (neiLevel.size() != nBoundaryFaces || neiCc.size() != nBoundaryFaces)
198 << nBoundaryFaces <<
" neiLevel:" << neiLevel.size()
202 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
208 const polyPatch& pp =
patches[patchi];
214 label bFacei = pp.start()-mesh_.nInternalFaces();
220 neiLevel[bFacei] = cellLevel[faceCells[i]];
221 neiCc[bFacei] = cellCentres[faceCells[i]];
225 else if (addedPatchIDSet.found(patchi))
237 label own = faceCells[i];
238 label ownLevel = cellLevel[own];
239 label faceLevel = meshCutter_.faceLevel(pp.start()+i);
244 faceLevel = ownLevel;
248 scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
249 if (faceLevel > ownLevel)
254 neiLevel[bFacei] = faceLevel;
256 neiCc[bFacei] = faceCentres[i] + d*fn;
264 neiLevel[bFacei] = cellLevel[faceCells[i]];
265 neiCc[bFacei] = faceCentres[i];
277 void Foam::meshRefinement::calcCellCellRays
287 const labelList& cellLevel = meshCutter_.cellLevel();
288 const pointField& cellCentres = mesh_.cellCentres();
293 bitSet isMaster(mesh_.nBoundaryFaces(),
true);
295 for (
const polyPatch& pp : mesh_.boundaryMesh())
297 if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
299 isMaster.
unset(labelRange(pp.offset(), pp.size()));
305 start.setSize(testFaces.size());
306 end.setSize(testFaces.size());
307 minLevel.setSize(testFaces.size());
311 const label facei = testFaces[i];
312 const label own = mesh_.faceOwner()[facei];
314 if (mesh_.isInternalFace(facei))
316 const label nei = mesh_.faceNeighbour()[facei];
318 start[i] = cellCentres[own];
319 end[i] = cellCentres[nei];
320 minLevel[i] =
min(cellLevel[own], cellLevel[nei]);
324 const label bFacei = facei - mesh_.nInternalFaces();
326 if (isMaster[bFacei])
328 start[i] = cellCentres[own];
329 end[i] = neiCc[bFacei];
334 start[i] = neiCc[bFacei];
335 end[i] = cellCentres[own];
337 minLevel[i] =
min(cellLevel[own], neiLevel[bFacei]);
356 const label nMasterFaces =
359 label nChangedFaces = 0;
362 if (isMasterFace.
test(changedFaces[i]))
371 Info<<
"Edge intersection testing:" <<
nl 372 <<
" Number of edges : " << nMasterFaces <<
nl 373 <<
" Number of edges to retest : " << nChangedFaces
380 labelList neiLevel(mesh_.nBoundaryFaces());
382 calcNeighbourData(neiLevel, neiCc);
405 surfaces_.findHigherIntersection
419 surfaceIndex_[changedFaces[i]] = surfaceHit[i];
430 Info<<
" Number of intersected edges : " << nTotHits <<
endl;
434 setInstance(mesh_.facesInstance());
438 void Foam::meshRefinement::nearestFace
441 const bitSet& isBlockedFace,
473 for (
const label facei : isBlockedFace)
478 List<topoDistanceData<label>> startData(startFaces.
size());
481 const label facei = startFaces[i];
482 if (isBlockedFace[facei])
485 <<
" at:" << mesh_.faceCentres()[facei]
488 startData[i] = topoDistanceData<label>(0, globalStart.toGlobal(i));
493 FaceCellWave<topoDistanceData<label>> deltaCalc
502 deltaCalc.iterate(nIter);
506 faceToStart.
setSize(mesh_.nFaces());
508 bool haveWarned =
false;
511 if (!faceData[facei].valid(deltaCalc.data()))
516 <<
"Did not visit some faces, e.g. face " << facei
517 <<
" at " << mesh_.faceCentres()[facei]
524 faceToStart[facei] = faceData[facei].
data();
529 List<Map<label>> compactMap;
530 mapPtr.
reset(
new mapDistribute(globalStart, faceToStart, compactMap));
534 void Foam::meshRefinement::nearestPatch
544 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
546 nearestZone.
setSize(mesh_.nFaces(), -1);
548 if (adaptPatchIDs.size())
550 nearestPatch.setSize(mesh_.nFaces(), adaptPatchIDs[0]);
554 labelList faceToZone(mesh_.nFaces(), -1);
556 for (
const faceZone& fz : mesh_.faceZones())
558 UIndirectList<label>(faceToZone, fz) = fz.index();
567 const polyPatch& pp =
patches[adaptPatchIDs[i]];
572 List<topoDistanceData<labelPair>> cellData(mesh_.nCells());
573 List<topoDistanceData<labelPair>> faceData(mesh_.nFaces());
577 List<topoDistanceData<labelPair>> patchData(nFaces);
581 label patchi = adaptPatchIDs[i];
582 const polyPatch& pp =
patches[patchi];
586 patchFaces[nFaces] = pp.start()+i;
587 patchData[nFaces] = topoDistanceData<labelPair>
593 faceToZone[pp.start()+i]
601 FaceCellWave<topoDistanceData<labelPair>> deltaCalc
608 mesh_.globalData().nTotalCells()+1
613 bool haveWarned =
false;
616 if (!faceData[facei].valid(deltaCalc.data()))
621 <<
"Did not visit some faces, e.g. face " << facei
622 <<
" at " << mesh_.faceCentres()[facei] <<
endl 623 <<
"Assigning these faces to patch " 632 nearestPatch[facei] = data.first();
633 nearestZone[facei] = data.second();
640 nearestPatch.setSize(mesh_.nFaces(), 0);
652 nearestPatch(adaptPatchIDs, nearestAdaptPatch, nearestAdaptZone);
653 return nearestAdaptPatch;
657 void Foam::meshRefinement::nearestIntersection
671 labelList neiLevel(mesh_.nBoundaryFaces());
673 calcNeighbourData(neiLevel, neiCc);
694 surfaces_.findNearestIntersection
713 const label defaultRegion
722 const labelList testFaces(intersectedFaces());
745 labelList nearestRegion(mesh_.nFaces(), defaultRegion);
756 label facei = testFaces[i];
757 if (surface1[i] != -1)
759 patchFaces.append(facei);
760 label regioni = surfaces_.globalRegion(surface1[i], region1[i]);
763 else if (surface2[i] != -1)
765 patchFaces.append(facei);
766 label regioni = surfaces_.globalRegion(surface2[i], region2[i]);
767 patchData.append(topoDistanceData<label>(0, regioni));
772 FaceCellWave<topoDistanceData<label>> deltaCalc
779 mesh_.globalData().nTotalCells()+1
784 bool haveWarned =
false;
787 if (!faceData[facei].valid(deltaCalc.data()))
792 <<
"Did not visit some faces, e.g. face " << facei
793 <<
" at " << mesh_.faceCentres()[facei] <<
endl 794 <<
"Assigning these faces to global region " 795 << defaultRegion <<
endl;
801 nearestRegion[facei] = faceData[facei].data();
805 return nearestRegion;
824 Pout<<
"Checking field " << msg <<
endl;
843 const scalar& minVal = minFld[pointi];
844 const scalar& maxVal = maxFld[pointi];
845 if (
mag(minVal-maxVal) > SMALL)
848 <<
" minFld:" << minVal <<
nl 849 <<
" maxFld:" << maxVal <<
nl 871 Pout<<
"Checking field " << msg <<
endl;
878 point(GREAT, GREAT, GREAT)
890 const point& minVal = minFld[pointi];
891 const point& maxVal = maxFld[pointi];
892 if (
mag(minVal-maxVal) > SMALL)
895 <<
" minFld:" << minVal <<
nl 896 <<
" maxFld:" << maxVal <<
nl 905 Pout<<
"meshRefinement::checkData() : Checking refinement structure." 907 meshCutter_.checkMesh();
909 Pout<<
"meshRefinement::checkData() : Checking refinement levels." 911 meshCutter_.checkRefinementLevels(1,
labelList(0));
914 const label nBnd = mesh_.nBoundaryFaces();
916 Pout<<
"meshRefinement::checkData() : Checking synchronization." 926 mesh_.nInternalFaces()
939 testSyncBoundaryFaceList
942 "testing faceCentres : ",
949 const labelList& surfIndex = surfaceIndex();
956 calcNeighbourData(neiLevel, neiCc);
964 start[facei] = mesh_.cellCentres()[mesh_.faceOwner()[facei]];
966 if (mesh_.isInternalFace(facei))
968 end[facei] = mesh_.cellCentres()[mesh_.faceNeighbour()[facei]];
972 end[facei] = neiCc[facei-mesh_.nInternalFaces()];
988 surfaces_.findHigherIntersection
1005 mesh_.nInternalFaces()
1011 forAll(surfaceHit, facei)
1013 if (surfIndex[facei] != surfaceHit[facei])
1015 if (mesh_.isInternalFace(facei))
1018 <<
"Internal face:" << facei
1019 <<
" fc:" << mesh_.faceCentres()[facei]
1020 <<
" cached surfaceIndex_:" << surfIndex[facei]
1021 <<
" current:" << surfaceHit[facei]
1023 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
1025 << mesh_.cellCentres()[mesh_.faceNeighbour()[facei]]
1031 != neiHit[facei-mesh_.nInternalFaces()]
1035 <<
"Boundary face:" << facei
1036 <<
" fc:" << mesh_.faceCentres()[facei]
1037 <<
" cached surfaceIndex_:" << surfIndex[facei]
1038 <<
" current:" << surfaceHit[facei]
1040 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
1042 << neiCc[facei-mesh_.nInternalFaces()]
1043 <<
" end:" <<
end[facei]
1045 << meshCutter_.cellLevel()[mesh_.faceOwner()[facei]]
1047 << meshCutter_.faceLevel(facei)
1057 mesh_.nBoundaryFaces(),
1058 mesh_.nInternalFaces()
1061 labelList neiBoundarySurface(boundarySurface);
1069 testSyncBoundaryFaceList
1072 "testing surfaceIndex() : ",
1080 Pout<<
"meshRefinement::checkData() : Counting duplicate faces." 1088 identity(mesh_.nBoundaryFaces(), mesh_.nInternalFaces())
1098 if (duplicateFace[i] != -1)
1104 Pout<<
"meshRefinement::checkData() : Found " << nDup
1105 <<
" duplicate pairs of faces." <<
endl;
1112 meshCutter_.setInstance(inst);
1113 surfaceIndex_.instance() = inst;
1138 mesh_.moving(
false);
1145 mesh_.updateMesh(map);
1160 setInstance(mesh_.facesInstance());
1175 updateMesh(map, newExposedFaces);
1191 label facei = splitFaces[i];
1192 const face&
f = mesh_.faces()[facei];
1208 label fp =
split[0];
1225 label own = mesh_.faceOwner()[facei];
1228 if (facei >= mesh_.nInternalFaces())
1230 patchi = mesh_.boundaryMesh().whichPatch(facei);
1234 nei = mesh_.faceNeighbour()[facei];
1237 label zonei = mesh_.faceZones().whichZone(facei);
1238 bool zoneFlip =
false;
1241 const faceZone& fz = mesh_.faceZones()[zonei];
1248 Pout<<
"face:" << facei <<
" verts:" <<
f 1249 <<
" split into f0:" << f0
1250 <<
" f1:" << f1 <<
endl;
1312 <<
"Splitting " << nSplit
1313 <<
" faces across diagonals" <<
"." <<
nl <<
endl;
1325 meshMod.
faces().size()+splitFaces.
size(),
1330 doSplitFaces(splitFaces, splits, meshMod);
1334 mesh_.moving(
false);
1341 mesh_.updateMesh(map);
1355 setInstance(mesh_.facesInstance());
1370 splitFaceToIndex.insert(splitFaces[i], i);
1375 label oldFacei = map.
faceMap()[facei];
1377 const auto oldFaceFnd = splitFaceToIndex.cfind(oldFacei);
1379 if (oldFaceFnd.found())
1381 labelPair& twoFaces = facePairs[oldFaceFnd.val()];
1382 if (twoFaces[0] == -1)
1384 twoFaces[0] = facei;
1386 else if (twoFaces[1] == -1)
1388 twoFaces[1] = facei;
1393 <<
"problem: twoFaces:" << twoFaces
1404 if (duplicateFace.
size())
1418 baffle.
first() = oldToNewFaces[baffle.
first()];
1421 if (baffle.
first() == -1 || baffle.
second() == -1)
1424 <<
"Removed baffle : faces:" << baffle
1437 changedFaces.
append(facePairs[i].first());
1438 changedFaces.
append(facePairs[i].second());
1442 updateMesh(map, growFaceCellFace(changedFaces));
1455 for (label iteration = 0; iteration < 100; iteration++)
1458 <<
"Undo iteration " << iteration <<
nl 1459 <<
"----------------" <<
endl;
1465 faceSet errorFaces(mesh_,
"errorFaces", mesh_.nBoundaryFaces());
1481 const labelList grownFaces(growFaceCellFace(errorFaces));
1483 errorFaces.insert(grownFaces);
1497 const labelPair& twoFaces = facePairs[index];
1501 errorFaces.found(twoFaces.
first())
1502 || errorFaces.found(twoFaces.
second())
1505 const face& originalFace = originalFaces[index];
1509 label own = mesh_.faceOwner()[twoFaces[0]];
1512 if (twoFaces[0] >= mesh_.nInternalFaces())
1514 patchi = mesh_.boundaryMesh().whichPatch(twoFaces[0]);
1518 nei = mesh_.faceNeighbour()[twoFaces[0]];
1521 label zonei = mesh_.faceZones().whichZone(twoFaces[0]);
1522 bool zoneFlip =
false;
1525 const faceZone& fz = mesh_.faceZones()[zonei];
1542 meshMod.
removeFace(twoFaces[1], twoFaces[0]);
1544 mergedIndices.insert(index);
1550 Info<<
"Detected " <<
n 1551 <<
" split faces that will be restored to their original faces." 1565 mesh_.moving(
false);
1572 mesh_.updateMesh(map);
1586 setInstance(mesh_.facesInstance());
1602 const labelPair& oldSplit = facePairs[index];
1603 label new0 = oldToNewFaces[oldSplit[0]];
1604 label new1 = oldToNewFaces[oldSplit[1]];
1606 if (!mergedIndices.found(index))
1609 if (new0 < 0 || new1 < 0)
1612 <<
"Problem: oldFaces:" << oldSplit
1613 <<
" newFaces:" <<
labelPair(new0, new1)
1617 facePairs[newIndex] =
labelPair(new0, new1);
1621 originalFaces[index]
1628 if (new0 < 0 || new1 == -1)
1631 <<
"Problem: oldFaces:" << oldSplit
1635 changedFaces.
append(new0);
1639 facePairs.setSize(newIndex);
1640 originalFaces.
setSize(newIndex);
1644 updateMesh(map, growFaceCellFace(changedFaces));
1650 if (duplicateFace.
size())
1664 baffle.
first() = reverseFaceMap[baffle.
first()];
1667 if (baffle.
first() == -1 || baffle.
second() == -1)
1670 <<
"Removed baffle : faces:" << baffle
1684 Foam::meshRefinement::meshRefinement
1687 const scalar mergeDistance,
1688 const bool overwrite,
1698 mergeDistance_(mergeDistance),
1699 overwrite_(overwrite),
1700 oldInstance_(
mesh.pointsInstance()),
1701 surfaces_(surfaces),
1702 features_(features),
1704 limitShells_(limitShells),
1716 mesh_.facesInstance(),
1736 if (surfaceIndex_.size() != mesh_.nFaces())
1743 return surfaceIndex_;
1749 if (surfaceIndex_.size() != mesh_.nFaces())
1751 updateIntersections(
identity(mesh_.nFaces()));
1753 return surfaceIndex_;
1764 const labelList& surfIndex = surfaceIndex();
1768 if (surfIndex[facei] >= 0 && isMasterFace.
test(facei))
1779 const bool keepZoneFaces,
1780 const bool keepBaffles,
1797 label nUnblocked = 0;
1811 specifiedProcessorFaces,
1817 if (keepZoneFaces || keepBaffles)
1837 const faceZone& fZone = fZones[zonei];
1841 label facei = fZone[i];
1842 if (blockedFace[facei])
1846 mesh_.isInternalFace(facei)
1850 blockedFace[facei] =
false;
1872 Info<<
"Found " << nUnblocked
1873 <<
" zoned faces to keep together." <<
endl;
1879 boolList separatedCoupledFace(mesh_.nFaces(),
false);
1880 selectSeparatedCoupledFaces(separatedCoupledFace);
1882 label nSeparated = 0;
1883 forAll(separatedCoupledFace, facei)
1885 if (separatedCoupledFace[facei])
1887 if (blockedFace[facei])
1889 blockedFace[facei] =
false;
1895 Info<<
"Found " << nSeparated
1896 <<
" separated coupled faces to keep together." <<
endl;
1898 nUnblocked += nSeparated;
1904 const label nBnd = mesh_.nBoundaryFaces();
1906 labelList coupledFace(mesh_.nFaces(), -1);
1924 const labelPair& baffle = allCouples[i];
1932 forAll(coupledFace, facei)
1934 if (coupledFace[facei] != -1 && facei < coupledFace[facei])
1936 couples[nCpl++] =
labelPair(facei, coupledFace[facei]);
1945 Info<<
"Found " << nCouples <<
" baffles to keep together." 1955 blockedFace[baffle.
first()] =
false;
1956 blockedFace[baffle.
second()] =
false;
1964 specifiedProcessorFaces,
1972 Pout<<
"Wanted distribution:" << nProcCells <<
endl;
1976 Pout<<
"Wanted resulting decomposition:" <<
endl;
1977 forAll(nProcCells, proci)
1979 Pout<<
" " << proci <<
'\t' << nProcCells[proci] <<
endl;
1992 setInstance(mesh_.facesInstance());
1995 if (
debug && keepZoneFaces)
2003 const faceZone& fZone = fZones[zonei];
2007 label facei = fZone[i];
2010 if (patchi >= 0 && pbm[patchi].
coupled())
2013 <<
"Face at " << mesh_.faceCentres()[facei]
2014 <<
" on zone " << fZone.
name()
2015 <<
" is on coupled patch " << pbm[patchi].
name()
2029 label nBoundaryFaces = 0;
2031 const labelList& surfIndex = surfaceIndex();
2035 if (surfIndex[facei] != -1)
2046 if (surfIndex[facei] != -1)
2048 surfaceFaces[nBoundaryFaces++] = facei;
2051 return surfaceFaces;
2057 const faceList& faces = mesh_.faces();
2060 bitSet isBoundaryPoint(mesh_.nPoints());
2061 label nBoundaryPoints = 0;
2063 const labelList& surfIndex = surfaceIndex();
2067 if (surfIndex[facei] != -1)
2069 const face&
f = faces[facei];
2073 if (isBoundaryPoint.set(
f[fp]))
2110 labelList boundaryPoints(nBoundaryPoints);
2111 nBoundaryPoints = 0;
2112 forAll(isBoundaryPoint, pointi)
2114 if (isBoundaryPoint.test(pointi))
2116 boundaryPoints[nBoundaryPoints++] = pointi;
2120 return boundaryPoints;
2140 nFaces += pp.size();
2151 label meshFacei = pp.
start();
2155 addressing[nFaces++] = meshFacei++;
2180 pointPatches.
size(),
2181 slipPointPatchVectorField::typeName
2186 patchFieldTypes[adaptPatchIDs[i]] =
2187 fixedValuePointPatchVectorField::typeName;
2190 forAll(pointPatches, patchi)
2192 if (isA<processorPointPatch>(pointPatches[patchi]))
2194 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
2196 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
2198 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
2208 "pointDisplacement",
2242 <<
"faceZones are not synchronised on processors." <<
nl 2243 <<
"Processor " << proci <<
" has faceZones " 2244 << zoneNames[proci] <<
nl 2246 <<
" has faceZones " 2259 const faceZone& fZone = fZones[zonei];
2267 if (faceToZone[bFacei] == -1)
2269 faceToZone[bFacei] = zonei;
2271 else if (faceToZone[bFacei] == zonei)
2274 <<
"Face " << fZone[i] <<
" in zone " 2276 <<
" is twice in zone!" 2282 <<
"Face " << fZone[i] <<
" in zone " 2284 <<
" is also in zone " 2285 << fZones[faceToZone[bFacei]].
name()
2297 if (faceToZone[i] != neiFaceToZone[i])
2301 <<
" is in zone " << faceToZone[i]
2302 <<
", its coupled face is in zone " << neiFaceToZone[i]
2312 const bitSet& isMasterEdge,
2327 const edge&
e = edges[edgei];
2333 pts[meshPoints[
e[1]]]
2334 -
pts[meshPoints[
e[0]]]
2337 edgeWeights[edgei] = 1.0/eMag;
2353 forAll(invSumWeight, pointi)
2355 scalar w = invSumWeight[pointi];
2359 invSumWeight[pointi] = 1.0/w;
2368 const label insertPatchi,
2369 const word& patchName,
2380 label patchi = polyPatches.
size();
2383 polyPatches.
setSize(patchi+1);
2401 polyPatches[patchi],
2406 addPatchFields<volScalarField>
2411 addPatchFields<volVectorField>
2416 addPatchFields<volSphericalTensorField>
2421 addPatchFields<volSymmTensorField>
2426 addPatchFields<volTensorField>
2434 addPatchFields<surfaceScalarField>
2439 addPatchFields<surfaceVectorField>
2444 addPatchFields<surfaceSphericalTensorField>
2449 addPatchFields<surfaceSymmTensorField>
2454 addPatchFields<surfaceTensorField>
2466 const word& patchName,
2474 const label patchi = polyPatches.
findPatchID(patchName);
2482 label insertPatchi = polyPatches.
size();
2485 forAll(polyPatches, patchi)
2487 const polyPatch& pp = polyPatches[patchi];
2489 if (isA<processorPolyPatch>(pp))
2491 insertPatchi = patchi;
2492 startFacei = pp.
start();
2498 patchDict.
set(
"nFaces", 0);
2499 patchDict.
set(
"startFace", startFacei);
2504 label addedPatchi = appendPatch(
mesh, insertPatchi, patchName, patchDict);
2510 for (label i = 0; i < insertPatchi; i++)
2515 for (label i = insertPatchi; i < addedPatchi; i++)
2520 oldToNew[addedPatchi] = insertPatchi;
2523 polyPatches.
reorder(oldToNew,
true);
2526 reorderPatchFields<volScalarField>(
mesh, oldToNew);
2527 reorderPatchFields<volVectorField>(
mesh, oldToNew);
2528 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
2529 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
2530 reorderPatchFields<volTensorField>(
mesh, oldToNew);
2531 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
2532 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
2533 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
2534 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
2535 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
2537 return insertPatchi;
2547 label meshedi = meshedPatches_.find(
name);
2552 return mesh_.boundaryMesh().findPatchID(
name);
2557 label patchi = addPatch(mesh_,
name, patchInfo);
2582 meshedPatches_.append(
name);
2585 faceToCoupledPatch_.clear();
2597 forAll(meshedPatches_, i)
2604 <<
"Problem : did not find patch " << meshedPatches_[i]
2621 const word& masterPatch,
2622 const word& slavePatch,
2634 faceZoneToMasterPatch_.insert(fzName, masterPatch);
2635 faceZoneToSlavePatch_.insert(fzName, slavePatch);
2636 faceZoneToType_.insert(fzName, fzType);
2645 label& masterPatchID,
2646 label& slavePatchID,
2652 if (!faceZoneToMasterPatch_.found(fzName))
2658 const word& masterName = faceZoneToMasterPatch_[fzName];
2661 const word& slaveName = faceZoneToSlavePatch_[fzName];
2664 fzType = faceZoneToType_[fzName];
2679 zoneI = pointZones.
size();
2703 const auto* cpp = isA<coupledPolyPatch>(pp);
2705 if (cpp && (cpp->separated() || !cpp->parallel()))
2724 nEdgeFaces[edgei] = edgeFaces[edgei].
size();
2773 const vector& perturbVec,
2795 const vector& perturbVec,
2807 regioni = cellToRegion[celli];
2817 regioni = cellToRegion[celli];
2857 locationsOutsideMesh,
2866 label nSegments = 0;
2867 if (leakPath.segments().size())
2869 nSegments =
max(leakPath.segments())+1;
2871 reduce(nSegments, maxOp<label>());
2874 for (label segmenti : leakPath.segments())
2876 nElemsPerSegment[segmenti]++;
2878 segmentPoints.setSize(nElemsPerSegment.size());
2879 segmentDist.
setSize(nElemsPerSegment.size());
2880 forAll(nElemsPerSegment, i)
2882 segmentPoints[i].setSize(nElemsPerSegment[i]);
2883 segmentDist[i].
setSize(nElemsPerSegment[i]);
2885 nElemsPerSegment = 0;
2889 label segmenti = leakPath.segments()[elemi];
2892 label&
n = nElemsPerSegment[segmenti];
2895 dist[
n] = leakPath.distance()[elemi];
2900 PtrList<coordSet> allLeakPaths(segmentPoints.size());
2901 forAll(allLeakPaths, segmenti)
2915 ListListOps::combine<pointList>
2917 gatheredPts, accessOp<pointList>()
2922 ListListOps::combine<scalarList>
2924 gatheredDist, accessOp<scalarList>()
2948 List<scalarField> allLeakData(allLeakPaths.size());
2949 forAll(allLeakPaths, segmenti)
2951 allLeakData[segmenti] = allLeakPaths[segmenti].distance();
2959 (outputDir / allLeakPaths[0].
name())
2962 fName =
writer.write(
"leakPath", allLeakData);
2981 const vector& perturbVec,
2984 const label nRegions,
2988 const bool exitIfLeakPath,
2999 label regioni = findRegion
3007 insideRegions[i] = regioni;
3010 forAll(cellRegion, celli)
3012 if (cellRegion[celli] == regioni)
3014 insideCell.set(celli);
3023 forAll(locationsOutsideMesh, i)
3029 label regioni = findRegion
3034 locationsOutsideMesh[i]
3037 if (regioni == -1 && (indexi = insideRegions.find(regioni)) != -1)
3039 if (leakPathFormatter)
3047 locationsOutsideMesh,
3052 Info<<
"Dumped leak path to " << fName <<
endl;
3062 err <<
"Location in mesh " << locationsInMesh[indexi]
3063 <<
" is inside same mesh region " << regioni
3064 <<
" as one of the locations outside mesh " 3065 << locationsOutsideMesh <<
endl;
3078 forAll(insideCell, celli)
3080 if (!insideCell.test(celli))
3082 cellRegion[celli] = -1;
3085 else if (cellRegion[celli] == -1)
3101 const bool exitIfLeakPath,
3106 (void)mesh_.tetBasePtIs();
3111 boolList blockedFace(mesh_.nFaces(),
false);
3112 selectSeparatedCoupledFaces(blockedFace);
3116 label nRemove = findRegions
3119 vector::uniform(mergeDistance_),
3121 locationsOutsideMesh,
3135 forAll(cellRegion, celli)
3137 if (cellRegion[celli] == -1)
3139 cellsToRemove.append(celli);
3142 cellsToRemove.shrink();
3146 cellsToRemove.size(),
3152 if (nTotCellsToRemove > 0)
3154 label nCellsToKeep =
3155 mesh_.globalData().nTotalCells()
3156 - nTotCellsToRemove;
3158 Info<<
"Keeping all cells containing points " << locationsInMesh <<
endl 3159 <<
"Selected for keeping : " 3161 <<
" cells." <<
endl;
3179 label defaultPatch = 0;
3180 if (globalToMasterPatch.
size())
3182 defaultPatch = globalToMasterPatch[0];
3186 <<
"Removing non-reachable cells exposes " 3187 << nExposedFaces <<
" internal or coupled faces." <<
endl 3188 <<
" These get put into patch " << defaultPatch <<
endl;
3189 exposedPatch.setSize(exposedFaces.
size(), defaultPatch);
3192 mapPtr = doRemoveCells
3211 meshCutter_.distribute(map);
3218 faceToCoupledPatch_.clear();
3245 geometry[i].distribute
3256 geometry[i].instance() = geometry[i].time().timeName();
3274 updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
3286 meshCutter_.storeData
3307 meshCutter_.updateMesh
3316 updateList(map.
faceMap(), label(-1), surfaceIndex_);
3320 Map<label> newFaceToPatch(faceToCoupledPatch_.size());
3327 newFaceToPatch.insert(newFacei, iter.val());
3330 faceToCoupledPatch_.
transfer(newFaceToPatch);
3335 updateIntersections(changedFaces);
3342 if (userFaceData_[i].first() == KEEPALL)
3347 else if (userFaceData_[i].first() == MASTERONLY)
3352 forAll(newFaceData, facei)
3354 label oldFacei = map.
faceMap()[facei];
3358 newFaceData[facei] =
data[oldFacei];
3374 label oldFacei = map.
faceMap()[facei];
3378 if (reverseFaceMap[oldFacei] != facei)
3381 reverseFaceMap[oldFacei] = -1;
3388 forAll(newFaceData, facei)
3390 label oldFacei = map.
faceMap()[facei];
3394 if (reverseFaceMap[oldFacei] == facei)
3396 newFaceData[facei] =
data[oldFacei];
3408 bool writeOk = mesh_.write();
3425 s.instance() !=
s.time().system()
3426 &&
s.instance() !=
s.time().caseSystem()
3427 &&
s.instance() !=
s.time().constant()
3428 &&
s.instance() !=
s.time().caseConstant()
3432 s.instance() =
s.time().timeName();
3433 writeOk = writeOk &&
s.write();
3464 bitSet isPatchMasterPoint(meshPoints.
size());
3465 forAll(meshPoints, pointi)
3469 isPatchMasterPoint.set(pointi);
3473 return isPatchMasterPoint;
3487 identity(globalEdges.localSize(), globalEdges.localStart())
3503 if (myEdges[edgei] == globalEdges.toGlobal(edgei))
3505 isMasterEdge.
set(edgei);
3509 return isMasterEdge;
3521 <<
" : cells(local):" << mesh_.nCells()
3522 <<
" faces(local):" << mesh_.nFaces()
3523 <<
" points(local):" << mesh_.nPoints()
3529 label nMasterFaces = isMasterFace.
count();
3532 label nMasterPoints = isMeshMasterPoint.
count();
3544 const labelList& cellLevel = meshCutter_.cellLevel();
3550 nCells[cellLevel[celli]]++;
3558 Info<<
"Cells per refinement level:" <<
endl;
3561 Info<<
" " << leveli <<
'\t' << nCells[leveli]
3571 if (overwrite_ && mesh_.time().timeIndex() == 0)
3573 return oldInstance_;
3576 return mesh_.time().timeName();
3590 mesh_.time().timeName(),
3598 zeroGradientFvPatchScalarField::typeName
3601 const labelList& cellLevel = meshCutter_.cellLevel();
3603 forAll(volRefLevel, celli)
3605 volRefLevel[celli] = cellLevel[celli];
3608 volRefLevel.write();
3620 mesh_.time().timeName(),
3630 const labelList& pointLevel = meshCutter_.pointLevel();
3632 forAll(pointRefLevel, pointi)
3634 pointRefLevel[pointi] = pointLevel[pointi];
3637 pointRefLevel.write();
3645 OFstream str(prefix +
"_edges.obj");
3647 Pout<<
"meshRefinement::dumpIntersections :" 3648 <<
" Writing cellcentre-cellcentre intersections to file " 3656 labelList neiLevel(mesh_.nBoundaryFaces());
3658 calcNeighbourData(neiLevel, neiCc);
3660 labelList intersectionFaces(intersectedFaces());
3682 surfaces_.findAnyIntersection
3690 forAll(intersectionFaces, i)
3692 if (surfaceHit[i] != -1)
3700 str <<
"l " << verti-2 <<
' ' << verti-1 <<
nl 3701 <<
"l " << verti-1 <<
' ' << verti <<
nl;
3717 if (writeFlags & WRITEMESH)
3722 if (writeFlags && !(writeFlags & NOWRITEREFINEMENT))
3724 meshCutter_.write();
3727 (void)surfaceIndex();
3728 surfaceIndex_.write();
3731 if (writeFlags & WRITELEVELS)
3733 dumpRefinementLevel();
3736 if ((debugFlags & OBJINTERSECTIONS) && prefix.size())
3738 dumpIntersections(prefix);
3757 if (
exists(setsDir/
"surfaceIndex"))
3759 rm(setsDir/
"surfaceIndex");
3775 writeLevel_ = flags;
3794 const word& keyword,
3799 const auto finder(
dict.
csearch(keyword, matchOpt));
3805 err <<
"Entry '" << keyword <<
"' not found in dictionary " 3818 return finder.dict();
3825 const word& keyword,
3836 err <<
"Entry '" << keyword <<
"' not found in dictionary " label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
void clearOut()
Clear all geometry and addressing.
const T & first() const noexcept
Access the first element.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
void size(const label n)
Older name for setAddressableSize.
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset(const label i)
Unset the bool entry at specified position, always false for out-of-range access. ...
unsigned int count(const bool on=true) const
Count number of bits set.
label size() const noexcept
Number of entries.
static const dictionary & subDict(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::subDict which does not exit.
void clearAddressing()
Clear addressing.
const labelList & reversePointMap() const
Reverse point map.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A class for handling file names.
const DynamicList< face > & faces() const
label addPointZone(const word &name)
Add pointZone if does not exist. Return index of zone.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
void transfer(dictionary &dict)
Transfer the contents of the argument and annul the argument.
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label countHits() const
Count number of intersections (local)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
static label findRegions(const polyMesh &, const vector &perturbVec, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const label nRegions, labelList &cellRegion, const boolList &blockedFace, const bool exitIfLeakPath, const refPtr< coordSetWriter > &leakPathFormatter)
Find regions points are in.
const word & name() const noexcept
Return the object name.
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
const mapDistribute & globalEdgeSlavesMap() const
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static label findRegion(const polyMesh &, const labelList &cellRegion, const vector &perturbVec, const point &p)
Find region point is in. Uses optional perturbation to re-test.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
Output to file stream, using an OSstream.
constexpr char nl
The newline '\n' character (0x0a)
autoPtr< mapPolyMesh > doRemoveCells(const labelList &cellsToRemove, const labelList &exposedFaces, const labelList &exposedPatchIDs, removeCells &cellRemover)
Remove cells. Put exposedFaces into exposedPatchIDs.
static ITstream & lookup(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::lookup which does not exit.
label splitFacesUndo(const labelList &splitFaces, const labelPairList &splits, const dictionary &motionDict, labelList &duplicateFace, List< labelPair > &baffles)
Split faces along diagonal. Maintain mesh quality. Return.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Given list of cells to remove, insert all the topology changes.
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
Helper: extract constraints:
static bool & parRun() noexcept
Test if this a parallel run.
void reorder(const labelUList &oldToNew, const bool check=false)
Reorder elements. Reordering must be unique (ie, shuffle).
void clear() noexcept
Same as reset(nullptr)
label constructSize() const noexcept
Constructed data size.
labelList intersectedFaces() const
Get faces with intersection.
static writeType writeLevel()
Get/set write level.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
static bitSet getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
Ignore writing from objectRegistry::writeObject()
const labelListList & globalEdgeSlaves() const
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimless
Dimensionless.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
static void calculateEdgeWeights(const polyMesh &mesh, const bitSet &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
List< point > pointList
A List of points.
const Time & time() const
Return the top-level database.
label nFaces() const noexcept
Number of mesh faces.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
cellDecomposition
Enumeration defining the decomposition of the cell for.
Finds shortest path (in terms of cell centres) to walk on mesh from any point in insidePoints to any ...
A class for managing references or pointers (no reference counting)
bool hasMotionPoints() const
Has valid preMotionPoints?
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
fileName path() const
The complete path.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
virtual const pointField & points() const
Return raw points.
Mesh representing a set of points created from polyMesh.
#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...
T & constCast() const
Return non-const reference to the object or to the contents of a (non-null) managed pointer...
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static const Enum< writeType > writeTypeNames
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Encapsulates queries for features.
void distributeFaceData(List< T > &values) const
Distribute list of face data.
static label appendPatch(fvMesh &, const label insertPatchi, const word &, const dictionary &)
Helper:append patch to end of mesh.
static void allGatherList(List< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses linear/tree communication. ...
void doSplitFaces(const labelList &splitFaces, const labelPairList &splits, polyTopoChange &meshMod) const
Split faces into two.
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A list of faces which address into the list of points.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A List obtained as a section of another List.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator) is 1 for serial run.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
vectorField pointField
pointField is a vectorField.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
const dimensionedScalar e
Elementary charge.
const fileName & pointsInstance() const
Return the current instance directory for points.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
label addFace(const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Add face to cells. Return new face label.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
wordList names() const
Return a list of patch names.
label size() const noexcept
The number of elements in the list.
List< scalar > scalarList
A List of scalars.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Base class for writing coordSet(s) and tracks with fields.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
const labelListList & edgeFaces() const
Return edge-face addressing.
Abstract base class for domain decomposition.
label nInternalFaces() const noexcept
Number of internal faces.
Encapsulates queries for volume refinement ('refine all cells within shell').
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
virtual const faceList & faces() const
Return raw faces.
Accumulating histogram of values. Specified bin resolution automatic generation of bins...
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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...
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
word timeName() const
Replacement for Time::timeName() that returns oldInstance (if overwrite_)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh size for if construct-without-mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
void checkData()
Debugging: check that all faces still obey start()>end()
int debug
Static debugging option.
Pair< label > labelPair
A pair of labels.
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
Type gMax(const FieldField< Field, Type > &f)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual bool open(const fileName &file, bool parallel=UPstream::parRun())
Open file for writing (creates parent directory).
defineTypeNameAndDebug(combustionModel, 0)
Database for solution data, solver performance and other reduced data.
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
void setSize(const label newLen)
Same as resize()
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
virtual const fileName & name() const
Read/write access to the name of the stream.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
const labelList & faceMap() const
Old face map.
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
void updateIntersections(const labelList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
static const Foam::polyMesh::cellDecomposition findCellMode(Foam::polyMesh::FACE_DIAG_TRIS)
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const bool exitIfLeakPath, const refPtr< coordSetWriter > &leakPathFormatter)
Split mesh. Keep part containing point. Return empty map if.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Use additional distance field for (scalar) axis.
static bool split(const std::string &line, std::string &key, std::string &val)
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
void setInstance(const fileName &)
Set instance of all local IOobjects.
Calculates points shared by more than two processor patches or cyclic patches.
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.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
Class containing processor-to-processor mapping information.
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
vector point
Point is a vector.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
static bitSet getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Direct mesh changes based on v1.3 polyTopoChange syntax.
void close()
End the file contents and close the file after writing.
label whichPatch(const label faceIndex) const
Return patch index for a given mesh face index.
static bool master(const label communicator=worldComm)
Am I the master rank.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & patches
const word & name() const noexcept
The zone name.
option
Enumeration for the data type and search/match modes (bitmask)
Automatically write from objectRegistry::writeObject()
static word outputPrefix
Directory prefix.
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
label nRegions() const
Return total number of regions.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
static const Enum< debugType > debugTypeNames
const boolList & flipMap() const noexcept
Return face flip map.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
Standard boundBox with extra functionality for use in octree.
wordList names() const
A list of the zone names.
messageStream Info
Information stream (stdout output on master, null elsewhere)
SubField< vector > subField
Declare type of subField.
writeType
Enumeration for what to write. Used as a bit-pattern.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
faceZoneType
What to do with faceZone faces.
debugType
Enumeration for what to debug. Used as a bit-pattern.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
#define DebugVar(var)
Report a variable name and value.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Mesh consisting of general polyhedral cells.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
A subset of mesh faces organised as a primitive patch.
bool write() const
Write mesh and all data.
List< label > labelList
A List of labels.
const_searcher csearch(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search dictionary for given keyword.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
A class for managing temporary objects.
T * first()
The first entry in the list.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
const T & second() const noexcept
Access the second element.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
void removeFace(const label facei, const label mergeFacei)
Remove/merge face.
Defines the attributes of an object for which implicit objectRegistry management is supported...
List< bool > boolList
A List of bools.
A List with indirect addressing.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
labelList countEdgeFaces(const uindirectPrimitivePatch &pp) const
Count number of faces per patch edge. Parallel consistent.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
An input stream of tokens.
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
const labelList & reverseFaceMap() const
Reverse face map.
const pointField & preMotionPoints() const
Pre-motion point positions.
static label findCell(const polyMesh &, const vector &perturbVec, const point &p)
Find cell point is in. Uses optional perturbation to re-test.
forAllConstIters(mixture.phases(), phase)
A keyword and a list of tokens is an 'entry'.
fileName globalPath() const
Return global path for the case.
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
After completion all processors have the same data.
static const Enum< coordFormat > coordFormatNames
String representation of coordFormat enum.
const labelListList & globalEdgeTransformedSlaves() const
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)