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" },
144Foam::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)
195void 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()
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))
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];
288void Foam::meshRefinement::calcCellCellRays
298 const labelList& cellLevel = meshCutter_.cellLevel();
299 const pointField& cellCentres = mesh_.cellCentres();
304 bitSet isMaster(mesh_.nBoundaryFaces(),
true);
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;
449void Foam::meshRefinement::nearestFace
489 List<topoDistanceData<label>> startData(startFaces.
size());
492 const label facei = startFaces[i];
496 <<
" at:" << mesh_.faceCentres()[facei]
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();
545void Foam::meshRefinement::nearestPatch
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())
592 label patchi = adaptPatchIDs[i];
597 patchFaces[nFaces] =
pp.start()+i;
604 faceToZone[
pp.start()+i]
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 "
642 const labelPair& data = faceData[facei].data();
643 nearestPatch[facei] = data.first();
644 nearestZone[facei] = data.second();
651 nearestPatch.setSize(mesh_.nFaces(), 0);
663 nearestPatch(adaptPatchIDs, nearestAdaptPatch, nearestAdaptZone);
664 return nearestAdaptPatch;
668void 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));
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;
827 if (
fld.size() !=
mesh.nPoints())
831 <<
"fld size:" <<
fld.size() <<
" mesh points:" <<
mesh.nPoints()
835 Pout<<
"Checking field " << msg <<
endl;
854 const scalar& minVal = minFld[pointi];
855 const scalar& maxVal = maxFld[pointi];
856 if (
mag(minVal-maxVal) > SMALL)
858 Pout<< msg <<
" at:" <<
mesh.points()[pointi] <<
nl
859 <<
" minFld:" << minVal <<
nl
860 <<
" maxFld:" << maxVal <<
nl
874 if (
fld.size() !=
mesh.nPoints())
878 <<
"fld size:" <<
fld.size() <<
" mesh points:" <<
mesh.nPoints()
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)
905 Pout<< msg <<
" at:" <<
mesh.points()[pointi] <<
nl
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()
953 "testing faceCentres : ",
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);
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);
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];
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);
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());
1497 for (label iteration = 0; iteration < 100; iteration++)
1500 <<
"Undo iteration " << iteration <<
nl
1501 <<
"----------------" <<
endl;
1507 faceSet errorFaces(mesh_,
"errorFaces", mesh_.nBoundaryFaces());
1525 errorFaces.
insert(grownFaces);
1539 const labelPair& twoFaces = facePairs[index];
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);
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);
1682 originalFaces.
setSize(newIndex);
1692 if (duplicateFace.
size())
1706 baffle.
first() = reverseFaceMap[baffle.
first()];
1709 if (baffle.
first() == -1 || baffle.
second() == -1)
1712 <<
"Removed baffle : faces:" << baffle
1726Foam::meshRefinement::meshRefinement
1743 oldInstance_(
mesh.pointsInstance()),
1760 mesh_.facesInstance(),
1780 if (surfaceIndex_.size() != mesh_.nFaces())
1782 const_cast<meshRefinement&
>(*this).updateIntersections
1787 return surfaceIndex_;
1793 if (surfaceIndex_.size() != mesh_.nFaces())
1797 return 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)
1892 ||
pbm[
pbm.whichPatch(facei)].coupled()
1895 blockedFace[facei] =
false;
1917 Info<<
"Found " << nUnblocked
1918 <<
" zoned faces to keep together." <<
endl;
1924 boolList separatedCoupledFace(mesh_.nFaces(),
false);
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)
2021 ||
pbm[
pbm.whichPatch(facei)].coupled()
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;
2074 if (
debug && keepZoneFaces)
2082 const faceZone& fZone = fZones[zonei];
2086 label facei = fZone[i];
2087 label patchi =
pbm.whichPatch(facei);
2092 <<
"Face at " << mesh_.faceCentres()[facei]
2093 <<
" on zone " << fZone.
name()
2094 <<
" is on coupled patch " <<
pbm[patchi].name()
2108 label nBoundaryFaces = 0;
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());
2145 if (surfIndex[facei] != -1)
2147 isBoundaryPoint.
set(faces[facei]);
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)
2244 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
2248 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
2258 "pointDisplacement",
2259 mesh.time().timeName(),
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];
2313 label bFacei = fZone[i]-
mesh.nInternalFaces();
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])
2350 <<
"Face " <<
mesh.nInternalFaces()+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();
2531 label startFacei =
mesh.nFaces();
2533 forAll(polyPatches, patchi)
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);
2630 meshedPatches_.append(
name);
2633 faceToCoupledPatch_.clear();
2645 forAll(meshedPatches_, i)
2647 label patchi =
patches.findPatchID(meshedPatches_[i]);
2652 <<
"Problem : did not find patch " << meshedPatches_[i]
2653 <<
endl <<
"Valid patches are " <<
patches.names()
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];
2707 masterPatchID =
pbm.findPatchID(masterName);
2709 const word& slaveName = faceZoneToSlavePatch_[fzName];
2710 slavePatchID =
pbm.findPatchID(slaveName);
2712 fzType = faceZoneToType_[fzName];
2727 zoneI = pointZones.
size();
2748 if (cpp && (cpp->separated() || !cpp->parallel()))
2767 nEdgeFaces[edgei] = edgeFaces[edgei].
size();
2780 bitSet sameEdgeOrientation;
2816 const vector& perturbVec,
2821 (void)
mesh.tetBasePtIs();
2838 const vector& perturbVec,
2845 (void)
mesh.tetBasePtIs();
2850 regioni = cellToRegion[celli];
2860 regioni = cellToRegion[celli];
2881 mesh.time().globalPath()
2883 /
mesh.pointsInstance()
2898 pbm.groupPatchIDs()[
"wall"],
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];
2944 forAll(allLeakPaths, segmenti)
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,
3050 insideRegions[i] = regioni;
3053 forAll(cellRegion, celli)
3055 if (cellRegion[celli] == regioni)
3057 insideCell.
set(celli);
3066 forAll(locationsOutsideMesh, i)
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);
3164 locationsOutsideMesh,
3178 forAll(cellRegion, celli)
3180 if (cellRegion[celli] == -1)
3182 cellsToRemove.
append(celli);
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);
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
3363 Map<label> newFaceToPatch(faceToCoupledPatch_.size());
3370 newFaceToPatch.
insert(newFacei, iter.val());
3373 faceToCoupledPatch_.transfer(newFaceToPatch);
3383 labelList& data = userFaceData_[i].second();
3385 if (userFaceData_[i].first() ==
KEEPALL)
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);
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;
3785 meshCutter_.write();
3789 surfaceIndex_.write();
3809 mesh.facesInstance(),
3815 if (topoSet::debug)
DebugVar(setsDir);
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 "
3867 <<
dict.relativeName() <<
nl;
3887 const word& keyword,
3892 const entry* eptr =
dict.findEntry(keyword, matchOpt);
3897 <<
"Entry '" << keyword <<
"' not found in dictionary "
3898 <<
dict.relativeName() <<
nl;
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Wave propagation of information through grid. Every iteration information goes through one layer of c...
SubField< vector > subField
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Same as contains().
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
void clear()
Remove all entries from table.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
An input stream of tokens.
static ITstream & empty_stream()
Return reference to an empty ITstream, for functions needing to return an ITstream reference but whic...
label size() const noexcept
The number of elements in the list.
A List with indirect addressing.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
SubList< vector > subList
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void setSize(label n)
Alias for resize().
A HashTable to objects of type <T> with a label key.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
virtual const fileName & name() const override
Read/write access to the name of the stream.
label size() const noexcept
Number of entries.
const T & first() const noexcept
Access the first element.
const T & second() const noexcept
Access the second element.
const Field< point_type > & faceAreas() const
Return face area vectors for patch.
const Field< point_type > & faceCentres() const
Return face centres for patch.
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.
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.
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.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void setSize(const label n)
Same as resize().
void push_back(T *ptr)
Append an element to the end of the list.
T & emplace_back(Args &&... args)
Construct and append an element to the end of the list, return reference to the new list element.
A non-owning sub-view of a List (allocated or unallocated storage).
A List with indirect addressing. Like IndirectList but does not store addressing.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
@ gatherList
gatherList [manual algorithm]
@ broadcast
broadcast [MPI]
void reorder(const labelUList &oldToNew, const bool check=false)
Reorder elements. Reordering must be unique (ie, shuffle).
label size() const noexcept
The number of entries in the list.
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
void clearAddressing()
Clear addressing.
wordList names() const
A list of the zone names.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr).
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
labelList sortedToc() const
The indices of the on bits as a sorted labelList.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
Base class for writing coordSet(s) and tracks with fields.
Holds list of sampling positions.
static const Enum< coordFormat > coordFormatNames
String representation of coordFormat enum.
@ DISTANCE
Use additional distance field for (scalar) axis.
Abstract base class for domain decomposition.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
Helper: extract constraints:
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.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Accumulating histogram of values. Specified bin resolution automatic generation of bins.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
Smooth ATC in cells next to a set of patches supplied by type.
A subset of mesh faces organised as a primitive patch.
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
static word outputPrefix
Directory prefix.
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
Mesh data needed to do the Finite Volume discretisation.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
labelRange range(label proci) const noexcept
Return start/size range of proci data.
label toGlobal(const label proci, const label i) const
From local to global on proci.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelListList & globalEdgeTransformedSlaves() const
const mapDistribute & globalEdgeSlavesMap() const
static void syncData(List< Type > &elems, const labelListList &slaves, const labelListList &transformedSlaves, const mapDistribute &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
label nTotalCells() const noexcept
Total global number of mesh cells.
const labelListList & globalEdgeSlaves() const
Calculates points shared by more than two processor patches or cyclic patches.
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
option
Enumeration for the data type and search/match modes (bitmask).
A range or interval of labels defined by a start and a size.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
label constructSize() const noexcept
Constructed data size.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void distributeFaceData(List< T > &values) const
Distribute list of face data.
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const pointField & preMotionPoints() const noexcept
Pre-motion point positions.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
const labelList & faceMap() const noexcept
Old face map.
bool hasMotionPoints() const noexcept
Has valid preMotionPoints?
const labelList & reversePointMap() const noexcept
Reverse point map.
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
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).
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
labelList intersectedFaces() const
Get faces with intersection.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
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.
void printMeshInfo(const bool debug, const string &msg, const bool printCellLevel) const
Print some mesh stats.
MeshType
Enumeration for how to operate.
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
static bitSet getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
static const Enum< MeshType > MeshTypeNames
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
void checkData()
Debugging: check that all faces still obey start()>end().
void updateIntersections(const labelUList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
writeType
Enumeration for what to write. Used as a bit-pattern.
void doSplitFaces(const labelList &splitFaces, const labelPairList &splits, const labelPairList &splitPatches, polyTopoChange &meshMod) const
Split faces into two.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
const shellSurfaces & limitShells() const
Reference to limit shells (regions).
labelList growFaceCellFace(const labelUList &set) const
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
static const Enum< writeType > writeTypeNames
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
static void splitFace(const face &f, const labelPair &split, face &f0, face &f1)
Helper: split face into:
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
label countHits() const
Count number of intersections (local).
autoPtr< mapPolyMesh > doRemoveCells(const labelList &cellsToRemove, const labelList &exposedFaces, const labelList &exposedPatchIDs, removeCells &cellRemover)
Remove cells. Put exposedFaces into exposedPatchIDs.
@ KEEPALL
have slaves (upon refinement) from master
@ MASTERONLY
maintain master only
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.
static label findCell(const polyMesh &, const vector &perturbVec, const point &p)
Find cell point is in. Uses optional perturbation to re-test.
const refinementSurfaces & surfaces() const
Reference to surface search engines.
word timeName() const
Replacement for Time::timeName() that returns oldInstance (if overwrite_).
debugType
Enumeration for what to debug. Used as a bit-pattern.
static bitSet getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
const shellSurfaces & shells() const
Reference to refinement shells (regions).
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
labelList countEdgeFaces(const uindirectPrimitivePatch &pp) const
Count number of faces per patch edge. Parallel consistent.
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.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
const fvMesh & mesh() const
Reference to mesh.
const refinementFeatures & features() const
Reference to feature edge mesh.
void testSyncBoundaryFaceList(const scalar mergeDistance, const string &, const UList< T > &, const UList< T > &) const
Compare two lists over all boundary faces.
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
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.
label addPointZone(const word &name)
Add pointZone if does not exist. Return index of zone.
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.
scalar mergeDistance() const
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
bool overwrite() const
Overwrite the mesh?
bool write() const
Write mesh and all data.
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const labelList &singleProcPoints, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
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.
void setInstance(const fileName &)
Set instance of all local IOobjects.
static const Enum< debugType > debugTypeNames
static label appendPatch(fvMesh &, const label insertPatchi, const word &, const dictionary &)
Helper:append patch to end of mesh.
MeshType meshType() const
Mode of meshing.
static writeType writeLevel()
Get/set write level.
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
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.
A pointBoundaryMesh is a pointPatch list with registered IO, a reference to the associated pointMesh,...
Mesh representing a set of points created from polyMesh.
const pointBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Mesh consisting of general polyhedral cells.
cellDecomposition
Enumeration defining the decomposition of the cell for.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
A patch is a list of labels that address the faces in the global face list.
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.
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const DynamicList< face > & faces() const
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip, const bool multiZone=false)
Modify vertices or cell of face.
void 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.
void removeFace(const label facei, const label mergeFacei)
Remove/merge face.
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.
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.
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact()).
label nFaces() const noexcept
Number of mesh faces.
A class for managing references or pointers (no reference counting).
T & constCast() const
Return non-const reference to the object or to the contents of a (non-null) managed pointer,...
Encapsulates queries for features.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
label nRegions() const
Return total number of regions.
Given list of cells to remove, insert all the topology changes.
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Encapsulates queries for volume refinement ('refine all cells within shell').
Finds shortest path (in terms of cell centres) to walk on mesh from any point in insidePoints to any ...
faceZoneType
What to do with faceZone faces.
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
virtual bool found(const label id) const
Has the given index?
Standard boundBox with extra functionality for use in octree.
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
void close()
End the file contents and close the file after writing.
virtual bool open(const fileName &file, bool parallel=UPstream::parRun())
Open file for writing (creates parent directory).
void write(const word &fieldName, const UList< Type > &field)
Write primitive field of CellData (Poly or Line) or PointData values.
A class for handling words, derived from Foam::string.
const word & name() const noexcept
The zone name.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
static bool split(const std::string &line, std::string &key, std::string &val)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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 bitSet isBlockedFace(intersectedFaces())
static const Foam::polyMesh::cellDecomposition findCellMode(Foam::polyMesh::FACE_DIAG_TRIS)
#define WarningInFunction
Report a warning using Foam::Warning.
#define DebugVar(var)
Report a variable name and value.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
Namespace for handling debugging switches.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
List< edge > edgeList
List of edge.
Type weightedSum(const UList< scalar > &weights, const UList< Type > &fld)
The local weighted sum (integral) of a field, using the mag() of the weights.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Pair< label > labelPair
A pair of labels.
List< word > wordList
List of word.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with pointZone content on a polyMesh.
List< labelPair > labelPairList
List of labelPair.
List< labelList > labelListList
List of labelList.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
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?
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
List< point > pointList
List of point.
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...
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vector point
Point is a vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
List< scalar > scalarList
List of scalar.
Type gMax(const FieldField< Field, Type > &f)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
constexpr char nl
The newline '\n' character (0x0a).
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Object access operator or list access operator (default is pass-through).