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

#include <G4StateManager.hh>

Public Member Functions

 ~G4StateManager ()
 
 G4StateManager (const G4StateManager &)=delete
 
G4StateManageroperator= (const G4StateManager &)=delete
 
G4bool operator== (const G4StateManager &) const =delete
 
G4bool operator!= (const G4StateManager &) const =delete
 
const G4ApplicationStateGetCurrentState () const
 
const G4ApplicationStateGetPreviousState () const
 
G4bool SetNewState (const G4ApplicationState &requestedState)
 
G4bool SetNewState (const G4ApplicationState &requestedState, const char *msg)
 
G4bool RegisterDependent (G4VStateDependent *aDependent, G4bool bottom=false)
 
G4bool DeregisterDependent (G4VStateDependent *aDependent)
 
G4VStateDependentRemoveDependent (const G4VStateDependent *aDependent)
 
G4String GetStateString (const G4ApplicationState &aState) const
 
void SetSuppressAbortion (G4int i)
 
G4int GetSuppressAbortion () const
 
const char * GetMessage () const
 
void SetExceptionHandler (G4VExceptionHandler *eh)
 
G4VExceptionHandlerGetExceptionHandler () const
 

Static Public Member Functions

static G4StateManagerGetStateManager ()
 
static void SetVerboseLevel (G4int val)
 

Detailed Description

Definition at line 49 of file G4StateManager.hh.

Constructor & Destructor Documentation

◆ ~G4StateManager()

G4StateManager::~G4StateManager ( )

Definition at line 47 of file G4StateManager.cc.

48{
49 G4VStateDependent* state = nullptr;
50
51 while(!theDependentsList.empty())
52 {
53 state = theDependentsList.back();
54 theDependentsList.pop_back();
55 for(auto i = theDependentsList.cbegin(); i != theDependentsList.cend();)
56 {
57 if(*i == state)
58 {
59 i = theDependentsList.erase(i);
60 }
61 else
62 {
63 ++i;
64 }
65 }
66 delete state;
67 }
68 theStateManager = nullptr;
69#ifdef G4MULTITHREADED_DEACTIVATE
71#endif
72}
void G4iosFinalization()
Definition G4ios.cc:266

◆ G4StateManager()

G4StateManager::G4StateManager ( const G4StateManager & )
delete

Member Function Documentation

◆ DeregisterDependent()

G4bool G4StateManager::DeregisterDependent ( G4VStateDependent * aDependent)

Definition at line 105 of file G4StateManager.cc.

106{
107 G4VStateDependent* tmp = nullptr;
108 for(auto i = theDependentsList.cbegin(); i != theDependentsList.cend();)
109 {
110 if(**i == *aDependent)
111 {
112 tmp = *i;
113 i = theDependentsList.erase(i);
114 }
115 else
116 {
117 ++i;
118 }
119 }
120 return (tmp != nullptr);
121}

Referenced by G4VStateDependent::~G4VStateDependent().

◆ GetCurrentState()

const G4ApplicationState & G4StateManager::GetCurrentState ( ) const

Definition at line 124 of file G4StateManager.cc.

125{
126 return theCurrentState;
127}

