Geant4  10.00.p02
G4KDTree Class Reference

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

#include <G4KDTree.hh>

+ Collaboration diagram for G4KDTree:

Public Member Functions

 G4KDTree (int dim=3)
 
virtual ~G4KDTree ()
 
void Clear ()
 
int GetDim ()
 
void SetDataDestructor (void(*fDestr)(void *))
 
int GetNbNodes ()
 
G4KDNodeGetRoot ()
 
G4KDNodeInsertMap (const double &x, const double &y, const double &z, void *data)
 
G4KDNodeInsertMap (const double *pos, void *data)
 
void Build ()
 
G4KDNodeInsert (const double *pos, void *data)
 
G4KDNodeInsert (const double &x, const double &y, const double &z, void *data)
 
G4KDTreeResultHandle Nearest (const double *pos)
 
G4KDTreeResultHandle Nearest (const double &x, const double &y, const double &z)
 
G4KDTreeResultHandle Nearest (G4KDNode *node)
 
G4KDTreeResultHandle NearestInRange (const double *pos, const double &range)
 
G4KDTreeResultHandle NearestInRange (const double &x, const double &y, const double &z, const double &range)
 
G4KDTreeResultHandle NearestInRange (G4KDNode *node, const double &range)
 

Protected Member Functions

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

Protected Attributes

G4KDNodefRoot
 

Private Attributes

int fDim
 
struct HyperRectfRect
 
void(* fDestr )(void *)
 
int fNbNodes
 
G4KDMapfKDMap
 

Friends

class G4KDNode
 

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 62 of file G4KDTree.hh.

Constructor & Destructor Documentation

G4KDTree::G4KDTree ( int  dim = 3)

Definition at line 170 of file G4KDTree.cc.

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

G4KDTree::~G4KDTree ( )
virtual

Definition at line 179 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 node)
protected

Definition at line 206 of file G4KDTree.cc.

References fDestr, G4KDNode::GetData(), G4KDNode::GetLeft(), G4KDNode::GetRight(), and G4KDNode::SetData().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int G4KDTree::__NearestInRange ( G4KDNode node,
const double *  pos,
const double &  range_sq,
const double &  range,
G4KDTreeResult list,
int  ordered,
G4KDNode source_node = 0 
)
protected

Definition at line 303 of file G4KDTree.cc.

References DBL_MAX, fDim, G4KDNode::GetAxis(), GetData(), G4KDNode::GetLeft(), G4KDNode::GetPosition(), G4KDNode::GetRight(), G4KDTreeResult::Insert(), pos, and sqr().

Referenced by NearestInRange().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 462 of file G4KDTree.cc.

References HyperRect::CompareDistSqr(), fDim, G4KDNode::GetAxis(), G4KDNode::GetData(), G4KDNode::GetLeft(), HyperRect::GetMax(), HyperRect::GetMin(), G4KDNode::GetPosition(), G4KDNode::GetRight(), and sqr().

Referenced by Nearest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4KDTree::__NearestToPosition ( G4KDNode node,
const double *  pos,
G4KDNode *&  result,
double *  result_dist_sq,
struct HyperRect fRect 
)
protected

Definition at line 350 of file G4KDTree.cc.

References HyperRect::CompareDistSqr(), fDim, G4KDNode::GetAxis(), G4KDNode::GetData(), G4KDNode::GetLeft(), HyperRect::GetMax(), HyperRect::GetMin(), G4KDNode::GetPosition(), G4KDNode::GetRight(), and sqr().

Referenced by Nearest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G4KDTree::Build ( )

Definition at line 241 of file G4KDTree.cc.

References HyperRect::Extend(), fDim, fKDMap, fRect, fRoot, G4KDNode::GetPosition(), G4KDMap::GetSize(), G4KDNode::Insert(), n, and G4KDMap::PopOutMiddle().

+ Here is the call graph for this function:

void G4KDTree::Clear ( )

Definition at line 193 of file G4KDTree.cc.

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

+ Here is the call graph for this function:

int G4KDTree::GetDim ( )
inline

