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

#include <G4FieldManagerStore.hh>

+ Inheritance diagram for G4FieldManagerStore:

Public Member Functions

void ClearAllChordFindersState ()
 
 ~G4FieldManagerStore ()
 

Static Public Member Functions

static void Register (G4FieldManager *pVolume)
 
static void DeRegister (G4FieldManager *pVolume)
 
static G4FieldManagerStoreGetInstance ()
 
static G4FieldManagerStoreGetInstanceIfExist ()
 
static void Clean ()
 

Protected Member Functions

 G4FieldManagerStore ()
 

Detailed Description

Definition at line 49 of file G4FieldManagerStore.hh.

Constructor & Destructor Documentation

◆ ~G4FieldManagerStore()

G4FieldManagerStore::~G4FieldManagerStore ( )

Definition at line 57 of file G4FieldManagerStore.cc.

58{
59 Clean();
60 fgInstance = nullptr;
61}

◆ G4FieldManagerStore()

G4FieldManagerStore::G4FieldManagerStore ( )
protected

Definition at line 47 of file G4FieldManagerStore.cc.

48 : std::vector<G4FieldManager*>()
49{
50 reserve(100);
51}

Referenced by GetInstance().

Member Function Documentation

◆ Clean()

void G4FieldManagerStore::Clean ( )
static

Definition at line 67 of file G4FieldManagerStore.cc.

68{
69 // Locks store for deletion of field managers. De-registration will be
70 // performed at this stage. G4FieldManagers will not de-register themselves.
71 //
72 locked = true;
73
74 size_t i=0;
76
77 for(auto pos=store->cbegin(); pos!=store->cend(); ++pos)
78 {
79 if (*pos) { delete *pos; }
80 i++;
81 }
82
83#ifdef G4GEOMETRY_DEBUG
84 if (store->size() < i-1)
85 {
86 G4cout << "No field managers deleted. Already deleted by user ?" << G4endl;
87 }
88 else
89 {
90 G4cout << i-1 << " field managers deleted !" << G4endl;
91 }
92#endif
93
94 locked = false;
95 store->clear();
96}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4FieldManagerStore * GetInstance()

Referenced by ~G4FieldManagerStore().

◆ ClearAllChordFindersState()

void G4FieldManagerStore::ClearAllChordFindersState ( )

Definition at line 153 of file G4FieldManagerStore.cc.

154{
155 G4ChordFinder* pChordFnd;
156
157 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
158 {
159 pChordFnd = (*i)->GetChordFinder();
160 if( pChordFnd != nullptr )
161 {
162 pChordFnd->ResetStepEstimate();
163 }
164 }
165}
void ResetStepEstimate()

Referenced by G4CoupledTransportation::StartTracking(), and G4Transportation::StartTracking().

◆ DeRegister()

void G4FieldManagerStore::DeRegister ( G4FieldManager pVolume)
static

Definition at line 111 of file G4FieldManagerStore.cc.

112{
113 if (!locked) // Do not de-register if locked !
114 {
115 for (auto i=GetInstance()->cbegin(); i!=GetInstance()->cend(); ++i)
116 {
117 if (*i==pFieldMgr) // For LogVol was **i == *pLogVolume ... Reason?
118 {
119 GetInstance()->erase(i);
120 break;
121 }
122 }
123 }
124}

Referenced by G4FieldManager::~G4FieldManager().

◆ GetInstance()

G4FieldManagerStore * G4FieldManagerStore::GetInstance ( )
static

Definition at line 130 of file G4FieldManagerStore.cc.

131{
132 if (fgInstance == nullptr)
133 {
134 fgInstance = new G4FieldManagerStore;
135 }
136 return fgInstance;
137}

Referenced by Clean(), ClearAllChordFindersState(), DeRegister(), Register(), G4ITTransportation::StartTracking(), G4CoupledTransportation::StartTracking(), and G4Transportation::StartTracking().

◆ GetInstanceIfExist()

G4FieldManagerStore * G4FieldManagerStore::GetInstanceIfExist ( )
static

Definition at line 143 of file G4FieldManagerStore.cc.

144{
145 return fgInstance;
146}

Referenced by G4RunManagerKernel::~G4RunManagerKernel().

◆ Register()

void G4FieldManagerStore::Register ( G4FieldManager pVolume)
static

Definition at line 102 of file G4FieldManagerStore.cc.

103{
104 GetInstance()->push_back(pFieldManager);
105}

Referenced by G4FieldManager::G4FieldManager().


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