Non-pointer based hierarchical recursive searching. More...
Public Member Functions | |
indexedOctree (const Type &shapes) | |
Construct null. More... | |
indexedOctree (const Type &shapes, const List< node > &nodes, const List< labelList > &contents) | |
Construct from components. More... | |
indexedOctree (const Type &shapes, const treeBoundBox &bb, const label maxLevels, const scalar maxLeafRatio, const scalar maxDuplicity) | |
Construct from shapes. More... | |
indexedOctree (const Type &shapes, Istream &is) | |
Construct from Istream. More... | |
autoPtr< indexedOctree< Type > > | clone () const |
Clone. More... | |
const Type & | shapes () const noexcept |
Reference to shape. More... | |
const List< node > & | nodes () const noexcept |
List of all nodes. More... | |
const List< labelList > & | contents () const noexcept |
List of all contents (referenced by those nodes that are contents) More... | |
PackedList< 2 > & | nodeTypes () const noexcept |
Per node, per octant whether is fully inside/outside/mixed. More... | |
const treeBoundBox & | bb () const |
Top bounding box. More... | |
label | nLeafs () const |
Return the number of leaf nodes. More... | |
pointIndexHit | findNearest (const point &sample, const scalar nearestDistSqr) const |
template<class FindNearestOp > | |
pointIndexHit | findNearest (const point &sample, const scalar nearestDistSqr, const FindNearestOp &fnOp) const |
Calculate nearest point on nearest shape. More... | |
template<class FindNearestOp > | |
void | findNearest (const label nodeI, const point &, scalar &nearestDistSqr, label &nearestShapeI, point &nearestPoint, const FindNearestOp &fnOp) const |
Low level: calculate nearest starting from subnode. More... | |
pointIndexHit | findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint) const |
Find nearest to line. More... | |
template<class FindNearestOp > | |
pointIndexHit | findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint, const FindNearestOp &fnOp) const |
pointIndexHit | findLine (const point &start, const point &end) const |
Find nearest intersection of line between start and end. More... | |
pointIndexHit | findLineAny (const point &start, const point &end) const |
Find any intersection of line between start and end. More... | |
template<class FindIntersectOp > | |
pointIndexHit | findLine (const point &start, const point &end, const FindIntersectOp &fiOp) const |
Find nearest intersection of line between start and end. More... | |
template<class FindIntersectOp > | |
pointIndexHit | findLineAny (const point &start, const point &end, const FindIntersectOp &fiOp) const |
Find any intersection of line between start and end. More... | |
bool | overlaps (const treeBoundBox &bb) const |
True if any shapes overlap the bounding box. More... | |
labelList | findBox (const treeBoundBox &bb) const |
Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box) More... | |
label | findBox (const treeBoundBox &bb, labelHashSet &elements) const |
Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box) More... | |
bool | overlaps (const point ¢re, const scalar radiusSqr) const |
True if any shapes overlap the bounding sphere. More... | |
labelList | findSphere (const point ¢re, const scalar radiusSqr) const |
Find indices of all shapes inside or overlapping a bounding sphere (i.e. all shapes not outside a sphere) More... | |
label | findSphere (const point ¢re, const scalar radiusSqr, labelHashSet &elements) const |
Find indices of all shapes inside or overlapping a bounding sphere (i.e. all shapes not outside sphere) More... | |
labelBits | findNode (const label nodeI, const point &) const |
Find deepest node (as parent+octant) containing point. Starts. More... | |
label | findInside (const point &) const |
Find shape containing point. Only implemented for certain. More... | |
const labelList & | findIndices (const point &) const |
Find the shape indices that occupy the result of findNode. More... | |
volumeType | getVolumeType (const point &) const |
Determine type (inside/outside/mixed) for point. unknown if. More... | |
template<class CompareOp > | |
void | findNear (const scalar nearDist, const indexedOctree< Type > &tree2, CompareOp &cop) const |
Find near pairs and apply CompareOp to them. More... | |
void | writeOBJ (Ostream &os) const |
Write (non-empty) tree boxes in OBJ format. More... | |
void | print (prefixOSstream &, const bool printContents, const label) const |
Print tree. Either print all indices (printContent = true) or. More... | |
bool | write (Ostream &os) const |
template<class FindIntersectOp > | |
Foam::pointIndexHit | findLine (const bool findAny, const point &treeStart, const point &treeEnd, const label startNodeI, const direction startOctant, const FindIntersectOp &fiOp, const bool verbose) const |
template<class FindIntersectOp > | |
Foam::pointIndexHit | findLine (const bool findAny, const point &start, const point &end, const FindIntersectOp &fiOp) const |
template<class FindNearestOp > | |
Foam::pointIndexHit | findNearest (const point &sample, const scalar startDistSqr, const FindNearestOp &fnOp) const |
template<class FindNearestOp > | |
Foam::pointIndexHit | findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint, const FindNearestOp &fnOp) const |
template<class FindIntersectOp > | |
Foam::pointIndexHit | findLine (const point &start, const point &end, const FindIntersectOp &fiOp) const |
template<class FindIntersectOp > | |
Foam::pointIndexHit | findLineAny (const point &start, const point &end, const FindIntersectOp &fiOp) const |
Public Member Functions inherited from indexedOctreeBase | |
ClassName ("indexedOctree") | |
Runtime type information. More... | |
indexedOctreeBase ()=default | |
Default construct. More... | |
Static Public Member Functions | |
static volumeType | getSide (const vector &outsideNormal, const vector &vec) |
Helper function to return the side. Returns outside if. More... | |
Static Public Member Functions inherited from indexedOctreeBase | |
static bool | isEmpty (labelBits i) noexcept |
An empty node - no content. More... | |
static bool | isContent (labelBits i) noexcept |
Node with content (leaf) More... | |
static bool | isNode (labelBits i) noexcept |
A parent node. More... | |
static label | getContent (labelBits i) |
Return real (dereferenced) index for a content node. More... | |
static label | getNode (const labelBits i) |
Return real (dereferenced) index for a parent node. More... | |
static direction | getOctant (labelBits i) noexcept |
Return sub-node direction/octant. More... | |
static scalar & | perturbTol () noexcept |
Get the perturbation tolerance. More... | |
static scalar | perturbTol (scalar tol) noexcept |
Set the perturbation tolerance, return the old value. More... | |
static void | writeOBJ (Ostream &os, const treeBoundBox &bb, label &vertIndex, const bool writeLinesOnly=false) |
Write treeBoundBox in OBJ format. More... | |
Friends | |
Ostream & | operator (Ostream &, const indexedOctree< Type > &) |
Additional Inherited Members | |
Static Protected Member Functions inherited from indexedOctreeBase | |
static labelBits | emptyPlusOctant (direction octant) |
From empty to subNodes_ entry. More... | |
static labelBits | contentPlusOctant (label i, direction octant) |
From index into contents_ to subNodes_ entry. More... | |
static labelBits | nodePlusOctant (label i, direction octant) |
From index into nodes_ to subNodes_ entry. More... | |
Static Protected Attributes inherited from indexedOctreeBase | |
static scalar | perturbTol_ = 10*SMALL |
Relative perturbation tolerance. More... | |
Non-pointer based hierarchical recursive searching.
Definition at line 44 of file treeDataPrimitivePatch.H.
indexedOctree | ( | const Type & | shapes | ) |
Construct null.
Definition at line 2111 of file indexedOctree.C.
indexedOctree | ( | const Type & | shapes, |
const List< node > & | nodes, | ||
const List< labelList > & | contents | ||
) |
Construct from components.
Definition at line 2122 of file indexedOctree.C.
indexedOctree | ( | const Type & | shapes, |
const treeBoundBox & | bb, | ||
const label | maxLevels, | ||
const scalar | maxLeafRatio, | ||
const scalar | maxDuplicity | ||
) |
Construct from shapes.
Definition at line 2137 of file indexedOctree.C.
indexedOctree | ( | const Type & | shapes, |
Istream & | is | ||
) |
Construct from Istream.
Definition at line 2316 of file indexedOctree.C.
|
inline |
Clone.
Definition at line 650 of file indexedOctree.H.
|
inlinenoexcept |
Reference to shape.
Definition at line 663 of file indexedOctree.H.
Referenced by patchProbes::findElements(), refinementFeatures::findNearestRegionEdge(), surfaceFeatures::nearestEdges(), surfaceFeatures::nearestFeatEdge(), surfaceFeatures::nearestSamples(), surfaceFeatures::nearestSurfEdge(), findNearestMaskedOp< PatchType >::operator()(), lumpedPointMovement::setInterpolator(), and lumpedPointMovement::setPatchControl().
List of all nodes.
Definition at line 668 of file indexedOctree.H.
Referenced by distributedTriSurfaceMesh::getVolumeType().
List of all contents (referenced by those nodes that are contents)
Definition at line 674 of file indexedOctree.H.
|
inlinenoexcept |
Per node, per octant whether is fully inside/outside/mixed.
Definition at line 682 of file indexedOctree.H.
Referenced by distributedTriSurfaceMesh::getVolumeType().
|
inline |
Top bounding box.
Definition at line 690 of file indexedOctree.H.
Referenced by patchProbes::findElements(), indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::findNear(), and surfaceFeatures::nearestSamples().
Foam::label nLeafs | ( | ) | const |
Return the number of leaf nodes.
Definition at line 2882 of file indexedOctree.C.
Foam::pointIndexHit findNearest | ( | const point & | sample, |
const scalar | nearestDistSqr | ||
) | const |
Definition at line 2332 of file indexedOctree.C.
pointIndexHit findNearest | ( | const point & | sample, |
const scalar | nearestDistSqr, | ||
const FindNearestOp & | fnOp | ||
) | const |
Calculate nearest point on nearest shape.
Returns
void findNearest | ( | const label | nodeI, |
const point & | sample, | ||
scalar & | nearestDistSqr, | ||
label & | nearestShapeI, | ||
point & | nearestPoint, | ||
const FindNearestOp & | fnOp | ||
) | const |
Low level: calculate nearest starting from subnode.
Definition at line 390 of file indexedOctree.C.
Foam::pointIndexHit findNearest | ( | const linePointRef & | ln, |
treeBoundBox & | tightest, | ||
point & | linePoint | ||
) | const |
Find nearest to line.
Returns
Definition at line 2381 of file indexedOctree.C.
pointIndexHit findNearest | ( | const linePointRef & | ln, |
treeBoundBox & | tightest, | ||
point & | linePoint, | ||
const FindNearestOp & | fnOp | ||
) | const |
Foam::pointIndexHit findLine | ( | const point & | start, |
const point & | end | ||
) | const |
Find nearest intersection of line between start and end.
Definition at line 2433 of file indexedOctree.C.
Foam::pointIndexHit findLineAny | ( | const point & | start, |
const point & | end | ||
) | const |
Find any intersection of line between start and end.
Definition at line 2450 of file indexedOctree.C.
Referenced by triSurfaceSearch::findLineAny().
pointIndexHit findLine | ( | const point & | start, |
const point & | end, | ||
const FindIntersectOp & | fiOp | ||
) | const |
Find nearest intersection of line between start and end.
pointIndexHit findLineAny | ( | const point & | start, |
const point & | end, | ||
const FindIntersectOp & | fiOp | ||
) | const |
Find any intersection of line between start and end.
bool overlaps | ( | const treeBoundBox & | bb | ) | const |
True if any shapes overlap the bounding box.
Definition at line 2493 of file indexedOctree.C.
Foam::labelList findBox | ( | const treeBoundBox & | bb | ) | const |
Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box)
bb | bound box limits |
Definition at line 2530 of file indexedOctree.C.
Foam::label findBox | ( | const treeBoundBox & | bb, |
labelHashSet & | elements | ||
) | const |
Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box)
bb | bound box limits | |
[out] | elements | elements found |
Definition at line 2504 of file indexedOctree.C.
bool overlaps | ( | const point & | centre, |
const scalar | radiusSqr | ||
) | const |
True if any shapes overlap the bounding sphere.
centre | centre of bound sphere |
radiusSqr | radius^2 of sphere |
Definition at line 2550 of file indexedOctree.C.
Foam::labelList findSphere | ( | const point & | centre, |
const scalar | radiusSqr | ||
) | const |
Find indices of all shapes inside or overlapping a bounding sphere (i.e. all shapes not outside a sphere)
centre | centre of bound sphere |
radiusSqr | radius^2 of sphere |
Definition at line 2590 of file indexedOctree.C.
Foam::label findSphere | ( | const point & | centre, |
const scalar | radiusSqr, | ||
labelHashSet & | elements | ||
) | const |
Find indices of all shapes inside or overlapping a bounding sphere (i.e. all shapes not outside sphere)
centre | centre of bound sphere | |
radiusSqr | radius^2 of sphere | |
[out] | elements | elements found |
Definition at line 2562 of file indexedOctree.C.
Foam::labelBits findNode | ( | const label | nodeI, |
const point & | sample | ||
) | const |
Find deepest node (as parent+octant) containing point. Starts.
off from starting index in nodes_ (use 0 to start from top) Use getNode and getOctant to extract info, or call findIndices.
Definition at line 2611 of file indexedOctree.C.
Foam::label findInside | ( | const point & | sample | ) | const |
Find shape containing point. Only implemented for certain.
shapes.
Definition at line 2647 of file indexedOctree.C.
const Foam::labelList & findIndices | ( | const point & | sample | ) | const |
Find the shape indices that occupy the result of findNode.
Definition at line 2682 of file indexedOctree.C.
Foam::volumeType getVolumeType | ( | const point & | sample | ) | const |
Determine type (inside/outside/mixed) for point. unknown if.
cannot be determined (e.g. non-manifold surface)
Definition at line 2709 of file indexedOctree.C.
|
static |
Helper function to return the side. Returns outside if.
outsideNormal&vec >= 0, inside otherwise
Definition at line 371 of file indexedOctree.C.
Referenced by treeDataFace::getVolumeType().
void findNear | ( | const scalar | nearDist, |
const indexedOctree< Type > & | tree2, | ||
CompareOp & | cop | ||
) | const |
Find near pairs and apply CompareOp to them.
tree2 can be *this or different tree.
Definition at line 2779 of file indexedOctree.C.
void writeOBJ | ( | Ostream & | os | ) | const |
Write (non-empty) tree boxes in OBJ format.
Definition at line 2097 of file indexedOctree.C.
void print | ( | prefixOSstream & | os, |
const bool | printContents, | ||
const label | nodeI | ||
) | const |
Print tree. Either print all indices (printContent = true) or.
just size of contents nodes.
Definition at line 2805 of file indexedOctree.C.
bool write | ( | Ostream & | os | ) | const |
Definition at line 2895 of file indexedOctree.C.
Foam::pointIndexHit findLine | ( | const bool | findAny, |
const point & | treeStart, | ||
const point & | treeEnd, | ||
const label | startNodeI, | ||
const direction | startOctant, | ||
const FindIntersectOp & | fiOp, | ||
const bool | verbose | ||
) | const |
Definition at line 1415 of file indexedOctree.C.
Foam::pointIndexHit findLine | ( | const bool | findAny, |
const point & | start, | ||
const point & | end, | ||
const FindIntersectOp & | fiOp | ||
) | const |
Definition at line 1607 of file indexedOctree.C.
Foam::pointIndexHit findNearest | ( | const point & | sample, |
const scalar | startDistSqr, | ||
const FindNearestOp & | fnOp | ||
) | const |
Definition at line 2349 of file indexedOctree.C.
Foam::pointIndexHit findNearest | ( | const linePointRef & | ln, |
treeBoundBox & | tightest, | ||
point & | linePoint, | ||
const FindNearestOp & | fnOp | ||
) | const |
Definition at line 2400 of file indexedOctree.C.
Foam::pointIndexHit findLine | ( | const point & | start, |
const point & | end, | ||
const FindIntersectOp & | fiOp | ||
) | const |
Definition at line 2468 of file indexedOctree.C.
Foam::pointIndexHit findLineAny | ( | const point & | start, |
const point & | end, | ||
const FindIntersectOp & | fiOp | ||
) | const |
Definition at line 2481 of file indexedOctree.C.
|
friend |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.