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 boolList globalBufferLayers(surfI,
true);
215 List<Map<label>> regionMinLevel(surfI);
216 List<Map<label>> regionMaxLevel(surfI);
217 List<Map<label>> regionLevelIncr(surfI);
218 List<Map<FixedList<label, 3>>> regionGapLevel(surfI);
219 List<Map<volumeType>> regionGapMode(surfI);
220 List<Map<bool>> regionGapSelf(surfI);
221 List<Map<FixedList<label, 4>>> regionCurvLevel(surfI);
222 List<Map<scalar>> regionAngle(surfI);
223 List<Map<autoPtr<dictionary>>> regionPatchInfo(surfI);
224 List<Map<label>> regionBlockLevel(surfI);
225 List<Map<label>> regionLeakLevel(surfI);
226 List<Map<label>> regionBufferLayers(surfI);
233 const word& geomName = allGeometry_.
names()[geomI];
241 unmatchedKeys.erase(ePtr->keyword());
243 names_[surfI] = geomName;
244 surfaces_[surfI] = geomI;
248 meshRefinement::get<labelPair>
258 globalMinLevel[surfI] = refLevel[0];
259 globalMaxLevel[surfI] = refLevel[1];
260 globalLevelIncr[surfI] =
dict.getOrDefault
268 globalMinLevel[surfI] < 0
269 || globalMaxLevel[surfI] < globalMinLevel[surfI]
270 || globalMaxLevel[surfI] < 0
271 || globalLevelIncr[surfI] < 0
275 <<
"Illegal level specification for surface " 277 <<
" : minLevel:" << globalMinLevel[surfI]
278 <<
" maxLevel:" << globalMaxLevel[surfI]
279 <<
" levelIncrement:" << globalLevelIncr[surfI]
286 globalGapLevel[surfI] =
dict.getOrDefault
291 globalGapMode[surfI] =
297 || globalGapLevel[surfI][0] < 0
298 || globalGapLevel[surfI][1] < 0
299 || globalGapLevel[surfI][2] < 0
300 || globalGapLevel[surfI][1] > globalGapLevel[surfI][2]
304 <<
"Illegal gapLevel specification for surface " 306 <<
" : gapLevel:" << globalGapLevel[surfI]
307 <<
" gapMode:" << globalGapMode[surfI].str()
311 globalGapSelf[surfI] =
312 dict.getOrDefault<
bool>(
"gapSelf",
true);
314 globalCurvLevel[surfI] = nullCurvLevel;
315 if (
dict.readIfPresent(
"curvatureLevel", globalCurvLevel[surfI]))
317 if (globalCurvLevel[surfI][0] <= 0)
320 <<
"Illegal curvatureLevel specification for surface " 322 <<
" : curvatureLevel:" << globalCurvLevel[surfI]
327 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
342 if (
dict.found(
"patchInfo"))
347 dict.subDict(
"patchInfo").clone()
350 dict.readIfPresent(
"perpendicularAngle", globalAngle[surfI]);
351 dict.readIfPresent(
"blockLevel", globalBlockLevel[surfI]);
352 dict.readIfPresent(
"leakLevel", globalLeakLevel[surfI]);
353 dict.readIfPresent(
"addBufferLayers", globalBufferLayers[surfI]);
355 if (
dict.found(
"regions"))
365 const dictionary& regionDict = regionsDict.subDict
372 meshRefinement::get<labelPair>
381 globalMinLevel[surfI],
382 globalMaxLevel[surfI]
388 regionMinLevel[surfI].insert(regionI, refLevel[0]);
389 regionMaxLevel[surfI].insert(regionI, refLevel[1]);
390 label levelIncr = regionDict.getOrDefault
395 regionLevelIncr[surfI].insert(regionI, levelIncr);
400 || refLevel[1] < refLevel[0]
405 <<
"Illegal level specification for surface " 406 << names_[surfI] <<
" region " 408 <<
" : minLevel:" << refLevel[0]
409 <<
" maxLevel:" << refLevel[1]
410 <<
" levelIncrement:" << levelIncr
418 FixedList<label, 3> gapSpec
420 regionDict.getOrDefault
423 globalGapLevel[surfI]
426 regionGapLevel[surfI].insert(regionI, gapSpec);
427 volumeType gapModeSpec
433 regionGapMode[surfI].insert(regionI, gapModeSpec);
440 || gapSpec[1] > gapSpec[2]
444 <<
"Illegal gapLevel specification for surface " 446 <<
" : gapLevel:" << gapSpec
447 <<
" gapMode:" << gapModeSpec.str()
450 regionGapSelf[surfI].insert
453 regionDict.getOrDefault<
bool>
461 FixedList<label, 4> curvSpec(nullCurvLevel);
464 regionDict.readIfPresent(
"curvatureLevel", curvSpec)
467 if (curvSpec[0] <= 0)
470 <<
"Illegal curvatureLevel" 471 <<
" specification for surface " 473 <<
" : curvatureLevel:" << curvSpec
476 regionCurvLevel[surfI].insert(regionI, curvSpec);
479 if (regionDict.found(
"perpendicularAngle"))
481 regionAngle[surfI].insert
484 regionDict.get<scalar>(
"perpendicularAngle")
488 if (regionDict.found(
"patchInfo"))
490 regionPatchInfo[surfI].insert
493 regionDict.subDict(
"patchInfo").clone()
498 if (regionDict.readIfPresent<label>(
"blockLevel", l))
500 regionBlockLevel[surfI].insert(regionI, l);
502 if (regionDict.readIfPresent<label>(
"leakLevel", l))
504 regionLeakLevel[surfI].insert(regionI, l);
509 regionDict.readIfPresent<
bool>(
"addBufferLayers",
s)
512 regionBufferLayers[surfI].insert(regionI,
s);
521 if (unmatchedKeys.size() > 0)
524 <<
"Not all entries in refinementSurfaces dictionary were used." 525 <<
" The following entries were not used : " 526 << unmatchedKeys.sortedToc()
537 nRegions += allGeometry_[surfaces_[surfI]].regions().
size();
542 regionToSurface_ = calcSurfaceIndex(allGeometry_, surfaces_);
551 extendedGapLevel_.setSize(
nRegions);
552 extendedGapLevel_ = nullGapLevel;
556 selfProximity_ =
true;
557 extendedCurvatureLevel_.setSize(
nRegions);
558 extendedCurvatureLevel_ = nullCurvLevel;
560 perpendicularAngle_ = -GREAT;
567 addBufferLayers_ =
false;
570 forAll(globalMinLevel, surfI)
572 label
nRegions = allGeometry_[surfaces_[surfI]].regions().
size();
575 for (label i = 0; i <
nRegions; i++)
577 const label globalRegionI = regionOffset_[surfI] + i;
579 minLevel_[globalRegionI] = globalMinLevel[surfI];
580 maxLevel_[globalRegionI] = globalMaxLevel[surfI];
581 gapLevel_[globalRegionI] =
582 maxLevel_[globalRegionI]
583 + globalLevelIncr[surfI];
584 extendedGapLevel_[globalRegionI] = globalGapLevel[surfI];
585 extendedGapMode_[globalRegionI] = globalGapMode[surfI];
586 selfProximity_[globalRegionI] = globalGapSelf[surfI];
587 extendedCurvatureLevel_[globalRegionI] = globalCurvLevel[surfI];
588 perpendicularAngle_[globalRegionI] = globalAngle[surfI];
589 if (globalPatchInfo.set(surfI))
594 globalPatchInfo[surfI].clone()
597 blockLevel_[globalRegionI] = globalBlockLevel[surfI];
598 leakLevel_[globalRegionI] = globalLeakLevel[surfI];
599 addBufferLayers_[globalRegionI] = globalBufferLayers[surfI];
605 const label globalRegionI = regionOffset_[surfI] + iter.key();
607 minLevel_[globalRegionI] = iter.val();
608 maxLevel_[globalRegionI] = regionMaxLevel[surfI][iter.key()];
609 gapLevel_[globalRegionI] =
610 maxLevel_[globalRegionI]
611 + regionLevelIncr[surfI][iter.key()];
616 const label globalRegionI = regionOffset_[surfI] + iter.key();
618 extendedGapLevel_[globalRegionI] =
619 regionGapLevel[surfI][iter.key()];
620 extendedGapMode_[globalRegionI] =
621 regionGapMode[surfI][iter.key()];
622 selfProximity_[globalRegionI] =
623 regionGapSelf[surfI][iter.key()];
628 const label globalRegionI = regionOffset_[surfI] + iter.key();
629 extendedCurvatureLevel_[globalRegionI] = iter.val();
634 const label globalRegionI = regionOffset_[surfI] + iter.key();
635 perpendicularAngle_[globalRegionI] = iter.val();
638 const Map<autoPtr<dictionary>>& localInfo = regionPatchInfo[surfI];
641 const label globalRegionI = regionOffset_[surfI] + iter.key();
644 patchInfo_.set(globalRegionI,
dict.clone());
649 const label globalRegionI = regionOffset_[surfI] + iter.key();
651 blockLevel_[globalRegionI] = iter.val();
652 leakLevel_[globalRegionI] = iter.val();
656 const label globalRegionI = regionOffset_[surfI] + iter.key();
657 addBufferLayers_[globalRegionI] = iter.val();
663 Foam::refinementSurfaces::refinementSurfaces
665 const searchableSurfaces& allGeometry,
668 const PtrList<surfaceZonesInfo>& surfZones,
674 PtrList<dictionary>& patchInfo,
678 allGeometry_(allGeometry),
681 surfZones_(surfZones),
682 regionOffset_(regionOffset),
683 regionToSurface_(calcSurfaceIndex(allGeometry, surfaces)),
687 perpendicularAngle_(perpendicularAngle),
688 patchInfo_(patchInfo.size()),
695 patchInfo_.set(pI,
patchInfo.set(pI,
nullptr));
705 const label globalRegionI
708 const label surfI = regionToSurface_[globalRegionI];
709 const label localI = globalRegionI-regionOffset_[surfI];
779 label globalI = globalRegion(surfI, regionI);
781 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
798 label globalI = globalRegion(surfI, regionI);
799 const FixedList<label, 4>& gapInfo =
800 extendedCurvatureLevel_[globalI];
801 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
814 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
821 if (geom.globalSize() > 10)
826 geom.boundingSpheres(ctrs, radiusSqr);
833 List<pointIndexHit> info;
834 geom.findNearest(ctrs, radiusSqr, info);
838 geom.getRegion(info, region);
845 minLevelField[i] = minLevel(surfI, region[i]);
853 shells.findHigherLevel(ctrs, minLevelField, shellLevel);
858 const auto* tsPtr = isA<triSurface>(geom);
866 const triSurface& ts = *tsPtr;
874 const labelledTri& t = ts[triI];
875 label level = shellLevel[triI];
878 minPointLevel[t[tI]] =
min(minPointLevel[t[tI]], level);
885 shells.findHigherLevel(
points, minPointLevel, pointLevel);
891 const labelledTri& t = ts[triI];
892 label fLevel = shellLevel[triI];
895 (pointLevel[t[0]] != fLevel)
896 || (pointLevel[t[1]] != fLevel)
897 || (pointLevel[t[2]] != fLevel)
904 shellLevel[triI] = -1;
911 Info<<
"For geometry " << geom.name()
914 <<
" uncached triangles out of " << geom.globalSize()
925 if (
min(minLevelField[i], shellLevel[i]) < 0)
927 minLevelField[i] = -1;
931 minLevelField[i] =
max(minLevelField[i], shellLevel[i]);
936 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
946 const scalar cosAngle,
947 const scalar level0EdgeLength
950 const labelList maxCurvLevel(maxCurvatureLevel());
956 if (maxCurvLevel[surfI] <= 0)
961 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
963 const auto* tsPtr = isA<triSurface>(geom);
975 geom.boundingSpheres(ctrs, radiusSqr);
986 List<pointIndexHit> info;
987 geom.findNearest(ctrs, radiusSqr, info);
991 geom.getRegion(info, region);
995 geom.getField(info, cachedField);
1002 const label globali = globalRegion(surfI, region[i]);
1003 curvIgnore[i] = extendedCurvatureLevel_[globali][3];
1004 nCurvCells[i] = extendedCurvatureLevel_[globali][0];
1006 surfMax[i] = extendedCurvatureLevel_[globali][2];
1008 minLevelField[i] = minLevel(surfI, region[i]);
1009 if (cachedField.size() > i)
1012 max(minLevelField[i], cachedField[i]);
1025 const auto& ts = *tsPtr;
1027 auto& curv = tcurv.ref();
1032 const auto& edgeFaces = ts.edgeFaces();
1033 const auto& edges = ts.edges();
1034 const auto&
points = ts.points();
1035 const auto&
mp = ts.meshPoints();
1040 const auto& eFaces = edgeFaces[edgei];
1041 const edge meshE(
mp, edges[edgei]);
1043 if (eFaces.size() == 2)
1045 const auto& f0 = ts[eFaces[0]];
1046 const auto& f1 = ts[eFaces[1]];
1051 const auto dir0 = f0.edgeDirection(meshE);
1052 const auto dir1 = f1.edgeDirection(meshE);
1054 if (dir0 && ((dir0 > 0) == (dir1 > 0)))
1062 if ((n0&n1) < cosAngle)
1064 isOnSharpEdge.set(meshE[0]);
1065 isOnSharpEdge.set(meshE[1]);
1072 bitSet oldOnSharpEdge(isOnSharpEdge);
1073 isOnSharpEdge =
false;
1074 for (
const auto&
f : ts)
1076 for (
const label pointi :
f)
1078 if (oldOnSharpEdge[pointi])
1081 isOnSharpEdge.set(
f);
1090 autoPtr<OBJstream> str;
1106 for (
const label pointi : isOnSharpEdge)
1112 str().write(
points[pointi]);
1133 const label level = curvIgnore[i];
1137 const scalar length = level0EdgeLength/(2<<level);
1138 const scalar invLength = 1.0/length;
1139 for (
const label pointi : ts[i])
1143 invLength < pointMinCurv[pointi]
1144 && curv[pointi] > SMALL
1158 pointMinCurv[pointi] =
1159 min(pointMinCurv[pointi], invLength);
1166 forAll(pointMinCurv, pointi)
1168 if (pointMinCurv[pointi] < curv[pointi])
1186 const auto&
f = ts[i];
1188 cellCurv[i] =
max(curv[
f[0]],
max(curv[
f[1]], curv[
f[2]]));
1211 if (cellCurv[i] > SMALL && nCurvCells[i] > 0)
1228 const scalar r = scalar(1.0)/cellCurv[i];
1229 const scalar level =
1230 log2(nCurvCells[i]*level0EdgeLength/r);
1231 const label l = round(level);
1233 if (l > minLevelField[i] && l <= surfMax[i])
1235 minLevelField[i] = l;
1243 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
1268 if (surfaces_.empty())
1273 if (surfaces_.size() == 1)
1292 geom.
getRegion(intersectionInfo, region);
1294 forAll(intersectionInfo, i)
1296 if (intersectionInfo[i].hit())
1298 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
1320 if (localLevel[i] > currentLevel[i])
1322 surfaces[i] = surfI;
1323 surfaceLevel[i] = localLevel[i];
1347 labelList surfaceOnlyLevel(intersectionInfo.size(), -1);
1351 geom.
getRegion(intersectionInfo, region);
1353 forAll(intersectionInfo, i)
1355 if (intersectionInfo[i].hit())
1357 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
1380 label pointI = intersectionToPoint[i];
1382 if (localLevel[i] > currentLevel[pointI])
1385 surfaces[pointI] = surfI;
1386 surfaceLevel[pointI] = localLevel[i];
1390 p0[missI] = start[pointI];
1391 p1[missI] =
end[pointI];
1392 intersectionToPoint[missI] = pointI;
1407 intersectionToPoint.
setSize(missI);
1408 intersectionInfo.setSize(missI);
1429 if (surfaces_.empty())
1435 List<List<pointIndexHit>> hitInfo;
1439 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1450 n += hitInfo[pointI].size();
1453 List<pointIndexHit> surfInfo(
n);
1459 const List<pointIndexHit>& pHits = hitInfo[pointI];
1463 surfInfo[
n] = pHits[i];
1464 pointMap[
n] = pointI;
1471 surface.getRegion(surfInfo, surfRegion);
1472 surface.getNormal(surfInfo, surfNormal);
1482 label region = globalRegion(surfI, surfRegion[i]);
1483 label pointI = pointMap[i];
1487 currentLevel[pointI] >= globalMinLevel[region]
1488 && currentLevel[pointI] < globalMaxLevel[region]
1492 label sz = surfaceNormal[pointI].
size();
1493 surfaceNormal[pointI].
setSize(sz+1);
1494 surfaceNormal[pointI][sz] = surfNormal[i];
1496 surfaceLevel[pointI].
setSize(sz+1);
1497 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1522 if (surfaces_.empty())
1528 List<List<pointIndexHit>> hitInfo;
1532 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1543 n += hitInfo[pointI].size();
1546 List<pointIndexHit> surfInfo(
n);
1552 const List<pointIndexHit>& pHits = hitInfo[pointI];
1556 surfInfo[
n] = pHits[i];
1557 pointMap[
n] = pointI;
1564 surface.getRegion(surfInfo, surfRegion);
1565 surface.getNormal(surfInfo, surfNormal);
1572 label region = globalRegion(surfI, surfRegion[i]);
1573 label pointI = pointMap[i];
1577 currentLevel[pointI] >= globalMinLevel[region]
1578 && currentLevel[pointI] < globalMaxLevel[region]
1582 label sz = surfaceNormal[pointI].
size();
1583 surfaceLocation[pointI].
setSize(sz+1);
1584 surfaceLocation[pointI][sz] = surfInfo[i].hitPoint();
1586 surfaceNormal[pointI].
setSize(sz+1);
1587 surfaceNormal[pointI][sz] = surfNormal[i];
1589 surfaceLevel[pointI].
setSize(sz+1);
1592 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1710 forAll(surfacesToTest, testI)
1712 label surfI = surfacesToTest[testI];
1729 forAll(nearestInfo, pointI)
1731 if (nearestInfo[pointI].hit())
1733 hit1[pointI] = nearestInfo[pointI];
1734 surface1[pointI] = surfI;
1735 region1[pointI] = region[pointI];
1736 nearest[pointI] = hit1[pointI].hitPoint();
1747 surface2 = surface1;
1754 if (hit1[pointI].hit())
1756 nearest[pointI] = hit1[pointI].point();
1761 nearest[pointI] =
end[pointI];
1765 forAll(surfacesToTest, testI)
1767 label surfI = surfacesToTest[testI];
1784 forAll(nearestInfo, pointI)
1786 if (nearestInfo[pointI].hit())
1788 hit2[pointI] = nearestInfo[pointI];
1789 surface2[pointI] = surfI;
1790 region2[pointI] = region[pointI];
1791 nearest[pointI] = hit2[pointI].hitPoint();
1801 if (hit1[pointI].hit() && !hit2[pointI].hit())
1803 hit2[pointI] = hit1[pointI];
1804 surface2[pointI] = surface1[pointI];
1805 region2[pointI] = region1[pointI];
1847 forAll(surfacesToTest, testI)
1849 label surfI = surfacesToTest[testI];
1853 geom.
findLine(start, nearest, nearestInfo);
1857 forAll(nearestInfo, pointI)
1859 if (nearestInfo[pointI].hit())
1861 hit1[pointI] = nearestInfo[pointI];
1862 surface1[pointI] = surfI;
1863 region1[pointI] = region[pointI];
1864 normal1[pointI] = normal[pointI];
1865 nearest[pointI] = hit1[pointI].hitPoint();
1876 surface2 = surface1;
1884 if (hit1[pointI].hit())
1886 nearest[pointI] = hit1[pointI].point();
1891 nearest[pointI] =
end[pointI];
1895 forAll(surfacesToTest, testI)
1897 label surfI = surfacesToTest[testI];
1898 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
1901 geom.findLine(
end, nearest, nearestInfo);
1902 geom.getRegion(nearestInfo, region);
1903 geom.getNormal(nearestInfo, normal);
1905 forAll(nearestInfo, pointI)
1907 if (nearestInfo[pointI].hit())
1909 hit2[pointI] = nearestInfo[pointI];
1910 surface2[pointI] = surfI;
1911 region2[pointI] = region[pointI];
1912 normal2[pointI] = normal[pointI];
1913 nearest[pointI] = hit2[pointI].hitPoint();
1923 if (hit1[pointI].hit() && !hit2[pointI].hit())
1925 hit2[pointI] = hit1[pointI];
1926 surface2[pointI] = surface1[pointI];
1927 region2[pointI] = region1[pointI];
1928 normal2[pointI] = normal1[pointI];
1961 geom.
findLine(start, nearest, nearestInfo);
1964 forAll(nearestInfo, pointI)
1966 if (nearestInfo[pointI].hit())
1968 surface1[pointI] = surfI;
1969 normal1[pointI] = normal[pointI];
1970 nearest[pointI] = nearestInfo[pointI].point();
2011 geom.
findLine(start, nearest, nearestInfo);
2015 forAll(nearestInfo, pointI)
2017 if (nearestInfo[pointI].hit())
2019 surface1[pointI] = surfI;
2020 region1[pointI] = region[pointI];
2021 hitInfo1[pointI] = nearestInfo[pointI];
2022 normal1[pointI] = normal[pointI];
2023 nearest[pointI] = nearestInfo[pointI].point();
2063 geom.
findLine(start, nearest, nearestInfo);
2066 forAll(nearestInfo, pointI)
2068 if (nearestInfo[pointI].hit())
2070 surface1[pointI] = surfI;
2071 hitInfo1[pointI] = nearestInfo[pointI];
2072 normal1[pointI] = normal[pointI];
2073 nearest[pointI] = nearestInfo[pointI].point();
2124 forAll(hitSurface, pointI)
2126 if (hitSurface[pointI] != -1)
2128 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2158 forAll(hitSurface, pointI)
2160 if (hitSurface[pointI] != -1)
2162 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2170 forAll(surfacesToTest, i)
2172 label surfI = surfacesToTest[i];
2177 List<pointIndexHit> localHits
2179 UIndirectList<pointIndexHit>
2187 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2191 hitRegion[localIndices[i]] = localRegion[i];
2222 forAll(hitSurface, pointI)
2224 if (hitSurface[pointI] != -1)
2226 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2236 forAll(surfacesToTest, i)
2238 label surfI = surfacesToTest[i];
2243 List<pointIndexHit> localHits
2245 UIndirectList<pointIndexHit>
2254 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2258 hitRegion[localIndices[i]] = localRegion[i];
2263 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2267 hitNormal[localIndices[i]] = localNormal[i];
2326 insideSurfaces = -1;
2330 label surfI = testSurfaces[i];
2335 surfZones_[surfI].zoneInside();
2344 <<
"Trying to use surface " 2346 <<
" which has non-geometric inside selection method " 2354 surface.getVolumeType(pt, volType);
2358 if (insideSurfaces[pointI] == -1)
2372 insideSurfaces[pointI] = surfI;
2408 forAll(hitSurface, pointI)
2410 if (hitSurface[pointI] != -1)
2412 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2447 forAll(hitSurface, pointI)
2449 if (hitSurface[pointI] != -1)
2451 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2461 forAll(surfacesToTest, i)
2463 label surfI = surfacesToTest[i];
2468 List<pointIndexHit> localHits
2470 UIndirectList<pointIndexHit>
2479 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2483 hitRegion[localIndices[i]] = localRegion[i];
2488 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2492 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), works like std::iota() but returning a...
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.
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.
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))
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)