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 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
244 for (
const polyPatch& pp :
patches)
246 if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
248 const labelRange bSlice
250 pp.start()-mesh_.nInternalFaces(),
253 isMaster.unset(bSlice);
259 start.
setSize(testFaces.size());
260 end.setSize(testFaces.size());
261 minLevel.setSize(testFaces.size());
265 const label facei = testFaces[i];
266 const label own = mesh_.faceOwner()[facei];
268 if (mesh_.isInternalFace(facei))
270 const label nei = mesh_.faceNeighbour()[facei];
272 start[i] = cellCentres[own];
273 end[i] = cellCentres[nei];
274 minLevel[i] =
min(cellLevel[own], cellLevel[nei]);
278 const label bFacei = facei - mesh_.nInternalFaces();
280 if (isMaster[bFacei])
282 start[i] = cellCentres[own];
283 end[i] = neiCc[bFacei];
288 start[i] = neiCc[bFacei];
289 end[i] = cellCentres[own];
291 minLevel[i] =
min(cellLevel[own], neiLevel[bFacei]);
310 label nMasterFaces = isMasterFace.
count();
313 label nChangedFaces = 0;
316 if (isMasterFace.
test(changedFaces[i]))
325 Info<<
"Edge intersection testing:" <<
nl
326 <<
" Number of edges : " << nMasterFaces <<
nl
327 <<
" Number of edges to retest : " << nChangedFaces
334 labelList neiLevel(mesh_.nBoundaryFaces());
336 calcNeighbourData(neiLevel, neiCc);
359 surfaces_.findHigherIntersection
373 surfaceIndex_[changedFaces[i]] = surfaceHit[i];
380 label nHits = countHits();
386 Info<<
" Number of intersected edges : " << nTotHits <<
endl;
390 setInstance(mesh_.facesInstance());
406 if (adaptPatchIDs.size())
408 nearestAdaptPatch.
setSize(mesh_.nFaces(), adaptPatchIDs[0]);
420 List<topoDistanceData<label>> cellData(mesh_.nCells());
421 List<topoDistanceData<label>> faceData(mesh_.nFaces());
425 List<topoDistanceData<label>> patchData(nFaces);
429 label patchi = adaptPatchIDs[i];
430 const polyPatch& pp =
patches[patchi];
434 patchFaces[nFaces] = pp.start()+i;
435 patchData[nFaces] = topoDistanceData<label>(0, patchi);
441 FaceCellWave<topoDistanceData<label>> deltaCalc
448 mesh_.globalData().nTotalCells()+1
453 bool haveWarned =
false;
456 if (!faceData[facei].valid(deltaCalc.data()))
461 <<
"Did not visit some faces, e.g. face " << facei
462 <<
" at " << mesh_.faceCentres()[facei] <<
endl
463 <<
"Assigning these faces to patch "
471 nearestAdaptPatch[facei] = faceData[facei].data();
478 nearestAdaptPatch.
setSize(mesh_.nFaces(), 0);
481 return nearestAdaptPatch;
488 const label defaultRegion
497 labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
498 pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
499 calcNeighbourData(neiLevel, neiCc);
505 const labelList testFaces(intersectedFaces());
523 List<pointIndexHit> hit1;
526 List<pointIndexHit> hit2;
528 surfaces_.findNearestIntersection
542 labelList nearestRegion(mesh_.nFaces(), defaultRegion);
545 List<topoDistanceData<label>> cellData(mesh_.nCells());
546 List<topoDistanceData<label>> faceData(mesh_.nFaces());
549 DynamicList<label> patchFaces(start.size());
550 DynamicList<topoDistanceData<label>> patchData(start.size());
553 label facei = testFaces[i];
554 if (surface1[i] != -1)
556 patchFaces.append(facei);
557 label regioni = surfaces_.globalRegion(surface1[i], region1[i]);
558 patchData.append(topoDistanceData<label>(0, regioni));
560 else if (surface2[i] != -1)
562 patchFaces.append(facei);
563 label regioni = surfaces_.globalRegion(surface2[i], region2[i]);
564 patchData.append(topoDistanceData<label>(0, regioni));
569 FaceCellWave<topoDistanceData<label>> deltaCalc
576 mesh_.globalData().nTotalCells()+1
581 bool haveWarned =
false;
584 if (!faceData[facei].valid(deltaCalc.data()))
589 <<
"Did not visit some faces, e.g. face " << facei
590 <<
" at " << mesh_.faceCentres()[facei] <<
endl
591 <<
"Assigning these faces to global region "
592 << defaultRegion <<
endl;
598 nearestRegion[facei] = faceData[facei].data();
602 return nearestRegion;
621 Pout<<
"Checking field " << msg <<
endl;
640 const scalar& minVal = minFld[pointi];
641 const scalar& maxVal = maxFld[pointi];
642 if (
mag(minVal-maxVal) > SMALL)
645 <<
" minFld:" << minVal <<
nl
646 <<
" maxFld:" << maxVal <<
nl
668 Pout<<
"Checking field " << msg <<
endl;
675 point(GREAT, GREAT, GREAT)
687 const point& minVal = minFld[pointi];
688 const point& maxVal = maxFld[pointi];
689 if (
mag(minVal-maxVal) > SMALL)
692 <<
" minFld:" << minVal <<
nl
693 <<
" maxFld:" << maxVal <<
nl
702 Pout<<
"meshRefinement::checkData() : Checking refinement structure."
704 meshCutter_.checkMesh();
706 Pout<<
"meshRefinement::checkData() : Checking refinement levels."
708 meshCutter_.checkRefinementLevels(1,
labelList(0));
711 const label nBnd = mesh_.nBoundaryFaces();
713 Pout<<
"meshRefinement::checkData() : Checking synchronization."
719 pointField::subList boundaryFc
723 mesh_.nInternalFaces()
736 testSyncBoundaryFaceList
739 "testing faceCentres : ",
746 const labelList& surfIndex = surfaceIndex();
753 calcNeighbourData(neiLevel, neiCc);
761 start[facei] = mesh_.cellCentres()[mesh_.faceOwner()[facei]];
763 if (mesh_.isInternalFace(facei))
765 end[facei] = mesh_.cellCentres()[mesh_.faceNeighbour()[facei]];
769 end[facei] = neiCc[facei-mesh_.nInternalFaces()];
785 surfaces_.findHigherIntersection
802 mesh_.nInternalFaces()
810 if (surfIndex[facei] != surfaceHit[facei])
812 if (mesh_.isInternalFace(facei))
815 <<
"Internal face:" << facei
816 <<
" fc:" << mesh_.faceCentres()[facei]
817 <<
" cached surfaceIndex_:" << surfIndex[facei]
818 <<
" current:" << surfaceHit[facei]
820 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
822 << mesh_.cellCentres()[mesh_.faceNeighbour()[facei]]
828 != neiHit[facei-mesh_.nInternalFaces()]
832 <<
"Boundary face:" << facei
833 <<
" fc:" << mesh_.faceCentres()[facei]
834 <<
" cached surfaceIndex_:" << surfIndex[facei]
835 <<
" current:" << surfaceHit[facei]
837 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
839 << neiCc[facei-mesh_.nInternalFaces()]
840 <<
" end:" <<
end[facei]
842 << meshCutter_.cellLevel()[mesh_.faceOwner()[facei]]
844 << meshCutter_.faceLevel(facei)
854 mesh_.nBoundaryFaces(),
855 mesh_.nInternalFaces()
858 labelList neiBoundarySurface(boundarySurface);
866 testSyncBoundaryFaceList
869 "testing surfaceIndex() : ",
877 Pout<<
"meshRefinement::checkData() : Counting duplicate faces."
885 identity(mesh_.nBoundaryFaces(), mesh_.nInternalFaces())
895 if (duplicateFace[i] != -1)
901 Pout<<
"meshRefinement::checkData() : Found " << nDup
902 <<
" duplicate pairs of faces." <<
endl;
909 meshCutter_.setInstance(inst);
910 surfaceIndex_.instance() = inst;
938 mesh_.updateMesh(map);
953 setInstance(mesh_.facesInstance());
968 updateMesh(map, newExposedFaces);
984 label facei = splitFaces[i];
985 const face&
f = mesh_.faces()[facei];
1001 label fp =
split[0];
1008 face f1(
f.size()-f0.size()+2);
1018 label own = mesh_.faceOwner()[facei];
1021 if (facei >= mesh_.nInternalFaces())
1023 patchi = mesh_.boundaryMesh().whichPatch(facei);
1027 nei = mesh_.faceNeighbour()[facei];
1030 label zonei = mesh_.faceZones().whichZone(facei);
1031 bool zoneFlip =
false;
1034 const faceZone& fz = mesh_.faceZones()[zonei];
1041 Pout<<
"face:" << facei <<
" verts:" <<
f
1042 <<
" split into f0:" << f0
1043 <<
" f1:" << f1 <<
endl;
1105 <<
"Splitting " << nSplit
1106 <<
" faces across diagonals" <<
"." <<
nl <<
endl;
1118 meshMod.
faces().size()+splitFaces.size(),
1123 doSplitFaces(splitFaces, splits, meshMod);
1130 mesh_.updateMesh(map);
1140 setInstance(mesh_.facesInstance());
1152 Map<label> splitFaceToIndex(2*splitFaces.size());
1155 splitFaceToIndex.insert(splitFaces[i], i);
1160 label oldFacei = map.
faceMap()[facei];
1162 const auto oldFaceFnd = splitFaceToIndex.cfind(oldFacei);
1164 if (oldFaceFnd.found())
1166 labelPair& twoFaces = facePairs[oldFaceFnd.val()];
1167 if (twoFaces[0] == -1)
1169 twoFaces[0] = facei;
1171 else if (twoFaces[1] == -1)
1173 twoFaces[1] = facei;
1178 <<
"problem: twoFaces:" << twoFaces
1189 if (duplicateFace.size())
1203 baffle.first() = oldToNewFaces[baffle.first()];
1206 if (baffle.first() == -1 || baffle.
second() == -1)
1209 <<
"Removed baffle : faces:" << baffle
1222 changedFaces.
append(facePairs[i].first());
1223 changedFaces.
append(facePairs[i].second());
1227 updateMesh(map, growFaceCellFace(changedFaces));
1240 for (label iteration = 0; iteration < 100; iteration++)
1243 <<
"Undo iteration " << iteration <<
nl
1244 <<
"----------------" <<
endl;
1250 faceSet errorFaces(mesh_,
"errorFaces", mesh_.nBoundaryFaces());
1266 const labelList grownFaces(growFaceCellFace(errorFaces));
1268 errorFaces.insert(grownFaces);
1282 const labelPair& twoFaces = facePairs[index];
1286 errorFaces.found(twoFaces.first())
1287 || errorFaces.found(twoFaces.
second())
1290 const face& originalFace = originalFaces[index];
1294 label own = mesh_.faceOwner()[twoFaces[0]];
1297 if (twoFaces[0] >= mesh_.nInternalFaces())
1299 patchi = mesh_.boundaryMesh().whichPatch(twoFaces[0]);
1303 nei = mesh_.faceNeighbour()[twoFaces[0]];
1306 label zonei = mesh_.faceZones().whichZone(twoFaces[0]);
1307 bool zoneFlip =
false;
1310 const faceZone& fz = mesh_.faceZones()[zonei];
1327 meshMod.
removeFace(twoFaces[1], twoFaces[0]);
1329 mergedIndices.insert(index);
1335 Info<<
"Detected " <<
n
1336 <<
" split faces that will be restored to their original faces."
1353 mesh_.updateMesh(map);
1363 setInstance(mesh_.facesInstance());
1379 const labelPair& oldSplit = facePairs[index];
1380 label new0 = oldToNewFaces[oldSplit[0]];
1381 label new1 = oldToNewFaces[oldSplit[1]];
1383 if (!mergedIndices.found(index))
1386 if (new0 < 0 || new1 < 0)
1389 <<
"Problem: oldFaces:" << oldSplit
1390 <<
" newFaces:" <<
labelPair(new0, new1)
1394 facePairs[newIndex] =
labelPair(new0, new1);
1398 originalFaces[index]
1405 if (new0 < 0 || new1 == -1)
1408 <<
"Problem: oldFaces:" << oldSplit
1412 changedFaces.
append(new0);
1416 facePairs.setSize(newIndex);
1417 originalFaces.
setSize(newIndex);
1421 updateMesh(map, growFaceCellFace(changedFaces));
1427 if (duplicateFace.size())
1441 baffle.first() = reverseFaceMap[baffle.first()];
1444 if (baffle.first() == -1 || baffle.
second() == -1)
1447 <<
"Removed baffle : faces:" << baffle
1461 Foam::meshRefinement::meshRefinement
1464 const scalar mergeDistance,
1465 const bool overwrite,
1475 mergeDistance_(mergeDistance),
1476 overwrite_(overwrite),
1478 surfaces_(surfaces),
1479 features_(features),
1481 limitShells_(limitShells),
1493 mesh_.facesInstance(),
1505 updateIntersections(checkFaces);
1513 if (surfaceIndex_.size() != mesh_.nFaces())
1520 return surfaceIndex_;
1526 if (surfaceIndex_.size() != mesh_.nFaces())
1528 updateIntersections(
identity(mesh_.nFaces()));
1530 return surfaceIndex_;
1541 const labelList& surfIndex = surfaceIndex();
1545 if (surfIndex[facei] >= 0 && isMasterFace.
test(facei))
1556 const bool keepZoneFaces,
1557 const bool keepBaffles,
1574 label nUnblocked = 0;
1588 specifiedProcessorFaces,
1594 if (keepZoneFaces || keepBaffles)
1614 const faceZone& fZone = fZones[zonei];
1618 label facei = fZone[i];
1619 if (blockedFace[facei])
1623 mesh_.isInternalFace(facei)
1627 blockedFace[facei] =
false;
1649 Info<<
"Found " << nUnblocked
1650 <<
" zoned faces to keep together." <<
endl;
1656 boolList separatedCoupledFace(mesh_.nFaces(),
false);
1657 selectSeparatedCoupledFaces(separatedCoupledFace);
1659 label nSeparated = 0;
1660 forAll(separatedCoupledFace, facei)
1662 if (separatedCoupledFace[facei])
1664 if (blockedFace[facei])
1666 blockedFace[facei] =
false;
1672 Info<<
"Found " << nSeparated
1673 <<
" separated coupled faces to keep together." <<
endl;
1675 nUnblocked += nSeparated;
1681 const label nBnd = mesh_.nBoundaryFaces();
1683 labelList coupledFace(mesh_.nFaces(), -1);
1696 coupledFace[baffle.first()] = baffle.
second();
1697 coupledFace[baffle.
second()] = baffle.first();
1701 const labelPair& baffle = allCouples[i];
1702 coupledFace[baffle.first()] = baffle.
second();
1703 coupledFace[baffle.
second()] = baffle.first();
1709 forAll(coupledFace, facei)
1711 if (coupledFace[facei] != -1 && facei < coupledFace[facei])
1713 couples[nCpl++] =
labelPair(facei, coupledFace[facei]);
1722 Info<<
"Found " << nCouples <<
" baffles to keep together."
1732 blockedFace[baffle.first()] =
false;
1733 blockedFace[baffle.
second()] =
false;
1741 specifiedProcessorFaces,
1749 Pout<<
"Wanted distribution:" << nProcCells <<
endl;
1754 Pout<<
"Wanted resulting decomposition:" <<
endl;
1755 forAll(nProcCells, proci)
1757 Pout<<
" " << proci <<
'\t' << nProcCells[proci] <<
endl;
1770 setInstance(mesh_.facesInstance());
1773 if (
debug && keepZoneFaces)
1781 const faceZone& fZone = fZones[zonei];
1785 label facei = fZone[i];
1788 if (patchi >= 0 && pbm[patchi].coupled())
1791 <<
"Face at " << mesh_.faceCentres()[facei]
1792 <<
" on zone " << fZone.
name()
1793 <<
" is on coupled patch " << pbm[patchi].
name()
1807 label nBoundaryFaces = 0;
1809 const labelList& surfIndex = surfaceIndex();
1813 if (surfIndex[facei] != -1)
1824 if (surfIndex[facei] != -1)
1826 surfaceFaces[nBoundaryFaces++] = facei;
1829 return surfaceFaces;
1835 const faceList& faces = mesh_.faces();
1838 bitSet isBoundaryPoint(mesh_.nPoints());
1839 label nBoundaryPoints = 0;
1841 const labelList& surfIndex = surfaceIndex();
1845 if (surfIndex[facei] != -1)
1847 const face&
f = faces[facei];
1851 if (isBoundaryPoint.set(
f[fp]))
1888 labelList boundaryPoints(nBoundaryPoints);
1889 nBoundaryPoints = 0;
1890 forAll(isBoundaryPoint, pointi)
1892 if (isBoundaryPoint.test(pointi))
1894 boundaryPoints[nBoundaryPoints++] = pointi;
1898 return boundaryPoints;
1918 nFaces += pp.size();
1929 label meshFacei = pp.
start();
1933 addressing[nFaces++] = meshFacei++;
1958 pointPatches.size(),
1959 slipPointPatchVectorField::typeName
1964 patchFieldTypes[adaptPatchIDs[i]] =
1965 fixedValuePointPatchVectorField::typeName;
1968 forAll(pointPatches, patchi)
1970 if (isA<processorPointPatch>(pointPatches[patchi]))
1972 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
1974 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
1976 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
1986 "pointDisplacement",
2018 <<
"faceZones are not synchronised on processors." <<
nl
2019 <<
"Processor " << proci <<
" has faceZones "
2020 << zoneNames[proci] <<
nl
2022 <<
" has faceZones "
2036 const faceZone& fZone = fZones[zonei];
2044 if (faceToZone[bFacei] == -1)
2046 faceToZone[bFacei] = zonei;
2048 else if (faceToZone[bFacei] == zonei)
2051 <<
"Face " << fZone[i] <<
" in zone "
2053 <<
" is twice in zone!"
2059 <<
"Face " << fZone[i] <<
" in zone "
2061 <<
" is also in zone "
2062 << fZones[faceToZone[bFacei]].name()
2074 if (faceToZone[i] != neiFaceToZone[i])
2078 <<
" is in zone " << faceToZone[i]
2079 <<
", its coupled face is in zone " << neiFaceToZone[i]
2089 const bitSet& isMasterEdge,
2099 edgeWeights.setSize(isMasterEdge.
size());
2100 invSumWeight.setSize(meshPoints.size());
2104 const edge&
e = edges[edgei];
2110 pts[meshPoints[
e[1]]]
2111 - pts[meshPoints[
e[0]]]
2114 edgeWeights[edgei] = 1.0/eMag;
2130 forAll(invSumWeight, pointi)
2132 scalar w = invSumWeight[pointi];
2136 invSumWeight[pointi] = 1.0/w;
2145 const label insertPatchi,
2146 const word& patchName,
2157 label patchi = polyPatches.size();
2160 polyPatches.
setSize(patchi+1);
2178 polyPatches[patchi],
2183 addPatchFields<volScalarField>
2188 addPatchFields<volVectorField>
2193 addPatchFields<volSphericalTensorField>
2198 addPatchFields<volSymmTensorField>
2203 addPatchFields<volTensorField>
2211 addPatchFields<surfaceScalarField>
2216 addPatchFields<surfaceVectorField>
2221 addPatchFields<surfaceSphericalTensorField>
2226 addPatchFields<surfaceSymmTensorField>
2231 addPatchFields<surfaceTensorField>
2243 const word& patchName,
2251 const label patchi = polyPatches.
findPatchID(patchName);
2259 label insertPatchi = polyPatches.size();
2262 forAll(polyPatches, patchi)
2264 const polyPatch& pp = polyPatches[patchi];
2266 if (isA<processorPolyPatch>(pp))
2268 insertPatchi = patchi;
2269 startFacei = pp.
start();
2275 patchDict.
set(
"nFaces", 0);
2276 patchDict.
set(
"startFace", startFacei);
2281 label addedPatchi = appendPatch(
mesh, insertPatchi, patchName, patchDict);
2287 for (label i = 0; i < insertPatchi; i++)
2292 for (label i = insertPatchi; i < addedPatchi; i++)
2297 oldToNew[addedPatchi] = insertPatchi;
2300 polyPatches.
reorder(oldToNew,
true);
2301 fvPatches.reorder(oldToNew);
2303 reorderPatchFields<volScalarField>(
mesh, oldToNew);
2304 reorderPatchFields<volVectorField>(
mesh, oldToNew);
2305 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
2306 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
2307 reorderPatchFields<volTensorField>(
mesh, oldToNew);
2308 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
2309 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
2310 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
2311 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
2312 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
2314 return insertPatchi;
2324 label meshedi = meshedPatches_.find(
name);
2329 return mesh_.boundaryMesh().findPatchID(
name);
2334 label patchi = addPatch(mesh_,
name, patchInfo);
2359 meshedPatches_.append(
name);
2362 faceToCoupledPatch_.clear();
2374 forAll(meshedPatches_, i)
2381 <<
"Problem : did not find patch " << meshedPatches_[i]
2398 const word& masterPatch,
2399 const word& slavePatch,
2411 faceZoneToMasterPatch_.insert(fzName, masterPatch);
2412 faceZoneToSlavePatch_.insert(fzName, slavePatch);
2413 faceZoneToType_.insert(fzName, fzType);
2422 label& masterPatchID,
2423 label& slavePatchID,
2429 if (!faceZoneToMasterPatch_.found(fzName))
2435 const word& masterName = faceZoneToMasterPatch_[fzName];
2438 const word& slaveName = faceZoneToSlavePatch_[fzName];
2441 fzType = faceZoneToType_[fzName];
2455 if (isA<coupledPolyPatch>(
patches[patchi]))
2466 selected[cpp.
start()+i] =
true;
2478 const vector& perturbVec,
2490 regioni = cellToRegion[celli];
2500 regioni = cellToRegion[celli];
2514 const vector& perturbVec,
2517 const bool exitIfLeakPath,
2519 const label nRegions,
2527 labelList insideRegions(locationsInMesh.size());
2531 label regioni = findRegion
2539 insideRegions[i] = regioni;
2542 forAll(cellRegion, celli)
2544 if (cellRegion[celli] == regioni)
2546 insideCell.set(celli);
2555 forAll(locationsOutsideMesh, i)
2558 label regioni = findRegion
2563 locationsOutsideMesh[i]
2570 label index = insideRegions.find(regioni);
2600 locationsOutsideMesh,
2609 label nSegments = 0;
2610 if (leakPath.segments().size())
2612 nSegments =
max(leakPath.segments())+1;
2617 for (label segmenti : leakPath.segments())
2619 nElemsPerSegment[segmenti]++;
2621 segmentPoints.
setSize(nElemsPerSegment.size());
2622 segmentDist.
setSize(nElemsPerSegment.size());
2623 forAll(nElemsPerSegment, i)
2625 segmentPoints[i].setSize(nElemsPerSegment[i]);
2626 segmentDist[i].
setSize(nElemsPerSegment[i]);
2628 nElemsPerSegment = 0;
2632 label segmenti = leakPath.segments()[elemi];
2635 label&
n = nElemsPerSegment[segmenti];
2638 dist[
n] = leakPath.curveDist()[elemi];
2644 forAll(allLeakPaths, segmenti)
2649 std::move(segmentPoints[segmenti]);
2654 std::move(segmentDist[segmenti]);
2660 ListListOps::combine<pointList>
2667 ListListOps::combine<scalarList>
2695 varData.
setSize(allLeakPaths.size());
2696 forAll(allLeakPaths, segmenti)
2698 varData[segmenti] = allLeakPaths[segmenti].curveDist();
2701 const wordList valueSetNames(1,
"leakPath");
2716 leakPathFormatter.
write
2732 <<
"Location in mesh " << locationsInMesh[index]
2733 <<
" is inside same mesh region " << regioni
2734 <<
" as one of the locations outside mesh "
2735 << locationsOutsideMesh
2736 <<
nl <<
" Dumped leak path to " << fName
2742 <<
"Location in mesh " << locationsInMesh[index]
2743 <<
" is inside same mesh region " << regioni
2744 <<
" as one of the locations outside mesh "
2745 << locationsOutsideMesh
2746 <<
nl <<
"Dumped leak path to " << fName <<
endl;
2756 forAll(insideCell, celli)
2758 if (!insideCell.test(celli))
2760 cellRegion[celli] = -1;
2763 else if (cellRegion[celli] == -1)
2779 const bool exitIfLeakPath,
2784 (void)mesh_.tetBasePtIs();
2789 boolList blockedFace(mesh_.nFaces(),
false);
2790 selectSeparatedCoupledFaces(blockedFace);
2794 label nRemove = findRegions
2799 locationsOutsideMesh,
2812 forAll(cellRegion, celli)
2814 if (cellRegion[celli] == -1)
2816 cellsToRemove.append(celli);
2819 cellsToRemove.shrink();
2823 cellsToRemove.size(),
2829 if (nTotCellsToRemove > 0)
2831 label nCellsToKeep =
2832 mesh_.globalData().nTotalCells()
2833 - nTotCellsToRemove;
2835 Info<<
"Keeping all cells containing points " << locationsInMesh <<
endl
2836 <<
"Selected for keeping : "
2838 <<
" cells." <<
endl;
2856 label defaultPatch = 0;
2857 if (globalToMasterPatch.size())
2859 defaultPatch = globalToMasterPatch[0];
2863 <<
"Removing non-reachable cells exposes "
2864 << nExposedFaces <<
" internal or coupled faces." <<
endl
2865 <<
" These get put into patch " << defaultPatch <<
endl;
2866 exposedPatch.setSize(exposedFaces.size(), defaultPatch);
2869 mapPtr = doRemoveCells
2888 meshCutter_.distribute(map);
2895 faceToCoupledPatch_.clear();
2921 geometry[i].distribute
2932 geometry[i].instance() = geometry[i].time().timeName();
2950 updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
2962 meshCutter_.storeData
2983 meshCutter_.updateMesh
2992 updateList(map.
faceMap(), label(-1), surfaceIndex_);
2996 Map<label> newFaceToPatch(faceToCoupledPatch_.size());
3003 newFaceToPatch.insert(newFacei, iter.val());
3006 faceToCoupledPatch_.
transfer(newFaceToPatch);
3011 updateIntersections(changedFaces);
3018 if (userFaceData_[i].first() == KEEPALL)
3023 else if (userFaceData_[i].first() == MASTERONLY)
3028 forAll(newFaceData, facei)
3030 label oldFacei = map.
faceMap()[facei];
3034 newFaceData[facei] =
data[oldFacei];
3050 label oldFacei = map.
faceMap()[facei];
3054 if (reverseFaceMap[oldFacei] != facei)
3057 reverseFaceMap[oldFacei] = -1;
3064 forAll(newFaceData, facei)
3066 label oldFacei = map.
faceMap()[facei];
3070 if (reverseFaceMap[oldFacei] == facei)
3072 newFaceData[facei] =
data[oldFacei];
3084 bool writeOk = mesh_.write();
3101 s.instance() !=
s.time().system()
3102 &&
s.instance() !=
s.time().caseSystem()
3103 &&
s.instance() !=
s.time().constant()
3104 &&
s.instance() !=
s.time().caseConstant()
3108 s.instance() =
s.time().timeName();
3109 writeOk = writeOk &&
s.write();
3140 bitSet isPatchMasterPoint(meshPoints.size());
3141 forAll(meshPoints, pointi)
3145 isPatchMasterPoint.set(pointi);
3149 return isPatchMasterPoint;
3163 identity(globalEdges.localSize(), globalEdges.localStart())
3176 bitSet isMasterEdge(meshEdges.size());
3179 if (myEdges[edgei] == globalEdges.toGlobal(edgei))
3181 isMasterEdge.
set(edgei);
3185 return isMasterEdge;
3197 <<
" : cells(local):" << mesh_.nCells()
3198 <<
" faces(local):" << mesh_.nFaces()
3199 <<
" points(local):" << mesh_.nPoints()
3205 label nMasterFaces = isMasterFace.
count();
3208 label nMasterPoints = isMeshMasterPoint.
count();
3220 const labelList& cellLevel = meshCutter_.cellLevel();
3226 nCells[cellLevel[celli]]++;
3232 Info<<
"Cells per refinement level:" <<
endl;
3235 Info<<
" " << leveli <<
'\t' << nCells[leveli]
3244 if (overwrite_ && mesh_.time().timeIndex() == 0)
3246 return oldInstance_;
3249 return mesh_.time().timeName();
3263 mesh_.time().timeName(),
3271 zeroGradientFvPatchScalarField::typeName
3274 const labelList& cellLevel = meshCutter_.cellLevel();
3276 forAll(volRefLevel, celli)
3278 volRefLevel[celli] = cellLevel[celli];
3281 volRefLevel.write();
3293 mesh_.time().timeName(),
3303 const labelList& pointLevel = meshCutter_.pointLevel();
3305 forAll(pointRefLevel, pointi)
3307 pointRefLevel[pointi] = pointLevel[pointi];
3310 pointRefLevel.write();
3318 OFstream str(prefix +
"_edges.obj");
3320 Pout<<
"meshRefinement::dumpIntersections :"
3321 <<
" Writing cellcentre-cellcentre intersections to file "
3329 labelList neiLevel(mesh_.nBoundaryFaces());
3331 calcNeighbourData(neiLevel, neiCc);
3333 labelList intersectionFaces(intersectedFaces());
3355 surfaces_.findAnyIntersection
3363 forAll(intersectionFaces, i)
3365 if (surfaceHit[i] != -1)
3373 str <<
"l " << verti-2 <<
' ' << verti-1 <<
nl
3374 <<
"l " << verti-1 <<
' ' << verti <<
nl;
3390 if (writeFlags & WRITEMESH)
3395 if (writeFlags && !(writeFlags & NOWRITEREFINEMENT))
3397 meshCutter_.write();
3400 (void)surfaceIndex();
3401 surfaceIndex_.write();
3404 if (writeFlags & WRITELEVELS)
3406 dumpRefinementLevel();
3409 if ((debugFlags & OBJINTERSECTIONS) && prefix.size())
3411 dumpIntersections(prefix);
3430 if (
exists(setsDir/
"surfaceIndex"))
3432 rm(setsDir/
"surfaceIndex");
3448 writeLevel_ = flags;
3467 const word& keyword,
3472 const auto finder(
dict.
csearch(keyword, matchOpt));
3478 err <<
"Entry '" << keyword <<
"' not found in dictionary "
3491 return finder.dict();
3498 const word& keyword,
3503 const auto finder(
dict.
csearch(keyword, matchOpt));
3509 err <<
"Entry '" << keyword <<
"' not found in dictionary "
3515 return dict.first()->stream();
3523 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.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
static const Vector< Cmpt > 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.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
const labelIOList & cellLevel() const
bool opened() const
Return true if stream has been opened.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
A class for handling file names.
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.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, 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 nInternalFaces() const
Number of internal faces.
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 nFaces() const
Number of mesh faces.
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 bool & parRun()
Test if this a parallel run, or allow modify access.
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.
label nTotalCells() const
Return total number of cells in decomposed mesh.
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.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
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.
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.
#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.
const faceZoneMesh & faceZones() const
Return face zone mesh.
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)
virtual bool parallel() const
Are the cyclic planes parallel.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual bool separated() const
Are the planes separated.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const fileName & name() const
The dictionary name.
Encapsulates queries for volume refinement ('refine all cells within shell').
label nCells() const
Number of mesh cells.
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 (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
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.
void setSize(const label newLen)
Same as resize()
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.
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,...
label nBoundaryFaces() const
Number of boundary faces (== nFaces - nInternalFaces)
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 a pointer to a new patch created on freestore from.
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)
const word & name() const
Return name.
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.
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.
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.
Encapsulates queries for features.
const labelList & reversePointMap() const
Reverse point map.
writeType
Enumeration for what to write. Used as a bit-pattern.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
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.
label nPoints() const
Number of mesh points.
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.
static bool clean(std::string &str)
Cleanup filename.
const Time & time() const
Return the top-level database.
static const Vector< Cmpt > zero
A List with indirect addressing.
SubField< vector > subField
Declare type of subField.
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.
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 with label keys and label hasher.
static const Enum< debugType > debugTypeNames
void setSize(const label newSize)
Alias for resize(const label)
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.
const boolList & flipMap() const
Return face flip map.
#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.
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.