33 Foam::triSurfaceRegionSearch::triSurfaceRegionSearch(
const triSurface& surface)
36 indirectRegionPatches_(),
41 Foam::triSurfaceRegionSearch::triSurfaceRegionSearch
48 indirectRegionPatches_(),
64 treeByRegion_.clear();
73 if (treeByRegion_.empty())
80 regionSizes(regionI)++;
85 indirectRegionPatches_.setSize(nRegions);
86 treeByRegion_.setSize(nRegions);
90 forAll(regionsAddressing, regionI)
92 regionsAddressing[regionI] =
labelList(regionSizes[regionI], -1);
101 regionsAddressing[regionI][nFacesInRegions[regionI]++] = fI;
104 forAll(regionsAddressing, regionI)
109 indirectRegionPatches_.set
117 regionsAddressing[regionI]
126 if (indirectRegionPatches_[regionI].size())
131 indirectRegionPatches_[regionI],
155 bb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
156 bb.
max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
167 indirectRegionPatches_[regionI],
181 return treeByRegion_;
193 if (regionIndices.
empty())
208 if (
findIndex(regionIndices, treeI) == -1)
213 const treeType& octree = octrees[treeI];
231 currentRegionHit.
hit()
238 <
magSqr(info[i].hitPoint() - samples[i])
243 info[i] = currentRegionHit;
label maxTreeDepth() const
Return max tree depth of octree.
#define forAll(list, i)
Loop across all elements in list.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void clearOut()
Clear storage.
const double e
Elementary charge.
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 any number of values (e...
void size(const label)
Override size to be inconsistent with allocated storage.
static scalar & perturbTol()
Get the perturbation tolerance.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label size() const
Return number of elements in table.
~triSurfaceRegionSearch()
Destructor.
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
Helper class to search on triSurface.
A list of faces which address into the list of points.
const Point & hitPoint() const
Return hit point.
void clearOut()
Clear storage.
Encapsulation of data needed to search on PrimitivePatches.
cachedRandom rndGen(label(0), -1)
bool hit() const
Is there a hit.
List< label > labelList
A List of labels.
Simple random number generator.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
const triSurface & surface() const
Return reference to the surface.
void setSize(const label)
Reset size of List.
const point & max() const
Maximum describing the bounding box.
vector point
Point is a vector.
Non-pointer based hierarchical recursive searching.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
scalar tolerance() const
Return tolerance to use in searches.
Standard boundBox + extra functionality for use in octree.
const point & min() const
Minimum describing the bounding box.
Triangulated surface description with patch information.
A List with indirect addressing.