Go to the documentation of this file.
36 Foam::triSurfaceRegionSearch::triSurfaceRegionSearch(
const triSurface& surface)
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 scalar oldTol = treeType::perturbTol();
112 treeType::perturbTol() = tolerance();
114 indirectRegionPatches_.set
122 regionsAddressing[regionI]
131 if (indirectRegionPatches_[regionI].size())
136 indirectRegionPatches_[regionI],
172 indirectRegionPatches_[regionI],
182 treeType::perturbTol() = oldTol;
186 return treeByRegion_;
198 if (regionIndices.empty())
204 scalar oldTol = treeType::perturbTol();
205 treeType::perturbTol() = tolerance();
213 if (!regionIndices.found(treeI))
218 const treeType& octree = octrees[treeI];
237 currentRegionHit.
hit()
249 info[i] = currentRegionHit;
254 treeType::perturbTol() = oldTol;
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
static Vector< Cmpt > uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
static constexpr const zero Zero
Global zero (0)
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.
Standard boundBox with extra functionality for use in octree.
void clearOut()
Clear storage.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
~triSurfaceRegionSearch()
Destructor.
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
const point & max() const
Maximum describing the bounding box.
Helper class to search on triSurface.
const point & min() const
Minimum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
bool hit() const noexcept
Is there a hit?
Triangulated surface description with patch information.
void setSize(const label n)
Alias for resize()
A List with indirect addressing.
Non-pointer based hierarchical recursive searching.
scalarField samples(nIntervals, Zero)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void clearOut()
Clear storage.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Encapsulation of data needed to search on PrimitivePatches.
const dimensionedScalar e
Elementary charge.
A list of faces which address into the list of points.