Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted. More...
#include <dynamicIndexedOctree.H>


Public Member Functions | |
| dynamicIndexedOctree (const Type &shapes, const treeBoundBox &bb, const label maxLevels, const scalar maxLeafRatio, const scalar maxDuplicity) | |
| Construct from shapes. | |
| autoPtr< dynamicIndexedOctree< Type > > | clone () const |
| Clone. | |
| const Type & | shapes () const noexcept |
| Reference to shape. | |
| const List< node > & | nodes () const noexcept |
| List of all nodes. | |
| const DynamicList< DynamicList< label > > & | contents () const noexcept |
| List of all contents (referenced by those nodes that are contents). | |
| PackedList< 2 > & | nodeTypes () const noexcept |
| Per node, per octant whether is fully inside/outside/mixed. | |
| const treeBoundBox & | bb () const |
| Top bounding box. | |
| pointIndexHit | findNearest (const point &sample, const scalar nearestDistSqr) const |
| Calculate nearest point on nearest shape. | |
| void | findNearest (const label nodeI, const point &, scalar &nearestDistSqr, label &nearestShapeI, point &nearestPoint) const |
| Low level: calculate nearest starting from subnode. | |
| pointIndexHit | findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint) const |
| Find nearest to line. | |
| pointIndexHit | findLine (const point &start, const point &end) const |
| Find nearest intersection of line between start and end. | |
| pointIndexHit | findLineAny (const point &start, const point &end) const |
| Find any intersection of line between start and end. | |
| bool | overlaps (const treeBoundBox &bb) const |
| True if any shapes overlap the bounding box. | |
| labelList | findBox (const treeBoundBox &bb) const |
| Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box). | |
| 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). | |
| bool | overlaps (const point ¢re, const scalar radiusSqr) const |
| True if any shapes overlap the bounding sphere. | |
| 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). | |
| 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). | |
| labelBits | findNode (const label nodeI, const point &) const |
| Find deepest node (as parent+octant) containing point. Starts. | |
| label | findInside (const point &) const |
| Find shape containing point. Only implemented for certain. | |
| const labelList & | findIndices (const point &) const |
| Find the shape indices that occupy the result of findNode. | |
| volumeType | getVolumeType (const point &) const |
| Determine type (inside/outside/mixed) for point. unknown if. | |
| template<class CompareOp> | |
| void | findNear (const scalar nearDist, const dynamicIndexedOctree< Type > &tree2, CompareOp &cop) const |
| Find near pairs and apply CompareOp to them. | |
| bool | insert (label startIndex, label endIndex) |
| Insert a new object into the tree. | |
| bool | insertIndex (const label nodIndex, const label index, label &nLevels) |
| bool | remove (const label index) |
| Remove an object from the tree. | |
| label | removeIndex (const label nodIndex, const label index) |
| void | writeOBJ (Ostream &os) const |
| Write all tree boxes as OBJ format. | |
| void | print (prefixOSstream &, const bool printContents, const label) const |
| Print tree. Either print all indices (printContent = true) or. | |
| bool | write (Ostream &os) const |
| void | writeTreeInfo () const |
| Public Member Functions inherited from dynamicIndexedOctreeBase | |
| ClassName ("dynamicIndexedOctree") | |
| Runtime type information. | |
| dynamicIndexedOctreeBase ()=default | |
| Default construct. | |
| Public Member Functions inherited from indexedOctreeBase | |
| ClassName ("indexedOctree") | |
| Runtime type information. | |
| indexedOctreeBase ()=default | |
| Default construct. | |
Static Public Member Functions | |
| static volumeType | getSide (const vector &outsideNormal, const vector &vec) |
| Helper function to return the side. Returns outside if. | |
| Static Public Member Functions inherited from indexedOctreeBase | |
| static bool | isEmpty (labelBits i) noexcept |
| An empty node - no content. | |
| static bool | isContent (labelBits i) noexcept |
| Node with content (leaf). | |
| static bool | isNode (labelBits i) noexcept |
| A parent node. | |
| static label | getContent (labelBits i) |
| Return real (dereferenced) index for a content node. | |
| static label | getNode (const labelBits i) |
| Return real (dereferenced) index for a parent node. | |
| static direction | getOctant (labelBits i) noexcept |
| Return sub-node direction/octant. | |
| static scalar & | perturbTol () noexcept |
| Get the perturbation tolerance. | |
| static scalar | perturbTol (scalar tol) noexcept |
| Set the perturbation tolerance, return the old value. | |
| static void | writeOBJ (Ostream &os, const treeBoundBox &bb, label &vertIndex, const bool writeLinesOnly=false) |
| Write treeBoundBox in OBJ format. | |
Friends | |
| Ostream & | operator<< (Ostream &, const dynamicIndexedOctree< Type > &) |
Additional Inherited Members | |
| Public Types inherited from dynamicIndexedOctreeBase | |
| using | node = indexedOctreeBase::node |
| Document that we are using the same types of node. | |
| Static Protected Member Functions inherited from indexedOctreeBase | |
| static labelBits | emptyPlusOctant (direction octant) |
| From empty to subNodes_ entry. | |
| static labelBits | contentPlusOctant (label i, direction octant) |
| From index into contents_ to subNodes_ entry. | |
| static labelBits | nodePlusOctant (label i, direction octant) |
| From index into nodes_ to subNodes_ entry. | |
| Static Protected Attributes inherited from indexedOctreeBase | |
| static scalar | perturbTol_ = 10*SMALL |
| Relative perturbation tolerance. | |
Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted.
Definition at line 91 of file dynamicIndexedOctree.H.
| dynamicIndexedOctree | ( | const Type & | shapes, |
| const treeBoundBox & | bb, | ||
| const label | maxLevels, | ||
| const scalar | maxLeafRatio, | ||
| const scalar | maxDuplicity ) |
Construct from shapes.
Definition at line 2023 of file dynamicIndexedOctree.C.
References bb(), if(), insert(), shapes(), and writeTreeInfo().
Referenced by findNear(), and operator<<.


|
inline |
Clone.
Definition at line 410 of file dynamicIndexedOctree.H.
References Foam::New().

|
inlinenoexcept |
Reference to shape.
Definition at line 423 of file dynamicIndexedOctree.H.
References Foam::noexcept.
Referenced by dynamicIndexedOctree(), insertIndex(), removeIndex(), and writeTreeInfo().

List of all nodes.
Definition at line 428 of file dynamicIndexedOctree.H.
References Foam::noexcept.
|
inlinenoexcept |
List of all contents (referenced by those nodes that are contents).
Definition at line 434 of file dynamicIndexedOctree.H.
References Foam::noexcept.
|
inlinenoexcept |
Per node, per octant whether is fully inside/outside/mixed.
Definition at line 442 of file dynamicIndexedOctree.H.
References Foam::noexcept.
|
inline |
Top bounding box.
Definition at line 450 of file dynamicIndexedOctree.H.
References treeBoundBox::null().
Referenced by dynamicIndexedOctree(), findNear(), getVolumeType(), and print().


| Foam::pointIndexHit findNearest | ( | const point & | sample, |
| const scalar | nearestDistSqr ) const |
Calculate nearest point on nearest shape.
Returns
Definition at line 2060 of file dynamicIndexedOctree.C.
References Foam::Zero.
| void findNearest | ( | const label | nodeI, |
| const point & | sample, | ||
| scalar & | nearestDistSqr, | ||
| label & | nearestShapeI, | ||
| point & | nearestPoint ) const |
Low level: calculate nearest starting from subnode.
Definition at line 341 of file dynamicIndexedOctree.C.
References indexedOctreeBase::node::bb_, indexedOctreeBase::getContent(), indexedOctreeBase::getNode(), indexedOctreeBase::isContent(), indexedOctreeBase::isNode(), treeBoundBox::overlaps(), treeBoundBox::searchOrder(), indexedOctreeBase::node::subNodes_, and treeBoundBox::subOverlaps().

| Foam::pointIndexHit findNearest | ( | const linePointRef & | ln, |
| treeBoundBox & | tightest, | ||
| point & | linePoint ) const |
Find nearest to line.
Returns
Definition at line 2088 of file dynamicIndexedOctree.C.
References Foam::ln(), and Foam::Zero.

| Foam::pointIndexHit findLine | ( | const point & | start, |
| const point & | end ) const |
Find nearest intersection of line between start and end.
Definition at line 2117 of file dynamicIndexedOctree.C.
| Foam::pointIndexHit findLineAny | ( | const point & | start, |
| const point & | end ) const |
Find any intersection of line between start and end.
Definition at line 2128 of file dynamicIndexedOctree.C.
| bool overlaps | ( | const treeBoundBox & | bb | ) | const |
True if any shapes overlap the bounding box.
Definition at line 2139 of file dynamicIndexedOctree.C.
Referenced by insertIndex(), and removeIndex().

| 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 2173 of file dynamicIndexedOctree.C.
References HashTable< T, Key, Hash >::toc().

| 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 2150 of file dynamicIndexedOctree.C.
References HashTable< T, Key, Hash >::clear(), Foam::max(), HashTable< T, Key, Hash >::reserve(), and HashTable< T, Key, Hash >::size().

| 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 2193 of file dynamicIndexedOctree.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 2229 of file dynamicIndexedOctree.C.
References HashTable< T, Key, Hash >::toc().

| 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 2205 of file dynamicIndexedOctree.C.
References HashTable< T, Key, Hash >::clear(), Foam::max(), HashTable< T, Key, Hash >::reserve(), and HashTable< T, Key, Hash >::size().

