Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
__1DSortOut Class Reference

#include <G4KDMap.hh>

Classes

struct  sortOutNDim
 

Public Member Functions

 __1DSortOut (size_t dimension)
 
 __1DSortOut (const __1DSortOut &right)
 
int GetDimension ()
 
G4KDNode_BaseGetMidle (size_t &)
 
std::deque< G4KDNode_Base * >::iterator Insert (G4KDNode_Base *)
 
G4KDNode_BasePopOutMiddle ()
 
void Sort ()
 
void Erase (std::deque< G4KDNode_Base * >::iterator &)
 
size_t Size ()
 

Protected Attributes

std::deque< G4KDNode_Base * > fContainer
 
sortOutNDim fSortOutNDim
 

Detailed Description

Definition at line 57 of file G4KDMap.hh.

Constructor & Destructor Documentation

◆ __1DSortOut() [1/2]

__1DSortOut::__1DSortOut ( size_t  dimension)

Definition at line 41 of file G4KDMap.cc.

41 :
42 fSortOutNDim(dimension)
43{
44}
sortOutNDim fSortOutNDim
Definition: G4KDMap.hh:86

◆ __1DSortOut() [2/2]

__1DSortOut::__1DSortOut ( const __1DSortOut right)

Definition at line 46 of file G4KDMap.cc.

46 :
48{
49}
std::deque< G4KDNode_Base * > fContainer
Definition: G4KDMap.hh:85

Member Function Documentation

◆ Erase()

void __1DSortOut::Erase ( std::deque< G4KDNode_Base * >::iterator &  deq_pos)

Definition at line 85 of file G4KDMap.cc.

86{
87 fContainer.erase(deq_pos);
88}

◆ GetDimension()

int __1DSortOut::GetDimension ( )

Definition at line 51 of file G4KDMap.cc.

52{
54}

◆ GetMidle()

G4KDNode_Base * __1DSortOut::GetMidle ( size_t &  main_middle)

Definition at line 56 of file G4KDMap.cc.

57{
58 size_t contSize = fContainer.size();
59 main_middle = (size_t) ceil(contSize / 2.); // ceil = round up
60 return fContainer[main_middle];
61}

Referenced by PopOutMiddle().

◆ Insert()

_deq_iterator __1DSortOut::Insert ( G4KDNode_Base pos)

Definition at line 63 of file G4KDMap.cc.

64{
65 return fContainer.insert(fContainer.end(), pos);
66}

◆ PopOutMiddle()

G4KDNode_Base * __1DSortOut::PopOutMiddle ( )

Definition at line 68 of file G4KDMap.cc.

69{
70 size_t middle;
71 G4KDNode_Base* pos = GetMidle(middle);
72 _deq_iterator deq_pos = fContainer.begin() + middle;
73
74 if(deq_pos == fContainer.end()) return 0; // this is a double check
75
76 fContainer.erase(deq_pos);
77 return pos;
78}
std::deque< G4KDNode_Base * >::iterator _deq_iterator
Definition: G4KDMap.cc:33
G4KDNode_Base * GetMidle(size_t &)
Definition: G4KDMap.cc:56

◆ Size()

size_t __1DSortOut::Size ( )
inline

Definition at line 69 of file G4KDMap.hh.

70 {
71 return fContainer.size();
72 }

◆ Sort()

void __1DSortOut::Sort ( )

Definition at line 80 of file G4KDMap.cc.

81{
82 sort(fContainer.begin(), fContainer.end(), fSortOutNDim);
83}

Member Data Documentation

◆ fContainer

std::deque<G4KDNode_Base*> __1DSortOut::fContainer
protected

Definition at line 85 of file G4KDMap.hh.

Referenced by Erase(), GetMidle(), Insert(), PopOutMiddle(), Size(), and Sort().

◆ fSortOutNDim

sortOutNDim __1DSortOut::fSortOutNDim
protected

Definition at line 86 of file G4KDMap.hh.

Referenced by GetDimension(), and Sort().


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