44 NamedEnum<shellSurfaces::refineMode, 3>::
66 if (modes_[shellI] != DISTANCE && distLevels.size() != 1)
69 <<
"For refinement mode "
70 << refineModeNames_[modes_[shellI]]
71 <<
" specify only one distance+level."
72 <<
" (its distance gets discarded)"
76 distances_[shellI].setSize(distLevels.size());
77 levels_[shellI].setSize(distLevels.size());
81 distances_[shellI][j] = distLevels[j].first();
82 levels_[shellI][j] = distLevels[j].second();
89 (distances_[shellI][j] <= distances_[shellI][j-1])
90 || (levels_[shellI][j] > levels_[shellI][j-1])
94 <<
"For refinement mode "
95 << refineModeNames_[modes_[shellI]]
96 <<
" : Refinement should be specified in order"
97 <<
" of increasing distance"
98 <<
" (and decreasing refinement level)." <<
endl
99 <<
"Distance:" << distances_[shellI][j]
100 <<
" refinementLevel:" << levels_[shellI][j]
108 if (modes_[shellI] == DISTANCE)
110 Info<<
"Refinement level according to distance to "
112 forAll(levels_[shellI], j)
114 Info<<
" level " << levels_[shellI][j]
115 <<
" for all cells within " << distances_[shellI][j]
116 <<
" metre." <<
endl;
124 <<
"Shell " << shell.
name()
125 <<
" does not support testing for "
126 << refineModeNames_[modes_[shellI]] <<
endl
127 <<
"Probably it is not closed."
131 if (modes_[shellI] == INSIDE)
133 Info<<
"Refinement level " << levels_[shellI][0]
134 <<
" for all cells inside " << shell.
name() <<
endl;
138 Info<<
"Refinement level " << levels_[shellI][0]
139 <<
" for all cells outside " << shell.
name() <<
endl;
160 if (modes_[shellI] == DISTANCE)
163 <<
"'gapLevel' specification cannot be used with mode "
164 << refineModeNames_[DISTANCE]
165 <<
" for shell " << shell.
name()
172 if (levels[0][0] > 0)
174 Info<<
"Refinement level up to " << levels[0][2]
175 <<
" for all cells in gaps for shell "
190 bool hasSurface =
false;
200 if (shell.triSurface::size())
223 const point outsidePt = overallBb.
max() + overallBb.
span();
235 refCast<const triSurfaceMesh>(
s)
255 Info<<
"shellSurfaces : Flipped orientation of surface "
257 <<
" so point " << outsidePt <<
" is outside." <<
endl;
273 const labelList& levels = levels_[shellI];
275 if (modes_[shellI] == DISTANCE)
288 label candidateI = 0;
294 if (levels[levelI] > maxLevel[pointI])
296 candidates[candidateI] = pt[pointI];
297 candidateMap[candidateI] = pointI;
298 candidateDistSqr[candidateI] =
sqr(distances[levelI]);
304 candidates.setSize(candidateI);
305 candidateMap.
setSize(candidateI);
306 candidateDistSqr.setSize(candidateI);
310 allGeometry_[shells_[shellI]].findNearest
329 label pointI = candidateMap[i];
332 maxLevel[pointI] = levels[minDistI+1];
345 label candidateI = 0;
349 if (levels[0] > maxLevel[pointI])
351 candidates[candidateI] = pt[pointI];
352 candidateMap[candidateI] = pointI;
356 candidates.setSize(candidateI);
357 candidateMap.
setSize(candidateI);
361 allGeometry_[shells_[shellI]].getVolumeType(candidates, volType);
365 label pointI = candidateMap[i];
370 modes_[shellI] == INSIDE
374 modes_[shellI] == OUTSIDE
379 maxLevel[pointI] = levels[0];
410 label candidateI = 0;
414 if (ptLevel[pointI] >= info[1] && ptLevel[pointI] < info[2])
416 candidateMap[candidateI++] = pointI;
419 candidateMap.
setSize(candidateI);
423 allGeometry_[shells_[shellI]].getVolumeType
431 label pointI = candidateMap[i];
438 (modes_[shellI] == INSIDE && isInside)
439 || (modes_[shellI] == OUTSIDE && !isInside)
441 && info[2] > gapInfo[pointI][2]
444 gapShell[pointI] = shellI;
445 gapInfo[pointI] = info;
446 gapMode[pointI] =
mode;
460 const labelList& levels = levels_[shellI];
462 if (modes_[shellI] == DISTANCE)
475 label candidateI = 0;
479 if (shell[pointI] == -1)
483 if (levels[levelI] <= minLevel[pointI])
485 candidates[candidateI] = pt[pointI];
486 candidateMap[candidateI] = pointI;
487 candidateDistSqr[candidateI] =
sqr(distances[levelI]);
494 candidates.setSize(candidateI);
495 candidateMap.
setSize(candidateI);
496 candidateDistSqr.setSize(candidateI);
500 allGeometry_[shells_[shellI]].findNearest
519 label pointI = candidateMap[i];
522 shell[pointI] = shellI;
523 minLevel[pointI] = levels[minDistI+1];
536 label candidateI = 0;
540 if (shell[pointI] == -1 && levels[0] <= minLevel[pointI])
542 candidates[candidateI] = pt[pointI];
543 candidateMap[candidateI] = pointI;
547 candidates.setSize(candidateI);
548 candidateMap.
setSize(candidateI);
552 allGeometry_[shells_[shellI]].getVolumeType(candidates, volType);
559 modes_[shellI] == INSIDE
563 modes_[shellI] == OUTSIDE
568 label pointI = candidateMap[i];
569 shell[pointI] = shellI;
570 minLevel[pointI] = levels[0];
585 allGeometry_(allGeometry)
593 const word& geomName = allGeometry_.names()[geomI];
595 if (shellsDict.
found(geomName))
603 shells_.setSize(shellI);
604 modes_.setSize(shellI);
605 distances_.setSize(shellI);
606 levels_.setSize(shellI);
608 extendedGapLevel_.setSize(shellI);
609 extendedGapMode_.setSize(shellI);
620 forAll(allGeometry_.names(), geomI)
622 const word& geomName = allGeometry_.names()[geomI];
631 shells_[shellI] = geomI;
632 modes_[shellI] = refineModeNames_.read(
dict.
lookup(
"mode"));
635 setAndCheckLevels(shellI,
dict.
lookup(
"levels"));
655 extendedGapLevel_[shellI].setSize(regionNames.
size());
656 extendedGapLevel_[shellI] = gapSpec;
669 extendedGapMode_[shellI].setSize(regionNames.
size());
670 extendedGapMode_[shellI] = gapModeSpec;
678 forAll(regionNames, regionI)
680 if (regionsDict.
found(regionNames[regionI]))
695 extendedGapLevel_[shellI][regionI] = gapSpec;
708 extendedGapMode_[shellI][regionI] = gapModeSpec;
714 checkGapLevels(
dict, shellI, extendedGapLevel_[shellI]);
720 if (unmatchedKeys.
size() > 0)
725 ) <<
"Not all entries in refinementRegions dictionary were used."
726 <<
" The following entries were not used : "
743 label overallMax = 0;
746 overallMax =
max(overallMax,
max(levels_[shellI]));
754 labelList surfaceMax(extendedGapLevel_.size(), 0);
756 forAll(extendedGapLevel_, shellI)
761 surfaceMax[shellI] =
max(surfaceMax[shellI], levels[i][2]);
780 findHigherLevel(pt, shellI, maxLevel);
803 gapInfo = nullGapLevel;
810 findHigherGapLevel(pt, ptLevel, shellI, gapShell, gapInfo, gapMode);
824 findHigherGapLevel(pt, ptLevel, gapShell, gapInfo, gapMode);
842 findLevel(pt, shellI, minLevel, shell);