Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4KDMap Class Reference

#include <G4KDMap.hh>

Public Member Functions

 G4KDMap (size_t dimensions)
 
void Insert (G4KDNode_Base *pos)
 
void Sort ()
 
G4KDNode_BasePopOutMiddle (size_t dimension)
 
size_t GetDimension ()
 
size_t GetSize ()
 

Detailed Description

Definition at line 89 of file G4KDMap.hh.

Constructor & Destructor Documentation

G4KDMap::G4KDMap ( size_t  dimensions)
inline

Definition at line 92 of file G4KDMap.hh.

92  : fSortOut(dimensions, __1DSortOut(dimensions))
93  {
94  fIsSorted = false;
95 // for(size_t i = 0 ; i < dimensions ; i++)
96 // {
97 // fSortOut[i] = new __1DSortOut(i);
98 // }
99  }

Member Function Documentation

size_t G4KDMap::GetDimension ( )
inline

Definition at line 105 of file G4KDMap.hh.

106  {
107  return fSortOut.size();
108  }
size_t G4KDMap::GetSize ( )
inline

Definition at line 110 of file G4KDMap.hh.

111  {
112  return fMap.size();
113  }

Here is the caller graph for this function:

void G4KDMap::Insert ( G4KDNode_Base pos)

Definition at line 90 of file G4KDMap.cc.

91 {
92  vector<_deq_iterator>& vit = fMap[pos];
93 
94  size_t maxSize = fSortOut.size();
95 
96  G4cout << "G4KDMap::Insert : " << maxSize << G4endl;
97 
98 
99  vit.reserve(maxSize);
100 
101  for (size_t i = 0; i < fSortOut.size(); ++i)
102  {
103  vit[i] = fSortOut[i].Insert(pos);
104 
105 // if(*(vit[i]) != pos)
106 // {
107 // G4cout << "insert wrong iterator" << G4endl;
108 // abort();
109 // }
110  }
111  /*
112  std::map<G4KDNode*, std::vector<_deq_iterator> >::iterator fMap_it
113  = fMap.begin();
114 
115  for( ; fMap_it != fMap.end() ; fMap_it++)
116  {
117  std::vector<_deq_iterator>& vit = fMap_it->second;
118 
119  G4KDNode* tmpNode = fMap_it->first;
120 
121  for(size_t i = 0 ; i < fSortOut.size() ; i++)
122  {
123  G4cout << "i = " << i << G4endl;
124  G4cout << "vit[i] = " << *(vit[i]) << G4endl;
125  if(*(vit[i]) != tmpNode)
126  {
127  G4cout << "!!!! Wrong iterator" << G4endl;
128  abort();
129  }
130  }
131 
132  }
133  */
134 
135  fIsSorted = false;
136 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static const G4double pos

Here is the caller graph for this function:

G4KDNode_Base * G4KDMap::PopOutMiddle ( size_t  dimension)

Definition at line 138 of file G4KDMap.cc.

139 {
140  G4cout << "_____________" << G4endl;
141  G4cout << "G4KDMap::PopOutMiddle ( "<< dimension << " )" << G4endl;
142 
143  if(fIsSorted == false) Sort();
144  G4KDNode_Base* output_node = fSortOut[dimension].PopOutMiddle();
145 
146  if(output_node == 0) return 0;
147 
148  G4cout << "output_node : " << output_node << G4endl;
149  G4cout << "output_node : " << output_node->GetAxis() << G4endl;
150 
151  std::map<G4KDNode_Base*, std::vector<_deq_iterator> >::iterator fMap_it
152  = fMap.find(output_node);
153 
154 
155  if(fMap_it == fMap.end())
156  {
157  G4cout << "fMap_it == fMap.end()" << G4endl;
158  G4cout << "output_node = " << output_node << G4endl;
159  return output_node;
160  }
161 
162  std::vector<_deq_iterator>& vit = fMap_it->second;
163 
164  /*
165  if(fMap_it->first != output_node)
166  {
167  G4cout << "fMap_it->first ! output_node"<< G4endl;
168  G4cout << "fMap_it->first = " << fMap_it->first << G4endl;
169  abort();
170  }
171  */
172 
173  for(size_t i = 0; i < fSortOut.size(); i++)
174  {
175  if(i != dimension)
176  {
177  G4cout << "i = " << i << G4endl;
178 
179  /*
180  // G4cout << "i = " << i << G4endl;
181  // G4cout << "vit[i] = " << *(vit[i]) << G4endl;
182  if(*(vit[i]) != output_node)
183  {
184  G4cout << "deleting wrong iterator" << G4endl;
185  abort();
186  }
187  */
188  fSortOut[i].Erase(vit[i]);
189  }
190  }
191 
192  fMap.erase(fMap_it);
193 
194  return output_node;
195 }
int GetAxis() const
Definition: G4KDNode.hh:83
void Sort()
Definition: G4KDMap.cc:197
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4KDMap::Sort ( )

Definition at line 197 of file G4KDMap.cc.

198 {
199  for (size_t i = 0; i < fSortOut.size(); ++i)
200  {
201  fSortOut[i].Sort();
202  }
203 
204  fIsSorted = true;
205 }

Here is the caller graph for this function:


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