84 { debugType::MESH,
"mesh" },
85 { debugType::OBJINTERSECTIONS,
"intersections" },
86 { debugType::FEATURESEEDS,
"featureSeeds" },
87 { debugType::ATTRACTION,
"attraction" },
88 { debugType::LAYERINFO,
"layerInfo" },
108 { writeType::WRITEMESH,
"mesh" },
109 { writeType::NOWRITEREFINEMENT,
"noRefinement" },
110 { writeType::WRITELEVELS,
"scalarLevels" },
111 { writeType::WRITELAYERSETS,
"layerSets" },
112 { writeType::WRITELAYERFIELDS,
"layerFields" },
133Foam::label Foam::meshRefinement::globalFaceCount(
const labelList& elems)
const
136 const bitSet isElem(mesh_.
nFaces(), elems);
137 if (label(isElem.count()) != elems.size())
140 <<
" isElem:" << isElem.count()
141 <<
" elems:" << elems.size()
147 bitSet isElem2(isElem);
157 if (isElem2[facei] != isElem[facei])
160 <<
"at face:" << facei
163 <<
" isElem:" << isElem[facei]
164 <<
" isElem2:" << isElem2[facei]
173 for (
const label i : isElem)
184void Foam::meshRefinement::calcNeighbourData
190 const labelList& cellLevel = meshCutter_.cellLevel();
191 const pointField& cellCentres = mesh_.cellCentres();
193 const label nBoundaryFaces = mesh_.nBoundaryFaces();
195 if (neiLevel.size() != nBoundaryFaces || neiCc.size() != nBoundaryFaces)
198 << nBoundaryFaces <<
" neiLevel:" << neiLevel.size()
202 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
208 const polyPatch& pp =
patches[patchi];
214 label bFacei = pp.start()-mesh_.nInternalFaces();
220 neiLevel[bFacei] = cellLevel[faceCells[i]];
221 neiCc[bFacei] = cellCentres[faceCells[i]];
225 else if (addedPatchIDSet.found(patchi))
237 label own = faceCells[i];
238 label ownLevel = cellLevel[own];
239 label faceLevel = meshCutter_.faceLevel(pp.start()+i);
244 faceLevel = ownLevel;
248 scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
249 if (faceLevel > ownLevel)
254 neiLevel[bFacei] = faceLevel;
256 neiCc[bFacei] = faceCentres[i] + d*fn;
264 neiLevel[bFacei] = cellLevel[faceCells[i]];
265 neiCc[bFacei] = faceCentres[i];
277void Foam::meshRefinement::calcCellCellRays
287 const labelList& cellLevel = meshCutter_.cellLevel();
288 const pointField& cellCentres = mesh_.cellCentres();
293 bitSet isMaster(mesh_.nBoundaryFaces(),
true);
295 for (
const polyPatch& pp : mesh_.boundaryMesh())
297 if (pp.coupled() && !refCast<const coupledPolyPatch>(pp).owner())
299 isMaster.unset(labelRange(pp.offset(), pp.size()));
305 start.setSize(testFaces.size());
306 end.setSize(testFaces.size());
307 minLevel.setSize(testFaces.size());
311 const label facei = testFaces[i];
312 const label own = mesh_.faceOwner()[facei];
314 if (mesh_.isInternalFace(facei))
316 const label nei = mesh_.faceNeighbour()[facei];
318 start[i] = cellCentres[own];
319 end[i] = cellCentres[nei];
320 minLevel[i] =
min(cellLevel[own], cellLevel[nei]);
324 const label bFacei = facei - mesh_.nInternalFaces();
326 if (isMaster[bFacei])
328 start[i] = cellCentres[own];
329 end[i] = neiCc[bFacei];
334 start[i] = neiCc[bFacei];
335 end[i] = cellCentres[own];
337 minLevel[i] =
min(cellLevel[own], neiLevel[bFacei]);
356 label nMasterFaces = isMasterFace.
count();
359 label nChangedFaces = 0;
362 if (isMasterFace.
test(changedFaces[i]))
371 Info<<
"Edge intersection testing:" <<
nl
372 <<
" Number of edges : " << nMasterFaces <<
nl
373 <<
" Number of edges to retest : " << nChangedFaces
380 labelList neiLevel(mesh_.nBoundaryFaces());
382 calcNeighbourData(neiLevel, neiCc);
405 surfaces_.findHigherIntersection
419 surfaceIndex_[changedFaces[i]] = surfaceHit[i];
426 label nHits = countHits();
432 Info<<
" Number of intersected edges : " << nTotHits <<
endl;
436 setInstance(mesh_.facesInstance());
440void Foam::meshRefinement::nearestFace
443 const bitSet& isBlockedFace,
475 for (
const label facei : isBlockedFace)
480 List<topoDistanceData<label>> startData(startFaces.
size());
483 const label facei = startFaces[i];
484 if (isBlockedFace[facei])
487 <<
" at:" << mesh_.faceCentres()[facei]
490 startData[i] = topoDistanceData<label>(0, globalStart.toGlobal(i));
495 FaceCellWave<topoDistanceData<label>> deltaCalc
504 deltaCalc.iterate(nIter);
508 faceToStart.
setSize(mesh_.nFaces());
510 bool haveWarned =
false;
513 if (!faceData[facei].valid(deltaCalc.data()))
518 <<
"Did not visit some faces, e.g. face " << facei
519 <<
" at " << mesh_.faceCentres()[facei]
526 faceToStart[facei] = faceData[facei].
data();
531 List<Map<label>> compactMap;
532 mapPtr.
reset(
new mapDistribute(globalStart, faceToStart, compactMap));
536void Foam::meshRefinement::nearestPatch
546 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
548 nearestZone.
setSize(mesh_.nFaces(), -1);
550 if (adaptPatchIDs.size())
552 nearestPatch.setSize(mesh_.nFaces(), adaptPatchIDs[0]);
556 labelList faceToZone(mesh_.nFaces(), -1);
558 for (
const faceZone& fz : mesh_.faceZones())
560 UIndirectList<label>(faceToZone, fz) = fz.index();
569 const polyPatch& pp =
patches[adaptPatchIDs[i]];
574 List<topoDistanceData<labelPair>> cellData(mesh_.nCells());
575 List<topoDistanceData<labelPair>> faceData(mesh_.nFaces());
579 List<topoDistanceData<labelPair>> patchData(
nFaces);
583 label patchi = adaptPatchIDs[i];
584 const polyPatch& pp =
patches[patchi];
588 patchFaces[
nFaces] = pp.start()+i;
589 patchData[
nFaces] = topoDistanceData<labelPair>
595 faceToZone[pp.start()+i]
603 FaceCellWave<topoDistanceData<labelPair>> deltaCalc
610 mesh_.globalData().nTotalCells()+1
615 bool haveWarned =
false;
618 if (!faceData[facei].valid(deltaCalc.data()))
623 <<
"Did not visit some faces, e.g. face " << facei
624 <<
" at " << mesh_.faceCentres()[facei] <<
endl
625 <<
"Assigning these faces to patch "
634 nearestPatch[facei] = data.first();
635 nearestZone[facei] = data.second();
642 nearestPatch.setSize(mesh_.nFaces(), 0);
654 nearestPatch(adaptPatchIDs, nearestAdaptPatch, nearestAdaptZone);
655 return nearestAdaptPatch;
659void Foam::meshRefinement::nearestIntersection
673 labelList neiLevel(mesh_.nBoundaryFaces());
675 calcNeighbourData(neiLevel, neiCc);
696 surfaces_.findNearestIntersection
715 const label defaultRegion
724 const labelList testFaces(intersectedFaces());
747 labelList nearestRegion(mesh_.nFaces(), defaultRegion);
758 label facei = testFaces[i];
759 if (surface1[i] != -1)
761 patchFaces.append(facei);
762 label regioni = surfaces_.globalRegion(surface1[i], region1[i]);
765 else if (surface2[i] != -1)
767 patchFaces.append(facei);
768 label regioni = surfaces_.globalRegion(surface2[i], region2[i]);
769 patchData.append(topoDistanceData<label>(0, regioni));
774 FaceCellWave<topoDistanceData<label>> deltaCalc
781 mesh_.globalData().nTotalCells()+1
786 bool haveWarned =
false;
789 if (!faceData[facei].valid(deltaCalc.data()))
794 <<
"Did not visit some faces, e.g. face " << facei
795 <<
" at " << mesh_.faceCentres()[facei] <<
endl
796 <<
"Assigning these faces to global region "
797 << defaultRegion <<
endl;
803 nearestRegion[facei] = faceData[facei].data();
807 return nearestRegion;
826 Pout<<
"Checking field " << msg <<
endl;
845 const scalar& minVal = minFld[pointi];
846 const scalar& maxVal = maxFld[pointi];
847 if (
mag(minVal-maxVal) > SMALL)
850 <<
" minFld:" << minVal <<
nl
851 <<
" maxFld:" << maxVal <<
nl
873 Pout<<
"Checking field " << msg <<
endl;
880 point(GREAT, GREAT, GREAT)
892 const point& minVal = minFld[pointi];
893 const point& maxVal = maxFld[pointi];
894 if (
mag(minVal-maxVal) > SMALL)
897 <<
" minFld:" << minVal <<
nl
898 <<
" maxFld:" << maxVal <<
nl
907 Pout<<
"meshRefinement::checkData() : Checking refinement structure."
909 meshCutter_.checkMesh();
911 Pout<<
"meshRefinement::checkData() : Checking refinement levels."
913 meshCutter_.checkRefinementLevels(1,
labelList(0));
916 const label nBnd = mesh_.nBoundaryFaces();
918 Pout<<
"meshRefinement::checkData() : Checking synchronization."
928 mesh_.nInternalFaces()
941 testSyncBoundaryFaceList
944 "testing faceCentres : ",
951 const labelList& surfIndex = surfaceIndex();
958 calcNeighbourData(neiLevel, neiCc);
966 start[facei] = mesh_.cellCentres()[mesh_.faceOwner()[facei]];
968 if (mesh_.isInternalFace(facei))
970 end[facei] = mesh_.cellCentres()[mesh_.faceNeighbour()[facei]];
974 end[facei] = neiCc[facei-mesh_.nInternalFaces()];
990 surfaces_.findHigherIntersection
1007 mesh_.nInternalFaces()
1013 forAll(surfaceHit, facei)
1015 if (surfIndex[facei] != surfaceHit[facei])
1017 if (mesh_.isInternalFace(facei))
1020 <<
"Internal face:" << facei
1021 <<
" fc:" << mesh_.faceCentres()[facei]
1022 <<
" cached surfaceIndex_:" << surfIndex[facei]
1023 <<
" current:" << surfaceHit[facei]
1025 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
1027 << mesh_.cellCentres()[mesh_.faceNeighbour()[facei]]
1033 != neiHit[facei-mesh_.nInternalFaces()]
1037 <<
"Boundary face:" << facei
1038 <<
" fc:" << mesh_.faceCentres()[facei]
1039 <<
" cached surfaceIndex_:" << surfIndex[facei]
1040 <<
" current:" << surfaceHit[facei]
1042 << mesh_.cellCentres()[mesh_.faceOwner()[facei]]
1044 << neiCc[facei-mesh_.nInternalFaces()]
1045 <<
" end:" << end[facei]
1047 << meshCutter_.cellLevel()[mesh_.faceOwner()[facei]]
1049 << meshCutter_.faceLevel(facei)
1059 mesh_.nBoundaryFaces(),
1060 mesh_.nInternalFaces()
1063 labelList neiBoundarySurface(boundarySurface);
1071 testSyncBoundaryFaceList
1074 "testing surfaceIndex() : ",
1082 Pout<<
"meshRefinement::checkData() : Counting duplicate faces."
1090 identity(mesh_.nBoundaryFaces(), mesh_.nInternalFaces())
1100 if (duplicateFace[i] != -1)
1106 Pout<<
"meshRefinement::checkData() : Found " << nDup
1107 <<
" duplicate pairs of faces." <<
endl;
1114 meshCutter_.setInstance(inst);
1115 surfaceIndex_.instance() = inst;
1140 mesh_.moving(
false);
1147 mesh_.updateMesh(map);
1162 setInstance(mesh_.facesInstance());
1177 updateMesh(map, newExposedFaces);
1193 label facei = splitFaces[i];
1194 const face&
f = mesh_.faces()[facei];
1210 label fp =
split[0];
1227 label own = mesh_.faceOwner()[facei];
1230 if (facei >= mesh_.nInternalFaces())
1232 patchi = mesh_.boundaryMesh().whichPatch(facei);
1236 nei = mesh_.faceNeighbour()[facei];
1239 label zonei = mesh_.faceZones().whichZone(facei);
1240 bool zoneFlip =
false;
1243 const faceZone& fz = mesh_.faceZones()[zonei];
1250 Pout<<
"face:" << facei <<
" verts:" <<
f
1251 <<
" split into f0:" << f0
1252 <<
" f1:" << f1 <<
endl;
1314 <<
"Splitting " << nSplit
1315 <<
" faces across diagonals" <<
"." <<
nl <<
endl;
1327 meshMod.
faces().size()+splitFaces.
size(),
1332 doSplitFaces(splitFaces, splits, meshMod);
1336 mesh_.moving(
false);
1343 mesh_.updateMesh(map);
1357 setInstance(mesh_.facesInstance());
1372 splitFaceToIndex.
insert(splitFaces[i], i);
1377 label oldFacei = map.
faceMap()[facei];
1379 const auto oldFaceFnd = splitFaceToIndex.
cfind(oldFacei);
1381 if (oldFaceFnd.found())
1383 labelPair& twoFaces = facePairs[oldFaceFnd.val()];
1384 if (twoFaces[0] == -1)
1386 twoFaces[0] = facei;
1388 else if (twoFaces[1] == -1)
1390 twoFaces[1] = facei;
1395 <<
"problem: twoFaces:" << twoFaces
1406 if (duplicateFace.
size())
1420 baffle.
first() = oldToNewFaces[baffle.
first()];
1423 if (baffle.
first() == -1 || baffle.
second() == -1)
1426 <<
"Removed baffle : faces:" << baffle
1439 changedFaces.
append(facePairs[i].first());
1440 changedFaces.
append(facePairs[i].second());
1444 updateMesh(map, growFaceCellFace(changedFaces));
1457 for (label iteration = 0; iteration < 100; iteration++)
1460 <<
"Undo iteration " << iteration <<
nl
1461 <<
"----------------" <<
endl;
1467 faceSet errorFaces(mesh_,
"errorFaces", mesh_.nBoundaryFaces());
1483 const labelList grownFaces(growFaceCellFace(errorFaces));
1485 errorFaces.
insert(grownFaces);
1499 const labelPair& twoFaces = facePairs[index];
1507 const face& originalFace = originalFaces[index];
1511 label own = mesh_.faceOwner()[twoFaces[0]];
1514 if (twoFaces[0] >= mesh_.nInternalFaces())
1516 patchi = mesh_.boundaryMesh().whichPatch(twoFaces[0]);
1520 nei = mesh_.faceNeighbour()[twoFaces[0]];
1523 label zonei = mesh_.faceZones().whichZone(twoFaces[0]);
1524 bool zoneFlip =
false;
1527 const faceZone& fz = mesh_.faceZones()[zonei];
1544 meshMod.
removeFace(twoFaces[1], twoFaces[0]);
1546 mergedIndices.
insert(index);
1552 Info<<
"Detected " <<
n
1553 <<
" split faces that will be restored to their original faces."
1567 mesh_.moving(
false);
1574 mesh_.updateMesh(map);
1588 setInstance(mesh_.facesInstance());
1604 const labelPair& oldSplit = facePairs[index];
1605 label new0 = oldToNewFaces[oldSplit[0]];
1606 label new1 = oldToNewFaces[oldSplit[1]];
1608 if (!mergedIndices.
found(index))
1611 if (new0 < 0 || new1 < 0)
1614 <<
"Problem: oldFaces:" << oldSplit
1615 <<
" newFaces:" <<
labelPair(new0, new1)
1619 facePairs[newIndex] =
labelPair(new0, new1);
1623 originalFaces[index]
1630 if (new0 < 0 || new1 == -1)
1633 <<
"Problem: oldFaces:" << oldSplit
1637 changedFaces.
append(new0);
1642 originalFaces.
setSize(newIndex);
1646 updateMesh(map, growFaceCellFace(changedFaces));
1652 if (duplicateFace.
size())
1666 baffle.
first() = reverseFaceMap[baffle.
first()];
1669 if (baffle.
first() == -1 || baffle.
second() == -1)
1672 <<
"Removed baffle : faces:" << baffle
1689 const scalar mergeDistance,
1690 const bool overwrite,
1700 mergeDistance_(mergeDistance),
1701 overwrite_(overwrite),
1702 oldInstance_(
mesh.pointsInstance()),
1703 surfaces_(surfaces),
1704 features_(features),
1706 limitShells_(limitShells),
1718 mesh_.facesInstance(),
1738 if (surfaceIndex_.size() != mesh_.nFaces())
1745 return surfaceIndex_;
1751 if (surfaceIndex_.size() != mesh_.nFaces())
1753 updateIntersections(
identity(mesh_.nFaces()));
1755 return surfaceIndex_;
1766 const labelList& surfIndex = surfaceIndex();
1770 if (surfIndex[facei] >= 0 && isMasterFace.
test(facei))
1781 const bool keepZoneFaces,
1782 const bool keepBaffles,
1799 label nUnblocked = 0;
1813 specifiedProcessorFaces,
1819 if (keepZoneFaces || keepBaffles)
1839 const faceZone& fZone = fZones[zonei];
1843 label facei = fZone[i];
1844 if (blockedFace[facei])
1848 mesh_.isInternalFace(facei)
1852 blockedFace[facei] =
false;
1874 Info<<
"Found " << nUnblocked
1875 <<
" zoned faces to keep together." <<
endl;
1881 boolList separatedCoupledFace(mesh_.nFaces(),
false);
1882 selectSeparatedCoupledFaces(separatedCoupledFace);
1884 label nSeparated = 0;
1885 forAll(separatedCoupledFace, facei)
1887 if (separatedCoupledFace[facei])
1889 if (blockedFace[facei])
1891 blockedFace[facei] =
false;
1897 Info<<
"Found " << nSeparated
1898 <<
" separated coupled faces to keep together." <<
endl;
1900 nUnblocked += nSeparated;
1906 const label nBnd = mesh_.nBoundaryFaces();
1908 labelList coupledFace(mesh_.nFaces(), -1);
1926 const labelPair& baffle = allCouples[i];
1934 forAll(coupledFace, facei)
1936 if (coupledFace[facei] != -1 && facei < coupledFace[facei])
1938 couples[nCpl++] =
labelPair(facei, coupledFace[facei]);
1947 Info<<
"Found " << nCouples <<
" baffles to keep together."
1957 blockedFace[baffle.
first()] =
false;
1958 blockedFace[baffle.
second()] =
false;
1966 specifiedProcessorFaces,
1974 Pout<<
"Wanted distribution:" << nProcCells <<
endl;
1978 Pout<<
"Wanted resulting decomposition:" <<
endl;
1979 forAll(nProcCells, proci)
1981 Pout<<
" " << proci <<
'\t' << nProcCells[proci] <<
endl;
1994 setInstance(mesh_.facesInstance());
1997 if (debug && keepZoneFaces)
2005 const faceZone& fZone = fZones[zonei];
2009 label facei = fZone[i];
2012 if (patchi >= 0 && pbm[patchi].
coupled())
2015 <<
"Face at " << mesh_.faceCentres()[facei]
2016 <<
" on zone " << fZone.
name()
2017 <<
" is on coupled patch " << pbm[patchi].
name()
2031 label nBoundaryFaces = 0;
2033 const labelList& surfIndex = surfaceIndex();
2037 if (surfIndex[facei] != -1)
2048 if (surfIndex[facei] != -1)
2050 surfaceFaces[nBoundaryFaces++] = facei;
2053 return surfaceFaces;
2059 const faceList& faces = mesh_.faces();
2062 bitSet isBoundaryPoint(mesh_.nPoints());
2063 label nBoundaryPoints = 0;
2065 const labelList& surfIndex = surfaceIndex();
2069 if (surfIndex[facei] != -1)
2071 const face&
f = faces[facei];
2075 if (isBoundaryPoint.
set(
f[fp]))
2112 labelList boundaryPoints(nBoundaryPoints);
2113 nBoundaryPoints = 0;
2114 forAll(isBoundaryPoint, pointi)
2116 if (isBoundaryPoint.
test(pointi))
2118 boundaryPoints[nBoundaryPoints++] = pointi;
2122 return boundaryPoints;
2153 label meshFacei = pp.
start();
2157 addressing[
nFaces++] = meshFacei++;
2182 pointPatches.
size(),
2183 slipPointPatchVectorField::typeName
2188 patchFieldTypes[adaptPatchIDs[i]] =
2189 fixedValuePointPatchVectorField::typeName;
2192 forAll(pointPatches, patchi)
2194 if (isA<processorPointPatch>(pointPatches[patchi]))
2196 patchFieldTypes[patchi] = calculatedPointPatchVectorField::typeName;
2198 else if (isA<cyclicPointPatch>(pointPatches[patchi]))
2200 patchFieldTypes[patchi] = cyclicSlipPointPatchVectorField::typeName;
2210 "pointDisplacement",
2244 <<
"faceZones are not synchronised on processors." <<
nl
2245 <<
"Processor " << proci <<
" has faceZones "
2246 << zoneNames[proci] <<
nl
2248 <<
" has faceZones "
2261 const faceZone& fZone = fZones[zonei];
2269 if (faceToZone[bFacei] == -1)
2271 faceToZone[bFacei] = zonei;
2273 else if (faceToZone[bFacei] == zonei)
2276 <<
"Face " << fZone[i] <<
" in zone "
2278 <<
" is twice in zone!"
2284 <<
"Face " << fZone[i] <<
" in zone "
2286 <<
" is also in zone "
2287 << fZones[faceToZone[bFacei]].
name()
2299 if (faceToZone[i] != neiFaceToZone[i])
2303 <<
" is in zone " << faceToZone[i]
2304 <<
", its coupled face is in zone " << neiFaceToZone[i]
2314 const bitSet& isMasterEdge,
2329 const edge&
e = edges[edgei];
2335 pts[meshPoints[
e[1]]]
2336 - pts[meshPoints[
e[0]]]
2339 edgeWeights[edgei] = 1.0/eMag;
2355 forAll(invSumWeight, pointi)
2357 scalar w = invSumWeight[pointi];
2361 invSumWeight[pointi] = 1.0/w;
2370 const label insertPatchi,
2371 const word& patchName,
2382 label patchi = polyPatches.
size();
2385 polyPatches.
setSize(patchi+1);
2403 polyPatches[patchi],
2408 addPatchFields<volScalarField>
2413 addPatchFields<volVectorField>
2418 addPatchFields<volSphericalTensorField>
2423 addPatchFields<volSymmTensorField>
2428 addPatchFields<volTensorField>
2436 addPatchFields<surfaceScalarField>
2441 addPatchFields<surfaceVectorField>
2446 addPatchFields<surfaceSphericalTensorField>
2451 addPatchFields<surfaceSymmTensorField>
2456 addPatchFields<surfaceTensorField>
2468 const word& patchName,
2476 const label patchi = polyPatches.
findPatchID(patchName);
2484 label insertPatchi = polyPatches.
size();
2487 forAll(polyPatches, patchi)
2489 const polyPatch& pp = polyPatches[patchi];
2491 if (isA<processorPolyPatch>(pp))
2493 insertPatchi = patchi;
2494 startFacei = pp.
start();
2500 patchDict.
set(
"nFaces", 0);
2501 patchDict.
set(
"startFace", startFacei);
2506 label addedPatchi = appendPatch(
mesh, insertPatchi, patchName, patchDict);
2512 for (label i = 0; i < insertPatchi; i++)
2517 for (label i = insertPatchi; i < addedPatchi; i++)
2522 oldToNew[addedPatchi] = insertPatchi;
2525 polyPatches.
reorder(oldToNew,
true);
2528 reorderPatchFields<volScalarField>(
mesh, oldToNew);
2529 reorderPatchFields<volVectorField>(
mesh, oldToNew);
2530 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
2531 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
2532 reorderPatchFields<volTensorField>(
mesh, oldToNew);
2533 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
2534 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
2535 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
2536 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
2537 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
2539 return insertPatchi;
2549 label meshedi = meshedPatches_.find(
name);
2554 return mesh_.boundaryMesh().findPatchID(
name);
2559 label patchi = addPatch(mesh_,
name, patchInfo);
2584 meshedPatches_.append(
name);
2587 faceToCoupledPatch_.clear();
2599 forAll(meshedPatches_, i)
2606 <<
"Problem : did not find patch " << meshedPatches_[i]
2623 const word& masterPatch,
2624 const word& slavePatch,
2636 faceZoneToMasterPatch_.insert(fzName, masterPatch);
2637 faceZoneToSlavePatch_.insert(fzName, slavePatch);
2638 faceZoneToType_.insert(fzName, fzType);
2647 label& masterPatchID,
2648 label& slavePatchID,
2654 if (!faceZoneToMasterPatch_.found(fzName))
2660 const word& masterName = faceZoneToMasterPatch_[fzName];
2663 const word& slaveName = faceZoneToSlavePatch_[fzName];
2666 fzType = faceZoneToType_[fzName];
2681 zoneI = pointZones.
size();
2705 const auto* cpp = isA<coupledPolyPatch>(pp);
2707 if (cpp && (cpp->separated() || !cpp->parallel()))
2726 nEdgeFaces[edgei] = edgeFaces[edgei].
size();
2775 const vector& perturbVec,
2796 const vector& perturbVec,
2808 regioni = cellToRegion[celli];
2818 regioni = cellToRegion[celli];
2858 locationsOutsideMesh,
2867 label nSegments = 0;
2868 if (leakPath.segments().size())
2870 nSegments =
max(leakPath.segments())+1;
2872 reduce(nSegments, maxOp<label>());
2875 for (label segmenti : leakPath.segments())
2877 nElemsPerSegment[segmenti]++;
2879 segmentPoints.
setSize(nElemsPerSegment.size());
2880 segmentDist.
setSize(nElemsPerSegment.size());
2881 forAll(nElemsPerSegment, i)
2883 segmentPoints[i].
setSize(nElemsPerSegment[i]);
2884 segmentDist[i].
setSize(nElemsPerSegment[i]);
2886 nElemsPerSegment = 0;
2890 label segmenti = leakPath.segments()[elemi];
2893 label&
n = nElemsPerSegment[segmenti];
2896 dist[
n] = leakPath.distance()[elemi];
2901 PtrList<coordSet> allLeakPaths(segmentPoints.
size());
2902 forAll(allLeakPaths, segmenti)
2916 ListListOps::combine<pointList>
2918 gatheredPts, accessOp<pointList>()
2923 ListListOps::combine<scalarList>
2925 gatheredDist, accessOp<scalarList>()
2949 List<scalarField> allLeakData(allLeakPaths.size());
2950 forAll(allLeakPaths, segmenti)
2952 allLeakData[segmenti] = allLeakPaths[segmenti].distance();
2960 (outputDir / allLeakPaths[0].
name())
2963 fName =
writer.write(
"leakPath", allLeakData);
2982 const vector& perturbVec,
2985 const label nRegions,
2989 const bool exitIfLeakPath,
3000 label regioni = findRegion
3008 insideRegions[i] = regioni;
3011 forAll(cellRegion, celli)
3013 if (cellRegion[celli] == regioni)
3015 insideCell.
set(celli);
3024 forAll(locationsOutsideMesh, i)
3030 label regioni = findRegion
3035 locationsOutsideMesh[i]
3038 if (regioni == -1 && (indexi = insideRegions.
find(regioni)) != -1)
3040 if (leakPathFormatter)
3048 locationsOutsideMesh,
3053 Info<<
"Dumped leak path to " << fName <<
endl;
3063 err <<
"Location in mesh " << locationsInMesh[indexi]
3064 <<
" is inside same mesh region " << regioni
3065 <<
" as one of the locations outside mesh "
3066 << locationsOutsideMesh <<
endl;
3079 forAll(insideCell, celli)
3081 if (!insideCell.
test(celli))
3083 cellRegion[celli] = -1;
3086 else if (cellRegion[celli] == -1)
3102 const bool exitIfLeakPath,
3107 (void)mesh_.tetBasePtIs();
3112 boolList blockedFace(mesh_.nFaces(),
false);
3113 selectSeparatedCoupledFaces(blockedFace);
3117 label nRemove = findRegions
3122 locationsOutsideMesh,
3136 forAll(cellRegion, celli)
3138 if (cellRegion[celli] == -1)
3140 cellsToRemove.
append(celli);
3147 cellsToRemove.
size(),
3153 if (nTotCellsToRemove > 0)
3155 label nCellsToKeep =
3156 mesh_.globalData().nTotalCells()
3157 - nTotCellsToRemove;
3159 Info<<
"Keeping all cells containing points " << locationsInMesh <<
endl
3160 <<
"Selected for keeping : "
3162 <<
" cells." <<
endl;
3180 label defaultPatch = 0;
3181 if (globalToMasterPatch.
size())
3183 defaultPatch = globalToMasterPatch[0];
3187 <<
"Removing non-reachable cells exposes "
3188 << nExposedFaces <<
" internal or coupled faces." <<
endl
3189 <<
" These get put into patch " << defaultPatch <<
endl;
3190 exposedPatch.
setSize(exposedFaces.
size(), defaultPatch);
3193 mapPtr = doRemoveCells
3212 meshCutter_.distribute(map);
3219 faceToCoupledPatch_.clear();
3245 geometry[i].distribute
3256 geometry[i].instance() = geometry[i].time().timeName();
3274 updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
3286 meshCutter_.storeData
3307 meshCutter_.updateMesh
3316 updateList(map.
faceMap(), label(-1), surfaceIndex_);
3320 Map<label> newFaceToPatch(faceToCoupledPatch_.size());
3327 newFaceToPatch.
insert(newFacei, iter.val());
3330 faceToCoupledPatch_.transfer(newFaceToPatch);
3335 updateIntersections(changedFaces);
3342 if (userFaceData_[i].first() == KEEPALL)
3347 else if (userFaceData_[i].first() == MASTERONLY)
3352 forAll(newFaceData, facei)
3354 label oldFacei = map.
faceMap()[facei];
3358 newFaceData[facei] =
data[oldFacei];
3374 label oldFacei = map.
faceMap()[facei];
3378 if (reverseFaceMap[oldFacei] != facei)
3381 reverseFaceMap[oldFacei] = -1;
3388 forAll(newFaceData, facei)
3390 label oldFacei = map.
faceMap()[facei];
3394 if (reverseFaceMap[oldFacei] == facei)
3396 newFaceData[facei] =
data[oldFacei];
3408 bool writeOk = mesh_.write();
3425 s.instance() !=
s.time().system()
3426 &&
s.instance() !=
s.time().caseSystem()
3427 &&
s.instance() !=
s.time().constant()
3428 &&
s.instance() !=
s.time().caseConstant()
3432 s.instance() =
s.time().timeName();
3433 writeOk = writeOk &&
s.write();
3464 bitSet isPatchMasterPoint(meshPoints.
size());
3465 forAll(meshPoints, pointi)
3469 isPatchMasterPoint.
set(pointi);
3473 return isPatchMasterPoint;
3503 if (myEdges[edgei] == globalEdges.
toGlobal(edgei))
3505 isMasterEdge.
set(edgei);
3509 return isMasterEdge;
3521 <<
" : cells(local):" << mesh_.nCells()
3522 <<
" faces(local):" << mesh_.nFaces()
3523 <<
" points(local):" << mesh_.nPoints()
3529 label nMasterFaces = isMasterFace.
count();
3532 label nMasterPoints = isMeshMasterPoint.
count();
3544 const labelList& cellLevel = meshCutter_.cellLevel();
3550 nCells[cellLevel[celli]]++;
3558 Info<<
"Cells per refinement level:" <<
endl;
3561 Info<<
" " << leveli <<
'\t' << nCells[leveli]
3571 if (overwrite_ && mesh_.time().timeIndex() == 0)
3573 return oldInstance_;
3576 return mesh_.time().timeName();
3590 mesh_.time().timeName(),
3598 zeroGradientFvPatchScalarField::typeName
3601 const labelList& cellLevel = meshCutter_.cellLevel();
3603 forAll(volRefLevel, celli)
3605 volRefLevel[celli] = cellLevel[celli];
3608 volRefLevel.
write();
3620 mesh_.time().timeName(),
3630 const labelList& pointLevel = meshCutter_.pointLevel();
3632 forAll(pointRefLevel, pointi)
3634 pointRefLevel[pointi] = pointLevel[pointi];
3637 pointRefLevel.
write();
3645 OFstream str(prefix +
"_edges.obj");
3647 Pout<<
"meshRefinement::dumpIntersections :"
3648 <<
" Writing cellcentre-cellcentre intersections to file "
3656 labelList neiLevel(mesh_.nBoundaryFaces());
3658 calcNeighbourData(neiLevel, neiCc);
3660 labelList intersectionFaces(intersectedFaces());
3682 surfaces_.findAnyIntersection
3690 forAll(intersectionFaces, i)
3692 if (surfaceHit[i] != -1)
3700 str <<
"l " << verti-2 <<
' ' << verti-1 <<
nl
3701 <<
"l " << verti-1 <<
' ' << verti <<
nl;
3717 if (writeFlags & WRITEMESH)
3722 if (writeFlags && !(writeFlags & NOWRITEREFINEMENT))
3724 meshCutter_.write();
3727 (void)surfaceIndex();
3728 surfaceIndex_.write();
3731 if (writeFlags & WRITELEVELS)
3733 dumpRefinementLevel();
3736 if ((debugFlags & OBJINTERSECTIONS) && prefix.size())
3738 dumpIntersections(prefix);
3754 if (topoSet::debug)
DebugVar(setsDir);
3757 if (
exists(setsDir/
"surfaceIndex"))
3759 rm(setsDir/
"surfaceIndex");
3775 writeLevel_ = flags;
3794 const word& keyword,
3799 const auto finder(
dict.
csearch(keyword, matchOpt));
3805 err <<
"Entry '" << keyword <<
"' not found in dictionary "
3818 return finder.dict();
3825 const word& keyword,
3830 const auto finder(
dict.
csearch(keyword, matchOpt));
3836 err <<
"Entry '" << keyword <<
"' not found in dictionary "
3850 return finder.ref().stream();
static bool split(const std::string &line, std::string &key, std::string &val)
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
void append(const T &val)
Copy append an element to the end of this list.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
SubField< vector > subField
Declare type of subField.
T & first() noexcept
The first element of the list, position [0].
T * data() noexcept
Return pointer to the underlying array serving as data storage.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Return true if hashed entry is found in table.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
void clear()
Clear all entries from table.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
fileName path() const
The complete path.
An input stream of tokens.
A List with indirect addressing.
void setSize(const label n)
Alias for resize()
A HashTable to objects of type <T> with a label key.
Output to file stream, using an OSstream.
virtual const fileName & name() const
Read/write access to the name of the stream.
label size() const noexcept
Number of entries.
const T & second() const noexcept
Return second element, which is also the last element.
A list of faces which address into the list of points.
const labelListList & edgeFaces() const
Return edge-face addressing.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void allGatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
void setSize(const label newLen)
Same as resize()
A List obtained as a section of another List.
fileName globalPath() const
Return global path for the case.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
T * first()
The first entry in the list.
A List with indirect addressing. Like IndirectList but does not store addressing.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
static bool & parRun() noexcept
Test if this a parallel run.
void reorder(const labelUList &oldToNew, const bool check=false)
label size() const noexcept
The number of elements in the list.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
void clearAddressing()
Clear addressing.
wordList names() const
A list of the zone names.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void clear() noexcept
Same as reset(nullptr)
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
void balance()
Cheap balance function.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool test(const label pos) const
Test value at specified position, never auto-vivify entries.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Base class for writing coordSet(s) and tracks with fields.
static const Enum< coordFormat > coordFormatNames
String representation of coordFormat enum.
@ DISTANCE
Use additional distance field for (scalar) axis.
virtual const word & constraintType() const
Return the constraint type this pointPatch implements.
Database for solution data, solver performance and other reduced data.
Abstract base class for domain decomposition.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
Helper: extract constraints:
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void transfer(dictionary &dict)
Transfer the contents of the argument and annul the argument.
const fileName & name() const noexcept
The dictionary name.
const_searcher csearch(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search dictionary for given keyword.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Accumulating histogram of values. Specified bin resolution automatic generation of bins.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void removeFiles() const
Remove all files from mesh instance()
A subset of mesh faces organised as a primitive patch.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
static word outputPrefix
Directory prefix.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const Time & time() const
Return the top-level database.
void clearOut()
Clear all geometry and addressing.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label localSize() const
My local size.
label localStart() const
My local start.
label toGlobal(const label i) const
From local to global index.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelListList & globalEdgeTransformedSlaves() const
const mapDistribute & globalEdgeSlavesMap() const
static void syncData(List< Type > &elems, const labelListList &slaves, const labelListList &transformedSlaves, const mapDistribute &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
const labelListList & globalEdgeSlaves() const
Calculates points shared by more than two processor patches or cyclic patches.
void checkMesh() const
Debug: Check coupled mesh for correctness.
option
Enumeration for the data type and search/match modes (bitmask)
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
label constructSize() const noexcept
Constructed data size.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void distributeFaceData(List< T > &values) const
Distribute list of face data.
Class containing processor-to-processor mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & faceMap() const
Old face map.
const pointField & preMotionPoints() const
Pre-motion point positions.
const labelList & reversePointMap() const
Reverse point map.
const labelList & reverseFaceMap() const
Reverse face map.
bool hasMotionPoints() const
Has valid preMotionPoints?
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
static void calculateEdgeWeights(const polyMesh &mesh, const bitSet &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
label addFaceZone(const word &fzName, const word &masterPatch, const word &slavePatch, const surfaceZonesInfo::faceZoneType &fzType)
Add/lookup faceZone and update information. Return index of.
label splitFacesUndo(const labelList &splitFaces, const labelPairList &splits, const dictionary &motionDict, labelList &duplicateFace, List< labelPair > &baffles)
Split faces along diagonal. Maintain mesh quality. Return.
bool getFaceZoneInfo(const word &fzName, label &masterPatchID, label &slavePatchID, surfaceZonesInfo::faceZoneType &fzType) const
Lookup faceZone information. Return false if no information.
labelList intersectedFaces() const
Get faces with intersection.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
static bitSet getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
void checkData()
Debugging: check that all faces still obey start()>end()
void updateIntersections(const labelList &changedFaces)
Find any intersection of surface. Store in surfaceIndex_.
writeType
Enumeration for what to write. Used as a bit-pattern.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
static const Enum< writeType > writeTypeNames
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
label countHits() const
Count number of intersections (local)
autoPtr< mapPolyMesh > doRemoveCells(const labelList &cellsToRemove, const labelList &exposedFaces, const labelList &exposedPatchIDs, removeCells &cellRemover)
Remove cells. Put exposedFaces into exposedPatchIDs.
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.
static label findCell(const polyMesh &, const vector &perturbVec, const point &p)
Find cell point is in. Uses optional perturbation to re-test.
debugType
Enumeration for what to debug. Used as a bit-pattern.
void doSplitFaces(const labelList &splitFaces, const labelPairList &splits, polyTopoChange &meshMod) const
Split faces into two.
static bitSet getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
labelList countEdgeFaces(const uindirectPrimitivePatch &pp) const
Count number of faces per patch edge. Parallel consistent.
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const bool exitIfLeakPath, const refPtr< coordSetWriter > &leakPathFormatter)
Split mesh. Keep part containing point. Return empty map if.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
static label findRegion(const polyMesh &, const labelList &cellRegion, const vector &perturbVec, const point &p)
Find region point is in. Uses optional perturbation to re-test.
label addPointZone(const word &name)
Add pointZone if does not exist. Return index of zone.
static label findRegions(const polyMesh &, const vector &perturbVec, const pointField &locationsInMesh, const pointField &locationsOutsideMesh, const label nRegions, labelList &cellRegion, const boolList &blockedFace, const bool exitIfLeakPath, const refPtr< coordSetWriter > &leakPathFormatter)
Find regions points are in.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
bool write() const
Write mesh and all data.
void setInstance(const fileName &)
Set instance of all local IOobjects.
static const Enum< debugType > debugTypeNames
static label appendPatch(fvMesh &, const label insertPatchi, const word &, const dictionary &)
Helper:append patch to end of mesh.
static writeType writeLevel()
Get/set write level.
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
void updateMesh()
Update for new mesh topology.
Mesh representing a set of points created from polyMesh.
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
wordList names() const
Return a list of patch names.
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
const fileName & facesInstance() const
Return the current instance directory for faces.
cellDecomposition
Enumeration defining the decomposition of the cell for.
virtual const faceList & faces() const
Return raw faces.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const fileName & pointsInstance() const
Return the current instance directory for points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const DynamicList< face > & faces() const
void setCapacity(const label nPoints, const label nFaces, const label nCells)
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 removeFace(const label facei, const label mergeFacei)
Remove/merge face.
label addFace(const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Add face to cells. Return new face label.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
const vectorField & faceCentres() const
label nInternalFaces() const noexcept
Number of internal faces.
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
int myProcNo() const noexcept
Return processor number.
Lookup type of boundary radiation properties.
A class for managing references or pointers (no reference counting)
Encapsulates queries for features.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
virtual bool write(const bool valid=true) const
Write using setting from DB.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
label nRegions() const
Return total number of regions.
Given list of cells to remove, insert all the topology changes.
labelList getExposedFaces(const bitSet &removedCell) const
Get labels of faces exposed after cells removal.
void setRefinement(const bitSet &removedCell, const labelUList &facesToExpose, const labelUList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Encapsulates queries for volume refinement ('refine all cells within shell').
Finds shortest path (in terms of cell centres) to walk on mesh from any point in insidePoints to any ...
splitCell * master() const
faceZoneType
What to do with faceZone faces.
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
A class for managing temporary objects.
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
virtual bool found(const label id) const
Has the given index?
Standard boundBox with extra functionality for use in octree.
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void close()
End the file contents and close the file after writing.
virtual bool open(const fileName &file, bool parallel=Pstream::parRun())
Open file for writing (creates parent directory).
A class for handling words, derived from Foam::string.
const word & name() const noexcept
The zone name.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
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))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
static const Foam::polyMesh::cellDecomposition findCellMode(Foam::polyMesh::FACE_DIAG_TRIS)
#define WarningInFunction
Report a warning using Foam::Warning.
#define DebugVar(var)
Report a variable name and value.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Pair< label > labelPair
A pair of labels.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
vector point
Point is a vector.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
List< point > pointList
A List of points.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
Type gMax(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
A non-counting (dummy) refCount.