83 { MeshType::CASTELLATED,
"castellated" },
84 { MeshType::CASTELLATEDBUFFERLAYER,
"castellatedBufferLayer" },
85 { MeshType::CASTELLATEDBUFFERLAYER2,
"castellatedBufferLayer2" }
95 { debugType::MESH,
"mesh" },
96 { debugType::OBJINTERSECTIONS,
"intersections" },
97 { debugType::FEATURESEEDS,
"featureSeeds" },
98 { debugType::ATTRACTION,
"attraction" },
99 { debugType::LAYERINFO,
"layerInfo" },
119 { writeType::WRITEMESH,
"mesh" },
120 { writeType::NOWRITEREFINEMENT,
"noRefinement" },
121 { writeType::WRITELEVELS,
"scalarLevels" },
122 { writeType::WRITELAYERSETS,
"layerSets" },
123 { writeType::WRITELAYERFIELDS,
"layerFields" },
144 Foam::label Foam::meshRefinement::globalFaceCount(
const labelList& elems)
const 147 const bitSet isElem(mesh_.nFaces(), elems);
148 if (label(isElem.count()) != elems.size())
151 <<
" isElem:" << isElem.count()
152 <<
" elems:" << elems.size()
158 bitSet isElem2(isElem);
163 label facei = mesh_.nInternalFaces();
164 facei < mesh_.nFaces();
168 if (isElem2[facei] != isElem[facei])
171 <<
"at face:" << facei
172 <<
" at:" << mesh_.faceCentres()[facei]
173 <<
" patch:" << mesh_.boundaryMesh().whichPatch(facei)
174 <<
" isElem:" << isElem[facei]
175 <<
" isElem2:" << isElem2[facei]
184 for (
const label i : isElem)
195 void Foam::meshRefinement::calcNeighbourData
201 const labelList& cellLevel = meshCutter_.cellLevel();
202 const pointField& cellCentres = mesh_.cellCentres();
204 const label nBoundaryFaces = mesh_.nBoundaryFaces();
206 if (neiLevel.size() != nBoundaryFaces || neiCc.size() != nBoundaryFaces)
209 << nBoundaryFaces <<
" neiLevel:" << neiLevel.size()
213 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
225 label bFacei =
pp.start()-mesh_.nInternalFaces();
231 neiLevel[bFacei] = cellLevel[faceCells[i]];
232 neiCc[bFacei] = cellCentres[faceCells[i]];
236 else if (addedPatchIDSet.found(patchi))
248 label own = faceCells[i];
249 label ownLevel = cellLevel[own];
250 label faceLevel = meshCutter_.faceLevel(
pp.start()+i);
255 faceLevel = ownLevel;
259 scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
260 if (faceLevel > ownLevel)
265 neiLevel[bFacei] = faceLevel;
267 neiCc[bFacei] = faceCentres[i] + d*fn;
275 neiLevel[bFacei] = cellLevel[faceCells[i]];
276 neiCc[bFacei] = faceCentres[i];
288 void Foam::meshRefinement::calcCellCellRays
298 const labelList& cellLevel = meshCutter_.cellLevel();
299 const pointField& cellCentres = mesh_.cellCentres();
304 bitSet isMaster(mesh_.nBoundaryFaces(),
true);
306 for (
const polyPatch&
pp : mesh_.boundaryMesh())
308 if (
pp.coupled() && !refCast<const coupledPolyPatch>(
pp).owner())
310 isMaster.
unset(labelRange(
pp.offset(),
pp.size()));
316 start.setSize(testFaces.size());
317 end.setSize(testFaces.size());
318 minLevel.setSize(testFaces.size());
322 const label facei = testFaces[i];
323 const label own = mesh_.faceOwner()[facei];
325 if (mesh_.isInternalFace(facei))
327 const label nei = mesh_.faceNeighbour()[facei];
329 start[i] = cellCentres[own];
330 end[i] = cellCentres[nei];
331 minLevel[i] =
min(cellLevel[own], cellLevel[nei]);
335 const label bFacei = facei - mesh_.nInternalFaces();
337 if (isMaster[bFacei])
339 start[i] = cellCentres[own];
340 end[i] = neiCc[bFacei];
345 start[i] = neiCc[bFacei];
346 end[i] = cellCentres[own];
348 minLevel[i] =
min(cellLevel[own], neiLevel[bFacei]);
367 const label nMasterFaces =
370 label nChangedFaces = 0;
373 if (isMasterFace.
test(changedFaces[i]))
382 Info<<
"Edge intersection testing:" <<
nl 383 <<
" Number of edges : " << nMasterFaces <<
nl 384 <<
" Number of edges to retest : " << nChangedFaces
391 labelList neiLevel(mesh_.nBoundaryFaces());
393 calcNeighbourData(neiLevel, neiCc);
416 surfaces_.findHigherIntersection
430 surfaceIndex_[changedFaces[i]] = surfaceHit[i];
441 Info<<
" Number of intersected edges : " << nTotHits <<
endl;
445 setInstance(mesh_.facesInstance());
449 void Foam::meshRefinement::nearestFace
489 List<topoDistanceData<label>> startData(startFaces.
size());
492 const label facei = startFaces[i];
496 <<
" at:" << mesh_.faceCentres()[facei]
499 startData[i] = topoDistanceData<label>(0, globalStart.toGlobal(i));
504 FaceCellWave<topoDistanceData<label>> deltaCalc
513 deltaCalc.iterate(nIter);
517 faceToStart.
setSize(mesh_.nFaces());
519 bool haveWarned =
false;
522 if (!faceData[facei].valid(deltaCalc.data()))
527 <<
"Did not visit some faces, e.g. face " << facei
528 <<
" at " << mesh_.faceCentres()[facei]
535 faceToStart[facei] = faceData[facei].
data();
540 List<Map<label>> compactMap;
541 mapPtr.
reset(
new mapDistribute(globalStart, faceToStart, compactMap));
545 void Foam::meshRefinement::nearestPatch
555 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
557 nearestZone.
setSize(mesh_.nFaces(), -1);
559 if (adaptPatchIDs.size())
561 nearestPatch.setSize(mesh_.nFaces(), adaptPatchIDs[0]);
565 labelList faceToZone(mesh_.nFaces(), -1);
567 for (
const faceZone& fz : mesh_.faceZones())
569 UIndirectList<label>(faceToZone, fz) = fz.index();
578 const polyPatch&
pp =
patches[adaptPatchIDs[i]];
583 List<topoDistanceData<labelPair>> cellData(mesh_.nCells());
584 List<topoDistanceData<labelPair>> faceData(mesh_.nFaces());
588 List<topoDistanceData<labelPair>> patchData(nFaces);
592 label patchi = adaptPatchIDs[i];
597 patchFaces[nFaces] =
pp.start()+i;
598 patchData[nFaces] = topoDistanceData<labelPair>
604 faceToZone[
pp.start()+i]
612 FaceCellWave<topoDistanceData<labelPair>> deltaCalc
619 mesh_.globalData().nTotalCells()+1
624 bool haveWarned =
false;
627 if (!faceData[facei].valid(deltaCalc.data()))
632 <<
"Did not visit some faces, e.g. face " << facei
633 <<
" at " << mesh_.faceCentres()[facei] <<
endl 634 <<
"Assigning these faces to patch " 643 nearestPatch[facei] = data.first();
644 nearestZone[facei] = data.second();
651 nearestPatch.setSize(mesh_.nFaces(), 0);
663 nearestPatch(adaptPatchIDs, nearestAdaptPatch, nearestAdaptZone);
664 return nearestAdaptPatch;
668 void Foam::meshRefinement::nearestIntersection
682 labelList neiLevel(mesh_.nBoundaryFaces());
684 calcNeighbourData(neiLevel, neiCc);
705 surfaces_.findNearestIntersection
724 const label defaultRegion
733 const labelList testFaces(intersectedFaces());
756 labelList nearestRegion(mesh_.nFaces(), defaultRegion);
767 label facei = testFaces[i];
768 if (surface1[i] != -1)
770 patchFaces.append(facei);
771 label regioni = surfaces_.globalRegion(surface1[i], region1[i]);
774 else if (surface2[i] != -1)
776 patchFaces.append(facei);
777 label regioni = surfaces_.globalRegion(surface2[i], region2[i]);
778 patchData.append(topoDistanceData<label>(0, regioni));
783 FaceCellWave<topoDistanceData<label>> deltaCalc
790 mesh_.globalData().nTotalCells()+1
795 bool haveWarned =
false;
798 if (!faceData[facei].valid(deltaCalc.data()))
803 <<
"Did not visit some faces, e.g. face " << facei
804 <<
" at " << mesh_.faceCentres()[facei] <<
endl 805 <<
"Assigning these faces to global region " 806 << defaultRegion <<
endl;
812 nearestRegion[facei] = faceData[facei].data();
816 return nearestRegion;
835 Pout<<
"Checking field " << msg <<
endl;
854 const scalar& minVal = minFld[pointi];
855 const scalar& maxVal = maxFld[pointi];
856 if (
mag(minVal-maxVal) > SMALL)
859 <<
" minFld:" << minVal <<
nl 860 <<
" maxFld:" << maxVal <<
nl 882 Pout<<
"Checking field " << msg <<
endl;
889 point(GREAT, GREAT, GREAT)
901 const point& minVal = minFld[pointi];
902 const point& maxVal = maxFld[pointi];
903 if (
mag(minVal-maxVal) > SMALL)
906 <<
" minFld:" << minVal <<
nl 907 <<
" maxFld:" << maxVal <<
nl 916 Pout<<
"meshRefinement::checkData() : Checking refinement structure." 918 meshCutter_.checkMesh();
920 Pout<<
"meshRefinement::checkData() : Checking refinement levels." 922 meshCutter_.checkRefinementLevels(1,
labelList(0));
925 const label nBnd = mesh_.nBoundaryFaces();
927 Pout<<
"meshRefinement::checkData() : Checking synchronization." 937 mesh_.nInternalFaces()
950 testSyncBoundaryFaceList
953 "testing faceCentres : ",
960 const labelList& surfIndex = surfaceIndex();
967 calcNeighbourData(neiLevel, neiCc);
975 start[facei] = mesh_.cellCentres()[mesh_.faceOwner()[facei]];
977 if (mesh_.isInternalFace(facei))
979 end[facei] = mesh_.cellCentres()[mesh_.faceNeighbour()[facei]];
983 end[facei] = neiCc[facei-mesh_.nInternalFaces()];
999 surfaces_.findHigherIntersection
1016 mesh_.nInternalFaces()
1022 forAll(surfaceHit, facei)
1024 if (surfIndex[facei] != surfaceHit[facei])
1026 if (mesh_.isInternalFace(facei))
1029 <<
"Internal face:" << facei
1030 <<
" fc:" << mesh_.faceCentres()[facei]
1031 <<
" cached surfaceIndex_:" << surfIndex[facei]
1032 <<
" current:" << surfaceHit[facei]
1034 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
1036 << mesh_.cellCentres()[mesh_.faceNeighbour()[facei]]
1042 != neiHit[facei-mesh_.nInternalFaces()]
1046 <<
"Boundary face:" << facei
1047 <<
" fc:" << mesh_.faceCentres()[facei]
1048 <<
" cached surfaceIndex_:" << surfIndex[facei]
1049 <<
" current:" << surfaceHit[facei]
1051 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
1053 << neiCc[facei-mesh_.nInternalFaces()]
1054 <<
" end:" <<
end[facei]
1056 << meshCutter_.cellLevel()[mesh_.faceOwner()[facei]]
1058 << meshCutter_.faceLevel(facei)
1068 mesh_.nBoundaryFaces(),
1069 mesh_.nInternalFaces()
1072 labelList neiBoundarySurface(boundarySurface);
1080 testSyncBoundaryFaceList
1083 "testing surfaceIndex() : ",
1091 Pout<<
"meshRefinement::checkData() : Counting duplicate faces." 1099 identity(mesh_.nBoundaryFaces(), mesh_.nInternalFaces())
1109 if (duplicateFace[i] != -1)
1115 Pout<<
"meshRefinement::checkData() : Found " << nDup
1116 <<
" duplicate pairs of faces." <<
endl;
1123 meshCutter_.setInstance(inst);
1124 surfaceIndex_.instance() = inst;
1149 mesh_.moving(
false);
1156 mesh_.updateMesh(map);
1171 setInstance(mesh_.facesInstance());
1186 updateMesh(map, newExposedFaces);
1201 if (
split.find(-1) != -1)
1218 label fp =
split[0];
1248 const label facei = splitFaces[i];
1249 const auto&
split = splits[i];
1250 const auto& twoPatches = splitPatches[i];
1252 const face&
f = mesh_.faces()[facei];
1255 splitFace(
f,
split, f0, f1);
1258 label own = mesh_.faceOwner()[facei];
1262 if (facei >= mesh_.nInternalFaces())
1268 : mesh_.boundaryMesh().whichPatch(facei)
1274 : mesh_.boundaryMesh().whichPatch(facei)
1279 nei = mesh_.faceNeighbour()[facei];
1282 label zonei = mesh_.faceZones().whichZone(facei);
1283 bool zoneFlip =
false;
1286 const faceZone& fz = mesh_.faceZones()[zonei];
1293 Pout<<
"face:" << facei <<
" verts:" <<
f 1294 <<
" split into f0:" << f0
1295 <<
" f1:" << f1 <<
endl;
1358 <<
"Splitting " << nSplit
1359 <<
" faces across diagonals" <<
"." <<
nl <<
endl;
1371 meshMod.
faces().size()+splitFaces.
size(),
1376 doSplitFaces(splitFaces, splits, splitPatches, meshMod);
1380 mesh_.moving(
false);
1387 mesh_.updateMesh(map);
1401 setInstance(mesh_.facesInstance());
1417 label oldFacei = map.
faceMap()[facei];
1419 const auto oldFaceFnd = splitFaceToIndex.
cfind(oldFacei);
1421 if (oldFaceFnd.good())
1423 labelPair& twoFaces = facePairs[oldFaceFnd.val()];
1424 if (twoFaces[0] == -1)
1426 twoFaces[0] = facei;
1428 else if (twoFaces[1] == -1)
1430 twoFaces[1] = facei;
1435 <<
"problem: twoFaces:" << twoFaces
1446 if (duplicateFace.
size())
1460 baffle.
first() = oldToNewFaces[baffle.
first()];
1463 if (baffle.
first() == -1 || baffle.
second() == -1)
1466 <<
"Removed baffle : faces:" << baffle
1479 changedFaces.
append(facePairs[i].first());
1480 changedFaces.
append(facePairs[i].second());
1484 updateMesh(map, growFaceCellFace(changedFaces));
1497 for (label iteration = 0; iteration < 100; iteration++)
1500 <<
"Undo iteration " << iteration <<
nl 1501 <<
"----------------" <<
endl;
1507 faceSet errorFaces(mesh_,
"errorFaces", mesh_.nBoundaryFaces());
1523 const labelList grownFaces(growFaceCellFace(errorFaces));
1525 errorFaces.insert(grownFaces);
1539 const labelPair& twoFaces = facePairs[index];
1543 errorFaces.found(twoFaces.
first())
1544 || errorFaces.found(twoFaces.
second())
1547 const face& originalFace = originalFaces[index];
1551 label own = mesh_.faceOwner()[twoFaces[0]];
1554 if (twoFaces[0] >= mesh_.nInternalFaces())
1556 patchi = mesh_.boundaryMesh().whichPatch(twoFaces[0]);
1560 nei = mesh_.faceNeighbour()[twoFaces[0]];
1563 label zonei = mesh_.faceZones().whichZone(twoFaces[0]);
1564 bool zoneFlip =
false;
1567 const faceZone& fz = mesh_.faceZones()[zonei];
1584 meshMod.
removeFace(twoFaces[1], twoFaces[0]);
1586 mergedIndices.insert(index);
1592 Info<<
"Detected " <<
n 1593 <<
" split faces that will be restored to their original faces." 1607 mesh_.moving(
false);
1614 mesh_.updateMesh(map);
1628 setInstance(mesh_.facesInstance());
1644 const labelPair& oldSplit = facePairs[index];
1645 label new0 = oldToNewFaces[oldSplit[0]];
1646 label new1 = oldToNewFaces[oldSplit[1]];
1648 if (!mergedIndices.found(index))
1651 if (new0 < 0 || new1 < 0)
1654 <<
"Problem: oldFaces:" << oldSplit
1655 <<
" newFaces:" <<
labelPair(new0, new1)
1659 facePairs[newIndex] =
labelPair(new0, new1);
1663 originalFaces[index]
1670 if (new0 < 0 || new1 == -1)
1673 <<
"Problem: oldFaces:" << oldSplit
1677 changedFaces.
append(new0);
1681 facePairs.setSize(newIndex);
1682 originalFaces.
setSize(newIndex);
1686 updateMesh(map, growFaceCellFace(changedFaces));
1692 if (duplicateFace.
size())
1706 baffle.
first() = reverseFaceMap[baffle.
first()];
1709 if (baffle.
first() == -1 || baffle.
second() == -1)
1712 <<
"Removed baffle : faces:" << baffle
1726 Foam::meshRefinement::meshRefinement
1730 const bool overwrite,
1742 overwrite_(overwrite),
1743 oldInstance_(
mesh.pointsInstance()),
1744 surfaces_(surfaces),
1745 features_(features),
1747 limitShells_(limitShells),
1748 meshType_(meshType),
1760 mesh_.facesInstance(),
1780 if (surfaceIndex_.size() != mesh_.nFaces())
1787 return surfaceIndex_;
1793 if (surfaceIndex_.size() != mesh_.nFaces())
1795 updateIntersections(
identity(mesh_.nFaces()));
1797 return surfaceIndex_;
1808 const labelList& surfIndex = surfaceIndex();
1812 if (surfIndex[facei] >= 0 && isMasterFace.
test(facei))
1823 const bool keepZoneFaces,
1824 const bool keepBaffles,
1842 label nUnblocked = 0;
1856 specifiedProcessorFaces,
1862 if (keepZoneFaces || keepBaffles)
1882 const faceZone& fZone = fZones[zonei];
1886 label facei = fZone[i];
1887 if (blockedFace[facei])
1891 mesh_.isInternalFace(facei)
1895 blockedFace[facei] =
false;
1917 Info<<
"Found " << nUnblocked
1918 <<
" zoned faces to keep together." <<
endl;
1924 boolList separatedCoupledFace(mesh_.nFaces(),
false);
1925 selectSeparatedCoupledFaces(separatedCoupledFace);
1927 label nSeparated = 0;
1928 forAll(separatedCoupledFace, facei)
1930 if (separatedCoupledFace[facei])
1932 if (blockedFace[facei])
1934 blockedFace[facei] =
false;
1940 Info<<
"Found " << nSeparated
1941 <<
" separated coupled faces to keep together." <<
endl;
1943 nUnblocked += nSeparated;
1949 const label nBnd = mesh_.nBoundaryFaces();
1951 labelList coupledFace(mesh_.nFaces(), -1);
1969 const labelPair& baffle = allCouples[i];
1977 forAll(coupledFace, facei)
1979 if (coupledFace[facei] != -1 && facei < coupledFace[facei])
1981 couples[nCpl++] =
labelPair(facei, coupledFace[facei]);
1990 Info<<
"Found " << nCouples <<
" baffles to keep together." 2000 blockedFace[baffle.
first()] =
false;
2001 blockedFace[baffle.
second()] =
false;
2011 label nPointFaces = 0;
2012 for (
const label pointi : singleProcPoints)
2014 for (
const label facei : mesh_.pointFaces()[pointi])
2016 if (blockedFace[facei])
2020 mesh_.isInternalFace(facei)
2024 blockedFace[facei] =
false;
2031 Info<<
"Found " << nPointFaces
2032 <<
" additional point-coupled faces to keep together." <<
endl;
2034 nUnblocked += nPointFaces;
2043 specifiedProcessorFaces,
2051 Pout<<
"Wanted distribution:" << nProcCells <<
endl;
2055 Pout<<
"Wanted resulting decomposition:" <<
endl;
2056 forAll(nProcCells, proci)
2058 Pout<<
" " << proci <<
'\t' << nProcCells[proci] <<
endl;
2071 setInstance(mesh_.facesInstance());
2074 if (
debug && keepZoneFaces)
2082 const faceZone& fZone = fZones[zonei];
2086 label facei = fZone[i];
2092 <<
"Face at " << mesh_.faceCentres()[facei]
2093 <<
" on zone " << fZone.
name()
2094 <<
" is on coupled patch " <<
pbm[patchi].
name()
2108 label nBoundaryFaces = 0;
2110 const labelList& surfIndex = surfaceIndex();
2114 if (surfIndex[facei] != -1)
2125 if (surfIndex[facei] != -1)
2127 surfaceFaces[nBoundaryFaces++] = facei;
2130 return surfaceFaces;
2136 const faceList& faces = mesh_.faces();
2139 bitSet isBoundaryPoint(mesh_.nPoints());
2141 const labelList& surfIndex = surfaceIndex();
2145 if (surfIndex[facei] != -1)
2147 isBoundaryPoint.set(faces[facei]);
2170 return isBoundaryPoint.sortedToc();
2190 nFaces +=
pp.size();
2201 label meshFacei =
pp.start();
2205 addressing[nFaces++] = meshFacei++;
2230 pointPatches.
size(),
2231 slipPointPatchVectorField::typeName
2236 patchFieldTypes[adaptPatchIDs[i]] =
2237 fixedValuePointPatchVectorField::typeName;
2240 forAll(pointPatches, patchi)
2242 if (isA<processorPointPatch>(pointPatches[patchi]))
2244 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
2246 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
2248 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
2258 "pointDisplacement",
2292 <<
"faceZones are not synchronised on processors." <<
nl 2293 <<
"Processor " << proci <<
" has faceZones " 2294 << zoneNames[proci] <<
nl 2296 <<
" has faceZones " 2309 const faceZone& fZone = fZones[zonei];
2317 if (faceToZone[bFacei] == -1)
2319 faceToZone[bFacei] = zonei;
2321 else if (faceToZone[bFacei] == zonei)
2324 <<
"Face " << fZone[i] <<
" in zone " 2326 <<
" is twice in zone!" 2332 <<
"Face " << fZone[i] <<
" in zone " 2334 <<
" is also in zone " 2335 << fZones[faceToZone[bFacei]].
name()
2347 if (faceToZone[i] != neiFaceToZone[i])
2351 <<
" is in zone " << faceToZone[i]
2352 <<
", its coupled face is in zone " << neiFaceToZone[i]
2362 const bitSet& isMasterEdge,
2377 const edge&
e = edges[edgei];
2383 pts[meshPoints[
e[1]]]
2384 -
pts[meshPoints[
e[0]]]
2387 edgeWeights[edgei] = 1.0/eMag;
2403 forAll(invSumWeight, pointi)
2405 scalar w = invSumWeight[pointi];
2409 invSumWeight[pointi] = 1.0/w;
2418 const label insertPatchi,
2419 const word& patchName,
2431 const label patchi = polyPatches.
size();
2449 polyPatches[patchi],
2454 addPatchFields<volScalarField>
2459 addPatchFields<volVectorField>
2464 addPatchFields<volSphericalTensorField>
2469 addPatchFields<volSymmTensorField>
2474 addPatchFields<volTensorField>
2482 addPatchFields<surfaceScalarField>
2487 addPatchFields<surfaceVectorField>
2492 addPatchFields<surfaceSphericalTensorField>
2497 addPatchFields<surfaceSymmTensorField>
2502 addPatchFields<surfaceTensorField>
2514 const word& patchName,
2522 const label patchi = polyPatches.
findPatchID(patchName);
2530 label insertPatchi = polyPatches.
size();
2533 forAll(polyPatches, patchi)
2537 if (isA<processorPolyPatch>(
pp))
2539 insertPatchi = patchi;
2540 startFacei =
pp.start();
2546 patchDict.
set(
"nFaces", 0);
2547 patchDict.
set(
"startFace", startFacei);
2552 label addedPatchi = appendPatch(
mesh, insertPatchi, patchName, patchDict);
2558 for (label i = 0; i < insertPatchi; i++)
2563 for (label i = insertPatchi; i < addedPatchi; i++)
2568 oldToNew[addedPatchi] = insertPatchi;
2571 polyPatches.
reorder(oldToNew,
true);
2574 reorderPatchFields<volScalarField>(
mesh, oldToNew);
2575 reorderPatchFields<volVectorField>(
mesh, oldToNew);
2576 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
2577 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
2578 reorderPatchFields<volTensorField>(
mesh, oldToNew);
2579 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
2580 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
2581 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
2582 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
2583 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
2585 return insertPatchi;
2595 label meshedi = meshedPatches_.find(
name);
2600 return mesh_.boundaryMesh().findPatchID(
name);
2605 label patchi = addPatch(mesh_,
name, patchInfo);
2630 meshedPatches_.append(
name);
2633 faceToCoupledPatch_.clear();
2645 forAll(meshedPatches_, i)
2652 <<
"Problem : did not find patch " << meshedPatches_[i]
2669 const word& masterPatch,
2670 const word& slavePatch,
2682 faceZoneToMasterPatch_.insert(fzName, masterPatch);
2683 faceZoneToSlavePatch_.insert(fzName, slavePatch);
2684 faceZoneToType_.insert(fzName, fzType);
2693 label& masterPatchID,
2694 label& slavePatchID,
2700 if (!faceZoneToMasterPatch_.found(fzName))
2706 const word& masterName = faceZoneToMasterPatch_[fzName];
2709 const word& slaveName = faceZoneToSlavePatch_[fzName];
2712 fzType = faceZoneToType_[fzName];
2727 zoneI = pointZones.
size();
2746 const auto* cpp = isA<coupledPolyPatch>(
pp);
2748 if (cpp && (cpp->separated() || !cpp->parallel()))
2767 nEdgeFaces[edgei] = edgeFaces[edgei].
size();
2780 bitSet sameEdgeOrientation;
2816 const vector& perturbVec,
2838 const vector& perturbVec,
2850 regioni = cellToRegion[celli];
2860 regioni = cellToRegion[celli];
2900 locationsOutsideMesh,
2909 label nSegments = 0;
2910 if (leakPath.segments().size())
2912 nSegments =
max(leakPath.segments())+1;
2914 reduce(nSegments, maxOp<label>());
2917 for (label segmenti : leakPath.segments())
2919 nElemsPerSegment[segmenti]++;
2921 segmentPoints.setSize(nElemsPerSegment.size());
2922 segmentDist.
setSize(nElemsPerSegment.size());
2923 forAll(nElemsPerSegment, i)
2925 segmentPoints[i].setSize(nElemsPerSegment[i]);
2926 segmentDist[i].
setSize(nElemsPerSegment[i]);
2928 nElemsPerSegment = 0;
2932 label segmenti = leakPath.segments()[elemi];
2935 label&
n = nElemsPerSegment[segmenti];
2938 dist[
n] = leakPath.distance()[elemi];
2943 PtrList<coordSet> allLeakPaths(segmentPoints.size());
2944 forAll(allLeakPaths, segmenti)
2958 ListListOps::combine<pointList>
2960 gatheredPts, accessOp<pointList>()
2965 ListListOps::combine<scalarList>
2967 gatheredDist, accessOp<scalarList>()
2991 List<scalarField> allLeakData(allLeakPaths.size());
2992 forAll(allLeakPaths, segmenti)
2994 allLeakData[segmenti] = allLeakPaths[segmenti].distance();
3002 (outputDir / allLeakPaths[0].
name())
3024 const vector& perturbVec,
3027 const label nRegions,
3031 const bool exitIfLeakPath,
3042 label regioni = findRegion
3050 insideRegions[i] = regioni;
3053 forAll(cellRegion, celli)
3055 if (cellRegion[celli] == regioni)
3057 insideCell.set(celli);
3066 forAll(locationsOutsideMesh, i)
3072 label regioni = findRegion
3077 locationsOutsideMesh[i]
3080 if (regioni == -1 && (indexi = insideRegions.find(regioni)) != -1)
3082 if (leakPathFormatter)
3090 locationsOutsideMesh,
3095 Info<<
"Dumped leak path to " << fName <<
endl;
3105 err <<
"Location in mesh " << locationsInMesh[indexi]
3106 <<
" is inside same mesh region " << regioni
3107 <<
" as one of the locations outside mesh " 3108 << locationsOutsideMesh <<
endl;
3121 forAll(insideCell, celli)
3123 if (!insideCell.test(celli))
3125 cellRegion[celli] = -1;
3128 else if (cellRegion[celli] == -1)
3144 const bool exitIfLeakPath,
3149 (void)mesh_.tetBasePtIs();
3154 boolList blockedFace(mesh_.nFaces(),
false);
3155 selectSeparatedCoupledFaces(blockedFace);
3159 label nRemove = findRegions
3162 vector::uniform(mergeDistance_),
3164 locationsOutsideMesh,
3178 forAll(cellRegion, celli)
3180 if (cellRegion[celli] == -1)
3182 cellsToRemove.append(celli);
3185 cellsToRemove.shrink();
3189 cellsToRemove.size(),
3195 if (nTotCellsToRemove > 0)
3197 label nCellsToKeep =
3198 mesh_.globalData().nTotalCells()
3199 - nTotCellsToRemove;
3201 Info<<
"Keeping all cells containing points " << locationsInMesh <<
endl 3202 <<
"Selected for keeping : " 3204 <<
" cells." <<
endl;
3222 label defaultPatch = 0;
3223 if (globalToMasterPatch.
size())
3225 defaultPatch = globalToMasterPatch[0];
3229 <<
"Removing non-reachable cells exposes " 3230 << nExposedFaces <<
" internal or coupled faces." <<
endl 3231 <<
" These get put into patch " << defaultPatch <<
endl;
3232 exposedPatch.setSize(exposedFaces.
size(), defaultPatch);
3235 mapPtr = doRemoveCells
3254 meshCutter_.distribute(map);
3261 faceToCoupledPatch_.clear();
3288 geometry[i].distribute
3299 geometry[i].instance() = geometry[i].time().timeName();
3317 updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
3329 meshCutter_.storeData
3350 meshCutter_.updateMesh
3359 updateList(map.
faceMap(), label(-1), surfaceIndex_);
3363 Map<label> newFaceToPatch(faceToCoupledPatch_.size());
3370 newFaceToPatch.insert(newFacei, iter.val());
3373 faceToCoupledPatch_.
transfer(newFaceToPatch);
3378 updateIntersections(changedFaces);
3383 labelList& data = userFaceData_[i].second();
3385 if (userFaceData_[i].first() == KEEPALL)
3388 updateList(map.
faceMap(), label(-1), data);
3390 else if (userFaceData_[i].first() == MASTERONLY)
3395 forAll(newFaceData, facei)
3397 label oldFacei = map.
faceMap()[facei];
3401 newFaceData[facei] = data[oldFacei];
3417 label oldFacei = map.
faceMap()[facei];
3421 if (reverseFaceMap[oldFacei] != facei)
3424 reverseFaceMap[oldFacei] = -1;
3431 forAll(newFaceData, facei)
3433 label oldFacei = map.
faceMap()[facei];
3437 if (reverseFaceMap[oldFacei] == facei)
3439 newFaceData[facei] = data[oldFacei];
3451 bool writeOk = mesh_.write();
3468 s.instance() !=
s.time().system()
3469 &&
s.instance() !=
s.time().caseSystem()
3470 &&
s.instance() !=
s.time().constant()
3471 &&
s.instance() !=
s.time().caseConstant()
3475 s.instance() =
s.time().timeName();
3476 writeOk = writeOk &&
s.write();
3508 bitSet isPatchMasterPoint(meshPoints.
size());
3509 forAll(meshPoints, pointi)
3511 if (myPoints[pointi] ==
globalPoints.toGlobal(myProci, pointi))
3513 isPatchMasterPoint.set(pointi);
3517 return isPatchMasterPoint;
3548 if (myEdges[edgei] == globalEdges.toGlobal(myProci, edgei))
3550 isMasterEdge.
set(edgei);
3554 return isMasterEdge;
3562 const bool printCellLevel
3571 <<
" : cells(local):" << mesh_.nCells()
3572 <<
" faces(local):" << mesh_.nFaces()
3573 <<
" points(local):" << mesh_.nPoints()
3579 label nMasterFaces = isMasterFace.
count();
3582 label nMasterPoints = isMeshMasterPoint.
count();
3591 const scalar nIdealCells =
3595 mag(1.0-mesh_.nCells()/nIdealCells),
3598 Info<<
" unbalance:" << unbalance;
3605 const labelList& cellLevel = meshCutter_.cellLevel();
3611 nCells[cellLevel[celli]]++;
3619 Info<<
"Cells per refinement level:" <<
endl;
3622 Info<<
" " << leveli <<
'\t' << nCells[leveli]
3632 if (overwrite_ && mesh_.time().timeIndex() == 0)
3634 return oldInstance_;
3637 return mesh_.time().timeName();
3651 mesh_.time().timeName(),
3662 const labelList& cellLevel = meshCutter_.cellLevel();
3664 forAll(volRefLevel, celli)
3666 volRefLevel[celli] = cellLevel[celli];
3669 volRefLevel.write();
3681 mesh_.time().timeName(),
3691 const labelList& pointLevel = meshCutter_.pointLevel();
3693 forAll(pointRefLevel, pointi)
3695 pointRefLevel[pointi] = pointLevel[pointi];
3698 pointRefLevel.write();
3706 OFstream str(prefix +
"_edges.obj");
3708 Pout<<
"meshRefinement::dumpIntersections :" 3709 <<
" Writing cellcentre-cellcentre intersections to file " 3717 labelList neiLevel(mesh_.nBoundaryFaces());
3719 calcNeighbourData(neiLevel, neiCc);
3721 labelList intersectionFaces(intersectedFaces());
3743 surfaces_.findAnyIntersection
3751 forAll(intersectionFaces, i)
3753 if (surfaceHit[i] != -1)
3761 str <<
"l " << verti-2 <<
' ' << verti-1 <<
nl 3762 <<
"l " << verti-1 <<
' ' << verti <<
nl;
3778 if (writeFlags & WRITEMESH)
3783 if (writeFlags && !(writeFlags & NOWRITEREFINEMENT))
3785 meshCutter_.write();
3788 (void)surfaceIndex();
3789 surfaceIndex_.write();
3792 if (writeFlags & WRITELEVELS)
3794 dumpRefinementLevel();
3797 if ((debugFlags & OBJINTERSECTIONS) && prefix.size())
3799 dumpIntersections(prefix);
3818 if (
exists(setsDir/
"surfaceIndex"))
3820 rm(setsDir/
"surfaceIndex");
3836 writeLevel_ = flags;
3855 const word& keyword,
3865 <<
"Entry '" << keyword
3866 <<
"' not found (or not a dictionary) in dictionary " 3887 const word& keyword,
3897 <<
"Entry '" << keyword <<
"' not found in dictionary " static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
List< scalar > scalarList
List of scalar.
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.
const Field< point_type > & faceAreas() const
Return face area vectors for patch.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
const polyBoundaryMesh & pbm
const T & first() const noexcept
Access the first element.
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.
constexpr T * data() noexcept
Return pointer to the underlying array serving as data storage.
unsigned int count(const bool on=true) const
Count number of bits set.
static FOAM_NO_DANGLING_REFERENCE 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.
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)
A pointBoundaryMesh is a pointPatch list with registered IO, a reference to the associated pointMesh...
const fileName & facesInstance() const
Return the current instance directory for faces.
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
MeshType
Enumeration for how to operate.
Type weightedSum(const UList< scalar > &weights, const UList< Type > &fld)
The local weighted sum (integral) of a field, using the mag() of the weights.
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.
const bitSet isBlockedFace(intersectedFaces())
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
virtual const fileName & name() const override
Read/write access to the name of the stream.
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
mergeDistance
Merging distance for points on the surface. Only used when reading.
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.
bool unset(const label i)
Unset the bool entry at specified position, always false for out-of-range access. ...
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
void printMeshInfo(const bool debug, const string &msg, const bool printCellLevel) const
Print some mesh stats.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
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.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
label splitFacesUndo(const labelList &splitFaces, const labelPairList &splits, const labelPairList &splitPatches, const dictionary &motionDict, labelList &duplicateFace, List< labelPair > &baffles)
Split faces along diagonal. Maintain mesh quality. Return.
Given list of cells to remove, insert all the topology changes.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
void setSize(const label n)
Same as resize()
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.
static int myProcNo(label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
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.
void clearOut(const bool isMeshUpdate=false)
Clear all geometry and addressing.
static const Enum< MeshType > MeshTypeNames
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
static const word & calculatedType() noexcept
The type name for calculated patch fields.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
fileName globalPath() const
The global path for the case = rootPath/globalCaseName.
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.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
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 void calculateEdgeWeights(const polyMesh &mesh, const bitSet &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
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.
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 ...
void write(const word &fieldName, const UList< Type > &field)
Write primitive field of CellData or PointData values (size depending on the current context)...
A class for managing references or pointers (no reference counting)
T & emplace_back(Args &&... args)
Construct and append an element to the end of the list, return reference to the new list element...
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 labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
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.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
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.
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.
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 non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
A non-owning sub-view of a List (allocated or unallocated storage).
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
const fileName & pointsInstance() const
Return the current instance directory for points.
static void listGather(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather (reduce) list elements, applying bop to each list element.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::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.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
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())
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
wordList names() const
Return a list of patch names.
label size() const noexcept
The number of entries in the list.
const Field< point_type > & faceCentres() const
Return face centres for patch.
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.
void doSplitFaces(const labelList &splitFaces, const labelPairList &splits, const labelPairList &splitPatches, polyTopoChange &meshMod) const
Split faces into two.
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.
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.
const labelListList & edgeFaces() const
Return edge-face addressing.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Abstract base class for domain decomposition.
label nInternalFaces() const noexcept
Number of internal faces.
Encapsulates queries for volume refinement ('refine all cells within shell').
const labelList & reversePointMap() const noexcept
Reverse point map.
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.
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.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
virtual bool open(const fileName &file, bool parallel=UPstream::parRun())
Open file for writing (creates parent directory).
errorManip< error > abort(error &err)
bool test(label pos) const
Test for true value at specified position. A no-op and returns false for out-of-range positions (safe...
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 registered IO, a reference to the associated polyMesh...
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 a time name for the given scalar time value formatted with the given precision.
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const labelList &singleProcPoints, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
void checkData()
Debugging: check that all faces still obey start()>end()
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)
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.
static void splitFace(const face &f, const labelPair &split, face &f0, face &f1)
Helper: split face into:
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
label nTotalCells() const noexcept
Total global number of mesh cells.
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.
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
static const Foam::polyMesh::cellDecomposition findCellMode(Foam::polyMesh::FACE_DIAG_TRIS)
bool hasMotionPoints() const noexcept
Has valid preMotionPoints?
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.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
void updateIntersections(const labelUList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
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 inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
static label nProcs(label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
decomposeUsingBbs false
Use bounding boxes (default) or unique decomposition of triangles (i.e. do not duplicate triangles) ...
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...
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
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.
const polyBoundaryMesh & patches
const word & name() const noexcept
The zone name.
option
Enumeration for the data type and search/match modes (bitmask)
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Automatically write from objectRegistry::writeObject()
static word outputPrefix
Directory prefix.
void push_back(T *ptr)
Append an element to the end of the list.
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.
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)
static ITstream & empty_stream()
Return reference to an empty ITstream, for functions needing to return an ITstream reference but whic...
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
static bool master(label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
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.
Mesh consisting of general polyhedral cells.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
vtk::vertexWriter writer(edgeCentres, outputOpts,(aMesh.time().globalPath()/outputName), UPstream::parRun())
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.
const labelList & faceMap() const noexcept
Old face map.
bool write() const
Write mesh and all data.
List< point > pointList
List of point.
List< label > labelList
A List of labels.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
A class for managing temporary objects.
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))
const pointBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
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)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
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...
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element...
List< bool > boolList
A List of bools.
A List with indirect addressing.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
const pointField & preMotionPoints() const noexcept
Pre-motion point positions.
void setSize(label n)
Alias for resize()
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.
label size() const noexcept
Number of entries.
Do not request registration (bool: false)
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)
static label findCell(const polyMesh &, const vector &perturbVec, const point &p)
Find cell point is in. Uses optional perturbation to re-test.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
A keyword and a list of tokens is an 'entry'.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
virtual labelList decompose(const pointField &points, const scalarField &pointWeights=scalarField::null()) const
Return the wanted processor number for every coordinate, using uniform or specified point weights...
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.
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
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)