Geant4  10.01.p02
G4KDTree Class Reference

G4KDTree is used by the ITManager to locate the neareast neighbours. More...

#include <G4KDTree.hh>

+ Collaboration diagram for G4KDTree:

Classes

class  HyperRect
 

Public Member Functions

 G4KDTree (size_t dim=3)
 
 ~G4KDTree ()
 
void Clear ()
 
void Print (std::ostream &out=G4cout) const
 
void Build ()
 
void NoticeNodeDeactivation ()
 
size_t GetDim () const
 
int GetNbNodes () const
 
G4KDNode_BaseGetRoot ()
 
template<typename PointT >
G4KDNode_BaseInsertMap (PointT *pos)
 
template<typename PointT >
G4KDNode_BaseInsert (PointT *pos)
 
template<typename Position >
G4KDTreeResultHandle Nearest (const Position &pos)
 
G4KDTreeResultHandle Nearest (G4KDNode_Base *node)
 
template<typename Position >
G4KDTreeResultHandle NearestInRange (const Position &pos, const double &range)
 
G4KDTreeResultHandle NearestInRange (G4KDNode_Base *node, const double &range)
 
void * operator new (size_t)
 
void operator delete (void *)
 

Protected Member Functions

void __InsertMap (G4KDNode_Base *node)
 
void __Clear_Rec (G4KDNode_Base *node)
 
template<typename Position >
int __NearestInRange (G4KDNode_Base *node, const Position &pos, const double &range_sq, const double &range, G4KDTreeResult &list, int ordered, G4KDNode_Base *source_node=0)
 
template<typename Position >
void __NearestToPosition (G4KDNode_Base *node, const Position &pos, G4KDNode_Base *&result, double *result_dist_sq, HyperRect *fRect)
 
template<typename Position >
void __NearestToNode (G4KDNode_Base *source_node, G4KDNode_Base *node, const Position &pos, std::vector< G4KDNode_Base * > &result, double *result_dist_sq, HyperRect *fRect, int &nbresult)
 

Protected Attributes

HyperRectfRect
 
G4KDNode_BasefRoot
 
size_t fDim
 
int fNbNodes
 
int fNbActiveNodes
 
G4KDMapfKDMap
 
G4ThreadLocalStatic
G4Allocator< G4KDTree > * 
fgAllocator
 

Friends

class G4KDNode_Base
 

Detailed Description

G4KDTree is used by the ITManager to locate the neareast neighbours.

A kdtree sorts out node in such a way that it reduces the number of node check. The results of this search can be retrieved by G4KDTreeResultHandle.

Definition at line 72 of file G4KDTree.hh.

Constructor & Destructor Documentation

G4KDTree::G4KDTree ( size_t  dim = 3)

Definition at line 50 of file G4KDTree.cc.

References fDim, fNbActiveNodes, fNbNodes, fRect, and fRoot.

G4KDTree::~G4KDTree ( )

Definition at line 60 of file G4KDTree.cc.

References __Clear_Rec(), fKDMap, fRect, and fRoot.

+ Here is the call graph for this function:

Member Function Documentation

void G4KDTree::__Clear_Rec ( G4KDNode_Base node)
protected

Definition at line 103 of file G4KDTree.cc.

References G4KDNode_Base::GetLeft(), and G4KDNode_Base::GetRight().

Referenced by Clear(), and ~G4KDTree().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4KDTree::__InsertMap ( G4KDNode_Base node)
protected

Definition at line 113 of file G4KDTree.cc.

References fKDMap, and G4KDMap::Insert().

+ Here is the call graph for this function:

template<typename Position >
int G4KDTree::__NearestInRange ( G4KDNode_Base node,
const Position &  pos,
const double &  range_sq,
const double &  range,
G4KDTreeResult list,
int  ordered,
G4KDNode_Base source_node = 0 
)
protected

Referenced by NearestInRange().

+ Here is the caller graph for this function:

template<typename Position >
void G4KDTree::__NearestToNode ( G4KDNode_Base source_node,
G4KDNode_Base node,
const Position &  pos,
std::vector< G4KDNode_Base * > &  result,
double *  result_dist_sq,
HyperRect fRect,
int &  nbresult 
)
protected

Referenced by Nearest().

+ Here is the caller graph for this function:

template<typename Position >
void G4KDTree::__NearestToPosition ( G4KDNode_Base node,
const Position &  pos,
G4KDNode_Base *&  result,
double *  result_dist_sq,
HyperRect fRect 
)
protected
void G4KDTree::Build ( void  )

