Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
G4SchedulerMessenger Class Reference

#include <G4SchedulerMessenger.hh>

Inheritance diagram for G4SchedulerMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4SchedulerMessenger (G4Scheduler *runMgr)
 
G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
 ~G4SchedulerMessenger ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Attributes

G4UIcmdWithADoubleAndUnitfEndTime
 
G4UIcmdWithoutParameterfInitCmd
 
G4UIdirectoryfITDirectory
 
G4UIcmdWithAnIntegerfMaxNULLTimeSteps
 
G4UIcmdWithAnIntegerfMaxStepNumber
 
G4UIcmdWithoutParameterfProcessCmd
 
G4SchedulerfScheduler
 
G4UIcmdWithADoubleAndUnitfTimeTolerance
 
G4UIcmdWithABoolfUseDefaultTimeSteps
 
G4UIcmdWithAnIntegerfVerboseCmd
 
G4UIcmdWithoutParameterfWhyDoYouStop
 

Detailed Description

Definition at line 65 of file G4SchedulerMessenger.hh.

Constructor & Destructor Documentation

◆ G4SchedulerMessenger()

G4SchedulerMessenger::G4SchedulerMessenger ( G4Scheduler runMgr)

Definition at line 46 of file G4SchedulerMessenger.cc.

46 :
47 fScheduler(stepMgr)
48{
49 fITDirectory = new G4UIdirectory("/scheduler/");
50 fITDirectory->SetGuidance("Control commands for the time scheduler "
51 "(dna chemistry applications).");
52
53 // Set end time
54 fEndTime = new G4UIcmdWithADoubleAndUnit("/scheduler/endTime", this);
55 fEndTime->SetGuidance("Set time at which the simulation must stop.");
58 fEndTime->SetDefaultUnit("picosecond");
60
61 // Set time tolerance
62 fTimeTolerance = new G4UIcmdWithADoubleAndUnit("/scheduler/timeTolerance",
63 this);
64 fTimeTolerance->SetGuidance("This command aims at resolving issues related to"
65 " floating points. If two time events are separated by less than the "
66 "selected tolerance, they are assumed to belong to the same time step.");
69 fTimeTolerance->SetDefaultUnit("picosecond");
71
72 // Initialize
73 fInitCmd = new G4UIcmdWithoutParameter("/scheduler/initialize", this);
74 fInitCmd->SetGuidance("Initialize G4Scheduler. This is done "
75 "for standalone application only (no physics).");
77
78 // Set Max Null time Step
79 fMaxNULLTimeSteps = new G4UIcmdWithAnInteger("/scheduler/maxNullTimeSteps",
80 this);
81 fMaxNULLTimeSteps->SetGuidance("Set maximum allowed zero time steps. After this "
82 "threshold, the simulation is stopped.");
83 fMaxNULLTimeSteps->SetParameterName("numberOfNullTimeSteps", true);
85 fMaxNULLTimeSteps->SetRange("numberOfNullTimeSteps >=0 ");
86
87 fMaxStepNumber = new G4UIcmdWithAnInteger("/scheduler/maxStepNumber", this);
88 fMaxStepNumber->SetGuidance("Set the maximum number of time steps. After this "
89 "threshold, the simulation is stopped.");
90 fMaxStepNumber->SetParameterName("maximumNumberOfSteps", true);
92
93 // Beam On
94 fProcessCmd = new G4UIcmdWithoutParameter("/scheduler/process", this);
95 fProcessCmd->SetGuidance("Process stacked tracks in G4Scheduler. This is done "
96 "for standalone application only (no physics).");
98
99 // Verbose
100 fVerboseCmd = new G4UIcmdWithAnInteger("/scheduler/verbose", this);
101 fVerboseCmd->SetGuidance("Set the Verbose level of G4Scheduler.");
102 fVerboseCmd->SetGuidance(" 0 : Silent (default)");
103 fVerboseCmd->SetGuidance(" 1 : Display reactions");
104 fVerboseCmd->SetGuidance(" 2 ");
105 fVerboseCmd->SetParameterName("level", true);
107 // fVerboseCmd->SetRange("level >=0 && level <=4");
108
109 fWhyDoYouStop = new G4UIcmdWithoutParameter("/scheduler/whyDoYouStop",this);
110 fWhyDoYouStop->SetGuidance("Will print information on why the scheduler is "
111 "stopping the process");
112
113 fUseDefaultTimeSteps = new G4UIcmdWithABool("/scheduler/useDefaultTimeSteps",
114 this);
115 fUseDefaultTimeSteps->SetGuidance("Let the G4 processes decided for the next "
116 "time step interval. This command would be interesting if no reaction has "
117 "been set and if one will want to track down Brownian objects. "
118 "NB: This command gets in conflicts with the declaration of time steps.");
119}
@ G4State_Idle
@ G4State_PreInit
G4UIcmdWithAnInteger * fMaxNULLTimeSteps
G4UIcmdWithoutParameter * fInitCmd
G4UIdirectory * fITDirectory
G4UIcmdWithADoubleAndUnit * fTimeTolerance
G4UIcmdWithoutParameter * fWhyDoYouStop
G4UIcmdWithABool * fUseDefaultTimeSteps
G4UIcmdWithAnInteger * fMaxStepNumber
G4UIcmdWithoutParameter * fProcessCmd
G4UIcmdWithAnInteger * fVerboseCmd
G4UIcmdWithADoubleAndUnit * fEndTime
void SetUnitCategory(const char *unitCategory)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:288