Definition at line 143 of file G4KDTree.hh.

References fDim.

Referenced by G4KDNode::GetDim(), and G4KDTreeResult::GetItem().

+ Here is the caller graph for this function:

int G4KDTree::GetNbNodes ( )
inline

Definition at line 83 of file G4KDTree.hh.

References fNbNodes.

G4KDNode* G4KDTree::GetRoot ( )
inline

Definition at line 84 of file G4KDTree.hh.

References fRoot.

G4KDNode * G4KDTree::Insert ( const double *  pos,
void *  data 
)

Definition at line 263 of file G4KDTree.cc.

References HyperRect::Extend(), fDim, fNbNodes, fRect, fRoot, G4KDNode, and G4KDNode::Insert().

Referenced by Insert().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4KDNode * G4KDTree::Insert ( const double &  x,
const double &  y,
const double &  z,
void *  data 
)

Definition at line 293 of file G4KDTree.cc.

References Insert(), and z.

+ Here is the call graph for this function:

G4KDNode * G4KDTree::InsertMap ( const double &  x,
const double &  y,
const double &  z,
void *  data 
)

Definition at line 224 of file G4KDTree.cc.

References z.

G4KDNode * G4KDTree::InsertMap ( const double *  pos,
void *  data 
)

Definition at line 233 of file G4KDTree.cc.

References fKDMap, G4KDNode, and G4KDMap::Insert().

+ Here is the call graph for this function:

G4KDTreeResultHandle G4KDTree::Nearest ( const double *  pos)

Definition at line 428 of file G4KDTree.cc.

References __NearestToPosition(), DBL_MAX, fRect, and fRoot.

Referenced by Nearest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4KDTreeResultHandle G4KDTree::Nearest ( const double &  x,
const double &  y,
const double &  z 
)

Definition at line 594 of file G4KDTree.cc.

References Nearest(), pos, and z.

+ Here is the call graph for this function:

G4KDTreeResultHandle G4KDTree::Nearest ( G4KDNode node)

Definition at line 550 of file G4KDTree.cc.

References __NearestToNode(), DBL_MAX, fRect, fRoot, G4cout, G4endl, G4KDNode::GetPosition(), and pos.

+ Here is the call graph for this function:

G4KDTreeResultHandle G4KDTree::NearestInRange ( const double *  pos,
const double &  range 
)

Definition at line 603 of file G4KDTree.cc.

References __NearestInRange(), fRoot, and sqr().

Referenced by NearestInRange().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

G4KDTreeResultHandle G4KDTree::NearestInRange ( const double &  x,
const double &  y,
const double &  z,
const double &  range 
)

Definition at line 620 of file G4KDTree.cc.

References NearestInRange(), and z.

+ Here is the call graph for this function:

G4KDTreeResultHandle G4KDTree::NearestInRange ( G4KDNode node,
const double &  range 
)

Definition at line 632 of file G4KDTree.cc.

References __NearestInRange(), fRoot, G4KDNode::GetPosition(), and sqr().

+ Here is the call graph for this function:

void G4KDTree::SetDataDestructor ( void(*)(void *)  fDestr)
inline

Definition at line 148 of file G4KDTree.hh.

References fDestr.

Friends And Related Function Documentation

friend class G4KDNode
friend

Definition at line 64 of file G4KDTree.hh.

Referenced by Insert(), and InsertMap().

Member Data Documentation

void(* G4KDTree::fDestr)(void *)
private

Definition at line 67 of file G4KDTree.hh.

Referenced by __Clear_Rec(), G4KDTree(), and SetDataDestructor().

G4KDMap* G4KDTree::fKDMap
private

Definition at line 69 of file G4KDTree.hh.

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

int G4KDTree::fNbNodes
private

Definition at line 68 of file G4KDTree.hh.

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

struct HyperRect* G4KDTree::fRect
private

Definition at line 66 of file G4KDTree.hh.

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

G4KDNode* G4KDTree::fRoot
protected

Definition at line 72 of file G4KDTree.hh.

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


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