47 const searchableSurface& geom,
48 const shellSurfaces& shells,
49 const List<pointIndexHit>& intersectionInfo,
50 const labelList& surfaceLevel
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]);
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;
156Foam::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);
231 forAll(allGeometry_.names(), geomI)
233 const word& geomName = allGeometry_.names()[geomI];
241 unmatchedKeys.erase(ePtr->keyword());
243 names_[surfI] = geomName;
244 surfaces_[surfI] = geomI;
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]];
337 allGeometry_.regionNames()[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"))
358 wordHashSet unmatchedRegionKeys(regionsDict.toc());
367 unmatchedRegionKeys.erase(erPtr->keyword());
370 const dictionary& regionDict = regionsDict.subDict
386 globalMinLevel[surfI],
387 globalMaxLevel[surfI]
393 regionMinLevel[surfI].insert(regionI, refLevel[0]);
394 regionMaxLevel[surfI].insert(regionI, refLevel[1]);
395 label levelIncr = regionDict.getOrDefault
400 regionLevelIncr[surfI].insert(regionI, levelIncr);
405 || refLevel[1] < refLevel[0]
410 <<
"Illegal level specification for surface "
411 << names_[surfI] <<
" region "
413 <<
" : minLevel:" << refLevel[0]
414 <<
" maxLevel:" << refLevel[1]
415 <<
" levelIncrement:" << levelIncr
423 FixedList<label, 3> gapSpec
425 regionDict.getOrDefault
428 globalGapLevel[surfI]
431 regionGapLevel[surfI].insert(regionI, gapSpec);
432 volumeType gapModeSpec
438 regionGapMode[surfI].insert(regionI, gapModeSpec);
445 || gapSpec[1] > gapSpec[2]
449 <<
"Illegal gapLevel specification for surface "
451 <<
" : gapLevel:" << gapSpec
452 <<
" gapMode:" << gapModeSpec.str()
455 regionGapSelf[surfI].insert
458 regionDict.getOrDefault<
bool>
466 FixedList<label, 4> curvSpec(nullCurvLevel);
469 regionDict.readIfPresent(
"curvatureLevel", curvSpec)
472 if (curvSpec[0] <= 0)
475 <<
"Illegal curvatureLevel"
476 <<
" specification for surface "
478 <<
" : curvatureLevel:" << curvSpec
481 regionCurvLevel[surfI].insert(regionI, curvSpec);
484 if (regionDict.found(
"perpendicularAngle"))
486 regionAngle[surfI].insert
489 regionDict.get<scalar>(
"perpendicularAngle")
493 if (regionDict.found(
"patchInfo"))
495 regionPatchInfo[surfI].insert
498 regionDict.subDict(
"patchInfo").clone()
503 if (regionDict.readIfPresent<label>(
"blockLevel", l))
505 regionBlockLevel[surfI].insert(regionI, l);
507 if (regionDict.readIfPresent<label>(
"leakLevel", l))
509 regionLeakLevel[surfI].insert(regionI, l);
514 regionDict.readIfPresent<
bool>(
"addBufferLayers",
s)
517 regionBufferLayers[surfI].insert(regionI,
s);
521 if (unmatchedRegionKeys.size() > 0)
524 <<
"Not all entries in refinementSurfaces.regions"
525 <<
" dictionary for surface " << names_[surfI]
526 <<
" were used. The following entries were not used : "
527 << unmatchedRegionKeys.sortedToc()
535 if (unmatchedKeys.size() > 0)
538 <<
"Not all entries in refinementSurfaces dictionary were used."
539 <<
" The following entries were not used : "
540 << unmatchedKeys.sortedToc()
551 nRegions += allGeometry_[surfaces_[surfI]].regions().size();
556 regionToSurface_ = calcSurfaceIndex(allGeometry_, surfaces_);
565 extendedGapLevel_.setSize(
nRegions);
566 extendedGapLevel_ = nullGapLevel;
570 selfProximity_ =
true;
571 extendedCurvatureLevel_.setSize(
nRegions);
572 extendedCurvatureLevel_ = nullCurvLevel;
573 perpendicularAngle_.setSize(
nRegions);
574 perpendicularAngle_ = -GREAT;
581 addBufferLayers_ =
false;
584 forAll(globalMinLevel, surfI)
586 label
nRegions = allGeometry_[surfaces_[surfI]].regions().size();
589 for (label i = 0; i <
nRegions; i++)
591 const label globalRegionI = regionOffset_[surfI] + i;
593 minLevel_[globalRegionI] = globalMinLevel[surfI];
594 maxLevel_[globalRegionI] = globalMaxLevel[surfI];
595 gapLevel_[globalRegionI] =
596 maxLevel_[globalRegionI]
597 + globalLevelIncr[surfI];
598 extendedGapLevel_[globalRegionI] = globalGapLevel[surfI];
599 extendedGapMode_[globalRegionI] = globalGapMode[surfI];
600 selfProximity_[globalRegionI] = globalGapSelf[surfI];
601 extendedCurvatureLevel_[globalRegionI] = globalCurvLevel[surfI];
602 perpendicularAngle_[globalRegionI] = globalAngle[surfI];
603 if (globalPatchInfo.set(surfI))
608 globalPatchInfo[surfI].clone()
611 blockLevel_[globalRegionI] = globalBlockLevel[surfI];
612 leakLevel_[globalRegionI] = globalLeakLevel[surfI];
613 addBufferLayers_[globalRegionI] = globalBufferLayers[surfI];
619 const label globalRegionI = regionOffset_[surfI] + iter.key();
621 minLevel_[globalRegionI] = iter.val();
622 maxLevel_[globalRegionI] = regionMaxLevel[surfI][iter.key()];
623 gapLevel_[globalRegionI] =
624 maxLevel_[globalRegionI]
625 + regionLevelIncr[surfI][iter.key()];
630 const label globalRegionI = regionOffset_[surfI] + iter.key();
632 extendedGapLevel_[globalRegionI] =
633 regionGapLevel[surfI][iter.key()];
634 extendedGapMode_[globalRegionI] =
635 regionGapMode[surfI][iter.key()];
636 selfProximity_[globalRegionI] =
637 regionGapSelf[surfI][iter.key()];
642 const label globalRegionI = regionOffset_[surfI] + iter.key();
643 extendedCurvatureLevel_[globalRegionI] = iter.val();
648 const label globalRegionI = regionOffset_[surfI] + iter.key();
649 perpendicularAngle_[globalRegionI] = iter.val();
652 const Map<autoPtr<dictionary>>& localInfo = regionPatchInfo[surfI];
655 const label globalRegionI = regionOffset_[surfI] + iter.key();
658 patchInfo_.set(globalRegionI,
dict.clone());
663 const label globalRegionI = regionOffset_[surfI] + iter.key();
665 blockLevel_[globalRegionI] = iter.val();
666 leakLevel_[globalRegionI] = iter.val();
670 const label globalRegionI = regionOffset_[surfI] + iter.key();
671 addBufferLayers_[globalRegionI] = iter.val();
677Foam::refinementSurfaces::refinementSurfaces
692 allGeometry_(allGeometry),
695 surfZones_(surfZones),
696 regionOffset_(regionOffset),
697 regionToSurface_(calcSurfaceIndex(allGeometry, surfaces)),
701 perpendicularAngle_(perpendicularAngle),
702 patchInfo_(patchInfo.size()),
709 patchInfo_.set(pI,
patchInfo.set(pI,
nullptr));
719 const label globalRegionI
722 const label surfI = regionToSurface_[globalRegionI];
723 const label localI = globalRegionI-regionOffset_[surfI];
795 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
812 label globalI = globalRegion(surfI, regionI);
814 extendedCurvatureLevel_[globalI];
815 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
828 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
835 if (geom.globalSize() > 10)
840 geom.boundingSpheres(ctrs, radiusSqr);
847 List<pointIndexHit> info;
848 geom.findNearest(ctrs, radiusSqr, info);
852 geom.getRegion(info, region);
859 minLevelField[i] = minLevel(surfI, region[i]);
867 shells.findHigherLevel(ctrs, minLevelField, shellLevel);
880 const triSurface& ts = *tsPtr;
888 const labelledTri& t = ts[triI];
889 label level = shellLevel[triI];
892 minPointLevel[t[tI]] =
min(minPointLevel[t[tI]], level);
899 shells.findHigherLevel(
points, minPointLevel, pointLevel);
905 const labelledTri& t = ts[triI];
906 label fLevel = shellLevel[triI];
909 (pointLevel[t[0]] != fLevel)
910 || (pointLevel[t[1]] != fLevel)
911 || (pointLevel[t[2]] != fLevel)
918 shellLevel[triI] = -1;
925 Info<<
"For geometry " << geom.name()
928 <<
" uncached triangles out of " << geom.globalSize()
939 if (
min(minLevelField[i], shellLevel[i]) < 0)
941 minLevelField[i] = -1;
945 minLevelField[i] =
max(minLevelField[i], shellLevel[i]);
950 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
960 const scalar cosAngle,
961 const scalar level0EdgeLength
964 const labelList maxCurvLevel(maxCurvatureLevel());
970 if (maxCurvLevel[surfI] <= 0)
989 geom.boundingSpheres(ctrs, radiusSqr);
1001 geom.findNearest(ctrs, radiusSqr, info);
1005 geom.getRegion(info, region);
1009 geom.getField(info, cachedField);
1016 const label globali = globalRegion(surfI, region[i]);
1017 curvIgnore[i] = extendedCurvatureLevel_[globali][3];
1018 nCurvCells[i] = extendedCurvatureLevel_[globali][0];
1020 surfMax[i] = extendedCurvatureLevel_[globali][2];
1022 minLevelField[i] = minLevel(surfI, region[i]);
1023 if (cachedField.size() > i)
1026 max(minLevelField[i], cachedField[i]);
1039 const auto& ts = *tsPtr;
1041 auto& curv = tcurv.ref();
1046 const auto& edgeFaces = ts.edgeFaces();
1047 const auto& edges = ts.edges();
1048 const auto&
points = ts.points();
1049 const auto&
mp = ts.meshPoints();
1054 const auto& eFaces = edgeFaces[edgei];
1055 const edge meshE(mp, edges[edgei]);
1057 if (eFaces.size() == 2)
1059 const auto& f0 = ts[eFaces[0]];
1060 const auto& f1 = ts[eFaces[1]];
1065 const auto dir0 = f0.edgeDirection(meshE);
1066 const auto dir1 = f1.edgeDirection(meshE);
1068 if (dir0 && ((dir0 > 0) == (dir1 > 0)))
1076 if ((n0&n1) < cosAngle)
1078 isOnSharpEdge.set(meshE[0]);
1079 isOnSharpEdge.set(meshE[1]);
1086 bitSet oldOnSharpEdge(isOnSharpEdge);
1087 isOnSharpEdge =
false;
1088 for (
const auto&
f : ts)
1090 for (
const label pointi :
f)
1092 if (oldOnSharpEdge[pointi])
1095 isOnSharpEdge.set(
f);
1120 for (
const label pointi : isOnSharpEdge)
1126 str().write(
points[pointi]);
1147 const label level = curvIgnore[i];
1151 const scalar length = level0EdgeLength/(2<<level);
1152 const scalar invLength = 1.0/length;
1153 for (
const label pointi : ts[i])
1157 invLength < pointMinCurv[pointi]
1158 && curv[pointi] > SMALL
1172 pointMinCurv[pointi] =
1173 min(pointMinCurv[pointi], invLength);
1180 forAll(pointMinCurv, pointi)
1182 if (pointMinCurv[pointi] < curv[pointi])
1200 const auto&
f = ts[i];
1202 cellCurv[i] =
max(curv[
f[0]],
max(curv[
f[1]], curv[
f[2]]));
1225 if (cellCurv[i] > SMALL && nCurvCells[i] > 0)
1242 const scalar r = scalar(1.0)/cellCurv[i];
1243 const scalar level =
1244 log2(nCurvCells[i]*level0EdgeLength/r);
1245 const label l = round(level);
1247 if (l > minLevelField[i] && l <= surfMax[i])
1249 minLevelField[i] = l;
1282 if (surfaces_.empty())
1287 if (surfaces_.size() == 1)
1306 geom.
getRegion(intersectionInfo, region);
1308 forAll(intersectionInfo, i)
1310 if (intersectionInfo[i].hit())
1312 surfaceOnlyLevel[i] =
minLevel(surfI, region[i]);
1334 if (localLevel[i] > currentLevel[i])
1337 surfaceLevel[i] = localLevel[i];
1365 geom.
getRegion(intersectionInfo, region);
1367 forAll(intersectionInfo, i)
1369 if (intersectionInfo[i].hit())
1371 surfaceOnlyLevel[i] =
minLevel(surfI, region[i]);
1394 label pointI = intersectionToPoint[i];
1396 if (localLevel[i] > currentLevel[pointI])
1400 surfaceLevel[pointI] = localLevel[i];
1404 p0[missI] = start[pointI];
1405 p1[missI] = end[pointI];
1406 intersectionToPoint[missI] = pointI;
1421 intersectionToPoint.
setSize(missI);
1422 intersectionInfo.
setSize(missI);
1436 List<vectorList>& surfaceNormal,
1440 surfaceLevel.setSize(start.size());
1441 surfaceNormal.setSize(start.size());
1443 if (surfaces_.empty())
1455 surface.findLineAll(start, end, hitInfo);
1464 n += hitInfo[pointI].
size();
1477 surfInfo[
n] = pHits[i];
1478 pointMap[
n] = pointI;
1485 surface.getRegion(surfInfo, surfRegion);
1486 surface.getNormal(surfInfo, surfNormal);
1496 label region = globalRegion(surfI, surfRegion[i]);
1497 label pointI = pointMap[i];
1501 currentLevel[pointI] >= globalMinLevel[region]
1502 && currentLevel[pointI] < globalMaxLevel[region]
1506 label sz = surfaceNormal[pointI].size();
1507 surfaceNormal[pointI].setSize(sz+1);
1508 surfaceNormal[pointI][sz] = surfNormal[i];
1510 surfaceLevel[pointI].setSize(sz+1);
1511 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1527 List<pointList>& surfaceLocation,
1528 List<vectorList>& surfaceNormal,
1532 surfaceLevel.setSize(start.size());
1533 surfaceNormal.setSize(start.size());
1534 surfaceLocation.setSize(start.size());
1536 if (surfaces_.empty())
1548 surface.findLineAll(start, end, hitInfo);
1557 n += hitInfo[pointI].
size();
1570 surfInfo[
n] = pHits[i];
1571 pointMap[
n] = pointI;
1578 surface.getRegion(surfInfo, surfRegion);
1579 surface.getNormal(surfInfo, surfNormal);
1586 label region = globalRegion(surfI, surfRegion[i]);
1587 label pointI = pointMap[i];
1591 currentLevel[pointI] >= globalMinLevel[region]
1592 && currentLevel[pointI] < globalMaxLevel[region]
1596 label sz = surfaceNormal[pointI].size();
1600 surfaceNormal[pointI].setSize(sz+1);
1601 surfaceNormal[pointI][sz] = surfNormal[i];
1603 surfaceLevel[pointI].setSize(sz+1);
1606 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1724 forAll(surfacesToTest, testI)
1726 label surfI = surfacesToTest[testI];
1743 forAll(nearestInfo, pointI)
1745 if (nearestInfo[pointI].hit())
1747 hit1[pointI] = nearestInfo[pointI];
1748 surface1[pointI] = surfI;
1749 region1[pointI] = region[pointI];
1750 nearest[pointI] = hit1[pointI].hitPoint();
1761 surface2 = surface1;
1768 if (hit1[pointI].hit())
1770 nearest[pointI] = hit1[pointI].point();
1775 nearest[pointI] = end[pointI];
1779 forAll(surfacesToTest, testI)
1781 label surfI = surfacesToTest[testI];
1798 forAll(nearestInfo, pointI)
1800 if (nearestInfo[pointI].hit())
1802 hit2[pointI] = nearestInfo[pointI];
1803 surface2[pointI] = surfI;
1804 region2[pointI] = region[pointI];
1805 nearest[pointI] = hit2[pointI].hitPoint();
1815 if (hit1[pointI].hit() && !hit2[pointI].hit())
1817 hit2[pointI] = hit1[pointI];
1818 surface2[pointI] = surface1[pointI];
1819 region2[pointI] = region1[pointI];
1832 List<pointIndexHit>& hit1,
1837 List<pointIndexHit>& hit2,
1846 surface1.
setSize(start.size());
1848 hit1.setSize(start.size());
1849 region1.setSize(start.size());
1851 normal1.setSize(start.size());
1857 List<pointIndexHit> nearestInfo(start.size());
1861 forAll(surfacesToTest, testI)
1863 label surfI = surfacesToTest[testI];
1864 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
1867 geom.findLine(start, nearest, nearestInfo);
1868 geom.getRegion(nearestInfo, region);
1869 geom.getNormal(nearestInfo, normal);
1871 forAll(nearestInfo, pointI)
1873 if (nearestInfo[pointI].hit())
1875 hit1[pointI] = nearestInfo[pointI];
1876 surface1[pointI] = surfI;
1877 region1[pointI] = region[pointI];
1878 normal1[pointI] = normal[pointI];
1879 nearest[pointI] = hit1[pointI].hitPoint();
1890 surface2 = surface1;
1898 if (hit1[pointI].hit())
1900 nearest[pointI] = hit1[pointI].point();
1905 nearest[pointI] =
end[pointI];
1909 forAll(surfacesToTest, testI)
1911 label surfI = surfacesToTest[testI];
1915 geom.
findLine(end, nearest, nearestInfo);
1916 geom.getRegion(nearestInfo, region);
1917 geom.getNormal(nearestInfo, normal);
1919 forAll(nearestInfo, pointI)
1921 if (nearestInfo[pointI].hit())
1923 hit2[pointI] = nearestInfo[pointI];
1924 surface2[pointI] = surfI;
1925 region2[pointI] = region[pointI];
1926 normal2[pointI] = normal[pointI];
1927 nearest[pointI] = hit2[pointI].hitPoint();
1937 if (hit1[pointI].hit() && !hit2[pointI].hit())
1939 hit2[pointI] = hit1[pointI];
1940 surface2[pointI] = surface1[pointI];
1941 region2[pointI] = region1[pointI];
1942 normal2[pointI] = normal1[pointI];
1958 surface1.setSize(start.size());
1960 normal1.setSize(start.size());
1966 List<pointIndexHit> nearestInfo(start.size());
1972 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
1975 geom.findLine(start, nearest, nearestInfo);
1976 geom.getNormal(nearestInfo, normal);
1978 forAll(nearestInfo, pointI)
1980 if (nearestInfo[pointI].hit())
1982 surface1[pointI] = surfI;
1983 normal1[pointI] = normal[pointI];
1984 nearest[pointI] = nearestInfo[pointI].point();
1999 List<pointIndexHit>& hitInfo1,
2004 surface1.
setSize(start.size());
2006 region1.setSize(start.size());
2008 hitInfo1.setSize(start.size());
2010 normal1.setSize(start.size());
2016 List<pointIndexHit> nearestInfo(start.size());
2022 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
2025 geom.findLine(start, nearest, nearestInfo);
2026 geom.getRegion(nearestInfo, region);
2027 geom.getNormal(nearestInfo, normal);
2029 forAll(nearestInfo, pointI)
2031 if (nearestInfo[pointI].hit())
2033 surface1[pointI] = surfI;
2034 region1[pointI] = region[pointI];
2035 hitInfo1[pointI] = nearestInfo[pointI];
2036 normal1[pointI] = normal[pointI];
2037 nearest[pointI] = nearestInfo[pointI].point();
2050 List<pointIndexHit>& hitInfo1,
2058 surface1.
setSize(start.size());
2060 hitInfo1.setSize(start.size());
2062 normal1.setSize(start.size());
2068 List<pointIndexHit> nearestInfo(start.size());
2074 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
2077 geom.findLine(start, nearest, nearestInfo);
2078 geom.getNormal(nearestInfo, normal);
2080 forAll(nearestInfo, pointI)
2082 if (nearestInfo[pointI].hit())
2084 surface1[pointI] = surfI;
2085 hitInfo1[pointI] = nearestInfo[pointI];
2086 normal1[pointI] = normal[pointI];
2087 nearest[pointI] = nearestInfo[pointI].point();
2100 List<pointIndexHit>& hitInfo
2138 forAll(hitSurface, pointI)
2140 if (hitSurface[pointI] != -1)
2142 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2160 List<pointIndexHit> hitInfo;
2172 forAll(hitSurface, pointI)
2174 if (hitSurface[pointI] != -1)
2176 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2181 hitRegion.setSize(hitSurface.size());
2184 forAll(surfacesToTest, i)
2186 label surfI = surfacesToTest[i];
2201 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2205 hitRegion[localIndices[i]] = localRegion[i];
2217 List<pointIndexHit>& hitInfo,
2236 forAll(hitSurface, pointI)
2238 if (hitSurface[pointI] != -1)
2240 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2245 hitRegion.setSize(hitSurface.size());
2247 hitNormal.setSize(hitSurface.size());
2250 forAll(surfacesToTest, i)
2252 label surfI = surfacesToTest[i];
2268 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2272 hitRegion[localIndices[i]] = localRegion[i];
2277 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2281 hitNormal[localIndices[i]] = localNormal[i];
2340 insideSurfaces = -1;
2344 label surfI = testSurfaces[i];
2349 surfZones_[surfI].zoneInside();
2358 <<
"Trying to use surface "
2360 <<
" which has non-geometric inside selection method "
2365 if (surface.hasVolumeType())
2368 surface.getVolumeType(pt, volType);
2372 if (insideSurfaces[pointI] == -1)
2386 insideSurfaces[pointI] = surfI;
2404 List<pointIndexHit>& hitInfo
2422 forAll(hitSurface, pointI)
2424 if (hitSurface[pointI] != -1)
2426 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2441 List<pointIndexHit>& hitInfo,
2461 forAll(hitSurface, pointI)
2463 if (hitSurface[pointI] != -1)
2465 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2470 hitRegion.setSize(hitSurface.size());
2472 hitNormal.setSize(hitSurface.size());
2475 forAll(surfacesToTest, i)
2477 label surfI = surfacesToTest[i];
2493 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2497 hitRegion[localIndices[i]] = localRegion[i];
2502 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2506 hitNormal[localIndices[i]] = localNormal[i];
A 1D vector of objects of type <T> with a fixed length <N>.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
label size() const noexcept
The number of elements in table.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
const word & name() const noexcept
Return the object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void setSize(label n)
Alias for resize().
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
const Field< point_type > & points() const noexcept
Return reference to global points.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
autoPtr< dictionary > clone() const
Construct and return clone.
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
wordList toc() const
Return the table of contents.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A keyword and a list of tokens is an 'entry'.
const keyType & keyword() const noexcept
Return keyword.
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary, otherwise Fatal.
@ REGEX
Regular expression.
A triFace with additional (region) index.
static Type get(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX, const Type &deflt=Zero)
Wrapper around dictionary::get which does not exit.
labelList maxGapLevel() const
Per surface the maximum extendedGapLevel over all its regions.
const labelList & gapLevel() const
From global region number to small gap refinement level.
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.
const PtrList< dictionary > & patchInfo() const
From global region number to patch type.
labelPair whichSurface(const label globalRegionI) const
From global region to surface + region.
void findNearest(const labelList &surfacesToTest, const pointField &samples, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest point on surfaces.
labelList maxCurvatureLevel() const
Per surface the maximum curvatureLevel over all its regions.
const wordList & names() const
Names of surfaces.
label globalRegion(const label surfI, const label regionI) const
From surface and region on surface to global region.
const labelList & surfaces() const
void findInside(const labelList &surfacesToTest, const pointField &pt, labelList &insideSurfaces) const
Detect if a point is 'inside' (closed) surfaces.
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.
void setCurvatureMinLevelFields(const scalar cosAngle, const scalar level0EdgeLength)
Update minLevelFields according to (triSurface-only) curvature.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Used for debugging only: find intersection of edge.
const labelList & minLevel() const
From global region number to refinement level.
const labelList & maxLevel() const
From global region number to refinement level.
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.
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.
const scalarField & perpendicularAngle() const
From global region number to perpendicular angle.
const PtrList< surfaceZonesInfo > & surfZones() const
const labelList & regionOffset() const
From surface to starting global region.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const =0
From a set of points and indices get the region.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Find first intersection on segment from start to end.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
virtual void getField(const List< pointIndexHit > &, labelList &values) const
WIP. From a set of hits (points and.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Return any intersection on segment from start to end.
virtual label globalSize() const
Range of global indices that can be returned.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const =0
From a set of points and indices get the normal.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const =0
Get bounding spheres (centre and radius squared), one per element.
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.
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.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
const wordList & names() const
Surface names, not region names.
Encapsulates queries for volume refinement ('refine all cells within shell').
Contains information about location on a triSurface.
areaSelectionAlgo
Types of selection of area.
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
Triangulated surface description with patch information.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
const word & str() const
The string representation of the volume type enumeration.
@ OUTSIDE
A location outside the volume.
@ MIXED
A location that is partly inside and outside.
@ INSIDE
A location inside the volume.
A class for handling words, derived from Foam::string.
const volScalarField & p0
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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))
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
const dimensionedScalar mp
Proton mass.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc).
Pair< label > labelPair
A pair of labels.
List< word > wordList
List of word.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
UIndirectList< label > labelUIndList
UIndirectList of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
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...
Field< vector > vectorField
Specialisation of Field<T> for vector.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
errorManipArg< error, int > exit(error &err, const int errNo=1)
surfacesMesh setField(triSurfaceToAgglom)
#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.
scalarField samples(nIntervals, Zero)