References G4UIcommand::AvailableForStates(), fEndTime, fInitCmd, fITDirectory, fMaxNULLTimeSteps, fMaxStepNumber, fProcessCmd, fTimeTolerance, fUseDefaultTimeSteps, fVerboseCmd, fWhyDoYouStop, G4State_Idle, G4State_PreInit, G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcommand::SetRange(), and G4UIcmdWithADoubleAndUnit::SetUnitCategory().

◆ ~G4SchedulerMessenger()

G4SchedulerMessenger::~G4SchedulerMessenger ( )

Definition at line 121 of file G4SchedulerMessenger.cc.

122{
123 delete fTimeTolerance;
124 delete fITDirectory;
125 delete fInitCmd;
126 delete fEndTime;
127 delete fMaxNULLTimeSteps;
128 delete fMaxStepNumber;
129 delete fProcessCmd;
130 delete fVerboseCmd;
131 delete fWhyDoYouStop;
133}

References fEndTime, fInitCmd, fITDirectory, fMaxNULLTimeSteps, fMaxStepNumber, fProcessCmd, fTimeTolerance, fUseDefaultTimeSteps, fVerboseCmd, and fWhyDoYouStop.

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4SchedulerMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 178 of file G4SchedulerMessenger.cc.

179{
180 G4String cv;
181
182 if (command == fVerboseCmd)
183 {
185 }
186 else if (command == fEndTime)
187 {
189 }
190 else if (command == fTimeTolerance)
191 {
193 }
194 else if (command == fInitCmd)
195 {
197 }
198 else if (command == fMaxNULLTimeSteps)
199 {
202 }
203 else if (command == fMaxStepNumber)
204 {
206 }
207 else if (command == fUseDefaultTimeSteps)
208 {
210 }
211
212 return cv;
213}
G4int GetMaxZeroTimeAllowed() const
Definition: G4Scheduler.hh:396
G4bool IsInitialized()
Definition: G4Scheduler.hh:296
G4int GetMaxNbSteps() const
Definition: G4Scheduler.hh:339
G4double GetEndTime() const
Definition: G4Scheduler.hh:349
G4bool AreDefaultTimeStepsUsed()
Definition: G4Scheduler.hh:451
G4double GetTimeTolerance() const
Definition: G4Scheduler.hh:406
G4int GetVerbose() const
Definition: G4Scheduler.hh:385
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4Scheduler::AreDefaultTimeStepsUsed(), G4UIcommand::ConvertToString(), fEndTime, fInitCmd, fMaxNULLTimeSteps, fMaxStepNumber, fScheduler, fTimeTolerance, fUseDefaultTimeSteps, fVerboseCmd, G4Scheduler::GetEndTime(), G4Scheduler::GetMaxNbSteps(), G4Scheduler::GetMaxZeroTimeAllowed(), G4Scheduler::GetTimeTolerance(), G4Scheduler::GetVerbose(), and G4Scheduler::IsInitialized().

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetNewValue()

void G4SchedulerMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 135 of file G4SchedulerMessenger.cc.

137{
138 if (command == fProcessCmd)
139 {
141 }
142 else if (command == fEndTime)
143 {
145 }
146 else if (command == fTimeTolerance)
147 {
150 }
151 else if (command == fVerboseCmd)
152 {
154 }
155 else if (command == fInitCmd)
156 {
158 }
159 else if (command == fMaxNULLTimeSteps)
160 {
163 }
164 else if (command == fMaxStepNumber)
165 {
167 }
168 else if (command == fWhyDoYouStop)
169 {
171 }
172 else if (command == fUseDefaultTimeSteps)
173 {
175 }
176}
void SetMaxNbSteps(G4int)
Definition: G4Scheduler.hh:334
void SetVerbose(G4int)
Definition: G4Scheduler.hh:380
void Process()
Definition: G4Scheduler.cc:379
void WhyDoYouStop()
Definition: G4Scheduler.hh:441
void Initialize()
Definition: G4Scheduler.cc:284
void SetMaxZeroTimeAllowed(G4int)
Definition: G4Scheduler.hh:391
void SetEndTime(const G4double)
Definition: G4Scheduler.hh:306
void SetTimeTolerance(G4double)
Definition: G4Scheduler.hh:401
void UseDefaultTimeSteps(G4bool)
Definition: G4Scheduler.hh:446
static G4bool GetNewBoolValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)

References fEndTime, fInitCmd, fMaxNULLTimeSteps, fMaxStepNumber, fProcessCmd, fScheduler, fTimeTolerance, fUseDefaultTimeSteps, fVerboseCmd, fWhyDoYouStop, G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), G4Scheduler::Initialize(), G4Scheduler::Process(), G4Scheduler::SetEndTime(), G4Scheduler::SetMaxNbSteps(), G4Scheduler::SetMaxZeroTimeAllowed(), G4Scheduler::SetTimeTolerance(), G4Scheduler::SetVerbose(), G4Scheduler::UseDefaultTimeSteps(), and G4Scheduler::WhyDoYouStop().

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ fEndTime

G4UIcmdWithADoubleAndUnit* G4SchedulerMessenger::fEndTime
private

◆ fInitCmd

G4UIcmdWithoutParameter* G4SchedulerMessenger::fInitCmd
private

◆ fITDirectory

G4UIdirectory* G4SchedulerMessenger::fITDirectory
private

Definition at line 79 of file G4SchedulerMessenger.hh.

Referenced by G4SchedulerMessenger(), and ~G4SchedulerMessenger().

◆ fMaxNULLTimeSteps

G4UIcmdWithAnInteger* G4SchedulerMessenger::fMaxNULLTimeSteps
private

◆ fMaxStepNumber

G4UIcmdWithAnInteger* G4SchedulerMessenger::fMaxStepNumber
private

◆ fProcessCmd

G4UIcmdWithoutParameter* G4SchedulerMessenger::fProcessCmd
private

◆ fScheduler

G4Scheduler* G4SchedulerMessenger::fScheduler
private

Definition at line 76 of file G4SchedulerMessenger.hh.

Referenced by GetCurrentValue(), and SetNewValue().

◆ fTimeTolerance

G4UIcmdWithADoubleAndUnit* G4SchedulerMessenger::fTimeTolerance
private

◆ fUseDefaultTimeSteps

G4UIcmdWithABool* G4SchedulerMessenger::fUseDefaultTimeSteps
private

◆ fVerboseCmd

G4UIcmdWithAnInteger* G4SchedulerMessenger::fVerboseCmd
private

◆ fWhyDoYouStop

G4UIcmdWithoutParameter* G4SchedulerMessenger::fWhyDoYouStop
private

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