48 geom.
getField(intersectionInfo, minLevelField);
62 forAll(intersectionInfo, i)
64 if (intersectionInfo[i].hit())
69 if (minLevelField.
size())
71 if (minLevelField[i] == -1)
77 localLevel[i] =
max(localLevel[i], minLevelField[i]);
100 samples[i] = intersectionInfo[retestSet[i]].hitPoint();
111 label sampleI = retestSet[i];
112 localLevel[sampleI] =
max(localLevel[sampleI], shellLevel[i]);
127 const label gapLevelIncrement
130 allGeometry_(allGeometry),
131 surfaces_(surfacesDict.size()),
132 names_(surfacesDict.size()),
133 surfZones_(surfacesDict.size()),
134 regionOffset_(surfacesDict.size())
141 forAll(allGeometry_.names(), geomI)
143 const word& geomName = allGeometry_.names()[geomI];
145 if (surfacesDict.
found(geomName))
152 surfaces_.setSize(surfI);
153 names_.setSize(surfI);
154 surfZones_.setSize(surfI);
155 regionOffset_.setSize(surfI);
183 forAll(allGeometry_.names(), geomI)
185 const word& geomName = allGeometry_.names()[geomI];
194 names_[surfI] = geomName;
195 surfaces_[surfI] = geomI;
198 globalMinLevel[surfI] = refLevel[0];
199 globalMaxLevel[surfI] = refLevel[1];
200 globalLevelIncr[surfI] =
dict.lookupOrDefault
208 globalMinLevel[surfI] < 0
209 || globalMaxLevel[surfI] < globalMinLevel[surfI]
210 || globalLevelIncr[surfI] < 0
214 <<
"Illegal level specification for surface "
216 <<
" : minLevel:" << globalMinLevel[surfI]
217 <<
" maxLevel:" << globalMaxLevel[surfI]
218 <<
" levelIncrement:" << globalLevelIncr[surfI]
225 globalGapLevel[surfI] =
dict.lookupOrDefault
230 globalGapMode[surfI] = volumeType::names
235 volumeType::names[volumeType::MIXED]
240 globalGapMode[surfI] == volumeType::UNKNOWN
241 || globalGapLevel[surfI][0] < 0
242 || globalGapLevel[surfI][1] < 0
243 || globalGapLevel[surfI][2] < 0
244 || globalGapLevel[surfI][1] > globalGapLevel[surfI][2]
248 <<
"Illegal gapLevel specification for surface "
250 <<
" : gapLevel:" << globalGapLevel[surfI]
251 <<
" gapMode:" << volumeType::names[globalGapMode[surfI]]
262 if (
dict.found(
"patchInfo"))
267 dict.subDict(
"patchInfo").clone()
270 dict.readIfPresent(
"perpendicularAngle", globalAngle[surfI]);
272 if (
dict.found(
"regions"))
277 forAll(regionNames, regionI)
279 if (regionsDict.
found(regionNames[regionI]))
289 regionMinLevel[surfI].insert(regionI, refLevel[0]);
290 regionMaxLevel[surfI].insert(regionI, refLevel[1]);
296 regionLevelIncr[surfI].insert(regionI, levelIncr);
301 || refLevel[1] < refLevel[0]
306 <<
"Illegal level specification for surface "
307 << names_[surfI] <<
" region "
308 << regionNames[regionI]
309 <<
" : minLevel:" << refLevel[0]
310 <<
" maxLevel:" << refLevel[1]
311 <<
" levelIncrement:" << levelIncr
327 regionGapLevel[surfI].insert(regionI, gapSpec);
335 volumeType::names[volumeType::MIXED]
339 regionGapMode[surfI].insert(regionI, gapModeSpec);
342 gapModeSpec == volumeType::UNKNOWN
346 || gapSpec[1] > gapSpec[2]
350 <<
"Illegal gapLevel specification for surface "
352 <<
" : gapLevel:" << gapSpec
353 <<
" gapMode:" << volumeType::names[gapModeSpec]
358 if (regionDict.
found(
"perpendicularAngle"))
360 regionAngle[surfI].insert
365 regionDict.
lookup(
"perpendicularAngle")
370 if (regionDict.
found(
"patchInfo"))
372 regionPatchInfo[surfI].insert
385 if (unmatchedKeys.
size() > 0)
390 ) <<
"Not all entries in refinementSurfaces dictionary were used."
391 <<
" The following entries were not used : "
402 regionOffset_[surfI] = nRegions;
403 nRegions += allGeometry_[surfaces_[surfI]].regions().size();
407 minLevel_.setSize(nRegions);
409 maxLevel_.setSize(nRegions);
411 gapLevel_.setSize(nRegions);
413 extendedGapLevel_.setSize(nRegions);
414 extendedGapLevel_ = nullGapLevel;
415 extendedGapMode_.
setSize(nRegions);
416 extendedGapMode_ = volumeType::UNKNOWN;
417 perpendicularAngle_.setSize(nRegions);
418 perpendicularAngle_ = -GREAT;
419 patchInfo_.setSize(nRegions);
422 forAll(globalMinLevel, surfI)
424 label nRegions = allGeometry_[surfaces_[surfI]].regions().size();
427 for (
label i = 0; i < nRegions; i++)
429 label globalRegionI = regionOffset_[surfI] + i;
430 minLevel_[globalRegionI] = globalMinLevel[surfI];
431 maxLevel_[globalRegionI] = globalMaxLevel[surfI];
432 gapLevel_[globalRegionI] =
433 maxLevel_[globalRegionI]
434 + globalLevelIncr[surfI];
435 extendedGapLevel_[globalRegionI] = globalGapLevel[surfI];
436 extendedGapMode_[globalRegionI] = globalGapMode[surfI];
437 perpendicularAngle_[globalRegionI] = globalAngle[surfI];
438 if (globalPatchInfo.
set(surfI))
443 globalPatchInfo[surfI].clone()
451 label globalRegionI = regionOffset_[surfI] + iter.key();
453 minLevel_[globalRegionI] = iter();
454 maxLevel_[globalRegionI] = regionMaxLevel[surfI][iter.key()];
455 gapLevel_[globalRegionI] =
456 maxLevel_[globalRegionI]
457 + regionLevelIncr[surfI][iter.key()];
458 extendedGapLevel_[globalRegionI] =
459 regionGapLevel[surfI][iter.key()];
460 extendedGapMode_[globalRegionI] =
461 regionGapMode[surfI][iter.key()];
465 label globalRegionI = regionOffset_[surfI] + iter.key();
467 perpendicularAngle_[globalRegionI] = regionAngle[surfI][iter.key()];
473 label globalRegionI = regionOffset_[surfI] + iter.key();
475 patchInfo_.set(globalRegionI, iter()().clone());
495 allGeometry_(allGeometry),
498 surfZones_(surfZones),
499 regionOffset_(regionOffset),
503 perpendicularAngle_(perpendicularAngle),
504 patchInfo_(patchInfo.
size())
508 if (patchInfo.
set(pI))
510 patchInfo_.set(pI, patchInfo.
set(pI, NULL));
581 forAll(regionNames, regionI)
585 surfaceMax[surfI] =
max(surfaceMax[surfI], gapInfo[2]);
629 minLevelField[i] = minLevel(surfI, region[i]);
642 if (isA<triSurface>(geom))
648 const triSurface& ts = refCast<const triSurface>(geom);
657 label level = shellLevel[triI];
660 minPointLevel[t[tI]] =
min(minPointLevel[t[tI]], level);
674 label fLevel = shellLevel[triI];
677 (pointLevel[t[0]] != fLevel)
678 || (pointLevel[t[1]] != fLevel)
679 || (pointLevel[t[2]] != fLevel)
686 shellLevel[triI] = -1;
691 Info<<
"For geometry " << geom.
name()
693 <<
" uncached triangles out of " << geom.
globalSize()
703 if (
min(minLevelField[i], shellLevel[i]) < 0)
705 minLevelField[i] = -1;
709 minLevelField[i] =
max(minLevelField[i], shellLevel[i]);
734 surfaces.
setSize(start.size());
736 surfaceLevel.
setSize(start.size());
739 if (surfaces_.empty())
744 if (surfaces_.size() == 1)
759 labelList surfaceOnlyLevel(start.size(), -1);
763 geom.
getRegion(intersectionInfo, region);
765 forAll(intersectionInfo, i)
767 if (intersectionInfo[i].hit())
769 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
791 if (localLevel[i] > currentLevel[i])
794 surfaceLevel[i] = localLevel[i];
822 geom.
getRegion(intersectionInfo, region);
824 forAll(intersectionInfo, i)
826 if (intersectionInfo[i].hit())
828 surfaceOnlyLevel[i] = minLevel(surfI, region[i]);
851 label pointI = intersectionToPoint[i];
853 if (localLevel[i] > currentLevel[pointI])
856 surfaces[pointI] = surfI;
857 surfaceLevel[pointI] = localLevel[i];
861 p0[missI] = start[pointI];
862 p1[missI] = end[pointI];
863 intersectionToPoint[missI] = pointI;
878 intersectionToPoint.
setSize(missI);
879 intersectionInfo.
setSize(missI);
896 surfaceLevel.
setSize(start.size());
897 surfaceNormal.
setSize(start.size());
899 if (surfaces_.empty())
913 surface.findLineAll(start, end, hitInfo);
922 n += hitInfo[pointI].
size();
935 surfInfo[
n] = pHits[i];
936 pointMap[
n] = pointI;
943 surface.getRegion(surfInfo, surfRegion);
944 surface.getNormal(surfInfo, surfNormal);
954 label region = globalRegion(surfI, surfRegion[i]);
955 label pointI = pointMap[i];
957 if (globalRegionLevel[region] > currentLevel[pointI])
961 surfaceNormal[pointI].
setSize(sz+1);
962 surfaceNormal[pointI][sz] = surfNormal[i];
964 surfaceLevel[pointI].
setSize(sz+1);
965 surfaceLevel[pointI][sz] = globalRegionLevel[region];
985 surfaceLevel.
setSize(start.size());
986 surfaceNormal.
setSize(start.size());
989 if (surfaces_.empty())
1003 surface.findLineAll(start, end, hitInfo);
1012 n += hitInfo[pointI].
size();
1025 surfInfo[
n] = pHits[i];
1026 pointMap[
n] = pointI;
1033 surface.getRegion(surfInfo, surfRegion);
1034 surface.getNormal(surfInfo, surfNormal);
1041 label region = globalRegion(surfI, surfRegion[i]);
1042 label pointI = pointMap[i];
1044 if (globalRegionLevel[region] > currentLevel[pointI])
1047 label sz = surfaceNormal[pointI].
size();
1051 surfaceNormal[pointI].
setSize(sz+1);
1052 surfaceNormal[pointI][sz] = surfNormal[i];
1054 surfaceLevel[pointI].
setSize(sz+1);
1055 surfaceLevel[pointI][sz] = globalRegionLevel[region];
1080 surface1.
setSize(start.size());
1083 region1.
setSize(start.size());
1091 forAll(surfacesToTest, testI)
1093 label surfI = surfacesToTest[testI];
1110 forAll(nearestInfo, pointI)
1112 if (nearestInfo[pointI].hit())
1114 hit1[pointI] = nearestInfo[pointI];
1115 surface1[pointI] = surfI;
1116 region1[pointI] = region[pointI];
1117 nearest[pointI] = hit1[pointI].hitPoint();
1128 surface2 = surface1;
1135 if (hit1[pointI].hit())
1137 nearest[pointI] = hit1[pointI].hitPoint();
1142 nearest[pointI] = end[pointI];
1146 forAll(surfacesToTest, testI)
1148 label surfI = surfacesToTest[testI];
1165 forAll(nearestInfo, pointI)
1167 if (nearestInfo[pointI].hit())
1169 hit2[pointI] = nearestInfo[pointI];
1170 surface2[pointI] = surfI;
1171 region2[pointI] = region[pointI];
1172 nearest[pointI] = hit2[pointI].hitPoint();
1182 if (hit1[pointI].hit() && !hit2[pointI].hit())
1184 hit2[pointI] = hit1[pointI];
1185 surface2[pointI] = surface1[pointI];
1186 region2[pointI] = region1[pointI];
1213 surface1.
setSize(start.size());
1216 region1.
setSize(start.size());
1218 normal1.setSize(start.size());
1228 forAll(surfacesToTest, testI)
1230 label surfI = surfacesToTest[testI];
1234 geom.
findLine(start, nearest, nearestInfo);
1238 forAll(nearestInfo, pointI)
1240 if (nearestInfo[pointI].hit())
1242 hit1[pointI] = nearestInfo[pointI];
1243 surface1[pointI] = surfI;
1244 region1[pointI] = region[pointI];
1245 normal1[pointI] =
normal[pointI];
1246 nearest[pointI] = hit1[pointI].hitPoint();
1257 surface2 = surface1;
1265 if (hit1[pointI].hit())
1267 nearest[pointI] = hit1[pointI].hitPoint();
1272 nearest[pointI] = end[pointI];
1276 forAll(surfacesToTest, testI)
1278 label surfI = surfacesToTest[testI];
1282 geom.
findLine(end, nearest, nearestInfo);
1286 forAll(nearestInfo, pointI)
1288 if (nearestInfo[pointI].hit())
1290 hit2[pointI] = nearestInfo[pointI];
1291 surface2[pointI] = surfI;
1292 region2[pointI] = region[pointI];
1293 normal2[pointI] =
normal[pointI];
1294 nearest[pointI] = hit2[pointI].hitPoint();
1304 if (hit1[pointI].hit() && !hit2[pointI].hit())
1306 hit2[pointI] = hit1[pointI];
1307 surface2[pointI] = surface1[pointI];
1308 region2[pointI] = region1[pointI];
1309 normal2[pointI] = normal1[pointI];
1325 surface1.
setSize(start.size());
1327 normal1.setSize(start.size());
1342 geom.
findLine(start, nearest, nearestInfo);
1345 forAll(nearestInfo, pointI)
1347 if (nearestInfo[pointI].hit())
1349 surface1[pointI] = surfI;
1350 normal1[pointI] =
normal[pointI];
1351 nearest[pointI] = nearestInfo[pointI].hitPoint();
1372 surface1.
setSize(start.size());
1374 hitInfo1.
setSize(start.size());
1376 normal1.setSize(start.size());
1391 geom.
findLine(start, nearest, nearestInfo);
1394 forAll(nearestInfo, pointI)
1396 if (nearestInfo[pointI].hit())
1398 surface1[pointI] = surfI;
1399 hitInfo1[pointI] = nearestInfo[pointI];
1400 normal1[pointI] =
normal[pointI];
1401 nearest[pointI] = nearestInfo[pointI].hitPoint();
1452 forAll(hitSurface, pointI)
1454 if (hitSurface[pointI] != -1)
1456 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
1486 forAll(hitSurface, pointI)
1488 if (hitSurface[pointI] != -1)
1490 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
1498 forAll(surfacesToTest, i)
1500 label surfI = surfacesToTest[i];
1515 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
1519 hitRegion[localIndices[i]] = localRegion[i];
1550 forAll(hitSurface, pointI)
1552 if (hitSurface[pointI] != -1)
1554 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
1561 hitNormal.setSize(hitSurface.
size());
1564 forAll(surfacesToTest, i)
1566 label surfI = surfacesToTest[i];
1582 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
1586 hitRegion[localIndices[i]] = localRegion[i];
1591 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
1595 hitNormal[localIndices[i]] = localNormal[i];
1653 insideSurfaces.
setSize(pt.size());
1654 insideSurfaces = -1;
1658 label surfI = testSurfaces[i];
1663 surfZones_[surfI].zoneInside();
1672 <<
"Trying to use surface "
1674 <<
" which has non-geometric inside selection method "
1682 surface.getVolumeType(pt, volType);
1686 if (insideSurfaces[pointI] == -1)
1700 insideSurfaces[pointI] = surfI;
1736 forAll(hitSurface, pointI)
1738 if (hitSurface[pointI] != -1)
1740 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
1775 forAll(hitSurface, pointI)
1777 if (hitSurface[pointI] != -1)
1779 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
1786 hitNormal.setSize(hitSurface.
size());
1789 forAll(surfacesToTest, i)
1791 label surfI = surfacesToTest[i];
1807 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
1811 hitRegion[localIndices[i]] = localRegion[i];
1816 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
1820 hitNormal[localIndices[i]] = localNormal[i];