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];
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"))
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();
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]];
1031 const auto dir0 = f0.edgeDirection(meshE);
1032 const auto dir1 = f1.edgeDirection(meshE);
1034 if (dir0 && ((dir0 > 0) == (dir1 > 0)))
1042 if ((n0&n1) < cosAngle)
1044 isOnSharpEdge.set(meshE[0]);
1045 isOnSharpEdge.set(meshE[1]);
1052 bitSet oldOnSharpEdge(isOnSharpEdge);
1053 isOnSharpEdge =
false;
1054 for (
const auto&
f : ts)
1056 for (
const label pointi :
f)
1058 if (oldOnSharpEdge[pointi])
1061 isOnSharpEdge.set(
f);
1070 autoPtr<OBJstream> str;
1086 for (
const label pointi : isOnSharpEdge)
1092 str().write(
points[pointi]);
1113 const label level = curvIgnore[i];
1117 const scalar length = level0EdgeLength/(2<<level);
1118 const scalar invLength = 1.0/length;
1119 for (
const label pointi : ts[i])
1123 invLength < pointMinCurv[pointi]
1124 && curv[pointi] > SMALL
1138 pointMinCurv[pointi] =
1139 min(pointMinCurv[pointi], invLength);
1146 forAll(pointMinCurv, pointi)
1148 if (pointMinCurv[pointi] < curv[pointi])
1166 const auto&
f = ts[i];
1168 cellCurv[i] =
max(curv[
f[0]],
max(curv[
f[1]], curv[
f[2]]));
1191 if (cellCurv[i] > SMALL && nCurvCells[i] > 0)
1208 const scalar r = scalar(1.0)/cellCurv[i];
1209 const scalar level =
1210 log2(nCurvCells[i]*level0EdgeLength/r);
1211 const label l = round(level);
1213 if (l > minLevelField[i] && l <= surfMax[i])
1215 minLevelField[i] = l;
1223 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
1248 if (surfaces_.empty())
1253 if (surfaces_.size() == 1)
1272 geom.
getRegion(intersectionInfo, region);
1274 forAll(intersectionInfo, i)
1276 if (intersectionInfo[i].hit())
1278 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
1300 if (localLevel[i] > currentLevel[i])
1302 surfaces[i] = surfI;
1303 surfaceLevel[i] = localLevel[i];
1327 labelList surfaceOnlyLevel(intersectionInfo.size(), -1);
1331 geom.
getRegion(intersectionInfo, region);
1333 forAll(intersectionInfo, i)
1335 if (intersectionInfo[i].hit())
1337 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
1360 label pointI = intersectionToPoint[i];
1362 if (localLevel[i] > currentLevel[pointI])
1365 surfaces[pointI] = surfI;
1366 surfaceLevel[pointI] = localLevel[i];
1370 p0[missI] = start[pointI];
1371 p1[missI] =
end[pointI];
1372 intersectionToPoint[missI] = pointI;
1387 intersectionToPoint.
setSize(missI);
1388 intersectionInfo.setSize(missI);
1409 if (surfaces_.empty())
1415 List<List<pointIndexHit>> hitInfo;
1419 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1430 n += hitInfo[pointI].size();
1433 List<pointIndexHit> surfInfo(
n);
1439 const List<pointIndexHit>& pHits = hitInfo[pointI];
1443 surfInfo[
n] = pHits[i];
1444 pointMap[
n] = pointI;
1451 surface.getRegion(surfInfo, surfRegion);
1452 surface.getNormal(surfInfo, surfNormal);
1462 label region = globalRegion(surfI, surfRegion[i]);
1463 label pointI = pointMap[i];
1467 currentLevel[pointI] >= globalMinLevel[region]
1468 && currentLevel[pointI] < globalMaxLevel[region]
1472 label sz = surfaceNormal[pointI].
size();
1473 surfaceNormal[pointI].
setSize(sz+1);
1474 surfaceNormal[pointI][sz] = surfNormal[i];
1476 surfaceLevel[pointI].
setSize(sz+1);
1477 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1502 if (surfaces_.empty())
1508 List<List<pointIndexHit>> hitInfo;
1512 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1523 n += hitInfo[pointI].size();
1526 List<pointIndexHit> surfInfo(
n);
1532 const List<pointIndexHit>& pHits = hitInfo[pointI];
1536 surfInfo[
n] = pHits[i];
1537 pointMap[
n] = pointI;
1544 surface.getRegion(surfInfo, surfRegion);
1545 surface.getNormal(surfInfo, surfNormal);
1552 label region = globalRegion(surfI, surfRegion[i]);
1553 label pointI = pointMap[i];
1557 currentLevel[pointI] >= globalMinLevel[region]
1558 && currentLevel[pointI] < globalMaxLevel[region]
1562 label sz = surfaceNormal[pointI].
size();
1563 surfaceLocation[pointI].
setSize(sz+1);
1564 surfaceLocation[pointI][sz] = surfInfo[i].hitPoint();
1566 surfaceNormal[pointI].
setSize(sz+1);
1567 surfaceNormal[pointI][sz] = surfNormal[i];
1569 surfaceLevel[pointI].
setSize(sz+1);
1572 surfaceLevel[pointI][sz] = globalMaxLevel[region];
1690 forAll(surfacesToTest, testI)
1692 label surfI = surfacesToTest[testI];
1709 forAll(nearestInfo, pointI)
1711 if (nearestInfo[pointI].hit())
1713 hit1[pointI] = nearestInfo[pointI];
1714 surface1[pointI] = surfI;
1715 region1[pointI] = region[pointI];
1716 nearest[pointI] = hit1[pointI].hitPoint();
1727 surface2 = surface1;
1734 if (hit1[pointI].hit())
1736 nearest[pointI] = hit1[pointI].point();
1741 nearest[pointI] =
end[pointI];
1745 forAll(surfacesToTest, testI)
1747 label surfI = surfacesToTest[testI];
1764 forAll(nearestInfo, pointI)
1766 if (nearestInfo[pointI].hit())
1768 hit2[pointI] = nearestInfo[pointI];
1769 surface2[pointI] = surfI;
1770 region2[pointI] = region[pointI];
1771 nearest[pointI] = hit2[pointI].hitPoint();
1781 if (hit1[pointI].hit() && !hit2[pointI].hit())
1783 hit2[pointI] = hit1[pointI];
1784 surface2[pointI] = surface1[pointI];
1785 region2[pointI] = region1[pointI];
1827 forAll(surfacesToTest, testI)
1829 label surfI = surfacesToTest[testI];
1833 geom.
findLine(start, nearest, nearestInfo);
1837 forAll(nearestInfo, pointI)
1839 if (nearestInfo[pointI].hit())
1841 hit1[pointI] = nearestInfo[pointI];
1842 surface1[pointI] = surfI;
1843 region1[pointI] = region[pointI];
1844 normal1[pointI] = normal[pointI];
1845 nearest[pointI] = hit1[pointI].hitPoint();
1856 surface2 = surface1;
1864 if (hit1[pointI].hit())
1866 nearest[pointI] = hit1[pointI].point();
1871 nearest[pointI] =
end[pointI];
1875 forAll(surfacesToTest, testI)
1877 label surfI = surfacesToTest[testI];
1878 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
1881 geom.findLine(
end, nearest, nearestInfo);
1882 geom.getRegion(nearestInfo, region);
1883 geom.getNormal(nearestInfo, normal);
1885 forAll(nearestInfo, pointI)
1887 if (nearestInfo[pointI].hit())
1889 hit2[pointI] = nearestInfo[pointI];
1890 surface2[pointI] = surfI;
1891 region2[pointI] = region[pointI];
1892 normal2[pointI] = normal[pointI];
1893 nearest[pointI] = hit2[pointI].hitPoint();
1903 if (hit1[pointI].hit() && !hit2[pointI].hit())
1905 hit2[pointI] = hit1[pointI];
1906 surface2[pointI] = surface1[pointI];
1907 region2[pointI] = region1[pointI];
1908 normal2[pointI] = normal1[pointI];
1941 geom.
findLine(start, nearest, nearestInfo);
1944 forAll(nearestInfo, pointI)
1946 if (nearestInfo[pointI].hit())
1948 surface1[pointI] = surfI;
1949 normal1[pointI] = normal[pointI];
1950 nearest[pointI] = nearestInfo[pointI].point();
1991 geom.
findLine(start, nearest, nearestInfo);
1995 forAll(nearestInfo, pointI)
1997 if (nearestInfo[pointI].hit())
1999 surface1[pointI] = surfI;
2000 region1[pointI] = region[pointI];
2001 hitInfo1[pointI] = nearestInfo[pointI];
2002 normal1[pointI] = normal[pointI];
2003 nearest[pointI] = nearestInfo[pointI].point();
2043 geom.
findLine(start, nearest, nearestInfo);
2046 forAll(nearestInfo, pointI)
2048 if (nearestInfo[pointI].hit())
2050 surface1[pointI] = surfI;
2051 hitInfo1[pointI] = nearestInfo[pointI];
2052 normal1[pointI] = normal[pointI];
2053 nearest[pointI] = nearestInfo[pointI].point();
2104 forAll(hitSurface, pointI)
2106 if (hitSurface[pointI] != -1)
2108 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2138 forAll(hitSurface, pointI)
2140 if (hitSurface[pointI] != -1)
2142 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2150 forAll(surfacesToTest, i)
2152 label surfI = surfacesToTest[i];
2157 List<pointIndexHit> localHits
2159 UIndirectList<pointIndexHit>
2167 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2171 hitRegion[localIndices[i]] = localRegion[i];
2202 forAll(hitSurface, pointI)
2204 if (hitSurface[pointI] != -1)
2206 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2216 forAll(surfacesToTest, i)
2218 label surfI = surfacesToTest[i];
2223 List<pointIndexHit> localHits
2225 UIndirectList<pointIndexHit>
2234 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2238 hitRegion[localIndices[i]] = localRegion[i];
2243 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2247 hitNormal[localIndices[i]] = localNormal[i];
2306 insideSurfaces = -1;
2310 label surfI = testSurfaces[i];
2315 surfZones_[surfI].zoneInside();
2324 <<
"Trying to use surface " 2326 <<
" which has non-geometric inside selection method " 2334 surface.getVolumeType(pt, volType);
2338 if (insideSurfaces[pointI] == -1)
2352 insideSurfaces[pointI] = surfI;
2388 forAll(hitSurface, pointI)
2390 if (hitSurface[pointI] != -1)
2392 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2427 forAll(hitSurface, pointI)
2429 if (hitSurface[pointI] != -1)
2431 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2441 forAll(surfacesToTest, i)
2443 label surfI = surfacesToTest[i];
2448 List<pointIndexHit> localHits
2450 UIndirectList<pointIndexHit>
2459 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2463 hitRegion[localIndices[i]] = localRegion[i];
2468 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
2472 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.
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)