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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/management/src/G4SchedulerMessenger.cc (Version 11.3.0) and /processes/electromagnetic/dna/management/src/G4SchedulerMessenger.cc (Version 10.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4ITSteppingMessenger.cc 60427 2012-07-11 16:34:35Z matkara $
 26 //                                                 27 //
 27 // Author: Mathieu Karamitros (kara (AT) cenbg     28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
 28 //                                                 29 //
 29 // History:                                        30 // History:
 30 // -----------                                     31 // -----------
 31 //                                                 32 //
 32 // -------------------------------------------     33 // -------------------------------------------------------------------
 33 #include <G4Scheduler.hh>                          34 #include <G4Scheduler.hh>
 34 #include <G4SchedulerMessenger.hh>                 35 #include <G4SchedulerMessenger.hh>
                                                   >>  36 
 35 #include "G4UIdirectory.hh"                        37 #include "G4UIdirectory.hh"
 36 #include "G4UIcmdWithoutParameter.hh"              38 #include "G4UIcmdWithoutParameter.hh"
 37 #include "G4UIcmdWithAnInteger.hh"                 39 #include "G4UIcmdWithAnInteger.hh"
 38 #include "G4UIcmdWithADoubleAndUnit.hh"            40 #include "G4UIcmdWithADoubleAndUnit.hh"
 39 #include "G4UIcmdWithABool.hh"                     41 #include "G4UIcmdWithABool.hh"
 40 #include "G4UIcmdWithAString.hh"               << 
 41 #include "G4UIcommand.hh"                          42 #include "G4UIcommand.hh"
 42 #include "G4UIparameter.hh"                        43 #include "G4UIparameter.hh"
                                                   >>  44 #include "G4UImanager.hh"
 43 #include "G4ios.hh"                                45 #include "G4ios.hh"
 44                                                    46 
 45 G4SchedulerMessenger::G4SchedulerMessenger(G4S <<  47 G4SchedulerMessenger::G4SchedulerMessenger(G4Scheduler * stepMgr) :
 46   : fScheduler(stepMgr)                        <<  48     fScheduler(stepMgr)
 47 {                                                  49 {
 48   fITDirectory = std::make_unique<G4UIdirector <<  50   fITDirectory = new G4UIdirectory("/scheduler/");
 49   fITDirectory->SetGuidance("Control commands      51   fITDirectory->SetGuidance("Control commands for the time scheduler "
 50                             "(dna chemistry ap <<  52       "(dna chemistry applications).");
 51                                                    53 
 52   // Set end time                                  54   // Set end time
 53   fEndTime = std::make_unique<G4UIcmdWithADoub <<  55   fEndTime = new G4UIcmdWithADoubleAndUnit("/scheduler/endTime", this);
 54   fEndTime->SetGuidance("Set time at which the     56   fEndTime->SetGuidance("Set time at which the simulation must stop.");
 55   fEndTime->AvailableForStates(G4State_PreInit     57   fEndTime->AvailableForStates(G4State_PreInit, G4State_Idle);
 56   fEndTime->SetUnitCategory("Time");               58   fEndTime->SetUnitCategory("Time");
 57   fEndTime->SetDefaultUnit("picosecond");          59   fEndTime->SetDefaultUnit("picosecond");
 58   fEndTime->SetDefaultValue(1);                    60   fEndTime->SetDefaultValue(1);
 59                                                    61 
 60   // Set time tolerance                            62   // Set time tolerance
 61   fTimeTolerance = std::make_unique<G4UIcmdWit <<  63   fTimeTolerance = new G4UIcmdWithADoubleAndUnit("/scheduler/timeTolerance",
 62   fTimeTolerance->SetGuidance(                 <<  64                                                  this);
 63     "This command aims at resolving issues rel <<  65   fTimeTolerance->SetGuidance("This command aims at resolving issues related to"
 64     " floating points. If two time events are  <<  66       " floating points. If two time events are separated by less than the "
 65     "selected tolerance, they are assumed to b <<  67       "selected tolerance, they are assumed to belong to the same time step.");
 66   fTimeTolerance->AvailableForStates(G4State_P     68   fTimeTolerance->AvailableForStates(G4State_PreInit, G4State_Idle);
 67   fTimeTolerance->SetUnitCategory("Time");         69   fTimeTolerance->SetUnitCategory("Time");
 68   fTimeTolerance->SetDefaultUnit("picosecond")     70   fTimeTolerance->SetDefaultUnit("picosecond");
 69   fTimeTolerance->SetDefaultValue(1);              71   fTimeTolerance->SetDefaultValue(1);
 70                                                    72 
 71   // Initialize                                    73   // Initialize
 72   fInitCmd = std::make_unique<G4UIcmdWithoutPa <<  74   fInitCmd = new G4UIcmdWithoutParameter("/scheduler/initialize", this);
 73   fInitCmd->SetGuidance("Initialize G4Schedule     75   fInitCmd->SetGuidance("Initialize G4Scheduler. This is done "
 74                         "for standalone applic <<  76       "for standalone application only (no physics).");
 75   fInitCmd->AvailableForStates(G4State_PreInit     77   fInitCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 76                                                    78 
 77   // Set Max Null time Step                        79   // Set Max Null time Step
 78   fMaxNULLTimeSteps = std::make_unique<G4UIcmd <<  80   fMaxNULLTimeSteps = new G4UIcmdWithAnInteger("/scheduler/maxNullTimeSteps",
 79   fMaxNULLTimeSteps->SetGuidance(              <<  81                                                this);
 80     "Set maximum allowed zero time steps. Afte <<  82   fMaxNULLTimeSteps->SetGuidance("Set maximum allowed zero time steps. After this "
 81     "threshold, the simulation is stopped.");  <<  83       "threshold, the simulation is stopped.");
 82   fMaxNULLTimeSteps->SetParameterName("numberO     84   fMaxNULLTimeSteps->SetParameterName("numberOfNullTimeSteps", true);
 83   fMaxNULLTimeSteps->SetDefaultValue(10000);   <<  85   fMaxNULLTimeSteps->SetDefaultValue(10);
 84   fMaxNULLTimeSteps->SetRange("numberOfNullTim     86   fMaxNULLTimeSteps->SetRange("numberOfNullTimeSteps >=0 ");
 85                                                    87 
 86   fMaxStepNumber = std::make_unique<G4UIcmdWit <<  88   fMaxStepNumber = new G4UIcmdWithAnInteger("/scheduler/maxStepNumber", this);
 87   fMaxStepNumber->SetGuidance(                 <<  89   fMaxStepNumber->SetGuidance("Set the maximum number of time steps. After this "
 88     "Set the maximum number of time steps. Aft <<  90       "threshold, the simulation is stopped.");
 89     "threshold, the simulation is stopped.");  << 
 90   fMaxStepNumber->SetParameterName("maximumNum     91   fMaxStepNumber->SetParameterName("maximumNumberOfSteps", true);
 91   fMaxStepNumber->SetDefaultValue(-1);             92   fMaxStepNumber->SetDefaultValue(-1);
 92                                                    93 
 93   // Beam On                                       94   // Beam On
 94   fProcessCmd = std::make_unique<G4UIcmdWithou <<  95   fProcessCmd = new G4UIcmdWithoutParameter("/scheduler/process", this);
 95   fProcessCmd->SetGuidance(                    <<  96   fProcessCmd->SetGuidance("Process stacked tracks in G4Scheduler. This is done "
 96     "Process stacked tracks in G4Scheduler. Th <<  97       "for standalone application only (no physics).");
 97     "for standalone application only (no physi << 
 98   fProcessCmd->AvailableForStates(G4State_PreI     98   fProcessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 99                                                    99 
100   // Verbose                                      100   // Verbose
101   fVerboseCmd = std::make_unique<G4UIcmdWithAn << 101   fVerboseCmd = new G4UIcmdWithAnInteger("/scheduler/verbose", this);
102   fVerboseCmd->SetGuidance("Set the Verbose le    102   fVerboseCmd->SetGuidance("Set the Verbose level of G4Scheduler.");
103   fVerboseCmd->SetGuidance(" 0 : Silent (defau    103   fVerboseCmd->SetGuidance(" 0 : Silent (default)");
104   fVerboseCmd->SetGuidance(" 1 : Display react    104   fVerboseCmd->SetGuidance(" 1 : Display reactions");
105   fVerboseCmd->SetGuidance(" 2 ");                105   fVerboseCmd->SetGuidance(" 2 ");
106   fVerboseCmd->SetParameterName("level", true)    106   fVerboseCmd->SetParameterName("level", true);
107   fVerboseCmd->SetDefaultValue(1);                107   fVerboseCmd->SetDefaultValue(1);
                                                   >> 108   //  fVerboseCmd->SetRange("level >=0 && level <=4");
108                                                   109 
109   fWhyDoYouStop = std::make_unique<G4UIcmdWith << 110   fWhyDoYouStop = new G4UIcmdWithoutParameter("/scheduler/whyDoYouStop",this);
110   fWhyDoYouStop->SetGuidance("Will print infor    111   fWhyDoYouStop->SetGuidance("Will print information on why the scheduler is "
111                              "stopping the pro << 112       "stopping the process");
112                                                << 
113   fUseDefaultTimeSteps = std::make_unique<G4UI << 
114   fUseDefaultTimeSteps->SetGuidance(           << 
115     "Let the G4 processes decided for the next << 
116     "time step interval. This command would be << 
117     "been set and if one will want to track do << 
118     "NB: This command gets in conflicts with t << 
119                                                << 
120   fResetScavenger = std::make_unique<G4UIcmdWi << 
121   fResetScavenger->SetGuidance(                << 
122     "Reset Scavenger information apres each Be << 
123   fResetScavenger->SetDefaultValue(true);      << 
124                                                   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.");
125 }                                                 120 }
126                                                   121 
127 G4SchedulerMessenger::~G4SchedulerMessenger()  << 122 G4SchedulerMessenger::~G4SchedulerMessenger()
                                                   >> 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 }
128                                                   135 
129 void G4SchedulerMessenger::SetNewValue(G4UIcom << 136 void G4SchedulerMessenger::SetNewValue(G4UIcommand * command,
                                                   >> 137                                          G4String newValue)
130 {                                                 138 {
131   if(command == fProcessCmd.get())             << 139   if (command == fProcessCmd)
132   {                                               140   {
133     fScheduler->Process();                        141     fScheduler->Process();
134   }                                               142   }
135   else if(command == fEndTime.get())           << 143   else if (command == fEndTime)
136   {                                               144   {
137     fScheduler->SetEndTime(fEndTime->GetNewDou    145     fScheduler->SetEndTime(fEndTime->GetNewDoubleValue(newValue));
138   }                                               146   }
139   else if(command == fTimeTolerance.get())     << 147   else if (command == fTimeTolerance)
140   {                                               148   {
141     fScheduler->SetTimeTolerance(fTimeToleranc << 149     fScheduler->SetTimeTolerance(
                                                   >> 150         fTimeTolerance->GetNewDoubleValue(newValue));
142   }                                               151   }
143   else if(command == fVerboseCmd.get())        << 152   else if (command == fVerboseCmd)
144   {                                               153   {
145     fScheduler->SetVerbose(fVerboseCmd->GetNew    154     fScheduler->SetVerbose(fVerboseCmd->GetNewIntValue(newValue));
146   }                                               155   }
147   else if(command == fInitCmd.get())           << 156   else if (command == fInitCmd)
148   {                                               157   {
149     fScheduler->Initialize();                     158     fScheduler->Initialize();
150   }                                               159   }
151   else if(command == fMaxNULLTimeSteps.get())  << 160   else if (command == fMaxNULLTimeSteps)
152   {                                               161   {
153     fScheduler->SetMaxZeroTimeAllowed(            162     fScheduler->SetMaxZeroTimeAllowed(
154       fMaxNULLTimeSteps->GetNewIntValue(newVal << 163         fMaxNULLTimeSteps->GetNewIntValue(newValue));
155   }                                               164   }
156   else if(command == fMaxStepNumber.get())     << 165   else if (command == fMaxStepNumber)
157   {                                               166   {
158     fScheduler->SetMaxNbSteps(fMaxStepNumber->    167     fScheduler->SetMaxNbSteps(fMaxStepNumber->GetNewIntValue(newValue));
159   }                                               168   }
160   else if(command == fWhyDoYouStop.get())      << 169   else if (command == fWhyDoYouStop)
161   {                                               170   {
162     fScheduler->WhyDoYouStop();                   171     fScheduler->WhyDoYouStop();
163   }                                               172   }
164   else if(command == fUseDefaultTimeSteps.get( << 173   else if (command == fUseDefaultTimeSteps)
165   {                                               174   {
166     fScheduler->UseDefaultTimeSteps(           << 175     fScheduler->UseDefaultTimeSteps(fUseDefaultTimeSteps->GetNewBoolValue(newValue));
167       fUseDefaultTimeSteps->GetNewBoolValue(ne << 
168   }                                            << 
169   else if(command == fResetScavenger.get())    << 
170   {                                            << 
171     fScheduler->ResetScavenger(fResetScavenger << 
172   }                                               176   }
173 }                                                 177 }
174                                                   178 
175 G4String G4SchedulerMessenger::GetCurrentValue << 179 G4String G4SchedulerMessenger::GetCurrentValue(G4UIcommand * command)
176 {                                                 180 {
177   G4String cv;                                    181   G4String cv;
178                                                   182 
179   if(command == fVerboseCmd.get())             << 183   if (command == fVerboseCmd)
180   {                                               184   {
181     cv = fVerboseCmd->ConvertToString(fSchedul    185     cv = fVerboseCmd->ConvertToString(fScheduler->GetVerbose());
182   }                                               186   }
183   else if(command == fEndTime.get())           << 187   else if (command == fEndTime)
184   {                                               188   {
185     cv = fEndTime->ConvertToString(fScheduler-    189     cv = fEndTime->ConvertToString(fScheduler->GetEndTime());
186   }                                               190   }
187   else if(command == fTimeTolerance.get())     << 191   else if (command == fTimeTolerance)
188   {                                               192   {
189     cv = fTimeTolerance->ConvertToString(fSche    193     cv = fTimeTolerance->ConvertToString(fScheduler->GetTimeTolerance());
190   }                                               194   }
191   else if(command == fInitCmd.get())           << 195   else if (command == fInitCmd)
192   {                                               196   {
193     cv = fInitCmd->ConvertToString(fScheduler-    197     cv = fInitCmd->ConvertToString(fScheduler->IsInitialized());
194   }                                               198   }
195   else if(command == fMaxNULLTimeSteps.get())  << 199   else if (command == fMaxNULLTimeSteps)
196   {                                               200   {
197     cv =                                       << 201     cv = fMaxNULLTimeSteps->ConvertToString(
198       fMaxNULLTimeSteps->ConvertToString(fSche << 202         fScheduler->GetMaxZeroTimeAllowed());
199   }                                               203   }
200   else if(command == fMaxStepNumber.get())     << 204   else if (command == fMaxStepNumber)
201   {                                               205   {
202     cv = fMaxStepNumber->ConvertToString(fSche    206     cv = fMaxStepNumber->ConvertToString(fScheduler->GetMaxNbSteps());
203   }                                               207   }
204   else if(command == fUseDefaultTimeSteps.get( << 208   else if (command == fUseDefaultTimeSteps)
205   {                                               209   {
206     cv = fUseDefaultTimeSteps->ConvertToString << 210     cv = fUseDefaultTimeSteps->ConvertToString(fScheduler->AreDefaultTimeStepsUsed());
207       fScheduler->AreDefaultTimeStepsUsed());  << 
208   }                                               211   }
                                                   >> 212 
209   return cv;                                      213   return cv;
210 }                                                 214 }
                                                   >> 215 
211                                                   216