47 const searchableSurface& geom,
48 const shellSurfaces& shells,
49 const List<pointIndexHit>& intersectionInfo,
55 geom.getField(intersectionInfo, minLevelField);
66 DynamicList<label> retestSet;
69 forAll(intersectionInfo, i)
71 if (intersectionInfo[i].hit())
76 if (minLevelField.size())
78 if (minLevelField[i] == -1)
84 localLevel[i] =
max(localLevel[i], minLevelField[i]);
105 samples[i] = intersectionInfo[retestSet[i]].hitPoint();
108 shells.findHigherLevel
116 label sampleI = retestSet[i];
117 localLevel[sampleI] =
max(localLevel[sampleI], shellLevel[i]);
128 const searchableSurfaces& allGeometry,
136 globalI += allGeometry[surfaces[surfI]].regions().size();
143 const label nLocal = allGeometry[surfaces[surfI]].regions().size();
144 for (label i = 0; i < nLocal; i++)
146 regionToSurface[globalI++] = surfI;
150 return regionToSurface;
156 Foam::refinementSurfaces::refinementSurfaces
160 const label gapLevelIncrement,
164 allGeometry_(allGeometry),
165 surfaces_(surfacesDict.size()),
166 names_(surfacesDict.size()),
167 surfZones_(surfacesDict.size()),
168 regionOffset_(surfacesDict.size()),
178 const word& geomName = allGeometry_.
names()[geomI];
180 if (surfacesDict.
found(geomName))
189 surfZones_.setSize(surfI);
197 const FixedList<label, 3> nullGapLevel({0, 0, 0});
198 List<FixedList<label, 3>> globalGapLevel(surfI);
199 List<volumeType> globalGapMode(surfI);
202 const FixedList<label, 4> nullCurvLevel({0, 0, 0, -1});
203 List<FixedList<label, 4>> globalCurvLevel(surfI);
206 PtrList<dictionary> globalPatchInfo(surfI);
212 List<Map<label>> regionMinLevel(surfI);
213 List<Map<label>> regionMaxLevel(surfI);
214 List<Map<label>> regionLevelIncr(surfI);
215 List<Map<FixedList<label, 3>>> regionGapLevel(surfI);
216 List<Map<volumeType>> regionGapMode(surfI);
217 List<Map<bool>> regionGapSelf(surfI);
218 List<Map<FixedList<label, 4>>> regionCurvLevel(surfI);
219 List<Map<scalar>> regionAngle(surfI);
220 List<Map<autoPtr<dictionary>>> regionPatchInfo(surfI);
221 List<Map<label>> regionBlockLevel(surfI);
222 List<Map<label>> regionLeakLevel(surfI);
229 const word& geomName = allGeometry_.
names()[geomI];
236 const dictionary&
dict = ePtr->dict();
237 unmatchedKeys.erase(ePtr->keyword());
239 names_[surfI] = geomName;
240 surfaces_[surfI] = geomI;
244 meshRefinement::get<labelPair>
254 globalMinLevel[surfI] = refLevel[0];
255 globalMaxLevel[surfI] = refLevel[1];
256 globalLevelIncr[surfI] =
dict.getOrDefault
264 globalMinLevel[surfI] < 0
265 || globalMaxLevel[surfI] < globalMinLevel[surfI]
266 || globalMaxLevel[surfI] < 0
267 || globalLevelIncr[surfI] < 0
271 <<
"Illegal level specification for surface " 273 <<
" : minLevel:" << globalMinLevel[surfI]
274 <<
" maxLevel:" << globalMaxLevel[surfI]
275 <<
" levelIncrement:" << globalLevelIncr[surfI]
282 globalGapLevel[surfI] =
dict.getOrDefault
287 globalGapMode[surfI] =
293 || globalGapLevel[surfI][0] < 0
294 || globalGapLevel[surfI][1] < 0
295 || globalGapLevel[surfI][2] < 0
296 || globalGapLevel[surfI][1] > globalGapLevel[surfI][2]
300 <<
"Illegal gapLevel specification for surface " 302 <<
" : gapLevel:" << globalGapLevel[surfI]
303 <<
" gapMode:" << globalGapMode[surfI].str()
307 globalGapSelf[surfI] =
308 dict.getOrDefault<
bool>(
"gapSelf",
true);
310 globalCurvLevel[surfI] = nullCurvLevel;
311 if (
dict.readIfPresent(
"curvatureLevel", globalCurvLevel[surfI]))
313 if (globalCurvLevel[surfI][0] <= 0)
316 <<
"Illegal curvatureLevel specification for surface " 318 <<
" : curvatureLevel:" << globalCurvLevel[surfI]
323 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
338 if (
dict.found(
"patchInfo"))
343 dict.subDict(
"patchInfo").clone()
346 dict.readIfPresent(
"perpendicularAngle", globalAngle[surfI]);
347 dict.readIfPresent(
"blockLevel", globalBlockLevel[surfI]);
348 dict.readIfPresent(
"leakLevel", globalLeakLevel[surfI]);
351 if (
dict.found(
"regions"))
353 const dictionary& regionsDict =
dict.subDict(
"regions");
361 const dictionary& regionDict = regionsDict.subDict
368 meshRefinement::get<labelPair>
377 globalMinLevel[surfI],
378 globalMaxLevel[surfI]
384 regionMinLevel[surfI].insert(regionI, refLevel[0]);
385 regionMaxLevel[surfI].insert(regionI, refLevel[1]);
386 label levelIncr = regionDict.getOrDefault
391 regionLevelIncr[surfI].insert(regionI, levelIncr);
396 || refLevel[1] < refLevel[0]
401 <<
"Illegal level specification for surface " 402 << names_[surfI] <<
" region " 404 <<
" : minLevel:" << refLevel[0]
405 <<
" maxLevel:" << refLevel[1]
406 <<
" levelIncrement:" << levelIncr
414 FixedList<label, 3> gapSpec
416 regionDict.getOrDefault
419 globalGapLevel[surfI]
422 regionGapLevel[surfI].insert(regionI, gapSpec);
423 volumeType gapModeSpec
429 regionGapMode[surfI].insert(regionI, gapModeSpec);
436 || gapSpec[1] > gapSpec[2]
440 <<
"Illegal gapLevel specification for surface " 442 <<
" : gapLevel:" << gapSpec
443 <<
" gapMode:" << gapModeSpec.str()
446 regionGapSelf[surfI].insert
449 regionDict.getOrDefault<
bool>
457 FixedList<label, 4> curvSpec(nullCurvLevel);
460 regionDict.readIfPresent(
"curvatureLevel", curvSpec)
463 if (curvSpec[0] <= 0)
466 <<
"Illegal curvatureLevel" 467 <<
" specification for surface " 469 <<
" : curvatureLevel:" << curvSpec
472 regionCurvLevel[surfI].insert(regionI, curvSpec);
475 if (regionDict.found(
"perpendicularAngle"))
477 regionAngle[surfI].insert
480 regionDict.get<scalar>(
"perpendicularAngle")
484 if (regionDict.found(
"patchInfo"))
486 regionPatchInfo[surfI].insert
489 regionDict.subDict(
"patchInfo").clone()
494 if (regionDict.readIfPresent<label>(
"blockLevel", l))
496 regionBlockLevel[surfI].insert(regionI, l);
498 if (regionDict.readIfPresent<label>(
"leakLevel", l))
500 regionLeakLevel[surfI].insert(regionI, l);
509 if (unmatchedKeys.size() > 0)
512 <<
"Not all entries in refinementSurfaces dictionary were used." 513 <<
" The following entries were not used : " 514 << unmatchedKeys.sortedToc()
525 nRegions += allGeometry_[surfaces_[surfI]].regions().
size();
530 regionToSurface_ = calcSurfaceIndex(allGeometry_, surfaces_);
539 extendedGapLevel_.setSize(
nRegions);
540 extendedGapLevel_ = nullGapLevel;
544 selfProximity_ =
true;
545 extendedCurvatureLevel_.setSize(
nRegions);
546 extendedCurvatureLevel_ = nullCurvLevel;
548 perpendicularAngle_ = -GREAT;
556 forAll(globalMinLevel, surfI)
558 label
nRegions = allGeometry_[surfaces_[surfI]].regions().
size();
561 for (label i = 0; i <
nRegions; i++)
563 const label globalRegionI = regionOffset_[surfI] + i;
565 minLevel_[globalRegionI] = globalMinLevel[surfI];
566 maxLevel_[globalRegionI] = globalMaxLevel[surfI];
567 gapLevel_[globalRegionI] =
568 maxLevel_[globalRegionI]
569 + globalLevelIncr[surfI];
570 extendedGapLevel_[globalRegionI] = globalGapLevel[surfI];
571 extendedGapMode_[globalRegionI] = globalGapMode[surfI];
572 selfProximity_[globalRegionI] = globalGapSelf[surfI];
573 extendedCurvatureLevel_[globalRegionI] = globalCurvLevel[surfI];
574 perpendicularAngle_[globalRegionI] = globalAngle[surfI];
575 if (globalPatchInfo.set(surfI))
580 globalPatchInfo[surfI].clone()
583 blockLevel_[globalRegionI] = globalBlockLevel[surfI];
584 leakLevel_[globalRegionI] = globalLeakLevel[surfI];
590 const label globalRegionI = regionOffset_[surfI] + iter.key();
592 minLevel_[globalRegionI] = iter.val();
593 maxLevel_[globalRegionI] = regionMaxLevel[surfI][iter.key()];
594 gapLevel_[globalRegionI] =
595 maxLevel_[globalRegionI]
596 + regionLevelIncr[surfI][iter.key()];
601 const label globalRegionI = regionOffset_[surfI] + iter.key();
603 extendedGapLevel_[globalRegionI] =
604 regionGapLevel[surfI][iter.key()];
605 extendedGapMode_[globalRegionI] =
606 regionGapMode[surfI][iter.key()];
607 selfProximity_[globalRegionI] =
608 regionGapSelf[surfI][iter.key()];
613 const label globalRegionI = regionOffset_[surfI] + iter.key();
614 extendedCurvatureLevel_[globalRegionI] = iter.val();
619 const label globalRegionI = regionOffset_[surfI] + iter.key();
620 perpendicularAngle_[globalRegionI] = iter.val();
623 const Map<autoPtr<dictionary>>& localInfo = regionPatchInfo[surfI];
626 const label globalRegionI = regionOffset_[surfI] + iter.key();
627 const dictionary&
dict = *(iter.val());
629 patchInfo_.set(globalRegionI,
dict.clone());
634 const label globalRegionI = regionOffset_[surfI] + iter.key();
636 blockLevel_[globalRegionI] = iter.val();
637 leakLevel_[globalRegionI] = iter.val();
643 Foam::refinementSurfaces::refinementSurfaces
645 const searchableSurfaces& allGeometry,
648 const PtrList<surfaceZonesInfo>& surfZones,
654 PtrList<dictionary>& patchInfo,
658 allGeometry_(allGeometry),
661 surfZones_(surfZones),
662 regionOffset_(regionOffset),
663 regionToSurface_(calcSurfaceIndex(allGeometry, surfaces)),
667 perpendicularAngle_(perpendicularAngle),
668 patchInfo_(patchInfo.size()),
675 patchInfo_.set(pI,
patchInfo.set(pI,
nullptr));
685 const label globalRegionI
688 const label surfI = regionToSurface_[globalRegionI];
689 const label localI = globalRegionI-regionOffset_[surfI];
759 label globalI = globalRegion(surfI, regionI);
761 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
778 label globalI = globalRegion(surfI, regionI);
779 const FixedList<label, 4>& gapInfo =
780 extendedCurvatureLevel_[globalI];
781 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
794 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
801 if (geom.globalSize() > 10)
806 geom.boundingSpheres(ctrs, radiusSqr);
813 List<pointIndexHit> info;
814 geom.findNearest(ctrs, radiusSqr, info);
818 geom.getRegion(info, region);
825 minLevelField[i] = minLevel(surfI, region[i]);
833 shells.findHigherLevel(ctrs, minLevelField, shellLevel);
838 const auto* tsPtr = isA<triSurface>(geom);
846 const triSurface& ts = *tsPtr;
854 const labelledTri& t = ts[triI];
855 label level = shellLevel[triI];
858 minPointLevel[t[tI]] =
min(minPointLevel[t[tI]], level);
865 shells.findHigherLevel(
points, minPointLevel, pointLevel);
871 const labelledTri& t = ts[triI];
872 label fLevel = shellLevel[triI];
875 (pointLevel[t[0]] != fLevel)
876 || (pointLevel[t[1]] != fLevel)
877 || (pointLevel[t[2]] != fLevel)
884 shellLevel[triI] = -1;
891 Info<<
"For geometry " << geom.name()
894 <<
" uncached triangles out of " << geom.globalSize()
905 if (
min(minLevelField[i], shellLevel[i]) < 0)
907 minLevelField[i] = -1;
911 minLevelField[i] =
max(minLevelField[i], shellLevel[i]);
916 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
926 const scalar cosAngle,
927 const scalar level0EdgeLength
930 const labelList maxCurvLevel(maxCurvatureLevel());
936 if (maxCurvLevel[surfI] <= 0)
941 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
943 const auto* tsPtr = isA<triSurface>(geom);
955 geom.boundingSpheres(ctrs, radiusSqr);
966 List<pointIndexHit> info;
967 geom.findNearest(ctrs, radiusSqr, info);
971 geom.getRegion(info, region);
975 geom.getField(info, cachedField);
982 const label globali = globalRegion(surfI, region[i]);
983 curvIgnore[i] = extendedCurvatureLevel_[globali][3];
984 nCurvCells[i] = extendedCurvatureLevel_[globali][0];
986 surfMax[i] = extendedCurvatureLevel_[globali][2];
988 minLevelField[i] = minLevel(surfI, region[i]);
989 if (cachedField.size() > i)
992 max(minLevelField[i], cachedField[i]);
1005 const auto& ts = *tsPtr;
1007 auto& curv = tcurv.ref();
1012 const auto& edgeFaces = ts.edgeFaces();
1013 const auto& edges = ts.edges();
1014 const auto&
points = ts.points();
1015 const auto&
mp = ts.meshPoints();
1020 const auto& eFaces = edgeFaces[edgei];
1021 const edge meshE(
mp, edges[edgei]);
1023 if (eFaces.size() == 2)
1025 const auto& f0 = ts[eFaces[0]];
1026 const auto& f1 = ts[eFaces[1]];
1030 const int dir0 = f0.edgeDirection(meshE);
1031 const int dir1 = f1.edgeDirection(meshE);
1041 if ((n0&n1) < cosAngle)
1043 isOnSharpEdge.set(meshE[0]);
1044 isOnSharpEdge.set(meshE[1]);
1051 bitSet oldOnSharpEdge(isOnSharpEdge);
1052 isOnSharpEdge =
false;
1053 for (
const auto&
f : ts)
1055 for (
const label pointi :
f)
1057 if (oldOnSharpEdge[pointi])
1060 isOnSharpEdge.set(
f);
1069 autoPtr<OBJstream> str;
1085 for (
const label pointi : isOnSharpEdge)
1091 str().write(
points[pointi]);
1112 const label level = curvIgnore[i];
1116 const scalar length = level0EdgeLength/(2<<level);
1117 const scalar invLength = 1.0/length;
1118 for (
const label pointi : ts[i])
1122 invLength < pointMinCurv[pointi]
1123 && curv[pointi] > SMALL
1137 pointMinCurv[pointi] =
1138 min(pointMinCurv[pointi], invLength);
1145 forAll(pointMinCurv, pointi)
1147 if (pointMinCurv[pointi] < curv[pointi])
1165 const auto&
f = ts[i];
1167 cellCurv[i] =
max(curv[
f[0]],
max(curv[
f[1]], curv[
f[2]]));
1190 if (cellCurv[i] > SMALL && nCurvCells[i] > 0)
1207 const scalar r = scalar(1.0)/cellCurv[i];
1208 const scalar level =
1209 log2(nCurvCells[i]*level0EdgeLength/r);
1210 const label l = round(level);
1212 if (l > minLevelField[i] && l <= surfMax[i])
1214 minLevelField[i] = l;
1222 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
1247 if (surfaces_.empty())
1252 if (surfaces_.size() == 1)
1271 geom.
getRegion(intersectionInfo, region);
1273 forAll(intersectionInfo, i)
1275 if (intersectionInfo[i].hit())
1277 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
1299 if (localLevel[i] > currentLevel[i])
1301 surfaces[i] = surfI;
1302 surfaceLevel[i] = localLevel[i];
1326 labelList surfaceOnlyLevel(intersectionInfo.size(), -1);
1330 geom.
getRegion(intersectionInfo, region);
1332 forAll(intersectionInfo, i)
1334 if (intersectionInfo[i].hit())
1336 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
1359 label pointI = intersectionToPoint[i];
1361 if (localLevel[i] > currentLevel[pointI])
1364 surfaces[pointI] = surfI;
1365 surfaceLevel[pointI] = localLevel[i];
1369 p0[missI] = start[pointI];
1370 p1[missI] =
end[pointI];
1371 intersectionToPoint[missI] = pointI;
1386 intersectionToPoint.
setSize(missI);
1387 intersectionInfo.setSize(missI);
1408 if (surfaces_.empty())
1414 List<List<pointIndexHit>> hitInfo;
1418 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1429 n += hitInfo[pointI].size();
1432 List<pointIndexHit> surfInfo(
n);
1438 const List<pointIndexHit>& pHits = hitInfo[pointI];
1442 surfInfo[
n] = pHits[i];
1443 pointMap[
n] = pointI;
1450 surface.getRegion(surfInfo, surfRegion);
1451 surface.getNormal(surfInfo, surfNormal);
1461 label region = globalRegion(surfI, surfRegion[i]);
1462 label pointI = pointMap[i];
1466 currentLevel[pointI] >= globalMinLevel[region]
1467 && currentLevel[pointI] < globalMaxLevel[region]
1471 label sz = surfaceNormal[pointI].
size();
1472 surfaceNormal[pointI].
setSize(sz+1);
1473 surfaceNormal[pointI][sz] = surfNormal[i];
1475 surfaceLevel[pointI].
setSize(sz+1);
1476 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1501 if (surfaces_.empty())
1507 List<List<pointIndexHit>> hitInfo;
1511 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1522 n += hitInfo[pointI].size();
1525 List<pointIndexHit> surfInfo(
n);
1531 const List<pointIndexHit>& pHits = hitInfo[pointI];
1535 surfInfo[
n] = pHits[i];
1536 pointMap[
n] = pointI;
1543 surface.getRegion(surfInfo, surfRegion);
1544 surface.getNormal(surfInfo, surfNormal);
1551 label region = globalRegion(surfI, surfRegion[i]);
1552 label pointI = pointMap[i];
1556 currentLevel[pointI] >= globalMinLevel[region]
1557 && currentLevel[pointI] < globalMaxLevel[region]
1561 label sz = surfaceNormal[pointI].
size();
1562 surfaceLocation[pointI].
setSize(sz+1);
1563 surfaceLocation[pointI][sz] = surfInfo[i].hitPoint();
1565 surfaceNormal[pointI].
setSize(sz+1);
1566 surfaceNormal[pointI][sz] = surfNormal[i];
1568 surfaceLevel[pointI].
setSize(sz+1);
1571 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1689 forAll(surfacesToTest, testI)
1691 label surfI = surfacesToTest[testI];
1708 forAll(nearestInfo, pointI)
1710 if (nearestInfo[pointI].hit())
1712 hit1[pointI] = nearestInfo[pointI];
1713 surface1[pointI] = surfI;
1714 region1[pointI] = region[pointI];
1715 nearest[pointI] = hit1[pointI].hitPoint();
1726 surface2 = surface1;
1733 if (hit1[pointI].hit())
1735 nearest[pointI] = hit1[pointI].point();
1740 nearest[pointI] =
end[pointI];
1744 forAll(surfacesToTest, testI)
1746 label surfI = surfacesToTest[testI];
1763 forAll(nearestInfo, pointI)
1765 if (nearestInfo[pointI].hit())
1767 hit2[pointI] = nearestInfo[pointI];
1768 surface2[pointI] = surfI;
1769 region2[pointI] = region[pointI];
1770 nearest[pointI] = hit2[pointI].hitPoint();
1780 if (hit1[pointI].hit() && !hit2[pointI].hit())
1782 hit2[pointI] = hit1[pointI];
1783 surface2[pointI] = surface1[pointI];
1784 region2[pointI] = region1[pointI];
1826 forAll(surfacesToTest, testI)
1828 label surfI = surfacesToTest[testI];
1832 geom.
findLine(start, nearest, nearestInfo);
1836 forAll(nearestInfo, pointI)
1838 if (nearestInfo[pointI].hit())
1840 hit1[pointI] = nearestInfo[pointI];
1841 surface1[pointI] = surfI;
1842 region1[pointI] = region[pointI];
1843 normal1[pointI] = normal[pointI];
1844 nearest[pointI] = hit1[pointI].hitPoint();
1855 surface2 = surface1;
1863 if (hit1[pointI].hit())
1865 nearest[pointI] = hit1[pointI].point();
1870 nearest[pointI] =
end[pointI];
1874 forAll(surfacesToTest, testI)
1876 label surfI = surfacesToTest[testI];
1877 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
1880 geom.findLine(
end, nearest, nearestInfo);
1881 geom.getRegion(nearestInfo, region);
1882 geom.getNormal(nearestInfo, normal);
1884 forAll(nearestInfo, pointI)
1886 if (nearestInfo[pointI].hit())
1888 hit2[pointI] = nearestInfo[pointI];
1889 surface2[pointI] = surfI;
1890 region2[pointI] = region[pointI];
1891 normal2[pointI] = normal[pointI];
1892 nearest[pointI] = hit2[pointI].hitPoint();
1902 if (hit1[pointI].hit() && !hit2[pointI].hit())
1904 hit2[pointI] = hit1[pointI];
1905 surface2[pointI] = surface1[pointI];
1906 region2[pointI] = region1[pointI];
1907 normal2[pointI] = normal1[pointI];
1940 geom.
findLine(start, nearest, nearestInfo);
1943 forAll(nearestInfo, pointI)
1945 if (nearestInfo[pointI].hit())
1947 surface1[pointI] = surfI;
1948 normal1[pointI] = normal[pointI];
1949 nearest[pointI] = nearestInfo[pointI].point();
1989 geom.
findLine(start, nearest, nearestInfo);
1992 forAll(nearestInfo, pointI)
1994 if (nearestInfo[pointI].hit())
1996 surface1[pointI] = surfI;
1997 hitInfo1[pointI] = nearestInfo[pointI];
1998 normal1[pointI] = normal[pointI];
1999 nearest[pointI] = nearestInfo[pointI].point();
2050 forAll(hitSurface, pointI)
2052 if (hitSurface[pointI] != -1)
2054 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2084 forAll(hitSurface, pointI)
2086 if (hitSurface[pointI] != -1)
2088 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2096 forAll(surfacesToTest, i)
2098 label surfI = surfacesToTest[i];
2103 List<pointIndexHit> localHits
2105 UIndirectList<pointIndexHit>
2113 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2117 hitRegion[localIndices[i]] = localRegion[i];
2148 forAll(hitSurface, pointI)
2150 if (hitSurface[pointI] != -1)
2152 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2162 forAll(surfacesToTest, i)
2164 label surfI = surfacesToTest[i];
2169 List<pointIndexHit> localHits
2171 UIndirectList<pointIndexHit>
2180 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2184 hitRegion[localIndices[i]] = localRegion[i];
2189 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2193 hitNormal[localIndices[i]] = localNormal[i];
2252 insideSurfaces = -1;
2256 label surfI = testSurfaces[i];
2261 surfZones_[surfI].zoneInside();
2270 <<
"Trying to use surface " 2272 <<
" which has non-geometric inside selection method " 2280 surface.getVolumeType(pt, volType);
2284 if (insideSurfaces[pointI] == -1)
2298 insideSurfaces[pointI] = surfI;
2334 forAll(hitSurface, pointI)
2336 if (hitSurface[pointI] != -1)
2338 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2373 forAll(hitSurface, pointI)
2375 if (hitSurface[pointI] != -1)
2377 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2387 forAll(surfacesToTest, i)
2389 label surfI = surfacesToTest[i];
2394 List<pointIndexHit> localHits
2396 UIndirectList<pointIndexHit>
2405 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2409 hitRegion[localIndices[i]] = localRegion[i];
2414 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2418 hitNormal[localIndices[i]] = localNormal[i];
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
void size(const label n)
Older name for setAddressableSize.
labelList maxCurvatureLevel() const
Per surface the maximum curvatureLevel over all its regions.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void findNearest(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &)
Find nearest. Return -1 (and a miss()) or surface and nearest.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
UIndirectList< label > labelUIndList
UIndirectList of labels.
scalarField samples(nIntervals, Zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Used for debugging only: find intersection of edge.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Return any intersection on segment from start to end.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
void findNearest(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest point on surfaces.
wordList toc() const
Return the table of contents.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
#define forAll(list, i)
Loop across all elements in list.
void findHigherIntersection(const shellSurfaces &shells, const pointField &start, const pointField &end, const labelList ¤tLevel, labelList &surfaces, labelList &surfaceLevel) const
Find intersection of edge. Return -1 or first surface.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
surfacesMesh setField(triSurfaceToAgglom)
void findNearestRegion(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &hitSurface, labelList &hitRegion) const
Find nearest point on surfaces. Return surface and region on.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const List< wordList > & regionNames() const
Region names per surface.
label size() const noexcept
The number of entries in the list.
labelPair whichSurface(const label globalRegionI) const
From global region to surface + region.
void findAllIntersections(const pointField &start, const pointField &end, const labelList ¤tLevel, const labelList &globalMinLevel, const labelList &globalMaxLevel, List< vectorList > &surfaceNormal, labelListList &surfaceLevel) const
Find all intersections of edge with any surface with applicable.
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
Encapsulates queries for volume refinement ('refine all cells within shell').
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
A location inside the volume.
static void findAnyIntersection(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &)
Find any intersection. Return hit point information and.
A location outside the volume.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
A location that is partly inside and outside.
Pair< label > labelPair
A pair of labels.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
void setCurvatureMinLevelFields(const scalar cosAngle, const scalar level0EdgeLength)
Update minLevelFields according to (triSurface-only) curvature.
List< word > wordList
List of word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const wordList & names() const
Surface names, not region names.
labelList maxGapLevel() const
Per surface the maximum extendedGapLevel over all its regions.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const =0
From a set of points and indices get the region.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const PtrList< dictionary > & patchInfo() const
From global region number to patch type.
Field< vector > vectorField
Specialisation of Field<T> for vector.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Contains information about location on a triSurface.
List< label > labelList
A List of labels.
void findNearestIntersection(const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList ®ion1, labelList &surface2, List< pointIndexHit > &hit2, labelList ®ion2) const
Find intersection nearest to the endpoints. surface1,2 are.
void setMinLevelFields(const shellSurfaces &shells)
Calculate minLevelFields according to both surface- and.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< bool > boolList
A List of bools.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
areaSelectionAlgo
Types of selection of area.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Find first intersection on segment from start to end.
const volScalarField & p0
const dimensionedScalar mp
Proton mass.
forAllConstIters(mixture.phases(), phase)
void findInside(const labelList &surfacesToTest, const pointField &pt, labelList &insideSurfaces) const
Detect if a point is 'inside' (closed) surfaces.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)