Referenced by G4RunManager::AbortEvent(), G4MTRunManager::AbortRun(), G4RunManager::AbortRun(), G4TaskRunManager::AbortRun(), G4MTcoutDestination::AddMasterOutput(), G4RunManager::ConfirmBeamOnCondition(), G4RunManagerKernel::DefineWorldVolume(), G4ParticleDefinition::G4ParticleDefinition(), G4EventManager::GetUserInformation(), G4ErrorPropagatorManager::InitGeant4e(), G4RunManager::Initialize(), G4RunManager::InitializeGeometry(), G4RunManager::InitializePhysics(), G4RunManagerKernel::InitializePhysics(), G4UIcommand::IsAvailable(), G4UItcsh::MakePrompt(), G4VUIshell::MakePrompt(), G4ExceptionHandler::Notify(), G4VSceneHandler::ProcessScene(), G4ErrorPropagator::PropagateOneStep(), G4VModularPhysicsList::RegisterPhysics(), G4IonTable::Remove(), G4ParticleTable::Remove(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::ReplacePhysics(), G4RunManagerKernel::RunInitialization(), G4MaterialScanner::Scan(), G4MTcoutDestination::SetDefaultOutput(), G4ParticlePropertyTable::SetParticleProperty(), G4EventManager::SetUserInformation(), G4VelocityTable::SetVelocityTableProperties(), G4TheMTRayTracer::Trace(), G4TheRayTracer::Trace(), G4RunManagerKernel::UpdateRegion(), G4RunManagerKernel::WorkerDefineWorldVolume(), G4ParticleDefinition::~G4ParticleDefinition(), G4RunManager::~G4RunManager(), and G4RunManagerKernel::~G4RunManagerKernel().

◆ GetExceptionHandler()

G4VExceptionHandler * G4StateManager::GetExceptionHandler ( ) const
inline

Referenced by G4Exception().

◆ GetMessage()

const char * G4StateManager::GetMessage ( ) const
inline

◆ GetPreviousState()

const G4ApplicationState & G4StateManager::GetPreviousState ( ) const

Definition at line 130 of file G4StateManager.cc.

131{
132 return thePreviousState;
133}

◆ GetStateManager()

G4StateManager * G4StateManager::GetStateManager ( )
static

Definition at line 75 of file G4StateManager.cc.

76{
77 if(theStateManager == nullptr)
78 {
79 theStateManager = new G4StateManager;
80 }
81 return theStateManager;
82}

Referenced by G4RunManager::AbortEvent(), G4MTRunManager::AbortRun(), G4RunManager::AbortRun(), G4TaskRunManager::AbortRun(), G4ErrorPropagatorManager::CloseGeometry(), G4RunManager::ConfirmBeamOnCondition(), G4TheRayTracer::CreateBitMap(), G4UIcommandTree::CreateHTML(), G4RunManagerKernel::DefineWorldVolume(), G4DeexPrecoParameters::G4DeexPrecoParameters(), G4EventManager::G4EventManager(), G4Exception(), G4MTcoutDestination::G4MTcoutDestination(), G4ParticleDefinition::G4ParticleDefinition(), G4RunManagerKernel::G4RunManagerKernel(), G4RunManagerKernel::G4RunManagerKernel(), G4VExceptionHandler::G4VExceptionHandler(), G4VStateDependent::G4VStateDependent(), G4UIcontrolMessenger::GetCurrentValue(), G4DNAMolecularMaterial::GetDensityTableFor(), G4DNAMolecularMaterial::GetNumMolPerVolTableFor(), G4ErrorPropagatorManager::InitGeant4e(), G4RunManager::Initialize(), G4RunManager::InitializeGeometry(), G4RunManager::InitializePhysics(), G4RunManagerKernel::InitializePhysics(), G4UIcommand::IsAvailable(), G4UItcsh::MakePrompt(), G4VUIshell::MakePrompt(), G4DNAMolecularMaterial::Notify(), G4ExceptionHandler::Notify(), G4UImanager::Notify(), G4ErrorPropagatorManager::PrintG4State(), G4VSceneHandler::ProcessScene(), G4ErrorPropagator::PropagateOneStep(), G4UIQt::ReceiveG4cerr(), G4VModularPhysicsList::RegisterPhysics(), G4IonTable::Remove(), G4ParticleTable::Remove(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::ReplacePhysics(), G4TransportationParameters::ReportLockError(), G4RunManagerKernel::RunInitialization(), G4RunManagerKernel::RunTermination(), G4MaterialScanner::Scan(), G4UIcontrolMessenger::SetNewValue(), G4ParticlePropertyTable::SetParticleProperty(), G4VelocityTable::SetVelocityTableProperties(), G4TheMTRayTracer::Trace(), G4TheRayTracer::Trace(), G4RunManagerKernel::UpdateRegion(), G4RunManagerKernel::WorkerDefineWorldVolume(), G4ParticleDefinition::~G4ParticleDefinition(), G4RunManager::~G4RunManager(), G4RunManagerKernel::~G4RunManagerKernel(), and G4VStateDependent::~G4VStateDependent().

◆ GetStateString()

G4String G4StateManager::GetStateString ( const G4ApplicationState & aState) const

Definition at line 211 of file G4StateManager.cc.

212{
213 G4String stateName;
214 switch(aState)
215 {
216 case G4State_PreInit:
217 stateName = "PreInit";
218 break;
219 case G4State_Init:
220 stateName = "Init";
221 break;
222 case G4State_Idle:
223 stateName = "Idle";
224 break;
226 stateName = "GeomClosed";
227 break;
229 stateName = "EventProc";
230 break;
231 case G4State_Quit:
232 stateName = "Quit";
233 break;
234 case G4State_Abort:
235 stateName = "Abort";
236 break;
237 default:
238 stateName = "Unknown";
239 break;
240 }
241 return stateName;
242}
@ G4State_EventProc
@ G4State_Init
@ G4State_Idle
@ G4State_Quit
@ G4State_Abort
@ G4State_GeomClosed
@ G4State_PreInit

Referenced by G4UIcommandTree::CreateHTML(), G4RunManagerKernel::DefineWorldVolume(), G4RunManagerKernel::InitializePhysics(), G4UItcsh::MakePrompt(), G4VUIshell::MakePrompt(), SetNewState(), G4TheMTRayTracer::Trace(), and G4RunManagerKernel::WorkerDefineWorldVolume().

◆ GetSuppressAbortion()

G4int G4StateManager::GetSuppressAbortion ( ) const
inline

◆ operator!=()

G4bool G4StateManager::operator!= ( const G4StateManager & ) const
delete

◆ operator=()

G4StateManager & G4StateManager::operator= ( const G4StateManager & )
delete

◆ operator==()

G4bool G4StateManager::operator== ( const G4StateManager & ) const
delete

◆ RegisterDependent()

G4bool G4StateManager::RegisterDependent ( G4VStateDependent * aDependent,
G4bool bottom = false )

Definition at line 85 of file G4StateManager.cc.

87{
88 G4bool ack = true;
89 if(!bottom)
90 {
91 theDependentsList.push_back(aDependent);
92 }
93 else
94 {
95 if(theBottomDependent != nullptr)
96 {
97 theDependentsList.push_back(theBottomDependent);
98 }
99 theBottomDependent = aDependent;
100 }
101 return ack;
102}
bool G4bool
Definition G4Types.hh:86

Referenced by G4VStateDependent::G4VStateDependent().

◆ RemoveDependent()

G4VStateDependent * G4StateManager::RemoveDependent ( const G4VStateDependent * aDependent)

Definition at line 191 of file G4StateManager.cc.

193{
194 G4VStateDependent* tmp = nullptr;
195 for(auto i = theDependentsList.cbegin(); i != theDependentsList.cend();)
196 {
197 if(**i == *aDependent)
198 {
199 tmp = *i;
200 i = theDependentsList.erase(i);
201 }
202 else
203 {
204 ++i;
205 }
206 }
207 return tmp;
208}

◆ SetExceptionHandler()

void G4StateManager::SetExceptionHandler ( G4VExceptionHandler * eh)
inline

◆ SetNewState() [1/2]

◆ SetNewState() [2/2]

G4bool G4StateManager::SetNewState ( const G4ApplicationState & requestedState,
const char * msg )

Definition at line 142 of file G4StateManager.cc.

144{
145 if(requestedState == G4State_Abort && suppressAbortion > 0)
146 {
147 if(suppressAbortion == 2)
148 {
149 return false;
150 }
151 if(theCurrentState == G4State_EventProc)
152 {
153 return false;
154 }
155 }
156 msgptr = msg;
157 std::size_t i = 0;
158 G4bool ack = true;
159 G4ApplicationState savedState = thePreviousState;
160 thePreviousState = theCurrentState;
161
162 while((ack) && (i < theDependentsList.size()))
163 {
164 ack = theDependentsList[i]->Notify(requestedState);
165 ++i;
166 }
167 if(theBottomDependent != nullptr)
168 {
169 ack = theBottomDependent->Notify(requestedState);
170 }
171
172 if(!ack)
173 {
174 thePreviousState = savedState;
175 }
176 else
177 {
178 theCurrentState = requestedState;
179 if(verboseLevel > 0)
180 {
181 G4cout << "#### G4StateManager::SetNewState from "
182 << GetStateString(thePreviousState) << " to "
183 << GetStateString(requestedState) << G4endl;
184 }
185 }
186 msgptr = nullptr;
187 return ack;
188}
G4ApplicationState
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4String GetStateString(const G4ApplicationState &aState) const
virtual G4bool Notify(G4ApplicationState requestedState)=0

◆ SetSuppressAbortion()

void G4StateManager::SetSuppressAbortion ( G4int i)
inline

◆ SetVerboseLevel()

void G4StateManager::SetVerboseLevel ( G4int val)
static

Definition at line 245 of file G4StateManager.cc.

245{ verboseLevel = val; }

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