Geant4 11.2.2
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)
default

Member Function Documentation

◆ Erase()

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

Definition at line 83 of file G4KDMap.cc.

84{
85 fContainer.erase(deq_pos);
86}
std::deque< G4KDNode_Base * > fContainer
Definition G4KDMap.hh:87

◆ GetDimension()

G4int __1DSortOut::GetDimension ( )

Definition at line 49 of file G4KDMap.cc.

50{
52}
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 54 of file G4KDMap.cc.

55{
56 std::size_t contSize = fContainer.size();
57 main_middle = (std::size_t) ceil(contSize / 2.); // ceil = round up
58 return fContainer[main_middle];
59}

Referenced by PopOutMiddle().

◆ Insert()

_deq_iterator __1DSortOut::Insert ( G4KDNode_Base * pos)

Definition at line 61 of file G4KDMap.cc.

62{
63 return fContainer.insert(fContainer.end(), pos);
64}

◆ PopOutMiddle()

G4KDNode_Base * __1DSortOut::PopOutMiddle ( )

Definition at line 66 of file G4KDMap.cc.

67{
68 std::size_t middle;
69 G4KDNode_Base* pos = GetMidle(middle);
70 auto deq_pos = fContainer.begin() + middle;
71
72 if(deq_pos == fContainer.end()) return nullptr; // this is a double check
73
74 fContainer.erase(deq_pos);
75 return pos;
76}
G4KDNode_Base * GetMidle(std::size_t &)
Definition G4KDMap.cc:54

◆ 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 78 of file G4KDMap.cc.

79{
80 sort(fContainer.begin(), fContainer.end(), fSortOutNDim);
81}

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: