Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4KDMap Class Reference

#include <G4KDMap.hh>

Public Member Functions

 G4KDMap (int dimensions)
 
void Insert (G4KDNode *pos)
 
void Sort ()
 
G4KDNodePopOutMiddle (int dimension)
 
int GetDimension ()
 
size_t GetSize ()
 

Detailed Description

Definition at line 73 of file G4KDMap.hh.

Constructor & Destructor Documentation

G4KDMap::G4KDMap ( int  dimensions)
inline

Definition at line 76 of file G4KDMap.hh.

76  : fSortOut(dimensions)
77  {
78  fIsSorted = false;
79  for(int i = 0 ; i < dimensions ; i++)
80  {
81  fSortOut[i] = new __1DSortOut(i);
82  }
83  }

Member Function Documentation

int G4KDMap::GetDimension ( )
inline

Definition at line 89 of file G4KDMap.hh.

90  {
91  return fSortOut.size();
92  }
size_t G4KDMap::GetSize ( )
inline

Definition at line 94 of file G4KDMap.hh.

Referenced by G4KDTree::Build().

95  {
96  return fMap.size();
97  }
void G4KDMap::Insert ( G4KDNode pos)

Definition at line 73 of file G4KDMap.cc.

Referenced by G4KDTree::InsertMap().

74 {
75  vector<_deq_iterator>& vit = fMap[pos];
76 
77  size_t maxSize = fSortOut.size();
78 
79  cout << maxSize << endl;
80  cout << fSortOut.capacity() << endl;
81 
82  vit.reserve(maxSize);
83 
84  for (size_t i = 0; i < fSortOut.size(); ++i)
85  {
86  vit[i]=fSortOut[i]->Insert(pos);
87  }
88 
89  fIsSorted = false;
90 }
G4KDNode * G4KDMap::PopOutMiddle ( int  dimension)

Definition at line 92 of file G4KDMap.cc.

References int(), and Sort().

Referenced by G4KDTree::Build().

93 {
94  if(fIsSorted == false) Sort();
95  G4KDNode* output_node = fSortOut[dimension]->PopOutMiddle();
96 
97  std::map<G4KDNode*, std::vector<_deq_iterator> >::iterator fMap_it
98  = fMap.find(output_node);
99 
100  std::vector<_deq_iterator>& vit = fMap_it->second;
101 
102  for(int i = 0 ; i < (int) fSortOut.size() ; i++)
103  {
104  if(i != dimension) fSortOut[i]->Erase(vit[i]);
105  }
106 
107  fMap.erase(fMap_it);
108 
109  return output_node;
110 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
void Sort()
Definition: G4KDMap.cc:112
void G4KDMap::Sort ( )

Definition at line 112 of file G4KDMap.cc.

Referenced by PopOutMiddle().

113 {
114  for (size_t i = 0; i < fSortOut.size(); ++i)
115  {
116  fSortOut[i]->Sort();
117  }
118 
119  fIsSorted = true;
120 }

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