Geant4  10.02.p03
G4NavigationHistoryPool Class Reference

#include <G4NavigationHistoryPool.hh>

Collaboration diagram for G4NavigationHistoryPool:

Public Member Functions

std::vector< G4NavigationLevel > * GetNewLevels ()
 
std::vector< G4NavigationLevel > * GetLevels ()
 
void DeRegister (std::vector< G4NavigationLevel > *pLevels)
 
void Clean ()
 
void Print () const
 
 ~G4NavigationHistoryPool ()
 

Static Public Member Functions

static G4NavigationHistoryPoolGetInstance ()
 

Private Member Functions

 G4NavigationHistoryPool ()
 
void Register (std::vector< G4NavigationLevel > *pLevels)
 
void Reset ()
 

Private Attributes

std::vector< std::vector< G4NavigationLevel > * > fPool
 
std::vector< std::vector< G4NavigationLevel > * > fFree
 

Static Private Attributes

static G4ThreadLocal G4NavigationHistoryPoolfgInstance = 0
 

Detailed Description

Definition at line 47 of file G4NavigationHistoryPool.hh.

Constructor & Destructor Documentation

◆ ~G4NavigationHistoryPool()

G4NavigationHistoryPool::~G4NavigationHistoryPool ( )

Definition at line 60 of file G4NavigationHistoryPool.cc.

61 {
62  Clean(); fgInstance = 0;
63 }
static G4ThreadLocal G4NavigationHistoryPool * fgInstance
Here is the call graph for this function:

◆ G4NavigationHistoryPool()

G4NavigationHistoryPool::G4NavigationHistoryPool ( )
private

Definition at line 50 of file G4NavigationHistoryPool.cc.

51 {
52  fPool.reserve(512);
53  fFree.reserve(512);
54 }
std::vector< std::vector< G4NavigationLevel > * > fPool
std::vector< std::vector< G4NavigationLevel > * > fFree
Here is the caller graph for this function:

Member Function Documentation

◆ Clean()

void G4NavigationHistoryPool::Clean ( )

Definition at line 69 of file G4NavigationHistoryPool.cc.

70 {
71  for(size_t i=0; i<fPool.size(); ++i)
72  {
73  delete fPool[i];
74  }
75  fPool.clear();
76  fFree.clear();
77 }
std::vector< std::vector< G4NavigationLevel > * > fPool
std::vector< std::vector< G4NavigationLevel > * > fFree
Here is the caller graph for this function:

◆ DeRegister()

void G4NavigationHistoryPool::DeRegister ( std::vector< G4NavigationLevel > *  pLevels)
inline

Definition at line 107 of file G4NavigationHistoryPool.hh.

108 {
109  fFree.push_back(pLevels);
110 }
std::vector< std::vector< G4NavigationLevel > * > fFree
Here is the caller graph for this function:

◆ GetInstance()

G4NavigationHistoryPool * G4NavigationHistoryPool::GetInstance ( void  )
static

Definition at line 111 of file G4NavigationHistoryPool.cc.

112 {
113  if (!fgInstance)
114  {
116  }
117  return fgInstance;
118 }
static G4ThreadLocal G4NavigationHistoryPool * fgInstance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLevels()

std::vector< G4NavigationLevel > * G4NavigationHistoryPool::GetLevels ( )
inline

Definition at line 130 of file G4NavigationHistoryPool.hh.

131 {
132  std::vector<G4NavigationLevel> * levels = 0;
133 
134  if (fFree.size() !=0)
135  {
136  levels = fFree.back();
137  fFree.pop_back();
138  }
139  else
140  {
141  levels = GetNewLevels();
142  }
143 
144  return levels;
145 }
std::vector< G4NavigationLevel > * GetNewLevels()
std::vector< std::vector< G4NavigationLevel > * > fFree
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNewLevels()

std::vector< G4NavigationLevel > * G4NavigationHistoryPool::GetNewLevels ( )
inline

Definition at line 116 of file G4NavigationHistoryPool.hh.

117 {
118  std::vector<G4NavigationLevel> * aLevelVec =
119  new std::vector<G4NavigationLevel>(kHistoryMax);
120  Register(aLevelVec);
121 
122  return aLevelVec;
123 }
static const G4int kHistoryMax
Definition: geomdefs.hh:72
void Register(std::vector< G4NavigationLevel > *pLevels)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Print()

void G4NavigationHistoryPool::Print ( void  ) const

Definition at line 83 of file G4NavigationHistoryPool.cc.

84 {
85 #ifdef G4VERBOSE
86  G4cout << "Total navigation history collections cleaned: "
87  << fPool.size() << G4endl;
88 #endif
89 }
G4GLOB_DLL std::ostream G4cout
std::vector< std::vector< G4NavigationLevel > * > fPool
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

◆ Register()

void G4NavigationHistoryPool::Register ( std::vector< G4NavigationLevel > *  pLevels)
inlineprivate

Definition at line 97 of file G4NavigationHistoryPool.hh.

98 {
99  fPool.push_back(pLevels);
100 }
std::vector< std::vector< G4NavigationLevel > * > fPool
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reset()

void G4NavigationHistoryPool::Reset ( )
private

Definition at line 95 of file G4NavigationHistoryPool.cc.

96 {
97  for(size_t i=0; i<fPool.size(); ++i)
98  {
99  fPool[i] = 0;
100  }
101  for(size_t j=0; j<fFree.size(); ++j)
102  {
103  fFree[j] = 0;
104  }
105 }
std::vector< std::vector< G4NavigationLevel > * > fPool
std::vector< std::vector< G4NavigationLevel > * > fFree

Member Data Documentation

◆ fFree

std::vector<std::vector<G4NavigationLevel> *> G4NavigationHistoryPool::fFree
private

Definition at line 89 of file G4NavigationHistoryPool.hh.

◆ fgInstance

G4ThreadLocal G4NavigationHistoryPool * G4NavigationHistoryPool::fgInstance = 0
staticprivate

Definition at line 86 of file G4NavigationHistoryPool.hh.

◆ fPool

std::vector<std::vector<G4NavigationLevel> *> G4NavigationHistoryPool::fPool
private

Definition at line 88 of file G4NavigationHistoryPool.hh.


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