libatomprobe
Library for Atom Probe Tomography (APT) computation
Public Member Functions | List of all members
AtomProbe::K3DTreeExact Class Reference

3D specific KD tree More...

#include <K3DTree-exact.h>

Public Member Functions

 K3DTreeExact ()
 KD Tree constructor. Tree is uninitialised at start. More...
 
 ~K3DTreeExact ()
 Cleans up tree, deallocates nodes. More...
 
void resetPts (std::vector< Point3D > &pts, bool clear=true)
 Supply points to KD tree. Ouput vector will be erased if clear=true. More...
 
void resetPts (std::vector< IonHit > &pts, bool clear=true)
 Supply points using IonHits to KD tree. Ouput vector will be erased if clear=true. More...
 
bool build ()
 Build the KD tree using the previously supplied points. More...
 
void getBoundCube (BoundCube &b)
 obtain the bounding rectangular prism volume for all elements in the KD tree More...
 
void dump (std::ostream &, size_t depth=0, size_t offset=-1) const
 Textual output of tree. Tabs are used to separate different levels of the tree. More...
 
size_t findNearestUntagged (const Point3D &queryPt, const BoundCube &b, bool tag=true)
 Find the nearest "untagged" point's internal index. More...
 
void findUntaggedInRadius (const Point3D &queryPt, const BoundCube &b, float radius, std::vector< size_t > &result)
 Find untagged points within a given radius. More...
 
void ptsInSphere (const Point3D &origin, float radius, std::vector< size_t > &pts) const
 
const Point3DgetPt (size_t index) const
 
const Point3DgetPtRef (size_t index) const
 
void clearTags (std::vector< size_t > &tagsToClear)
 
size_t getOrigIndex (size_t treeIndex) const
 
void setCallback (bool(*cb)(void))
 
void setProgressPointer (unsigned int *p)
 
void clear ()
 
void tag (size_t treeIndex, bool tagVal=true)
 
void tag (const std::vector< size_t > &treeIndicies, bool tagVal=true)
 
bool getTag (size_t treeIndex) const
 
size_t size () const
 
size_t rootIdx () const
 
size_t tagCount () const
 
void clearAllTags ()
 

Detailed Description

3D specific KD tree

Definition at line 54 of file K3DTree-exact.h.

Constructor & Destructor Documentation

◆ K3DTreeExact()

K3DTreeExact::K3DTreeExact ( )

KD Tree constructor. Tree is uninitialised at start.

Note : must set progress pointer and callback

Definition at line 65 of file K3DTree-exact.cpp.

◆ ~K3DTreeExact()

AtomProbe::K3DTreeExact::~K3DTreeExact ( )
inline

Cleans up tree, deallocates nodes.

Definition at line 85 of file K3DTree-exact.h.

Member Function Documentation

◆ build()

bool K3DTreeExact::build ( )

Build the KD tree using the previously supplied points.

Builds a balanced KD tree from a list of points previously set by "resetPts". Callback and progress pointers must be set.

  • Returns false if callback returns false;

Definition at line 162 of file K3DTree-exact.cpp.

References ASSERT, clearAllTags(), AtomProbe::PROGRESS_REDUCE, and AxisCompareExact::setAxis().

Referenced by clearAllTags(), kdExactFuzz(), and main().

Here is the call graph for this function:

◆ clear()

void AtomProbe::K3DTreeExact::clear ( )
inline

Definition at line 149 of file K3DTree-exact.h.

◆ clearAllTags()

void K3DTreeExact::clearAllTags ( )

Definition at line 787 of file K3DTree-exact.cpp.

References ASSERT, build(), getPt(), ptsInSphere(), resetPts(), setCallback(), setProgressPointer(), AtomProbe::Point3D::sqrDist(), and TEST.

Referenced by build().

Here is the call graph for this function:

◆ clearTags()

void K3DTreeExact::clearTags ( std::vector< size_t > &  tagsToClear)

Definition at line 780 of file K3DTree-exact.cpp.

◆ dump()

void K3DTreeExact::dump ( std::ostream &  strm,
size_t  depth = 0,
size_t  offset = -1 
) const

Textual output of tree. Tabs are used to separate different levels of the tree.

The output from this function can be quite large for even modest trees. Recommended for debugging only

Definition at line 333 of file K3DTree-exact.cpp.

◆ findNearestUntagged()

size_t K3DTreeExact::findNearestUntagged ( const Point3D queryPt,
const BoundCube b,
bool  tag = true 
)

Find the nearest "untagged" point's internal index.

The point found is marked as "tagged" in the tree by default. -Returns -1 on failure (no untagged points), otherwise index of point

Definition at line 475 of file K3DTree-exact.cpp.

References ASSERT, and AtomProbe::BoundCube::intersects().

Referenced by findUntaggedInRadius(), and main().

Here is the call graph for this function:

◆ findUntaggedInRadius()

void K3DTreeExact::findUntaggedInRadius ( const Point3D queryPt,
const BoundCube b,
float  radius,
std::vector< size_t > &  result 
)

Find untagged points within a given radius.

This is not thread safe - tags are read/written during operation

Definition at line 724 of file K3DTree-exact.cpp.

References ASSERT, findNearestUntagged(), getPtRef(), size(), AtomProbe::Point3D::sqrDist(), and tag().

Referenced by kdExactFuzz(), and main().

Here is the call graph for this function:

◆ getBoundCube()

void K3DTreeExact::getBoundCube ( BoundCube b)

obtain the bounding rectangular prism volume for all elements in the KD tree

Definition at line 69 of file K3DTree-exact.cpp.

References ASSERT, and AtomProbe::BoundCube::setBounds().

Referenced by kdExactFuzz(), and main().

Here is the call graph for this function:

◆ getOrigIndex()

size_t K3DTreeExact::getOrigIndex ( size_t  treeIndex) const

Definition at line 87 of file K3DTree-exact.cpp.

References ASSERT.

Referenced by main().

◆ getPt()

const Point3D * K3DTreeExact::getPt ( size_t  index) const

Definition at line 75 of file K3DTree-exact.cpp.

References ASSERT.

Referenced by clearAllTags().

◆ getPtRef()

const Point3D & K3DTreeExact::getPtRef ( size_t  index) const

◆ getTag()

bool K3DTreeExact::getTag ( size_t  treeIndex) const

Definition at line 93 of file K3DTree-exact.cpp.

References ASSERT.

◆ ptsInSphere()

void K3DTreeExact::ptsInSphere ( const Point3D origin,
float  radius,
std::vector< size_t > &  pts 
) const

◆ resetPts() [1/2]

void K3DTreeExact::resetPts ( std::vector< Point3D > &  pts,
bool  clear = true 
)

Supply points to KD tree. Ouput vector will be erased if clear=true.

Definition at line 119 of file K3DTree-exact.cpp.

References AtomProbe::BoundCube::setBounds().

Referenced by clearAllTags(), kdExactFuzz(), and main().

Here is the call graph for this function:

◆ resetPts() [2/2]

void K3DTreeExact::resetPts ( std::vector< IonHit > &  pts,
bool  clear = true 
)

Supply points using IonHits to KD tree. Ouput vector will be erased if clear=true.

Definition at line 138 of file K3DTree-exact.cpp.

References AtomProbe::IonHit::getIonDataLimits().

Here is the call graph for this function:

◆ rootIdx()

size_t AtomProbe::K3DTreeExact::rootIdx ( ) const
inline

Definition at line 163 of file K3DTree-exact.h.

◆ setCallback()

void AtomProbe::K3DTreeExact::setCallback ( bool(*)(void)  cb)
inline

Definition at line 143 of file K3DTree-exact.h.

References callback().

Referenced by clearAllTags(), kdExactFuzz(), and main().

Here is the call graph for this function:

◆ setProgressPointer()

void AtomProbe::K3DTreeExact::setProgressPointer ( unsigned int *  p)
inline

Definition at line 146 of file K3DTree-exact.h.

Referenced by clearAllTags(), kdExactFuzz(), and main().

◆ size()

size_t K3DTreeExact::size ( ) const

◆ tag() [1/2]

void K3DTreeExact::tag ( size_t  treeIndex,
bool  tagVal = true 
)

Definition at line 99 of file K3DTree-exact.cpp.

References ASSERT.

Referenced by findUntaggedInRadius().

◆ tag() [2/2]

void K3DTreeExact::tag ( const std::vector< size_t > &  treeIndicies,
bool  tagVal = true 
)

Definition at line 105 of file K3DTree-exact.cpp.

References ASSERT.

◆ tagCount()

size_t K3DTreeExact::tagCount ( ) const

Definition at line 765 of file K3DTree-exact.cpp.


The documentation for this class was generated from the following files: