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"))
358 wordHashSet unmatchedRegionKeys(regionsDict.toc());
367 unmatchedRegionKeys.erase(erPtr->keyword());
370 const dictionary& regionDict = regionsDict.subDict
377 meshRefinement::get<labelPair>
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;
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();
677 Foam::refinementSurfaces::refinementSurfaces
679 const searchableSurfaces& allGeometry,
682 const PtrList<surfaceZonesInfo>& surfZones,
688 PtrList<dictionary>& patchInfo,
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];
793 label globalI = globalRegion(surfI, regionI);
795 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
812 label globalI = globalRegion(surfI, regionI);
813 const FixedList<label, 4>& gapInfo =
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);
872 const auto* tsPtr = isA<triSurface>(geom);
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)
975 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
977 const auto* tsPtr = isA<triSurface>(geom);
989 geom.boundingSpheres(ctrs, radiusSqr);
1000 List<pointIndexHit> info;
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);
1104 autoPtr<OBJstream> str;
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;
1257 const_cast<searchableSurface&
>(geom).
setField(minLevelField);
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])
1336 surfaces[i] = surfI;
1337 surfaceLevel[i] = localLevel[i];
1361 labelList surfaceOnlyLevel(intersectionInfo.size(), -1);
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])
1399 surfaces[pointI] = surfI;
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);
1443 if (surfaces_.empty())
1449 List<List<pointIndexHit>> hitInfo;
1453 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1464 n += hitInfo[pointI].size();
1467 List<pointIndexHit> surfInfo(
n);
1473 const List<pointIndexHit>& pHits = hitInfo[pointI];
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];
1536 if (surfaces_.empty())
1542 List<List<pointIndexHit>> hitInfo;
1546 const searchableSurface&
surface = allGeometry_[surfaces_[surfI]];
1557 n += hitInfo[pointI].size();
1560 List<pointIndexHit> surfInfo(
n);
1566 const List<pointIndexHit>& pHits = hitInfo[pointI];
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();
1597 surfaceLocation[pointI].
setSize(sz+1);
1598 surfaceLocation[pointI][sz] = surfInfo[i].hitPoint();
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];
1861 forAll(surfacesToTest, testI)
1863 label surfI = surfacesToTest[testI];
1867 geom.
findLine(start, nearest, nearestInfo);
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];
1912 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
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];
1975 geom.
findLine(start, nearest, nearestInfo);
1978 forAll(nearestInfo, pointI)
1980 if (nearestInfo[pointI].hit())
1982 surface1[pointI] = surfI;
1983 normal1[pointI] = normal[pointI];
1984 nearest[pointI] = nearestInfo[pointI].point();
2025 geom.
findLine(start, nearest, nearestInfo);
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();
2077 geom.
findLine(start, nearest, nearestInfo);
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();
2138 forAll(hitSurface, pointI)
2140 if (hitSurface[pointI] != -1)
2142 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2172 forAll(hitSurface, pointI)
2174 if (hitSurface[pointI] != -1)
2176 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2184 forAll(surfacesToTest, i)
2186 label surfI = surfacesToTest[i];
2191 List<pointIndexHit> localHits
2193 UIndirectList<pointIndexHit>
2201 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
2205 hitRegion[localIndices[i]] = localRegion[i];
2236 forAll(hitSurface, pointI)
2238 if (hitSurface[pointI] != -1)
2240 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2250 forAll(surfacesToTest, i)
2252 label surfI = surfacesToTest[i];
2257 List<pointIndexHit> localHits
2259 UIndirectList<pointIndexHit>
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 " 2368 surface.getVolumeType(pt, volType);
2372 if (insideSurfaces[pointI] == -1)
2386 insideSurfaces[pointI] = surfI;
2422 forAll(hitSurface, pointI)
2424 if (hitSurface[pointI] != -1)
2426 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2461 forAll(hitSurface, pointI)
2463 if (hitSurface[pointI] != -1)
2465 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
2475 forAll(surfacesToTest, i)
2477 label surfI = surfacesToTest[i];
2482 List<pointIndexHit> localHits
2484 UIndirectList<pointIndexHit>
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];
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.
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.
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.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
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...
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.
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.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
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.
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)