Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4KDNode_Base Class Referenceabstract

#include <G4KDNode.hh>

Inheritance diagram for G4KDNode_Base:
Collaboration diagram for G4KDNode_Base:

Public Member Functions

 G4KDNode_Base (G4KDTree *, G4KDNode_Base *)
 
virtual ~G4KDNode_Base ()
 
virtual double operator[] (size_t) const =0
 
virtual void InactiveNode ()
 
virtual bool IsValid () const
 
G4KDTreeGetTree () const
 
void SetTree (G4KDTree *tree)
 
int GetDim () const
 
int GetAxis () const
 
G4KDNode_BaseGetParent ()
 
G4KDNode_BaseGetLeft ()
 
G4KDNode_BaseGetRight ()
 
template<typename Position >
G4KDNode_BaseFindParent (const Position &x0)
 
template<typename PointT >
G4KDNode_BaseInsert (PointT *point)
 
template<typename PointT >
G4KDNode_BaseInsert (const PointT &point)
 
int Insert (G4KDNode_Base *newNode)
 
void PullSubTree ()
 
void RetrieveNodeList (std::list< G4KDNode_Base * > &node_list)
 
void Print (std::ostream &out, int level=0) const
 

Protected Attributes

size_t fAxis
 
int fSide
 
G4KDTreefTree
 
G4KDNode_BasefLeft
 
G4KDNode_BasefRight
 
G4KDNode_BasefParent
 

Detailed Description

Definition at line 65 of file G4KDNode.hh.

Constructor & Destructor Documentation

G4KDNode_Base::G4KDNode_Base ( G4KDTree tree,
G4KDNode_Base parent 
)

Definition at line 72 of file G4KDNode.cc.

73  :
74  fTree(tree),
75  fLeft(0), fRight(0), fParent(parent)
76 {
77  fSide = 0;
78  fAxis = fParent == 0? 0 : fParent->fAxis +1 < fTree->fDim? fParent->fAxis+1:0;
79 }
G4KDNode_Base * fLeft
Definition: G4KDNode.hh:120
size_t fDim
Definition: G4KDTree.hh:270
size_t fAxis
Definition: G4KDNode.hh:112
G4KDNode_Base * fParent
Definition: G4KDNode.hh:120
G4KDTree * fTree
Definition: G4KDNode.hh:119
G4KDNode_Base * fRight
Definition: G4KDNode.hh:120
G4KDNode_Base::~G4KDNode_Base ( )
virtual

Definition at line 103 of file G4KDNode.cc.

104 {
105 }

Member Function Documentation

template<typename Position >
G4KDNode_Base* G4KDNode_Base::FindParent ( const Position &  x0)

Here is the caller graph for this function:

int G4KDNode_Base::GetAxis ( ) const
inline

Definition at line 83 of file G4KDNode.hh.

83 {return fAxis;}
size_t fAxis
Definition: G4KDNode.hh:112

Here is the caller graph for this function:

int G4KDNode_Base::GetDim ( ) const

Definition at line 112 of file G4KDNode.cc.

113 {
114  if(fTree)
115  return fTree->GetDim();
116  else
117  return -1;
118 }
size_t GetDim() const
Definition: G4KDTree.hh:88
G4KDTree * fTree
Definition: G4KDNode.hh:119

Here is the call graph for this function:

G4KDNode_Base* G4KDNode_Base::GetLeft ( )
inline

Definition at line 85 of file G4KDNode.hh.

85 {return fLeft;}
G4KDNode_Base * fLeft
Definition: G4KDNode.hh:120

Here is the caller graph for this function:

G4KDNode_Base* G4KDNode_Base::GetParent ( )
inline

Definition at line 84 of file G4KDNode.hh.

84 {return fParent;}
G4KDNode_Base * fParent
Definition: G4KDNode.hh:120
G4KDNode_Base* G4KDNode_Base::GetRight ( )
inline

Definition at line 86 of file G4KDNode.hh.

86 {return fRight;}
G4KDNode_Base * fRight
Definition: G4KDNode.hh:120

Here is the caller graph for this function:

G4KDTree* G4KDNode_Base::GetTree ( ) const
inline

Definition at line 78 of file G4KDNode.hh.

78 {return fTree;}
G4KDTree * fTree
Definition: G4KDNode.hh:119
void G4KDNode_Base::InactiveNode ( )
virtual

Reimplemented in G4KDNodeCopy< PointCopyT >, and G4KDNode< PointT >.

Definition at line 107 of file G4KDNode.cc.

108 {
110 }
G4KDTree * fTree
Definition: G4KDNode.hh:119
void NoticeNodeDeactivation()
Definition: G4KDTree.hh:82

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename PointT >
G4KDNode_Base* G4KDNode_Base::Insert ( PointT *  point)

Here is the caller graph for this function:

template<typename PointT >
G4KDNode_Base* G4KDNode_Base::Insert ( const PointT &  point)
int G4KDNode_Base::Insert ( G4KDNode_Base newNode)

Definition at line 120 of file G4KDNode.cc.

