Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4SchedulerMessenger.cc
이 파일의 문서화 페이지로 가기
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 // $Id: G4ITSteppingMessenger.cc 60427 2012-07-11 16:34:35Z matkara $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // History:
31 // -----------
32 //
33 // -------------------------------------------------------------------
34 #include <G4Scheduler.hh>
35 #include <G4SchedulerMessenger.hh>
36 
37 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAnInteger.hh"
41 #include "G4UIcmdWithABool.hh"
42 #include "G4UIcommand.hh"
43 #include "G4UIparameter.hh"
44 #include "G4UImanager.hh"
45 #include "G4ios.hh"
46 
48  fScheduler(stepMgr)
49 {
50  fITDirectory = new G4UIdirectory("/scheduler/");
51  fITDirectory->SetGuidance("Control commands for the time scheduler "
52  "(dna chemistry applications).");
53 
54  // Set end time
55  fEndTime = new G4UIcmdWithADoubleAndUnit("/scheduler/endTime", this);
56  fEndTime->SetGuidance("Set time at which the simulation must stop.");
58  fEndTime->SetUnitCategory("Time");
59  fEndTime->SetDefaultUnit("picosecond");
61 
62  // Set time tolerance
63  fTimeTolerance = new G4UIcmdWithADoubleAndUnit("/scheduler/timeTolerance",
64  this);
65  fTimeTolerance->SetGuidance("This command aims at resolving issues related to"
66  " floating points. If two time events are separated by less than the "
67  "selected tolerance, they are assumed to belong to the same time step.");
70  fTimeTolerance->SetDefaultUnit("picosecond");
72 
73  // Initialize
74  fInitCmd = new G4UIcmdWithoutParameter("/scheduler/initialize", this);
75  fInitCmd->SetGuidance("Initialize G4Scheduler. This is done "
76  "for standalone application only (no physics).");
78 
79  // Set Max Null time Step
80  fMaxNULLTimeSteps = new G4UIcmdWithAnInteger("/scheduler/maxNullTimeSteps",
81  this);
82  fMaxNULLTimeSteps->SetGuidance("Set maximum allowed zero time steps. After this "
83  "threshold, the simulation is stopped.");
84  fMaxNULLTimeSteps->SetParameterName("numberOfNullTimeSteps", true);
86  fMaxNULLTimeSteps->SetRange("numberOfNullTimeSteps >=0 ");
87 
88  fMaxStepNumber = new G4UIcmdWithAnInteger("/scheduler/maxStepNumber", this);
89  fMaxStepNumber->SetGuidance("Set the maximum number of time steps. After this "
90  "threshold, the simulation is stopped.");
91  fMaxStepNumber->SetParameterName("maximumNumberOfSteps", true);
93 
94  // Beam On
95  fProcessCmd = new G4UIcmdWithoutParameter("/scheduler/process", this);
96  fProcessCmd->SetGuidance("Process stacked tracks in G4Scheduler. This is done "
97  "for standalone application only (no physics).");
99 
100  // Verbose
101  fVerboseCmd = new G4UIcmdWithAnInteger("/scheduler/verbose", this);
102  fVerboseCmd->SetGuidance("Set the Verbose level of G4Scheduler.");
103  fVerboseCmd->SetGuidance(" 0 : Silent (default)");
104  fVerboseCmd->SetGuidance(" 1 : Display reactions");
105  fVerboseCmd->SetGuidance(" 2 ");
106  fVerboseCmd->SetParameterName("level", true);
108  // fVerboseCmd->SetRange("level >=0 && level <=4");
109 
110  fWhyDoYouStop = new G4UIcmdWithoutParameter("/scheduler/whyDoYouStop",this);
111  fWhyDoYouStop->SetGuidance("Will print information on why the scheduler is "
112  "stopping the process");
113 
114  fUseDefaultTimeSteps = new G4UIcmdWithABool("/scheduler/useDefaultTimeSteps",
115  this);
116  fUseDefaultTimeSteps->SetGuidance("Let the G4 processes decided for the next "
117  "time step interval. This command would be interesting if no reaction has "
118  "been set and if one will want to track down Brownian objects. "
119  "NB: This command gets in conflicts with the declaration of time steps.");
120 }
121 
123 {
124  delete fTimeTolerance;
125  delete fITDirectory;
126  delete fInitCmd;
127  delete fEndTime;
128  delete fMaxNULLTimeSteps;
129  delete fMaxStepNumber;
130  delete fProcessCmd;
131  delete fVerboseCmd;
132  delete fWhyDoYouStop;
133  delete fUseDefaultTimeSteps;
134 }
135 
137  G4String newValue)
138 {
139  if (command == fProcessCmd)
140  {
141  fScheduler->Process();
142  }
143  else if (command == fEndTime)
144  {
146  }
147  else if (command == fTimeTolerance)
148  {
150  fTimeTolerance->GetNewDoubleValue(newValue));
151  }
152  else if (command == fVerboseCmd)
153  {
155  }
156  else if (command == fInitCmd)
157  {
159  }
160  else if (command == fMaxNULLTimeSteps)
161  {
163  fMaxNULLTimeSteps->GetNewIntValue(newValue));
164  }
165  else if (command == fMaxStepNumber)
166  {
168  }
169  else if (command == fWhyDoYouStop)
170  {
172  }
173  else if (command == fUseDefaultTimeSteps)
174  {
176  }
177 }
178 
180 {
181  G4String cv;
182 
183  if (command == fVerboseCmd)
184  {
186  }
187  else if (command == fEndTime)
188  {
190  }
191  else if (command == fTimeTolerance)
192  {
194  }
195  else if (command == fInitCmd)
196  {
198  }
199  else if (command == fMaxNULLTimeSteps)
200  {
203  }
204  else if (command == fMaxStepNumber)
205  {
207  }
208  else if (command == fUseDefaultTimeSteps)
209  {
211  }
212 
213  return cv;
214 }
215 
void SetTimeTolerance(double)
Definition: G4Scheduler.hh:388
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4UIcmdWithADoubleAndUnit * fEndTime
void SetDefaultValue(G4int defVal)
G4double GetEndTime() const
Definition: G4Scheduler.hh:336
void SetMaxNbSteps(G4int)
Definition: G4Scheduler.hh:321
G4UIcmdWithoutParameter * fInitCmd
G4UIcmdWithABool * fUseDefaultTimeSteps
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
G4UIcmdWithAnInteger * fMaxNULLTimeSteps
static G4bool GetNewBoolValue(const char *paramString)
G4UIdirectory * fITDirectory
void Initialize()
Definition: G4Scheduler.cc:282
static G4double GetNewDoubleValue(const char *paramString)
void UseDefaultTimeSteps(G4bool)
Definition: G4Scheduler.hh:433
void WhyDoYouStop()
Definition: G4Scheduler.hh:428
G4String GetCurrentValue(G4UIcommand *command)
void SetUnitCategory(const char *unitCategory)
bool IsInitialized()
Definition: G4Scheduler.hh:283
G4bool AreDefaultTimeStepsUsed()
Definition: G4Scheduler.hh:438
int GetMaxZeroTimeAllowed() const
Definition: G4Scheduler.hh:383
G4UIcmdWithoutParameter * fProcessCmd
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:374
G4SchedulerMessenger(G4Scheduler *runMgr)
G4UIcmdWithoutParameter * fWhyDoYouStop
G4UIcmdWithAnInteger * fMaxStepNumber
void SetEndTime(const double)
Definition: G4Scheduler.hh:293
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void Process()
Definition: G4Scheduler.cc:377
static G4int GetNewIntValue(const char *paramString)
G4UIcmdWithADoubleAndUnit * fTimeTolerance
void SetMaxZeroTimeAllowed(int)
Definition: G4Scheduler.hh:378
void SetNewValue(G4UIcommand *command, G4String newValues)
void SetVerbose(int)
Definition: G4Scheduler.hh:367
G4UIcmdWithAnInteger * fVerboseCmd
G4int GetMaxNbSteps() const
Definition: G4Scheduler.hh:326
double GetTimeTolerance() const
Definition: G4Scheduler.hh:393
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242
int GetVerbose() const
Definition: G4Scheduler.hh:372
void SetDefaultUnit(const char *defUnit)