Geant4 11.1.1
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 (std::size_t dimension)
 
 __1DSortOut (const __1DSortOut &right)
 
G4int GetDimension ()
 
G4KDNode_BaseGetMidle (std::size_t &)
 
std::deque< G4KDNode_Base * >::iterator Insert (G4KDNode_Base *)
 
G4KDNode_BasePopOutMiddle ()
 
void Sort ()
 
void Erase (std::deque< G4KDNode_Base * >::iterator &)
 
std::size_t Size ()
 

Protected Attributes

std::deque< G4KDNode_Base * > fContainer
 
sortOutNDim fSortOutNDim
 

Detailed Description

Definition at line 59 of file G4KDMap.hh.

Constructor & Destructor Documentation

◆ __1DSortOut() [1/2]

__1DSortOut::__1DSortOut ( std::size_t  dimension)

Definition at line 41 of file G4KDMap.cc.

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

◆ __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:87

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()

G4int __1DSortOut::GetDimension ( )

Definition at line 51 of file G4KDMap.cc.

52{
54}
int G4int
Definition: G4Types.hh:85
std::size_t fDimension
Definition: G4KDMap.hh:84

◆ GetMidle()

G4KDNode_Base * __1DSortOut::GetMidle ( std::size_t &  main_middle)

Definition at line 56 of file G4KDMap.cc.

57{
58 std::size_t contSize = fContainer.size();
59 main_middle = (std::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 std::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(std::size_t &)
Definition: G4KDMap.cc:56

◆ Size()

std::size_t __1DSortOut::Size ( )
inline

Definition at line 71 of file G4KDMap.hh.

72 {
73 return fContainer.size();
74 }

◆ 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 87 of file G4KDMap.hh.

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

◆ fSortOutNDim

sortOutNDim __1DSortOut::fSortOutNDim
protected

Definition at line 88 of file G4KDMap.hh.

Referenced by GetDimension(), and Sort().


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