121 {
122  G4KDNode_Base* aParent = FindParent(*newNode);
123  // TODO check p == aParent->pos
124  // Exception
125 
126  newNode->fAxis = aParent->fAxis +1 < fTree->GetDim()? aParent->fAxis+1:0;
127  newNode->fParent = aParent ;
128 
129  if((*newNode)[aParent->fAxis] > (*aParent)[aParent->fAxis])
130  {
131  aParent->fRight = newNode ;
132  newNode->fSide = 1 ;
133  }
134  else
135  {
136  aParent->fLeft = newNode ;
137  newNode->fSide = -1 ;
138  }
139 
140  newNode->fRight = 0;
141  newNode->fLeft = 0;
142 
143  return 0 ;
144 }
G4KDNode_Base * fLeft
Definition: G4KDNode.hh:120
size_t fAxis
Definition: G4KDNode.hh:112
G4KDNode_Base * FindParent(const Position &x0)
G4KDNode_Base * fParent
Definition: G4KDNode.hh:120
size_t GetDim() const
Definition: G4KDTree.hh:88
G4KDTree * fTree
Definition: G4KDNode.hh:119
G4KDNode_Base * fRight
Definition: G4KDNode.hh:120

Here is the call graph for this function:

virtual bool G4KDNode_Base::IsValid ( void  ) const
inlinevirtual

Reimplemented in G4KDNodeCopy< PointCopyT >, and G4KDNode< PointT >.

Definition at line 75 of file G4KDNode.hh.

75 { return true; }
virtual double G4KDNode_Base::operator[] ( size_t  ) const
pure virtual
void G4KDNode_Base::Print ( std::ostream &  out,
int  level = 0 
) const

Definition at line 178 of file G4KDNode.cc.

179 {
180  // Print node level
181  out << G4endl;
182  for (int i=0; i<level; i++) // Indent to level
183  {
184  out << " ";
185  }
186  out << level;
187 
188  // Print children
189  if(fLeft)
190  {
191  fLeft->Print(out, level + 1);
192  }
193  if(fRight)
194  {
195  fRight->Print(out, level + 1);
196  }
197 }
G4KDNode_Base * fLeft
Definition: G4KDNode.hh:120
void Print(std::ostream &out, int level=0) const
Definition: G4KDNode.cc:178
#define G4endl
Definition: G4ios.hh:61
G4KDNode_Base * fRight
Definition: G4KDNode.hh:120

Here is the call graph for this function:

Here is the caller graph for this function:

void G4KDNode_Base::PullSubTree ( )

Definition at line 147 of file G4KDNode.cc.

148 {
149  if(fParent)
150  {
151  if(fSide == -1)
152  {
153  fParent->fLeft = 0;
154  }
155  else
156  fParent->fRight = 0;
157  }
158  if(fLeft) fLeft -> PullSubTree();
159  if(fRight) fRight-> PullSubTree();
160 
161  fParent = 0 ;
162  fRight = 0 ;
163  fLeft = 0 ;
164  fTree = 0 ;
165 }
G4KDNode_Base * fLeft
Definition: G4KDNode.hh:120
G4KDNode_Base * fParent
Definition: G4KDNode.hh:120
void PullSubTree()
Definition: G4KDNode.cc:147
G4KDTree * fTree
Definition: G4KDNode.hh:119
G4KDNode_Base * fRight
Definition: G4KDNode.hh:120
void G4KDNode_Base::RetrieveNodeList ( std::list< G4KDNode_Base * > &  node_list)

Definition at line 167 of file G4KDNode.cc.

168 {
169  output.push_back(this);
170 
171  if(fLeft)
172  fLeft->RetrieveNodeList(output);
173 
174  if(fRight)
175  fRight->RetrieveNodeList(output);
176 }
G4KDNode_Base * fLeft
Definition: G4KDNode.hh:120
void RetrieveNodeList(std::list< G4KDNode_Base * > &node_list)
Definition: G4KDNode.cc:167
G4KDNode_Base * fRight
Definition: G4KDNode.hh:120

Here is the call graph for this function:

Here is the caller graph for this function:

void G4KDNode_Base::SetTree ( G4KDTree tree)
inline

Definition at line 79 of file G4KDNode.hh.

79 {fTree = tree;}
tuple tree
Definition: gammaraytel.py:4
G4KDTree * fTree
Definition: G4KDNode.hh:119

Member Data Documentation

size_t G4KDNode_Base::fAxis
protected

Definition at line 112 of file G4KDNode.hh.

G4KDNode_Base* G4KDNode_Base::fLeft
protected

Definition at line 120 of file G4KDNode.hh.

G4KDNode_Base * G4KDNode_Base::fParent
protected

Definition at line 120 of file G4KDNode.hh.

G4KDNode_Base * G4KDNode_Base::fRight
protected

Definition at line 120 of file G4KDNode.hh.

int G4KDNode_Base::fSide
protected

Definition at line 113 of file G4KDNode.hh.

G4KDTree* G4KDNode_Base::fTree
protected

Definition at line 119 of file G4KDNode.hh.


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