39 indirectRegionPatches_(),
44 Foam::triSurfaceRegionSearch::triSurfaceRegionSearch
51 indirectRegionPatches_(),
67 treeByRegion_.clear();
76 if (treeByRegion_.empty())
81 const label regionI =
surface()[fI].region();
82 maxRegion =
max(maxRegion, regionI);
84 const label nRegions = maxRegion+1;
89 const label regionI =
surface()[fI].region();
90 nFacesInRegions[regionI]++;
93 indirectRegionPatches_.
setSize(nRegions);
94 treeByRegion_.setSize(nRegions);
98 forAll(regionsAddressing, regionI)
100 regionsAddressing[regionI].
setSize(nFacesInRegions[regionI]);
102 nFacesInRegions =
Zero;
105 const label regionI =
surface()[fI].region();
106 regionsAddressing[regionI][nFacesInRegions[regionI]++] = fI;
109 forAll(regionsAddressing, regionI)
111 const scalar oldTol = treeType::perturbTol(tolerance());
113 indirectRegionPatches_.set
116 new indirectTriSurface
121 regionsAddressing[regionI]
130 if (indirectRegionPatches_[regionI].size())
135 indirectRegionPatches_[regionI],
166 treeDataIndirectTriSurface
168 indirectRegionPatches_[regionI],
178 treeType::perturbTol(oldTol);
182 return treeByRegion_;
191 List<pointIndexHit>& info
194 if (regionIndices.empty())
200 const scalar oldTol = treeType::perturbTol(tolerance());
202 const PtrList<treeType>& octrees = treeByRegion();
208 if (!regionIndices.found(treeI))
213 const treeType& octree = octrees[treeI];
214 const treeDataIndirectTriSurface::findNearestOp nearOp(octree);
232 currentRegionHit.hit()
238 samples[i].distSqr(currentRegionHit.point())
244 info[i] = currentRegionHit;
249 treeType::perturbTol(oldTol);
void size(const label n)
Older name for setAddressableSize.
void clearOut()
Clear storage.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, const labelList ®ionIndices, List< pointIndexHit > &info) const
Find the nearest point on the surface out of the regions.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void inflate(const scalar factor)
Expand box by factor*mag(span) in all dimensions.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
scalarField samples(nIntervals, Zero)
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
~triSurfaceRegionSearch()
Destructor.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
#define forAll(list, i)
Loop across all elements in list.
Helper class to search on triSurface.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void clearOut()
Clear storage.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
vector point
Point is a vector.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Standard boundBox with extra functionality for use in octree.
List< label > labelList
A List of labels.
Triangulated surface description with patch information.
A List with indirect addressing.
static constexpr const zero Zero
Global zero (0)