Go to the documentation of this file.
83 { debugType::MESH,
"mesh" },
84 { debugType::OBJINTERSECTIONS,
"intersections" },
85 { debugType::FEATURESEEDS,
"featureSeeds" },
86 { debugType::ATTRACTION,
"attraction" },
87 { debugType::LAYERINFO,
"layerInfo" },
107 { writeType::WRITEMESH,
"mesh" },
108 { writeType::NOWRITEREFINEMENT,
"noRefinement" },
109 { writeType::WRITELEVELS,
"scalarLevels" },
110 { writeType::WRITELAYERSETS,
"layerSets" },
111 { writeType::WRITELAYERFIELDS,
"layerFields" },
132 void Foam::meshRefinement::calcNeighbourData
139 const pointField& cellCentres = mesh_.cellCentres();
141 const label nBoundaryFaces = mesh_.nBoundaryFaces();
143 if (neiLevel.size() != nBoundaryFaces || neiCc.size() != nBoundaryFaces)
146 << nBoundaryFaces <<
" neiLevel:" << neiLevel.size()
150 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
156 const polyPatch& pp =
patches[patchi];
162 label bFacei = pp.start()-mesh_.nInternalFaces();
168 neiLevel[bFacei] = cellLevel[faceCells[i]];
169 neiCc[bFacei] = cellCentres[faceCells[i]];
173 else if (addedPatchIDSet.found(patchi))
185 label own = faceCells[i];
186 label ownLevel = cellLevel[own];
187 label faceLevel = meshCutter_.
faceLevel(pp.start()+i);
192 faceLevel = ownLevel;
196 scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
197 if (faceLevel > ownLevel)
202 neiLevel[bFacei] = faceLevel;
204 neiCc[bFacei] = faceCentres[i] + d*fn;
212 neiLevel[bFacei] = cellLevel[faceCells[i]];
213 neiCc[bFacei] = faceCentres[i];
225 void Foam::meshRefinement::calcCellCellRays
235 const labelList& cellLevel = meshCutter_.cellLevel();
236 const pointField& cellCentres = mesh_.cellCentres();
241 bitSet isMaster(mesh_.nBoundaryFaces(),
true);
243 for (
const polyPatch& pp : mesh_.boundaryMesh())
245 if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
247 isMaster.unset(labelRange(pp.offset(), pp.size()));
253 start.setSize(testFaces.size());
254 end.setSize(testFaces.size());
255 minLevel.setSize(testFaces.size());
259 const label facei = testFaces[i];
260 const label own = mesh_.faceOwner()[facei];
262 if (mesh_.isInternalFace(facei))
264 const label nei = mesh_.faceNeighbour()[facei];
266 start[i] = cellCentres[own];
267 end[i] = cellCentres[nei];
268 minLevel[i] =
min(cellLevel[own], cellLevel[nei]);
272 const label bFacei = facei - mesh_.nInternalFaces();
274 if (isMaster[bFacei])
276 start[i] = cellCentres[own];
277 end[i] = neiCc[bFacei];
282 start[i] = neiCc[bFacei];
283 end[i] = cellCentres[own];
285 minLevel[i] =
min(cellLevel[own], neiLevel[bFacei]);
304 label nMasterFaces = isMasterFace.
count();
307 label nChangedFaces = 0;
310 if (isMasterFace.
test(changedFaces[i]))
319 Info<<
"Edge intersection testing:" <<
nl
320 <<
" Number of edges : " << nMasterFaces <<
nl
321 <<
" Number of edges to retest : " << nChangedFaces
328 labelList neiLevel(mesh_.nBoundaryFaces());
330 calcNeighbourData(neiLevel, neiCc);
353 surfaces_.findHigherIntersection
367 surfaceIndex_[changedFaces[i]] = surfaceHit[i];
374 label nHits = countHits();
380 Info<<
" Number of intersected edges : " << nTotHits <<
endl;
384 setInstance(mesh_.facesInstance());
400 if (adaptPatchIDs.size())
402 nearestAdaptPatch.
setSize(mesh_.nFaces(), adaptPatchIDs[0]);
414 List<topoDistanceData<label>> cellData(mesh_.nCells());
415 List<topoDistanceData<label>> faceData(mesh_.nFaces());
419 List<topoDistanceData<label>> patchData(nFaces);
423 label patchi = adaptPatchIDs[i];
424 const polyPatch& pp =
patches[patchi];
428 patchFaces[nFaces] = pp.start()+i;
429 patchData[nFaces] = topoDistanceData<label>(0, patchi);
435 FaceCellWave<topoDistanceData<label>> deltaCalc
442 mesh_.globalData().nTotalCells()+1
447 bool haveWarned =
false;
450 if (!faceData[facei].valid(deltaCalc.data()))
455 <<
"Did not visit some faces, e.g. face " << facei
456 <<
" at " << mesh_.faceCentres()[facei] <<
endl
457 <<
"Assigning these faces to patch "
465 nearestAdaptPatch[facei] = faceData[facei].data();
472 nearestAdaptPatch.
setSize(mesh_.nFaces(), 0);
475 return nearestAdaptPatch;
482 const label defaultRegion
491 labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
492 pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
493 calcNeighbourData(neiLevel, neiCc);
499 const labelList testFaces(intersectedFaces());
517 List<pointIndexHit> hit1;
520 List<pointIndexHit> hit2;
522 surfaces_.findNearestIntersection
536 labelList nearestRegion(mesh_.nFaces(), defaultRegion);
539 List<topoDistanceData<label>> cellData(mesh_.nCells());
540 List<topoDistanceData<label>> faceData(mesh_.nFaces());
543 DynamicList<label> patchFaces(start.size());
544 DynamicList<topoDistanceData<label>> patchData(start.size());
547 label facei = testFaces[i];
548 if (surface1[i] != -1)
550 patchFaces.append(facei);
551 label regioni = surfaces_.globalRegion(surface1[i], region1[i]);
552 patchData.append(topoDistanceData<label>(0, regioni));
554 else if (surface2[i] != -1)
556 patchFaces.append(facei);
557 label regioni = surfaces_.globalRegion(surface2[i], region2[i]);
558 patchData.append(topoDistanceData<label>(0, regioni));
563 FaceCellWave<topoDistanceData<label>> deltaCalc
570 mesh_.globalData().nTotalCells()+1
575 bool haveWarned =
false;
578 if (!faceData[facei].valid(deltaCalc.data()))
583 <<
"Did not visit some faces, e.g. face " << facei
584 <<
" at " << mesh_.faceCentres()[facei] <<
endl
585 <<
"Assigning these faces to global region "
586 << defaultRegion <<
endl;
592 nearestRegion[facei] = faceData[facei].data();
596 return nearestRegion;
615 Pout<<
"Checking field " << msg <<
endl;
634 const scalar& minVal = minFld[pointi];
635 const scalar& maxVal = maxFld[pointi];
636 if (
mag(minVal-maxVal) > SMALL)
639 <<
" minFld:" << minVal <<
nl
640 <<
" maxFld:" << maxVal <<
nl
662 Pout<<
"Checking field " << msg <<
endl;
669 point(GREAT, GREAT, GREAT)
681 const point& minVal = minFld[pointi];
682 const point& maxVal = maxFld[pointi];
683 if (
mag(minVal-maxVal) > SMALL)
686 <<
" minFld:" << minVal <<
nl
687 <<
" maxFld:" << maxVal <<
nl
696 Pout<<
"meshRefinement::checkData() : Checking refinement structure."
698 meshCutter_.checkMesh();
700 Pout<<
"meshRefinement::checkData() : Checking refinement levels."
702 meshCutter_.checkRefinementLevels(1,
labelList(0));
705 const label nBnd = mesh_.nBoundaryFaces();
707 Pout<<
"meshRefinement::checkData() : Checking synchronization."
713 pointField::subList boundaryFc
717 mesh_.nInternalFaces()
730 testSyncBoundaryFaceList
733 "testing faceCentres : ",
740 const labelList& surfIndex = surfaceIndex();
747 calcNeighbourData(neiLevel, neiCc);
755 start[facei] = mesh_.cellCentres()[mesh_.faceOwner()[facei]];
757 if (mesh_.isInternalFace(facei))
759 end[facei] = mesh_.cellCentres()[mesh_.faceNeighbour()[facei]];
763 end[facei] = neiCc[facei-mesh_.nInternalFaces()];
779 surfaces_.findHigherIntersection
796 mesh_.nInternalFaces()
804 if (surfIndex[facei] != surfaceHit[facei])
806 if (mesh_.isInternalFace(facei))
809 <<
"Internal face:" << facei
810 <<
" fc:" << mesh_.faceCentres()[facei]
811 <<
" cached surfaceIndex_:" << surfIndex[facei]
812 <<
" current:" << surfaceHit[facei]
814 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
816 << mesh_.cellCentres()[mesh_.faceNeighbour()[facei]]
822 != neiHit[facei-mesh_.nInternalFaces()]
826 <<
"Boundary face:" << facei
827 <<
" fc:" << mesh_.faceCentres()[facei]
828 <<
" cached surfaceIndex_:" << surfIndex[facei]
829 <<
" current:" << surfaceHit[facei]
831 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
833 << neiCc[facei-mesh_.nInternalFaces()]
834 <<
" end:" <<
end[facei]
836 << meshCutter_.cellLevel()[mesh_.faceOwner()[facei]]
838 << meshCutter_.faceLevel(facei)
848 mesh_.nBoundaryFaces(),
849 mesh_.nInternalFaces()
852 labelList neiBoundarySurface(boundarySurface);
860 testSyncBoundaryFaceList
863 "testing surfaceIndex() : ",
871 Pout<<
"meshRefinement::checkData() : Counting duplicate faces."
879 identity(mesh_.nBoundaryFaces(), mesh_.nInternalFaces())
889 if (duplicateFace[i] != -1)
895 Pout<<
"meshRefinement::checkData() : Found " << nDup
896 <<
" duplicate pairs of faces." <<
endl;
903 meshCutter_.setInstance(inst);
904 surfaceIndex_.instance() = inst;
932 mesh_.updateMesh(map);
947 setInstance(mesh_.facesInstance());
962 updateMesh(map, newExposedFaces);
978 label facei = splitFaces[i];
979 const face&
f = mesh_.faces()[facei];
1002 face f1(
f.size()-f0.size()+2);
1012 label own = mesh_.faceOwner()[facei];
1015 if (facei >= mesh_.nInternalFaces())
1017 patchi = mesh_.boundaryMesh().whichPatch(facei);
1021 nei = mesh_.faceNeighbour()[facei];
1024 label zonei = mesh_.faceZones().whichZone(facei);
1025 bool zoneFlip =
false;
1028 const faceZone& fz = mesh_.faceZones()[zonei];
1035 Pout<<
"face:" << facei <<
" verts:" <<
f
1036 <<
" split into f0:" << f0
1037 <<
" f1:" << f1 <<
endl;
1099 <<
"Splitting " << nSplit
1100 <<
" faces across diagonals" <<
"." <<
nl <<
endl;
1112 meshMod.
faces().size()+splitFaces.size(),
1117 doSplitFaces(splitFaces, splits, meshMod);
1124 mesh_.updateMesh(map);
1134 setInstance(mesh_.facesInstance());
1146 Map<label> splitFaceToIndex(2*splitFaces.size());
1149 splitFaceToIndex.insert(splitFaces[i], i);
1154 label oldFacei = map.
faceMap()[facei];
1156 const auto oldFaceFnd = splitFaceToIndex.cfind(oldFacei);
1158 if (oldFaceFnd.found())
1160 labelPair& twoFaces = facePairs[oldFaceFnd.val()];
1161 if (twoFaces[0] == -1)
1163 twoFaces[0] = facei;
1165 else if (twoFaces[1] == -1)
1167 twoFaces[1] = facei;
1172 <<
"problem: twoFaces:" << twoFaces
1183 if (duplicateFace.size())
1197 baffle.first() = oldToNewFaces[baffle.first()];
1200 if (baffle.first() == -1 || baffle.
second() == -1)
1203 <<
"Removed baffle : faces:" << baffle
1216 changedFaces.
append(facePairs[i].first());
1217 changedFaces.
append(facePairs[i].second());
1221 updateMesh(map, growFaceCellFace(changedFaces));
1234 for (label iteration = 0; iteration < 100; iteration++)
1237 <<
"Undo iteration " << iteration <<
nl
1238 <<
"----------------" <<
endl;
1244 faceSet errorFaces(mesh_,
"errorFaces", mesh_.nBoundaryFaces());
1260 const labelList grownFaces(growFaceCellFace(errorFaces));
1262 errorFaces.insert(grownFaces);
1276 const labelPair& twoFaces = facePairs[index];
1280 errorFaces.found(twoFaces.first())
1281 || errorFaces.found(twoFaces.
second())
1284 const face& originalFace = originalFaces[index];
1288 label own = mesh_.faceOwner()[twoFaces[0]];
1291 if (twoFaces[0] >= mesh_.nInternalFaces())
1293 patchi = mesh_.boundaryMesh().whichPatch(twoFaces[0]);
1297 nei = mesh_.faceNeighbour()[twoFaces[0]];
1300 label zonei = mesh_.faceZones().whichZone(twoFaces[0]);
1301 bool zoneFlip =
false;
1304 const faceZone& fz = mesh_.faceZones()[zonei];
1321 meshMod.
removeFace(twoFaces[1], twoFaces[0]);
1323 mergedIndices.insert(index);
1329 Info<<
"Detected " <<
n
1330 <<
" split faces that will be restored to their original faces."
1347 mesh_.updateMesh(map);
1357 setInstance(mesh_.facesInstance());
1373 const labelPair& oldSplit = facePairs[index];
1374 label new0 = oldToNewFaces[oldSplit[0]];
1375 label new1 = oldToNewFaces[oldSplit[1]];
1377 if (!mergedIndices.found(index))
1380 if (new0 < 0 || new1 < 0)
1383 <<
"Problem: oldFaces:" << oldSplit
1384 <<
" newFaces:" <<
labelPair(new0, new1)
1388 facePairs[newIndex] =
labelPair(new0, new1);
1392 originalFaces[index]
1399 if (new0 < 0 || new1 == -1)
1402 <<
"Problem: oldFaces:" << oldSplit
1406 changedFaces.
append(new0);
1410 facePairs.setSize(newIndex);
1411 originalFaces.
setSize(newIndex);
1415 updateMesh(map, growFaceCellFace(changedFaces));
1421 if (duplicateFace.size())
1435 baffle.first() = reverseFaceMap[baffle.first()];
1438 if (baffle.first() == -1 || baffle.
second() == -1)
1441 <<
"Removed baffle : faces:" << baffle
1455 Foam::meshRefinement::meshRefinement
1458 const scalar mergeDistance,
1459 const bool overwrite,
1469 mergeDistance_(mergeDistance),
1470 overwrite_(overwrite),
1472 surfaces_(surfaces),
1473 features_(features),
1475 limitShells_(limitShells),
1487 mesh_.facesInstance(),
1499 updateIntersections(checkFaces);
1507 if (surfaceIndex_.size() != mesh_.nFaces())
1514 return surfaceIndex_;
1520 if (surfaceIndex_.size() != mesh_.nFaces())
1522 updateIntersections(
identity(mesh_.nFaces()));
1524 return surfaceIndex_;
1535 const labelList& surfIndex = surfaceIndex();
1539 if (surfIndex[facei] >= 0 && isMasterFace.
test(facei))
1550 const bool keepZoneFaces,
1551 const bool keepBaffles,
1568 label nUnblocked = 0;
1582 specifiedProcessorFaces,
1588 if (keepZoneFaces || keepBaffles)
1608 const faceZone& fZone = fZones[zonei];
1612 label facei = fZone[i];
1613 if (blockedFace[facei])
1617 mesh_.isInternalFace(facei)
1621 blockedFace[facei] =
false;
1643 Info<<
"Found " << nUnblocked
1644 <<
" zoned faces to keep together." <<
endl;
1650 boolList separatedCoupledFace(mesh_.nFaces(),
false);
1651 selectSeparatedCoupledFaces(separatedCoupledFace);
1653 label nSeparated = 0;
1654 forAll(separatedCoupledFace, facei)
1656 if (separatedCoupledFace[facei])
1658 if (blockedFace[facei])
1660 blockedFace[facei] =
false;
1666 Info<<
"Found " << nSeparated
1667 <<
" separated coupled faces to keep together." <<
endl;
1669 nUnblocked += nSeparated;
1675 const label nBnd = mesh_.nBoundaryFaces();
1677 labelList coupledFace(mesh_.nFaces(), -1);
1690 coupledFace[baffle.first()] = baffle.
second();
1691 coupledFace[baffle.
second()] = baffle.first();
1695 const labelPair& baffle = allCouples[i];
1696 coupledFace[baffle.first()] = baffle.
second();
1697 coupledFace[baffle.
second()] = baffle.first();
1703 forAll(coupledFace, facei)
1705 if (coupledFace[facei] != -1 && facei < coupledFace[facei])
1707 couples[nCpl++] =
labelPair(facei, coupledFace[facei]);
1716 Info<<
"Found " << nCouples <<
" baffles to keep together."
1726 blockedFace[baffle.first()] =
false;
1727 blockedFace[baffle.
second()] =
false;
1735 specifiedProcessorFaces,
1743 Pout<<
"Wanted distribution:" << nProcCells <<
endl;
1748 Pout<<
"Wanted resulting decomposition:" <<
endl;
1749 forAll(nProcCells, proci)
1751 Pout<<
" " << proci <<
'\t' << nProcCells[proci] <<
endl;
1764 setInstance(mesh_.facesInstance());
1767 if (
debug && keepZoneFaces)
1775 const faceZone& fZone = fZones[zonei];
1779 label facei = fZone[i];
1782 if (patchi >= 0 && pbm[patchi].
coupled())
1785 <<
"Face at " << mesh_.faceCentres()[facei]
1786 <<
" on zone " << fZone.
name()
1787 <<
" is on coupled patch " << pbm[patchi].
name()
1801 label nBoundaryFaces = 0;
1803 const labelList& surfIndex = surfaceIndex();
1807 if (surfIndex[facei] != -1)
1818 if (surfIndex[facei] != -1)
1820 surfaceFaces[nBoundaryFaces++] = facei;
1823 return surfaceFaces;
1829 const faceList& faces = mesh_.faces();
1832 bitSet isBoundaryPoint(mesh_.nPoints());
1833 label nBoundaryPoints = 0;
1835 const labelList& surfIndex = surfaceIndex();
1839 if (surfIndex[facei] != -1)
1841 const face&
f = faces[facei];
1845 if (isBoundaryPoint.set(
f[fp]))
1882 labelList boundaryPoints(nBoundaryPoints);
1883 nBoundaryPoints = 0;
1884 forAll(isBoundaryPoint, pointi)
1886 if (isBoundaryPoint.test(pointi))
1888 boundaryPoints[nBoundaryPoints++] = pointi;
1892 return boundaryPoints;
1912 nFaces += pp.size();
1923 label meshFacei = pp.
start();
1927 addressing[nFaces++] = meshFacei++;
1952 pointPatches.size(),
1953 slipPointPatchVectorField::typeName
1958 patchFieldTypes[adaptPatchIDs[i]] =
1959 fixedValuePointPatchVectorField::typeName;
1962 forAll(pointPatches, patchi)
1964 if (isA<processorPointPatch>(pointPatches[patchi]))
1966 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
1968 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
1970 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
1980 "pointDisplacement",
2012 <<
"faceZones are not synchronised on processors." <<
nl
2013 <<
"Processor " << proci <<
" has faceZones "
2014 << zoneNames[proci] <<
nl
2016 <<
" has faceZones "
2030 const faceZone& fZone = fZones[zonei];
2038 if (faceToZone[bFacei] == -1)
2040 faceToZone[bFacei] = zonei;
2042 else if (faceToZone[bFacei] == zonei)
2045 <<
"Face " << fZone[i] <<
" in zone "
2047 <<
" is twice in zone!"
2053 <<
"Face " << fZone[i] <<
" in zone "
2055 <<
" is also in zone "
2056 << fZones[faceToZone[bFacei]].name()
2068 if (faceToZone[i] != neiFaceToZone[i])
2072 <<
" is in zone " << faceToZone[i]
2073 <<
", its coupled face is in zone " << neiFaceToZone[i]
2083 const bitSet& isMasterEdge,
2093 edgeWeights.setSize(isMasterEdge.
size());
2094 invSumWeight.setSize(meshPoints.size());
2098 const edge&
e = edges[edgei];
2104 pts[meshPoints[
e[1]]]
2105 - pts[meshPoints[
e[0]]]
2108 edgeWeights[edgei] = 1.0/eMag;
2124 forAll(invSumWeight, pointi)
2126 scalar w = invSumWeight[pointi];
2130 invSumWeight[pointi] = 1.0/w;
2139 const label insertPatchi,
2140 const word& patchName,
2151 label patchi = polyPatches.size();
2154 polyPatches.
setSize(patchi+1);
2172 polyPatches[patchi],
2177 addPatchFields<volScalarField>
2182 addPatchFields<volVectorField>
2187 addPatchFields<volSphericalTensorField>
2192 addPatchFields<volSymmTensorField>
2197 addPatchFields<volTensorField>
2205 addPatchFields<surfaceScalarField>
2210 addPatchFields<surfaceVectorField>
2215 addPatchFields<surfaceSphericalTensorField>
2220 addPatchFields<surfaceSymmTensorField>
2225 addPatchFields<surfaceTensorField>
2237 const word& patchName,
2245 const label patchi = polyPatches.
findPatchID(patchName);
2253 label insertPatchi = polyPatches.size();
2256 forAll(polyPatches, patchi)
2258 const polyPatch& pp = polyPatches[patchi];
2260 if (isA<processorPolyPatch>(pp))
2262 insertPatchi = patchi;
2263 startFacei = pp.
start();
2269 patchDict.
set(
"nFaces", 0);
2270 patchDict.
set(
"startFace", startFacei);
2275 label addedPatchi = appendPatch(
mesh, insertPatchi, patchName, patchDict);
2281 for (label i = 0; i < insertPatchi; i++)
2286 for (label i = insertPatchi; i < addedPatchi; i++)
2291 oldToNew[addedPatchi] = insertPatchi;
2294 polyPatches.
reorder(oldToNew,
true);
2295 fvPatches.reorder(oldToNew);
2297 reorderPatchFields<volScalarField>(
mesh, oldToNew);
2298 reorderPatchFields<volVectorField>(
mesh, oldToNew);
2299 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
2300 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
2301 reorderPatchFields<volTensorField>(
mesh, oldToNew);
2302 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
2303 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
2304 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
2305 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
2306 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
2308 return insertPatchi;
2318 label meshedi = meshedPatches_.find(
name);
2323 return mesh_.boundaryMesh().findPatchID(
name);
2328 label patchi = addPatch(mesh_,
name, patchInfo);
2353 meshedPatches_.append(
name);
2356 faceToCoupledPatch_.clear();
2368 forAll(meshedPatches_, i)
2375 <<
"Problem : did not find patch " << meshedPatches_[i]
2392 const word& masterPatch,
2393 const word& slavePatch,
2405 faceZoneToMasterPatch_.insert(fzName, masterPatch);
2406 faceZoneToSlavePatch_.insert(fzName, slavePatch);
2407 faceZoneToType_.insert(fzName, fzType);
2416 label& masterPatchID,
2417 label& slavePatchID,
2423 if (!faceZoneToMasterPatch_.found(fzName))
2429 const word& masterName = faceZoneToMasterPatch_[fzName];
2432 const word& slaveName = faceZoneToSlavePatch_[fzName];
2435 fzType = faceZoneToType_[fzName];
2447 const auto* cpp = isA<coupledPolyPatch>(pp);
2449 if (cpp && (cpp->separated() || !cpp->parallel()))
2461 const vector& perturbVec,
2473 regioni = cellToRegion[celli];
2483 regioni = cellToRegion[celli];
2497 const vector& perturbVec,
2500 const bool exitIfLeakPath,
2502 const label nRegions,
2510 labelList insideRegions(locationsInMesh.size());
2514 label regioni = findRegion
2522 insideRegions[i] = regioni;
2525 forAll(cellRegion, celli)
2527 if (cellRegion[celli] == regioni)
2529 insideCell.set(celli);
2538 forAll(locationsOutsideMesh, i)
2541 label regioni = findRegion
2546 locationsOutsideMesh[i]
2553 label index = insideRegions.find(regioni);
2585 locationsOutsideMesh,
2594 label nSegments = 0;
2595 if (leakPath.segments().size())
2597 nSegments =
max(leakPath.segments())+1;
2602 for (label segmenti : leakPath.segments())
2604 nElemsPerSegment[segmenti]++;
2606 segmentPoints.
setSize(nElemsPerSegment.size());
2607 segmentDist.
setSize(nElemsPerSegment.size());
2608 forAll(nElemsPerSegment, i)
2610 segmentPoints[i].setSize(nElemsPerSegment[i]);
2611 segmentDist[i].
setSize(nElemsPerSegment[i]);
2613 nElemsPerSegment = 0;
2617 label segmenti = leakPath.segments()[elemi];
2620 label&
n = nElemsPerSegment[segmenti];
2623 dist[
n] = leakPath.curveDist()[elemi];
2629 forAll(allLeakPaths, segmenti)
2634 std::move(segmentPoints[segmenti]);
2639 std::move(segmentDist[segmenti]);
2645 ListListOps::combine<pointList>
2652 ListListOps::combine<scalarList>
2680 varData.
setSize(allLeakPaths.size());
2681 forAll(allLeakPaths, segmenti)
2683 varData[segmenti] = allLeakPaths[segmenti].curveDist();
2686 const wordList valueSetNames(1,
"leakPath");
2701 leakPathFormatter.
write
2718 <<
"Location in mesh " << locationsInMesh[index]
2719 <<
" is inside same mesh region " << regioni
2720 <<
" as one of the locations outside mesh "
2721 << locationsOutsideMesh
2722 <<
nl <<
" Dumped leak path to " << fName
2728 <<
"Location in mesh " << locationsInMesh[index]
2729 <<
" is inside same mesh region " << regioni
2730 <<
" as one of the locations outside mesh "
2731 << locationsOutsideMesh
2732 <<
nl <<
"Dumped leak path to " << fName <<
endl;
2742 forAll(insideCell, celli)
2744 if (!insideCell.test(celli))
2746 cellRegion[celli] = -1;
2749 else if (cellRegion[celli] == -1)
2765 const bool exitIfLeakPath,
2770 (void)mesh_.tetBasePtIs();
2775 boolList blockedFace(mesh_.nFaces(),
false);
2776 selectSeparatedCoupledFaces(blockedFace);
2780 label nRemove = findRegions
2785 locationsOutsideMesh,
2798 forAll(cellRegion, celli)
2800 if (cellRegion[celli] == -1)
2802 cellsToRemove.append(celli);
2805 cellsToRemove.shrink();
2809 cellsToRemove.size(),
2815 if (nTotCellsToRemove > 0)
2817 label nCellsToKeep =
2818 mesh_.globalData().nTotalCells()
2819 - nTotCellsToRemove;
2821 Info<<
"Keeping all cells containing points " << locationsInMesh <<
endl
2822 <<
"Selected for keeping : "
2824 <<
" cells." <<
endl;
2842 label defaultPatch = 0;
2843 if (globalToMasterPatch.size())
2845 defaultPatch = globalToMasterPatch[0];
2849 <<
"Removing non-reachable cells exposes "
2850 << nExposedFaces <<
" internal or coupled faces." <<
endl
2851 <<
" These get put into patch " << defaultPatch <<
endl;
2852 exposedPatch.setSize(exposedFaces.size(), defaultPatch);
2855 mapPtr = doRemoveCells
2874 meshCutter_.distribute(map);
2881 faceToCoupledPatch_.clear();
2907 geometry[i].distribute
2918 geometry[i].instance() = geometry[i].time().timeName();
2936 updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
2948 meshCutter_.storeData
2969 meshCutter_.updateMesh
2978 updateList(map.
faceMap(), label(-1), surfaceIndex_);
2982 Map<label> newFaceToPatch(faceToCoupledPatch_.size());
2989 newFaceToPatch.insert(newFacei, iter.val());
2992 faceToCoupledPatch_.
transfer(newFaceToPatch);
2997 updateIntersections(changedFaces);
3004 if (userFaceData_[i].first() == KEEPALL)
3009 else if (userFaceData_[i].first() == MASTERONLY)
3014 forAll(newFaceData, facei)
3016 label oldFacei = map.
faceMap()[facei];
3020 newFaceData[facei] =
data[oldFacei];
3036 label oldFacei = map.
faceMap()[facei];
3040 if (reverseFaceMap[oldFacei] != facei)
3043 reverseFaceMap[oldFacei] = -1;
3050 forAll(newFaceData, facei)
3052 label oldFacei = map.
faceMap()[facei];
3056 if (reverseFaceMap[oldFacei] == facei)
3058 newFaceData[facei] =
data[oldFacei];
3070 bool writeOk = mesh_.write();
3087 s.instance() !=
s.time().system()
3088 &&
s.instance() !=
s.time().caseSystem()
3089 &&
s.instance() !=
s.time().constant()
3090 &&
s.instance() !=
s.time().caseConstant()
3094 s.instance() =
s.time().timeName();
3095 writeOk = writeOk &&
s.write();
3126 bitSet isPatchMasterPoint(meshPoints.size());
3127 forAll(meshPoints, pointi)
3131 isPatchMasterPoint.set(pointi);
3135 return isPatchMasterPoint;
3149 identity(globalEdges.localSize(), globalEdges.localStart())
3162 bitSet isMasterEdge(meshEdges.size());
3165 if (myEdges[edgei] == globalEdges.toGlobal(edgei))
3167 isMasterEdge.
set(edgei);
3171 return isMasterEdge;
3183 <<
" : cells(local):" << mesh_.nCells()
3184 <<
" faces(local):" << mesh_.nFaces()
3185 <<
" points(local):" << mesh_.nPoints()
3191 label nMasterFaces = isMasterFace.
count();
3194 label nMasterPoints = isMeshMasterPoint.
count();
3206 const labelList& cellLevel = meshCutter_.cellLevel();
3212 nCells[cellLevel[celli]]++;
3218 Info<<
"Cells per refinement level:" <<
endl;
3221 Info<<
" " << leveli <<
'\t' << nCells[leveli]
3230 if (overwrite_ && mesh_.time().timeIndex() == 0)
3232 return oldInstance_;
3235 return mesh_.time().timeName();
3249 mesh_.time().timeName(),
3257 zeroGradientFvPatchScalarField::typeName
3260 const labelList& cellLevel = meshCutter_.cellLevel();
3262 forAll(volRefLevel, celli)
3264 volRefLevel[celli] = cellLevel[celli];
3267 volRefLevel.write();
3279 mesh_.time().timeName(),
3289 const labelList& pointLevel = meshCutter_.pointLevel();
3291 forAll(pointRefLevel, pointi)
3293 pointRefLevel[pointi] = pointLevel[pointi];
3296 pointRefLevel.write();
3304 OFstream str(prefix +
"_edges.obj");
3306 Pout<<
"meshRefinement::dumpIntersections :"
3307 <<
" Writing cellcentre-cellcentre intersections to file "
3315 labelList neiLevel(mesh_.nBoundaryFaces());
3317 calcNeighbourData(neiLevel, neiCc);
3319 labelList intersectionFaces(intersectedFaces());
3341 surfaces_.findAnyIntersection
3349 forAll(intersectionFaces, i)
3351 if (surfaceHit[i] != -1)
3359 str <<
"l " << verti-2 <<
' ' << verti-1 <<
nl
3360 <<
"l " << verti-1 <<
' ' << verti <<
nl;
3376 if (writeFlags & WRITEMESH)
3381 if (writeFlags && !(writeFlags & NOWRITEREFINEMENT))
3383 meshCutter_.write();
3386 (void)surfaceIndex();
3387 surfaceIndex_.write();
3390 if (writeFlags & WRITELEVELS)
3392 dumpRefinementLevel();
3395 if ((debugFlags & OBJINTERSECTIONS) && prefix.size())
3397 dumpIntersections(prefix);
3416 if (
exists(setsDir/
"surfaceIndex"))
3418 rm(setsDir/
"surfaceIndex");
3434 writeLevel_ = flags;
3453 const word& keyword,
3458 const auto finder(
dict.
csearch(keyword, matchOpt));
3464 err <<
"Entry '" << keyword <<
"' not found in dictionary "
3477 return finder.dict();
3484 const word& keyword,
3489 const auto finder(
dict.
csearch(keyword, matchOpt));
3495 err <<
"Entry '" << keyword <<
"' not found in dictionary "
3501 return dict.first()->stream();
3509 return finder.ref().stream();
int debug
Static debugging option.
const T & second() const noexcept
Return second element, which is also the last element.
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
virtual const pointField & points() const
Return raw points.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
List< scalar > scalarList
A List of scalars.
Accumulating histogram of values. Specified bin resolution automatic generation of bins.
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
static const Vector< scalar > one
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?
cellDecomposition
Enumeration defining the decomposition of the cell for.
Calculates points shared by more than two processor patches or cyclic patches.
faceZoneType
What to do with faceZone faces.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
A class for handling words, derived from Foam::string.
const labelIOList & cellLevel() const
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
A class for handling file names.
const boolList & flipMap() const noexcept
Return face flip map.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
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))
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const bool exitIfLeakPath, const writer< scalar > &leakPathFormatter)
Split mesh. Keep part containing point. Return empty map if.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
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.
virtual const fileName & name() const
Read/write access to the name of the stream.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
A class for managing temporary objects.
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.
static constexpr const zero Zero
Global zero (0)
Given list of cells to remove, insert all the topology changes.
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
A List obtained as a section of another List.
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.
Standard boundBox with extra functionality for use in octree.
static writeType writeLevel()
Get/set write level.
labelList intersectedFaces() const
Get faces with intersection.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
static word timeName(const scalar t, const int precision=precision_)
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label countHits() const
Count number of intersections (local)
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
static const dictionary & subDict(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX)
Wrapper around dictionary::subDict which does not exit.
virtual void write(const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const =0
General entry point for writing.
const fileName & facesInstance() const
Return the current instance directory for faces.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
void set(const bitSet &bitset)
Set specified bits from another bitset.
static bool master(const label communicator=worldComm)
Am I the master process.
label splitFacesUndo(const labelList &splitFaces, const labelPairList &splits, const dictionary &motionDict, labelList &duplicateFace, List< labelPair > &baffles)
Split faces along diagonal. Maintain mesh quality. Return.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
List< bool > boolList
A List of bools.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
void append(const T &val)
Append an element at the end of the list.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
const pointField & preMotionPoints() const
Pre-motion point positions.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
Helper: extract constraints:
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
const fileName & name() const noexcept
The dictionary name.
static void removeFiles(const polyMesh &)
Helper: remove all relevant files from mesh instance.
unsigned int count(const bool on=true) const
Count number of bits set.
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
void doSplitFaces(const labelList &splitFaces, const labelPairList &splits, polyTopoChange &meshMod) const
Split faces into two.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
Mesh consisting of general polyhedral cells.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
wordList names() const
Return a list of patch names.
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
void transfer(dictionary &dict)
Transfer the contents of the argument and annul the argument.
label nPoints() const noexcept
Number of mesh points.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
void setCapacity(const label nPoints, const label nFaces, const label nCells)
static bitSet getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
virtual fileName getFileName(const coordSet &, const wordList &) const =0
Generate file name with correct extension.
autoPtr< mapPolyMesh > doRemoveCells(const labelList &cellsToRemove, const labelList &exposedFaces, const labelList &exposedPatchIDs, removeCells &cellRemover)
Remove cells. Put exposedFaces into exposedPatchIDs.
Pair< label > labelPair
A pair of labels.
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 fileName & pointsInstance() const
Return the current instance directory for points.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
label nCells() const noexcept
Number of mesh cells.
Encapsulates queries for volume refinement ('refine all cells within shell').
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const DynamicList< face > & faces() const
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
An input stream of tokens.
A subset of mesh faces organised as a primitive patch.
messageStream Info
Information stream (stdout output on master, null elsewhere)
A patch is a list of labels that address the faces in the global face list.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
void setSize(const label n)
Alias for resize()
static label appendPatch(fvMesh &, const label insertPatchi, const word &, const dictionary &)
Helper:append patch to end of mesh.
static label findRegions(const polyMesh &, const vector &perturbVec, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const bool exitIfLeakPath, const writer< scalar > &leakPathFormatter, const label nRegions, labelList &cellRegion, const boolList &blockedFace)
Find regions points are in.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Modify vertices or cell of face.
void transfer(List< T > &list)
static const Foam::polyMesh::cellDecomposition findCellMode(Foam::polyMesh::FACE_DIAG_TRIS)
const_searcher csearch(const word &keyword, enum keyType::option=keyType::REGEX) const
Search dictionary for given keyword.
A List with indirect addressing.
bool opened() const noexcept
True if stream has been opened.
void setSize(const label newLen)
Same as resize()
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label nRegions() const
Return total number of regions.
static word outputPrefix
Directory prefix.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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))
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
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.
static const Enum< writeType > writeTypeNames
Finds shortest path (in terms of cell centres) to walk on mesh from any point in insidePoints to any ...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
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 autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
Abstract base class for domain decomposition.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
Holds list of sampling positions.
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
Mesh data needed to do the Finite Volume discretisation.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Mesh representing a set of points created from polyMesh.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
Vector< scalar > vector
A scalar version of the templated Vector.
label start() const
Return start label of this patch in the polyMesh face list.
void removeFace(const label facei, const label mergeFacei)
Remove/merge face.
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
wordList names() const
A list of the zone names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
void setInstance(const fileName &)
Set instance of all local IOobjects.
const labelList & reverseFaceMap() const
Reverse face map.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const word & name() const noexcept
Return name.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
const vectorField & cellCentres() const
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
forAllConstIters(mixture.phases(), phase)
static const Enum< coordFormat > coordFormatNames
String representation of coordFormat enum.
const word & name() const noexcept
The zone name.
Encapsulates queries for features.
const labelList & reversePointMap() const
Reverse point map.
writeType
Enumeration for what to write. Used as a bit-pattern.
label nInternalFaces() const noexcept
Number of internal faces.
static bool & parRun() noexcept
Test if this a parallel run.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
label size() const noexcept
Number of entries.
void checkData()
Debugging: check that all faces still obey start()>end()
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
const dimensionedScalar e
Elementary charge.
bool write() const
Write mesh and all data.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
const polyBoundaryMesh & patches
const labelList & faceMap() const
Old face map.
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
void clear() noexcept
Same as reset(nullptr)
static bool split(const std::string &line, std::string &key, std::string &val)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool hasMotionPoints() const
Has valid preMotionPoints?
fileName globalPath() const
Return global path for the case.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static bool clean(std::string &str)
const Time & time() const
Return the top-level database.
static const Vector< scalar > zero
A List with indirect addressing.
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
SubField< vector > subField
Declare type of subField.
label nFaces() const noexcept
Number of mesh faces.
A face is a list of labels corresponding to mesh vertices.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void updateIntersections(const labelList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
List< point > pointList
A List of points.
label faceLevel(const label facei) const
Gets level such that the face has four points <= level.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
vector point
Point is a vector.
UList< label > labelUList
A UList of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static const Enum< debugType > debugTypeNames
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
#define DebugVar(var)
Report a variable name and value.
defineTypeNameAndDebug(combustionModel, 0)
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
#define WarningInFunction
Report a warning using Foam::Warning.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Database for solution data, solver performance and other reduced data.
Type gMax(const FieldField< Field, Type > &f)
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
static bitSet getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
const dimensionSet dimless
Dimensionless.
option
Enumeration for the data type and search/match modes (bitmask)
void clearOut()
Clear all geometry and addressing.
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
debugType
Enumeration for what to debug. Used as a bit-pattern.
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.