Geant4-11
G4SchedulerMessenger.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
28//
29// History:
30// -----------
31//
32// -------------------------------------------------------------------
33#include <G4Scheduler.hh>
35
36#include "G4UIdirectory.hh"
40#include "G4UIcmdWithABool.hh"
41#include "G4UIcommand.hh"
42#include "G4UIparameter.hh"
43#include "G4UImanager.hh"
44#include "G4ios.hh"
45
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}
120
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}
134
136 G4String newValue)
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}
177
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}
214
@ G4State_Idle
@ G4State_PreInit
void SetNewValue(G4UIcommand *command, G4String newValues)
G4UIcmdWithAnInteger * fMaxNULLTimeSteps
G4UIcmdWithoutParameter * fInitCmd
G4UIdirectory * fITDirectory
G4UIcmdWithADoubleAndUnit * fTimeTolerance
G4String GetCurrentValue(G4UIcommand *command)
G4UIcmdWithoutParameter * fWhyDoYouStop
G4UIcmdWithABool * fUseDefaultTimeSteps
G4UIcmdWithAnInteger * fMaxStepNumber
G4UIcmdWithoutParameter * fProcessCmd
G4SchedulerMessenger(G4Scheduler *runMgr)
G4UIcmdWithAnInteger * fVerboseCmd
G4UIcmdWithADoubleAndUnit * fEndTime
G4int GetMaxZeroTimeAllowed() const
Definition: G4Scheduler.hh:396
void SetMaxNbSteps(G4int)
Definition: G4Scheduler.hh:334
G4bool IsInitialized()
Definition: G4Scheduler.hh:296
G4int GetMaxNbSteps() const
Definition: G4Scheduler.hh:339
void SetVerbose(G4int)
Definition: G4Scheduler.hh:380
void Process()
Definition: G4Scheduler.cc:379
G4double GetEndTime() const
Definition: G4Scheduler.hh:349
G4bool AreDefaultTimeStepsUsed()
Definition: G4Scheduler.hh:451
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
G4double GetTimeTolerance() const
Definition: G4Scheduler.hh:406
void SetTimeTolerance(G4double)
Definition: G4Scheduler.hh:401
G4int GetVerbose() const
Definition: G4Scheduler.hh:385
void UseDefaultTimeSteps(G4bool)
Definition: G4Scheduler.hh:446
static G4bool GetNewBoolValue(const char *paramString)
void SetUnitCategory(const char *unitCategory)
void SetDefaultUnit(const char *defUnit)
static G4double GetNewDoubleValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetDefaultValue(G4int defVal)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445
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