| 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 2250 of file dynamicIndexedOctree.C.
References Foam::abort(), indexedOctreeBase::node::bb_, treeBoundBox::contains(), Foam::FatalError, FatalErrorInFunction, findNode(), indexedOctreeBase::getNode(), indexedOctreeBase::isContent(), indexedOctreeBase::isNode(), indexedOctreeBase::nodePlusOctant(), indexedOctreeBase::node::subNodes_, and treeBoundBox::subOctant().
Referenced by findIndices(), findInside(), and findNode().


| Foam::label findInside | ( | const point & | sample | ) | const |
Find shape containing point. Only implemented for certain.
shapes.
Definition at line 2297 of file dynamicIndexedOctree.C.
References findNode(), forAll, indexedOctreeBase::getContent(), indexedOctreeBase::getNode(), Foam::getOctant(), indexedOctreeBase::isContent(), and indexedOctreeBase::node::subNodes_.

| const Foam::labelList & findIndices | ( | const point & | sample | ) | const |
Find the shape indices that occupy the result of findNode.
Definition at line 2329 of file dynamicIndexedOctree.C.
References findNode(), indexedOctreeBase::getContent(), indexedOctreeBase::getNode(), Foam::getOctant(), indexedOctreeBase::isContent(), List< label >::null(), and indexedOctreeBase::node::subNodes_.

| 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 2351 of file dynamicIndexedOctree.C.
References Foam::abort(), bb(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, volumeType::INSIDE, volumeType::MIXED, volumeType::OUTSIDE, Foam::Pout, and volumeType::UNKNOWN.

|
static |
Helper function to return the side. Returns outside if.
outsideNormal&vec >= 0, inside otherwise
Definition at line 323 of file dynamicIndexedOctree.C.
References volumeType::INSIDE, and volumeType::OUTSIDE.
| void findNear | ( | const scalar | nearDist, |
| const dynamicIndexedOctree< Type > & | tree2, | ||
| CompareOp & | cop ) const |
Find near pairs and apply CompareOp to them.
tree2 can be *this or different tree.
Definition at line 2421 of file dynamicIndexedOctree.C.
References bb(), dynamicIndexedOctree(), and indexedOctreeBase::nodePlusOctant().

| bool insert | ( | label | startIndex, |
| label | endIndex ) |
Insert a new object into the tree.
Definition at line 2444 of file dynamicIndexedOctree.C.
References Foam::divide(), insertIndex(), Foam::max(), and success.
Referenced by dynamicIndexedOctree().


| bool insertIndex | ( | const label | nodIndex, |
| const label | index, | ||
| label & | nLevels ) |
Definition at line 2482 of file dynamicIndexedOctree.C.
References indexedOctreeBase::contentPlusOctant(), indexedOctreeBase::getContent(), indexedOctreeBase::getNode(), insertIndex(), indexedOctreeBase::isContent(), indexedOctreeBase::isNode(), indexedOctreeBase::node::nChildren, overlaps(), shapes(), and treeBoundBox::subBbox().
Referenced by insert(), and insertIndex().


| bool remove | ( | const label | index | ) |
Remove an object from the tree.
Definition at line 2554 of file dynamicIndexedOctree.C.
References removeIndex().

| Foam::label removeIndex | ( | const label | nodIndex, |
| const label | index ) |
Definition at line 2568 of file dynamicIndexedOctree.C.
References UList< T >::empty(), indexedOctreeBase::emptyPlusOctant(), forAll, indexedOctreeBase::getContent(), indexedOctreeBase::getNode(), indexedOctreeBase::isContent(), indexedOctreeBase::isNode(), indexedOctreeBase::node::nChildren, overlaps(), DynamicList< T, SizeMin >::push_back(), removeIndex(), shapes(), DynamicList< T, SizeMin >::shrink(), UList< T >::size(), treeBoundBox::subBbox(), and DynamicList< T, SizeMin >::transfer().
Referenced by remove(), and removeIndex().


| void writeOBJ | ( | Ostream & | os | ) | const |
Write all tree boxes as OBJ format.
Definition at line 2009 of file dynamicIndexedOctree.C.
References os().

| 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 2651 of file dynamicIndexedOctree.C.
References bb(), indexedOctreeBase::node::bb_, Foam::endl(), forAll, indexedOctreeBase::getContent(), indexedOctreeBase::getNode(), indexedOctreeBase::isContent(), indexedOctreeBase::isNode(), indexedOctreeBase::node::nChildren, Foam::nl, indexedOctreeBase::nodePlusOctant(), os(), indexedOctreeBase::node::parent_, print(), UList< T >::size(), and indexedOctreeBase::node::subNodes_.
Referenced by print().


| bool write | ( | Ostream & | os | ) | const |
Definition at line 2750 of file dynamicIndexedOctree.C.
References os().

| void writeTreeInfo | ( | ) | const |
Definition at line 2724 of file dynamicIndexedOctree.C.
References Foam::endl(), Foam::nl, Foam::Pout, and shapes().
Referenced by dynamicIndexedOctree().


|
friend |
References dynamicIndexedOctree().