1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*----------------------------------------------------------------------------*/
26 #include "refinementSurfaces.H"
28 #include "searchableSurfaces.H"
29 #include "shellSurfaces.H"
30 #include "triSurfaceMesh.H"
31 #include "labelPair.H"
32 #include "searchableSurfacesQueries.H"
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 const char* Foam::NamedEnum
42 Foam::refinementSurfaces::areaSelectionAlgo,
54 const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
55 Foam::refinementSurfaces::areaSelectionAlgoNames;
58 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60 Foam::refinementSurfaces::refinementSurfaces
62 const searchableSurfaces& allGeometry,
63 const dictionary& surfacesDict
66 allGeometry_(allGeometry),
67 surfaces_(surfacesDict.size()),
68 names_(surfacesDict.size()),
69 faceZoneNames_(surfacesDict.size()),
70 cellZoneNames_(surfacesDict.size()),
71 zoneInside_(surfacesDict.size(), NONE),
72 zoneInsidePoints_(surfacesDict.size()),
73 regionOffset_(surfacesDict.size())
75 // Wilcard specification : loop over all surface, all regions
76 // and try to find a match.
78 // Count number of surfaces.
80 forAll(allGeometry.names(), geomI)
82 const word& geomName = allGeometry_.names()[geomI];
84 if (surfacesDict.found(geomName))
91 surfaces_.setSize(surfI);
92 names_.setSize(surfI);
93 faceZoneNames_.setSize(surfI);
94 cellZoneNames_.setSize(surfI);
95 zoneInside_.setSize(surfI, NONE);
96 regionOffset_.setSize(surfI);
98 labelList globalMinLevel(surfI, 0);
99 labelList globalMaxLevel(surfI, 0);
100 scalarField globalAngle(surfI, -GREAT);
101 PtrList<dictionary> globalPatchInfo(surfI);
102 List<Map<label> > regionMinLevel(surfI);
103 List<Map<label> > regionMaxLevel(surfI);
104 List<Map<scalar> > regionAngle(surfI);
105 List<Map<autoPtr<dictionary> > > regionPatchInfo(surfI);
108 forAll(allGeometry.names(), geomI)
110 const word& geomName = allGeometry_.names()[geomI];
112 if (surfacesDict.found(geomName))
114 const dictionary& dict = surfacesDict.subDict(geomName);
116 names_[surfI] = geomName;
117 surfaces_[surfI] = geomI;
119 const labelPair refLevel(dict.lookup("level"));
120 globalMinLevel[surfI] = refLevel[0];
121 globalMaxLevel[surfI] = refLevel[1];
123 // Global zone names per surface
124 if (dict.readIfPresent("faceZone", faceZoneNames_[surfI]))
126 // Read optional entry to determine inside of faceZone
129 bool hasSide = dict.readIfPresent("cellZoneInside", method);
132 zoneInside_[surfI] = areaSelectionAlgoNames[method];
133 if (zoneInside_[surfI] == INSIDEPOINT)
135 dict.lookup("insidePoint") >> zoneInsidePoints_[surfI];
143 if (dict.readIfPresent("zoneInside", inside))
146 zoneInside_[surfI] = (inside ? INSIDE : OUTSIDE);
150 // Read optional cellZone name
152 if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
157 zoneInside_[surfI] == INSIDE
158 || zoneInside_[surfI] == OUTSIDE
160 && !allGeometry_[surfaces_[surfI]].hasVolumeType()
165 "refinementSurfaces::refinementSurfaces(..)",
167 ) << "Illegal entry zoneInside "
168 << areaSelectionAlgoNames[zoneInside_[surfI]]
170 << faceZoneNames_[surfI]
171 << " since surface " << names_[surfI]
172 << " is not closed." << endl;
179 "refinementSurfaces::refinementSurfaces(..)",
181 ) << "Unused entry zoneInside for faceZone "
182 << faceZoneNames_[surfI]
183 << " since no cellZone specified."
188 // Global perpendicular angle
189 if (dict.found("patchInfo"))
194 dict.subDict("patchInfo").clone()
197 dict.readIfPresent("perpendicularAngle", globalAngle[surfI]);
199 if (dict.found("regions"))
201 const dictionary& regionsDict = dict.subDict("regions");
202 const wordList& regionNames =
203 allGeometry_[surfaces_[surfI]].regions();
205 forAll(regionNames, regionI)
207 if (regionsDict.found(regionNames[regionI]))
209 // Get the dictionary for region
210 const dictionary& regionDict = regionsDict.subDict
215 const labelPair refLevel(regionDict.lookup("level"));
217 regionMinLevel[surfI].insert(regionI, refLevel[0]);
218 regionMaxLevel[surfI].insert(regionI, refLevel[1]);
220 if (regionDict.found("perpendicularAngle"))
222 regionAngle[surfI].insert
227 regionDict.lookup("perpendicularAngle")
232 if (regionDict.found("patchInfo"))
234 regionPatchInfo[surfI].insert
237 regionDict.subDict("patchInfo").clone()
247 // Calculate local to global region offset
250 forAll(surfaces_, surfI)
252 regionOffset_[surfI] = nRegions;
253 nRegions += allGeometry_[surfaces_[surfI]].regions().size();
256 // Rework surface specific information into information per global region
257 minLevel_.setSize(nRegions);
259 maxLevel_.setSize(nRegions);
261 perpendicularAngle_.setSize(nRegions);
262 perpendicularAngle_ = -GREAT;
263 patchInfo_.setSize(nRegions);
266 forAll(globalMinLevel, surfI)
268 label nRegions = allGeometry_[surfaces_[surfI]].regions().size();
270 // Initialise to global (i.e. per surface)
271 for (label i = 0; i < nRegions; i++)
273 label globalRegionI = regionOffset_[surfI] + i;
274 minLevel_[globalRegionI] = globalMinLevel[surfI];
275 maxLevel_[globalRegionI] = globalMaxLevel[surfI];
276 perpendicularAngle_[globalRegionI] = globalAngle[surfI];
277 if (globalPatchInfo.set(surfI))
282 globalPatchInfo[surfI].clone()
287 // Overwrite with region specific information
288 forAllConstIter(Map<label>, regionMinLevel[surfI], iter)
290 label globalRegionI = regionOffset_[surfI] + iter.key();
292 minLevel_[globalRegionI] = iter();
293 maxLevel_[globalRegionI] = regionMaxLevel[surfI][iter.key()];
298 minLevel_[globalRegionI] < 0
299 || maxLevel_[globalRegionI] < minLevel_[globalRegionI]
304 "refinementSurfaces::refinementSurfaces"
305 "(const searchableSurfaces&, const dictionary>&"
306 ) << "Illegal level or layer specification for surface "
308 << " : minLevel:" << minLevel_[globalRegionI]
309 << " maxLevel:" << maxLevel_[globalRegionI]
313 forAllConstIter(Map<scalar>, regionAngle[surfI], iter)
315 label globalRegionI = regionOffset_[surfI] + iter.key();
317 perpendicularAngle_[globalRegionI] = regionAngle[surfI][iter.key()];
320 const Map<autoPtr<dictionary> >& localInfo = regionPatchInfo[surfI];
321 forAllConstIter(Map<autoPtr<dictionary> >, localInfo, iter)
323 label globalRegionI = regionOffset_[surfI] + iter.key();
325 patchInfo_.set(globalRegionI, iter()().clone());
331 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
333 // Get indices of unnamed surfaces (surfaces without faceZoneName)
334 Foam::labelList Foam::refinementSurfaces::getUnnamedSurfaces() const
336 labelList anonymousSurfaces(faceZoneNames_.size());
339 forAll(faceZoneNames_, surfI)
341 if (faceZoneNames_[surfI].empty())
343 anonymousSurfaces[i++] = surfI;
346 anonymousSurfaces.setSize(i);
348 return anonymousSurfaces;
352 // Get indices of named surfaces (surfaces with faceZoneName)
353 Foam::labelList Foam::refinementSurfaces::getNamedSurfaces() const
355 labelList namedSurfaces(faceZoneNames_.size());
358 forAll(faceZoneNames_, surfI)
360 if (faceZoneNames_[surfI].size())
362 namedSurfaces[namedI++] = surfI;
365 namedSurfaces.setSize(namedI);
367 return namedSurfaces;
371 // Get indices of closed named surfaces
372 Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
374 labelList closed(cellZoneNames_.size());
377 forAll(cellZoneNames_, surfI)
381 cellZoneNames_[surfI].size()
383 zoneInside_[surfI] == INSIDE
384 || zoneInside_[surfI] == OUTSIDE
386 && allGeometry_[surfaces_[surfI]].hasVolumeType()
389 closed[closedI++] = surfI;
392 closed.setSize(closedI);
398 // Get indices of named surfaces with a
399 Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
401 labelList closed(cellZoneNames_.size());
404 forAll(cellZoneNames_, surfI)
406 if (cellZoneNames_[surfI].size() && zoneInside_[surfI] == INSIDEPOINT)
408 closed[closedI++] = surfI;
411 closed.setSize(closedI);
417 // // Count number of triangles per surface region
418 // Foam::labelList Foam::refinementSurfaces::countRegions(const triSurface& s)
420 // const geometricSurfacePatchList& regions = s.patches();
422 // labelList nTris(regions.size(), 0);
426 // nTris[s[triI].region()]++;
432 // // Pre-calculate the refinement level for every element
433 // void Foam::refinementSurfaces::wantedRefinementLevel
435 // const shellSurfaces& shells,
436 // const label surfI,
437 // const List<pointIndexHit>& info, // Indices
438 // const pointField& ctrs, // Representative coordinate
439 // labelList& minLevelField
442 // const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
444 // // Get per element the region
446 // geom.getRegion(info, region);
448 // // Initialise fields to region wise minLevel
449 // minLevelField.setSize(ctrs.size());
450 // minLevelField = -1;
452 // forAll(minLevelField, i)
454 // if (info[i].hit())
456 // minLevelField[i] = minLevel(surfI, region[i]);
460 // // Find out if triangle inside shell with higher level
461 // // What level does shell want to refine fc to?
462 // labelList shellLevel;
463 // shells.findHigherLevel(ctrs, minLevelField, shellLevel);
465 // forAll(minLevelField, i)
467 // minLevelField[i] = max(minLevelField[i], shellLevel[i]);
472 // Precalculate the refinement level for every element of the searchable
474 void Foam::refinementSurfaces::setMinLevelFields
476 const shellSurfaces& shells
479 forAll(surfaces_, surfI)
481 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
483 // Precalculation only makes sense if there are different regions
484 // (so different refinement levels possible) and there are some
485 // elements. Possibly should have 'enough' elements to have fine
486 // enough resolution but for now just make sure we don't catch e.g.
487 // searchableBox (size=6)
488 if (geom.regions().size() > 1 && geom.globalSize() > 10)
490 // Representative local coordinates
491 const pointField ctrs = geom.coordinates();
493 labelList minLevelField(ctrs.size(), -1);
495 // Get the element index in a roundabout way. Problem is e.g.
496 // distributed surface where local indices differ from global
497 // ones (needed for getRegion call)
498 List<pointIndexHit> info;
502 scalarField(ctrs.size(), sqr(GREAT)),
506 // Get per element the region
508 geom.getRegion(info, region);
510 // From the region get the surface-wise refinement level
511 forAll(minLevelField, i)
515 minLevelField[i] = minLevel(surfI, region[i]);
520 // Find out if triangle inside shell with higher level
521 // What level does shell want to refine fc to?
522 labelList shellLevel;
523 shells.findHigherLevel(ctrs, minLevelField, shellLevel);
525 forAll(minLevelField, i)
527 minLevelField[i] = max(minLevelField[i], shellLevel[i]);
530 // Store minLevelField on surface
531 const_cast<searchableSurface&>(geom).setField(minLevelField);
537 // Find intersections of edge. Return -1 or first surface with higher minLevel
539 void Foam::refinementSurfaces::findHigherIntersection
541 const pointField& start,
542 const pointField& end,
543 const labelList& currentLevel, // current cell refinement level
546 labelList& surfaceLevel
549 surfaces.setSize(start.size());
551 surfaceLevel.setSize(start.size());
554 if (surfaces_.empty())
559 if (surfaces_.size() == 1)
561 // Optimisation: single segmented surface. No need to duplicate
566 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
568 // Do intersection test
569 List<pointIndexHit> intersectionInfo(start.size());
570 geom.findLineAny(start, end, intersectionInfo);
572 // See if a cached level field available
573 labelList minLevelField;
574 geom.getField(intersectionInfo, minLevelField);
575 bool haveLevelField =
577 returnReduce(minLevelField.size(), sumOp<label>())
581 if (!haveLevelField && geom.regions().size() == 1)
583 minLevelField = labelList
585 intersectionInfo.size(),
588 haveLevelField = true;
593 forAll(intersectionInfo, i)
597 intersectionInfo[i].hit()
598 && minLevelField[i] > currentLevel[i]
601 surfaces[i] = surfI; // index of surface
602 surfaceLevel[i] = minLevelField[i];
612 pointField p0(start);
614 labelList intersectionToPoint(identity(start.size()));
615 List<pointIndexHit> intersectionInfo(start.size());
617 forAll(surfaces_, surfI)
619 const searchableSurface& geom = allGeometry_[surfaces_[surfI]];
621 // Do intersection test
622 geom.findLineAny(p0, p1, intersectionInfo);
624 // See if a cached level field available
625 labelList minLevelField;
626 geom.getField(intersectionInfo, minLevelField);
628 // Copy all hits into arguments, In-place compact misses.
630 forAll(intersectionInfo, i)
632 // Get the minLevel for the point
633 label minLocalLevel = -1;
635 if (intersectionInfo[i].hit())
637 // Check if minLevelField for this surface.
638 if (minLevelField.size())
640 minLocalLevel = minLevelField[i];
644 // Use the min level for the surface instead. Assume
646 minLocalLevel = minLevel(surfI, 0);
651 label pointI = intersectionToPoint[i];
653 if (minLocalLevel > currentLevel[pointI])
655 // Mark point for refinement
656 surfaces[pointI] = surfI;
657 surfaceLevel[pointI] = minLocalLevel;
661 p0[missI] = start[pointI];
662 p1[missI] = end[pointI];
663 intersectionToPoint[missI] = pointI;
668 // All done? Note that this decision should be synchronised
669 if (returnReduce(missI, sumOp<label>()) == 0)
677 intersectionToPoint.setSize(missI);
678 intersectionInfo.setSize(missI);
683 void Foam::refinementSurfaces::findAllHigherIntersections
685 const pointField& start,
686 const pointField& end,
687 const labelList& currentLevel, // current cell refinement level
689 List<vectorList>& surfaceNormal,
690 labelListList& surfaceLevel
693 surfaceLevel.setSize(start.size());
694 surfaceNormal.setSize(start.size());
696 if (surfaces_.empty())
702 List<List<pointIndexHit> > hitInfo;
704 vectorField pNormals;
706 forAll(surfaces_, surfI)
708 allGeometry_[surfaces_[surfI]].findLineAll(start, end, hitInfo);
710 // Repack hits for surface into flat list
711 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
712 // To avoid overhead of calling getRegion for every point
715 forAll(hitInfo, pointI)
717 n += hitInfo[pointI].size();
720 List<pointIndexHit> surfInfo(n);
721 labelList pointMap(n);
724 forAll(hitInfo, pointI)
726 const List<pointIndexHit>& pHits = hitInfo[pointI];
730 surfInfo[n] = pHits[i];
731 pointMap[n] = pointI;
736 labelList surfRegion(n);
737 vectorField surfNormal(n);
738 allGeometry_[surfaces_[surfI]].getRegion(surfInfo, surfRegion);
739 allGeometry_[surfaces_[surfI]].getNormal(surfInfo, surfNormal);
744 // Extract back into pointwise
745 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
747 forAll(surfRegion, i)
749 label region = globalRegion(surfI, surfRegion[i]);
750 label pointI = pointMap[i];
752 if (maxLevel_[region] > currentLevel[pointI])
754 // Append to pointI info
755 label sz = surfaceNormal[pointI].size();
756 surfaceNormal[pointI].setSize(sz+1);
757 surfaceNormal[pointI][sz] = surfNormal[i];
759 surfaceLevel[pointI].setSize(sz+1);
760 surfaceLevel[pointI][sz] = maxLevel_[region];
767 void Foam::refinementSurfaces::findNearestIntersection
769 const labelList& surfacesToTest,
770 const pointField& start,
771 const pointField& end,
774 List<pointIndexHit>& hit1,
777 List<pointIndexHit>& hit2,
781 // 1. intersection from start to end
782 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
784 // Initialize arguments
785 surface1.setSize(start.size());
787 hit1.setSize(start.size());
788 region1.setSize(start.size());
790 // Current end of segment to test.
791 pointField nearest(end);
793 List<pointIndexHit> nearestInfo(start.size());
796 forAll(surfacesToTest, testI)
798 label surfI = surfacesToTest[testI];
800 // See if any intersection between start and current nearest
801 allGeometry_[surfaces_[surfI]].findLine
807 allGeometry_[surfaces_[surfI]].getRegion
813 forAll(nearestInfo, pointI)
815 if (nearestInfo[pointI].hit())
817 hit1[pointI] = nearestInfo[pointI];
818 surface1[pointI] = surfI;
819 region1[pointI] = region[pointI];
820 nearest[pointI] = hit1[pointI].hitPoint();
826 // 2. intersection from end to last intersection
827 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
829 // Find the nearest intersection from end to start. Note that we initialize
830 // to the first intersection (if any).
835 // Set current end of segment to test.
836 forAll(nearest, pointI)
838 if (hit1[pointI].hit())
840 nearest[pointI] = hit1[pointI].hitPoint();
844 // Disable testing by setting to end.
845 nearest[pointI] = end[pointI];
849 forAll(surfacesToTest, testI)
851 label surfI = surfacesToTest[testI];
853 // See if any intersection between end and current nearest
854 allGeometry_[surfaces_[surfI]].findLine
860 allGeometry_[surfaces_[surfI]].getRegion
866 forAll(nearestInfo, pointI)
868 if (nearestInfo[pointI].hit())
870 hit2[pointI] = nearestInfo[pointI];
871 surface2[pointI] = surfI;
872 region2[pointI] = region[pointI];
873 nearest[pointI] = hit2[pointI].hitPoint();
879 // Make sure that if hit1 has hit something, hit2 will have at least the
880 // same point (due to tolerances it might miss its end point)
883 if (hit1[pointI].hit() && !hit2[pointI].hit())
885 hit2[pointI] = hit1[pointI];
886 surface2[pointI] = surface1[pointI];
887 region2[pointI] = region1[pointI];
893 void Foam::refinementSurfaces::findAnyIntersection
895 const pointField& start,
896 const pointField& end,
898 labelList& hitSurface,
899 List<pointIndexHit>& hitInfo
902 searchableSurfacesQueries::findAnyIntersection
914 void Foam::refinementSurfaces::findNearest
916 const labelList& surfacesToTest,
917 const pointField& samples,
918 const scalarField& nearestDistSqr,
919 labelList& hitSurface,
920 List<pointIndexHit>& hitInfo
923 labelList geometries(UIndirectList<label>(surfaces_, surfacesToTest));
925 // Do the tests. Note that findNearest returns index in geometries.
926 searchableSurfacesQueries::findNearest
936 // Rework the hitSurface to be surface (i.e. index into surfaces_)
937 forAll(hitSurface, pointI)
939 if (hitSurface[pointI] != -1)
941 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
947 void Foam::refinementSurfaces::findNearestRegion
949 const labelList& surfacesToTest,
950 const pointField& samples,
951 const scalarField& nearestDistSqr,
952 labelList& hitSurface,
956 labelList geometries(UIndirectList<label>(surfaces_, surfacesToTest));
958 // Do the tests. Note that findNearest returns index in geometries.
959 List<pointIndexHit> hitInfo;
960 searchableSurfacesQueries::findNearest
970 // Rework the hitSurface to be surface (i.e. index into surfaces_)
971 forAll(hitSurface, pointI)
973 if (hitSurface[pointI] != -1)
975 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
979 // Collect the region
980 hitRegion.setSize(hitSurface.size());
983 forAll(surfacesToTest, i)
985 label surfI = surfacesToTest[i];
987 // Collect hits for surfI
988 const labelList localIndices(findIndices(hitSurface, surfI));
990 List<pointIndexHit> localHits
992 UIndirectList<pointIndexHit>
999 labelList localRegion;
1000 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
1002 forAll(localIndices, i)
1004 hitRegion[localIndices[i]] = localRegion[i];
1010 void Foam::refinementSurfaces::findNearestRegion
1012 const labelList& surfacesToTest,
1013 const pointField& samples,
1014 const scalarField& nearestDistSqr,
1015 labelList& hitSurface,
1016 List<pointIndexHit>& hitInfo,
1017 labelList& hitRegion,
1018 vectorField& hitNormal
1021 labelList geometries(UIndirectList<label>(surfaces_, surfacesToTest));
1023 // Do the tests. Note that findNearest returns index in geometries.
1024 searchableSurfacesQueries::findNearest
1034 // Rework the hitSurface to be surface (i.e. index into surfaces_)
1035 forAll(hitSurface, pointI)
1037 if (hitSurface[pointI] != -1)
1039 hitSurface[pointI] = surfacesToTest[hitSurface[pointI]];
1043 // Collect the region
1044 hitRegion.setSize(hitSurface.size());
1046 hitNormal.setSize(hitSurface.size());
1047 hitNormal = vector::zero;
1049 forAll(surfacesToTest, i)
1051 label surfI = surfacesToTest[i];
1053 // Collect hits for surfI
1054 const labelList localIndices(findIndices(hitSurface, surfI));
1056 List<pointIndexHit> localHits
1058 UIndirectList<pointIndexHit>
1066 labelList localRegion;
1067 allGeometry_[surfaces_[surfI]].getRegion(localHits, localRegion);
1069 forAll(localIndices, i)
1071 hitRegion[localIndices[i]] = localRegion[i];
1075 vectorField localNormal;
1076 allGeometry_[surfaces_[surfI]].getNormal(localHits, localNormal);
1078 forAll(localIndices, i)
1080 hitNormal[localIndices[i]] = localNormal[i];
1086 //// Find intersection with max of edge. Return -1 or the surface
1087 //// with the highest maxLevel above currentLevel
1088 //Foam::label Foam::refinementSurfaces::findHighestIntersection
1090 // const point& start,
1091 // const point& end,
1092 // const label currentLevel, // current cell refinement level
1094 // pointIndexHit& maxHit
1097 // // surface with highest maxlevel
1098 // label maxSurface = -1;
1099 // // maxLevel of maxSurface
1100 // label maxLevel = currentLevel;
1102 // forAll(*this, surfI)
1104 // pointIndexHit hit = operator[](surfI).findLineAny(start, end);
1108 // const triSurface& s = operator[](surfI);
1110 // label region = globalRegion(surfI, s[hit.index()].region());
1112 // if (maxLevel_[region] > maxLevel)
1114 // maxSurface = surfI;
1115 // maxLevel = maxLevel_[region];
1121 // if (maxSurface == -1)
1123 // // maxLevel unchanged. No interesting surface hit.
1124 // maxHit.setMiss();
1127 // return maxSurface;
1131 void Foam::refinementSurfaces::findInside
1133 const labelList& testSurfaces,
1134 const pointField& pt,
1135 labelList& insideSurfaces
1138 insideSurfaces.setSize(pt.size());
1139 insideSurfaces = -1;
1141 forAll(testSurfaces, i)
1143 label surfI = testSurfaces[i];
1145 if (zoneInside_[surfI] != INSIDE && zoneInside_[surfI] != OUTSIDE)
1147 FatalErrorIn("refinementSurfaces::findInside(..)")
1148 << "Trying to use surface "
1149 << allGeometry_[surfaces_[surfI]].name()
1150 << " which has non-geometric inside selection method "
1151 << areaSelectionAlgoNames[zoneInside_[surfI]]
1152 << exit(FatalError);
1155 if (allGeometry_[surfaces_[surfI]].hasVolumeType())
1157 List<searchableSurface::volumeType> volType;
1158 allGeometry_[surfaces_[surfI]].getVolumeType(pt, volType);
1160 forAll(volType, pointI)
1162 if (insideSurfaces[pointI] == -1)
1167 volType[pointI] == triSurfaceMesh::INSIDE
1168 && zoneInside_[surfI] == INSIDE
1171 volType[pointI] == triSurfaceMesh::OUTSIDE
1172 && zoneInside_[surfI] == OUTSIDE
1176 insideSurfaces[pointI] = surfI;
1185 // ************************************************************************* //