Definition at line 118 of file G4KDTree.cc.

References G4KDTree::HyperRect::Extend(), fDim, fKDMap, fNbActiveNodes, fRect, fRoot, G4cout, G4endl, G4KDMap::GetSize(), G4KDNode_Base::Insert(), n, G4KDMap::PopOutMiddle(), and G4KDTree::HyperRect::SetMinMax().

+ Here is the call graph for this function:

void G4KDTree::Clear ( )

Definition at line 90 of file G4KDTree.cc.

References __Clear_Rec(), fNbNodes, fRect, and fRoot.

Referenced by NoticeNodeDeactivation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t G4KDTree::GetDim ( ) const
inline

Definition at line 88 of file G4KDTree.hh.

References fDim.

Referenced by G4KDNode_Base::GetDim(), and G4KDNode_Base::Insert().

+ Here is the caller graph for this function:

int G4KDTree::GetNbNodes ( ) const
inline

Definition at line 92 of file G4KDTree.hh.

References fNbNodes.

G4KDNode_Base* G4KDTree::GetRoot ( )
inline

Definition at line 96 of file G4KDTree.hh.

References fRoot.

template<typename PointT >
G4KDNode_Base* G4KDTree::Insert ( PointT *  pos)
template<typename PointT >
G4KDNode_Base* G4KDTree::InsertMap ( PointT *  pos)
template<typename Position >
G4KDTreeResultHandle G4KDTree::Nearest ( const Position &  pos)
G4KDTreeResultHandle G4KDTree::Nearest ( G4KDNode_Base node)

Definition at line 155 of file G4KDTree.cc.

References __NearestToNode(), DBL_MAX, fRect, fRoot, G4cout, and G4endl.

+ Here is the call graph for this function:

template<typename Position >
G4KDTreeResultHandle G4KDTree::NearestInRange ( const Position &  pos,
const double &  range 
)
G4KDTreeResultHandle G4KDTree::NearestInRange ( G4KDNode_Base node,
const double &  range 
)

Definition at line 198 of file G4KDTree.cc.

References __NearestInRange(), fRoot, G4KDTreeResult::Rewind(), G4KDTreeResult::Sort(), and sqr().

+ Here is the call graph for this function:

void G4KDTree::NoticeNodeDeactivation ( )
inline

Definition at line 82 of file G4KDTree.hh.

References Clear(), and fNbActiveNodes.

Referenced by G4KDNode_Base::InactiveNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4KDTree::operator delete ( void *  aNode)

Definition at line 80 of file G4KDTree.cc.

void * G4KDTree::operator new ( size_t  )

Definition at line 74 of file G4KDTree.cc.

References G4Allocator< Type >::MallocSingle().

+ Here is the call graph for this function:

void G4KDTree::Print ( std::ostream &  out = G4cout) const

Definition at line 85 of file G4KDTree.cc.

References fRoot, and G4KDNode_Base::Print().

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class G4KDNode_Base
friend

Definition at line 74 of file G4KDTree.hh.

Member Data Documentation

size_t G4KDTree::fDim
protected

Definition at line 268 of file G4KDTree.hh.

Referenced by Build(), G4KDNode_Base::G4KDNode_Base(), G4KDTree(), and GetDim().

G4ThreadLocal G4Allocator< G4KDTree > * G4KDTree::fgAllocator
protected

Definition at line 273 of file G4KDTree.hh.

G4KDMap* G4KDTree::fKDMap
protected

Definition at line 271 of file G4KDTree.hh.

Referenced by __InsertMap(), Build(), and ~G4KDTree().

int G4KDTree::fNbActiveNodes
protected

Definition at line 270 of file G4KDTree.hh.

Referenced by Build(), G4KDTree(), and NoticeNodeDeactivation().

int G4KDTree::fNbNodes
protected

Definition at line 269 of file G4KDTree.hh.

Referenced by Clear(), G4KDTree(), and GetNbNodes().

HyperRect* G4KDTree::fRect
protected

Definition at line 266 of file G4KDTree.hh.

Referenced by Build(), Clear(), G4KDTree(), Nearest(), and ~G4KDTree().

G4KDNode_Base* G4KDTree::fRoot
protected

Definition at line 267 of file G4KDTree.hh.

Referenced by Build(), Clear(), G4KDTree(), GetRoot(), Nearest(), NearestInRange(), Print(), and ~G4KDTree().


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