39 indirectRegionPatches_(),
44Foam::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_;
194 if (regionIndices.empty())
200 const scalar oldTol = treeType::perturbTol(tolerance());
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())
239 <
samples[i].distSqr(info[i].point())
244 info[i] = currentRegionHit;
249 treeType::perturbTol(oldTol);
258 for (
auto&
tree : treeByRegion_)
A List with indirect addressing.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
bool hit() const noexcept
Is there a hit?
const point_type & point() const noexcept
Return point, no checks.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
bool found(const T &val, label pos=0) const
Same as contains().
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
void inflate(const scalar factor)
Expand box by factor*mag(span) in all dimensions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static scalar & perturbTol() noexcept
Get the perturbation tolerance.
Standard boundBox with extra functionality for use in octree.
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.
void flip()
Flip orientation.
~triSurfaceRegionSearch()
Destructor.
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
void clearOut()
Clear storage.
Helper class to search on triSurface.
void flip()
Flip orientation (if cached on octree).
scalar tolerance() const
Return tolerance to use in searches.
const triSurface & surface() const
Return reference to the surface.
const indexedOctree< treeDataTriSurface > & tree() const
Demand driven construction of the octree.
label maxTreeDepth() const
Return max tree depth of octree.
void clearOut()
Clear storage.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
Triangulated surface description with patch information.
@ OUTSIDE
A location outside the volume.
@ INSIDE
A location inside the volume.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static constexpr const zero Zero
Global zero (0).
vectorField pointField
pointField is a vectorField.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
Tree tree(triangles.begin(), triangles.end())
#define forAll(list, i)
Loop across all elements in list.
scalarField samples(nIntervals, Zero)