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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.7.p3)


  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 //                                                 26 //
 27 // Author: Mathieu Karamitros (kara (AT) cenbg     27 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
 28 //                                                 28 //
 29 // History:                                        29 // History:
 30 // -----------                                     30 // -----------
 31 //                                                 31 //
 32 // -------------------------------------------     32 // -------------------------------------------------------------------
 33 #include <G4Scheduler.hh>                          33 #include <G4Scheduler.hh>
 34 #include <G4SchedulerMessenger.hh>                 34 #include <G4SchedulerMessenger.hh>
                                                   >>  35 
 35 #include "G4UIdirectory.hh"                        36 #include "G4UIdirectory.hh"
 36 #include "G4UIcmdWithoutParameter.hh"              37 #include "G4UIcmdWithoutParameter.hh"
 37 #include "G4UIcmdWithAnInteger.hh"                 38 #include "G4UIcmdWithAnInteger.hh"
 38 #include "G4UIcmdWithADoubleAndUnit.hh"            39 #include "G4UIcmdWithADoubleAndUnit.hh"
 39 #include "G4UIcmdWithABool.hh"                     40 #include "G4UIcmdWithABool.hh"
 40 #include "G4UIcmdWithAString.hh"               << 
 41 #include "G4UIcommand.hh"                          41 #include "G4UIcommand.hh"
 42 #include "G4UIparameter.hh"                        42 #include "G4UIparameter.hh"
                                                   >>  43 #include "G4UImanager.hh"
 43 #include "G4ios.hh"                                44 #include "G4ios.hh"
 44                                                    45 
 45 G4SchedulerMessenger::G4SchedulerMessenger(G4S <<  46 G4SchedulerMessenger::G4SchedulerMessenger(G4Scheduler * stepMgr) :
 46   : fScheduler(stepMgr)                        <<  47     fScheduler(stepMgr)
 47 {                                                  48 {
 48   fITDirectory = std::make_unique<G4UIdirector <<  49   fITDirectory = new G4UIdirectory("/scheduler/");
 49   fITDirectory->SetGuidance("Control commands      50   fITDirectory->SetGuidance("Control commands for the time scheduler "
 50                             "(dna chemistry ap <<  51       "(dna chemistry applications).");
 51                                                    52 
 52   // Set end time                                  53   // Set end time
 53   fEndTime = std::make_unique<G4UIcmdWithADoub <<  54   fEndTime = new G4UIcmdWithADoubleAndUnit("/scheduler/endTime", this);
 54   fEndTime->SetGuidance("Set time at which the     55   fEndTime->SetGuidance("Set time at which the simulation must stop.");
 55   fEndTime->AvailableForStates(G4State_PreInit     56   fEndTime->AvailableForStates(G4State_PreInit, G4State_Idle);
 56   fEndTime->SetUnitCategory("Time");               57   fEndTime->SetUnitCategory("Time");
 57   fEndTime->SetDefaultUnit("picosecond");          58   fEndTime->SetDefaultUnit("picosecond");
 58   fEndTime->SetDefaultValue(1);                    59   fEndTime->SetDefaultValue(1);
 59                                                    60 
 60   // Set time tolerance                            61   // Set time tolerance
 61   fTimeTolerance = std::make_unique<G4UIcmdWit <<  62   fTimeTolerance = new G4UIcmdWithADoubleAndUnit("/scheduler/timeTolerance",
 62   fTimeTolerance->SetGuidance(                 <<  63                                                  this);
 63     "This command aims at resolving issues rel <<  64   fTimeTolerance->SetGuidance("This command aims at resolving issues related to"
 64     " floating points. If two time events are  <<  65       " floating points. If two time events are separated by less than the "
 65     "selected tolerance, they are assumed to b <<  66       "selected tolerance, they are assumed to belong to the same time step.");
 66   fTimeTolerance->AvailableForStates(G4State_P     67   fTimeTolerance->AvailableForStates(G4State_PreInit, G4State_Idle);
 67   fTimeTolerance->SetUnitCategory("Time");         68   fTimeTolerance->SetUnitCategory("Time");
 68   fTimeTolerance->SetDefaultUnit("picosecond")     69   fTimeTolerance->SetDefaultUnit("picosecond");
 69   fTimeTolerance->SetDefaultValue(1);              70   fTimeTolerance->SetDefaultValue(1);
 70                                                    71 
 71   // Initialize                                    72   // Initialize
 72   fInitCmd = std::make_unique<G4UIcmdWithoutPa <<  73   fInitCmd = new G4UIcmdWithoutParameter("/scheduler/initialize", this);
 73   fInitCmd->SetGuidance("Initialize G4Schedule     74   fInitCmd->SetGuidance("Initialize G4Scheduler. This is done "
 74                         "for standalone applic <<  75       "for standalone application only (no physics).");
 75   fInitCmd->AvailableForStates(G4State_PreInit     76   fInitCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 76                                                    77 
 77   // Set Max Null time Step                        78   // Set Max Null time Step
 78   fMaxNULLTimeSteps = std::make_unique<G4UIcmd <<  79   fMaxNULLTimeSteps = new G4UIcmdWithAnInteger("/scheduler/maxNullTimeSteps",
 79   fMaxNULLTimeSteps->SetGuidance(              <<  80                                                this);
 80     "Set maximum allowed zero time steps. Afte <<  81   fMaxNULLTimeSteps->SetGuidance("Set maximum allowed zero time steps. After this "
 81     "threshold, the simulation is stopped.");  <<  82       "threshold, the simulation is stopped.");
 82   fMaxNULLTimeSteps->SetParameterName("numberO     83   fMaxNULLTimeSteps->SetParameterName("numberOfNullTimeSteps", true);
 83   fMaxNULLTimeSteps->SetDefaultValue(10000);   <<  84   fMaxNULLTimeSteps->SetDefaultValue(10);
 84   fMaxNULLTimeSteps->SetRange("numberOfNullTim     85   fMaxNULLTimeSteps->SetRange("numberOfNullTimeSteps >=0 ");
 85                                                    86 
 86   fMaxStepNumber = std::make_unique<G4UIcmdWit <<  87   fMaxStepNumber = new G4UIcmdWithAnInteger("/scheduler/maxStepNumber", this);
 87   fMaxStepNumber->SetGuidance(                 <<  88   fMaxStepNumber->SetGuidance("Set the maximum number of time steps. After this "
 88     "Set the maximum number of time steps. Aft <<  89       "threshold, the simulation is stopped.");
 89     "threshold, the simulation is stopped.");  << 
 90   fMaxStepNumber->SetParameterName("maximumNum     90   fMaxStepNumber->SetParameterName("maximumNumberOfSteps", true);
 91   fMaxStepNumber->SetDefaultValue(-1);             91   fMaxStepNumber->SetDefaultValue(-1);
 92                                                    92 
 93   // Beam On                                       93   // Beam On
 94   fProcessCmd = std::make_unique<G4UIcmdWithou <<  94   fProcessCmd = new G4UIcmdWithoutParameter("/scheduler/process", this);
 95   fProcessCmd->SetGuidance(                    <<  95   fProcessCmd->SetGuidance("Process stacked tracks in G4Scheduler. This is done "
 96     "Process stacked tracks in G4Scheduler. Th <<  96       "for standalone application only (no physics).");
 97     "for standalone application only (no physi << 
 98   fProcessCmd->AvailableForStates(G4State_PreI     97   fProcessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 99                                                    98 
100   // Verbose                                       99   // Verbose
101   fVerboseCmd = std::make_unique<G4UIcmdWithAn << 100   fVerboseCmd = new G4UIcmdWithAnInteger("/scheduler/verbose", this);
102   fVerboseCmd->SetGuidance("Set the Verbose le    101   fVerboseCmd->SetGuidance("Set the Verbose level of G4Scheduler.");
103   fVerboseCmd->SetGuidance(" 0 : Silent (defau    102   fVerboseCmd->SetGuidance(" 0 : Silent (default)");
104   fVerboseCmd->SetGuidance(" 1 : Display react    103   fVerboseCmd->SetGuidance(" 1 : Display reactions");
105   fVerboseCmd->SetGuidance(" 2 ");                104   fVerboseCmd->SetGuidance(" 2 ");
106   fVerboseCmd->SetParameterName("level", true)    105   fVerboseCmd->SetParameterName("level", true);
107   fVerboseCmd->SetDefaultValue(1);                106   fVerboseCmd->SetDefaultValue(1);
                                                   >> 107   //  fVerboseCmd->SetRange("level >=0 && level <=4");
108                                                   108 
109   fWhyDoYouStop = std::make_unique<G4UIcmdWith << 109   fWhyDoYouStop = new G4UIcmdWithoutParameter("/scheduler/whyDoYouStop",this);
110   fWhyDoYouStop->SetGuidance("Will print infor    110   fWhyDoYouStop->SetGuidance("Will print information on why the scheduler is "
111                              "stopping the pro << 111       "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                                                   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.");
125 }                                                 119 }
126                                                   120 
127 G4SchedulerMessenger::~G4SchedulerMessenger()  << 121 G4SchedulerMessenger::~G4SchedulerMessenger()
                                                   >> 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;
                                                   >> 132   delete fUseDefaultTimeSteps;
                                                   >> 133 }
128                                                   134 
129 void G4SchedulerMessenger::SetNewValue(G4UIcom << 135 void G4SchedulerMessenger::SetNewValue(G4UIcommand * command,
                                                   >> 136                                          G4String newValue)
130 {                                                 137 {
131   if(command == fProcessCmd.get())             << 138   if (command == fProcessCmd)
132   {                                               139   {
133     fScheduler->Process();                        140     fScheduler->Process();
134   }                                               141   }
135   else if(command == fEndTime.get())           << 142   else if (command == fEndTime)
136   {                                               143   {
137     fScheduler->SetEndTime(fEndTime->GetNewDou    144     fScheduler->SetEndTime(fEndTime->GetNewDoubleValue(newValue));
138   }                                               145   }
139   else if(command == fTimeTolerance.get())     << 146   else if (command == fTimeTolerance)
140   {                                               147   {
141     fScheduler->SetTimeTolerance(fTimeToleranc << 148     fScheduler->SetTimeTolerance(
                                                   >> 149         fTimeTolerance->GetNewDoubleValue(newValue));
142   }                                               150   }
143   else if(command == fVerboseCmd.get())        << 151   else if (command == fVerboseCmd)
144   {                                               152   {
145     fScheduler->SetVerbose(fVerboseCmd->GetNew    153     fScheduler->SetVerbose(fVerboseCmd->GetNewIntValue(newValue));
146   }                                               154   }
147   else if(command == fInitCmd.get())           << 155   else if (command == fInitCmd)
148   {                                               156   {
149     fScheduler->Initialize();                     157     fScheduler->Initialize();
150   }                                               158   }
151   else if(command == fMaxNULLTimeSteps.get())  << 159   else if (command == fMaxNULLTimeSteps)
152   {                                               160   {
153     fScheduler->SetMaxZeroTimeAllowed(            161     fScheduler->SetMaxZeroTimeAllowed(
154       fMaxNULLTimeSteps->GetNewIntValue(newVal << 162         fMaxNULLTimeSteps->GetNewIntValue(newValue));
155   }                                               163   }
156   else if(command == fMaxStepNumber.get())     << 164   else if (command == fMaxStepNumber)
157   {                                               165   {
158     fScheduler->SetMaxNbSteps(fMaxStepNumber->    166     fScheduler->SetMaxNbSteps(fMaxStepNumber->GetNewIntValue(newValue));
159   }                                               167   }
160   else if(command == fWhyDoYouStop.get())      << 168   else if (command == fWhyDoYouStop)
161   {                                               169   {
162     fScheduler->WhyDoYouStop();                   170     fScheduler->WhyDoYouStop();
163   }                                               171   }
164   else if(command == fUseDefaultTimeSteps.get( << 172   else if (command == fUseDefaultTimeSteps)
165   {                                               173   {
166     fScheduler->UseDefaultTimeSteps(           << 174     fScheduler->UseDefaultTimeSteps(fUseDefaultTimeSteps->GetNewBoolValue(newValue));
167       fUseDefaultTimeSteps->GetNewBoolValue(ne << 
168   }                                            << 
169   else if(command == fResetScavenger.get())    << 
170   {                                            << 
171     fScheduler->ResetScavenger(fResetScavenger << 
172   }                                               175   }
173 }                                                 176 }
174                                                   177 
175 G4String G4SchedulerMessenger::GetCurrentValue << 178 G4String G4SchedulerMessenger::GetCurrentValue(G4UIcommand * command)
176 {                                                 179 {
177   G4String cv;                                    180   G4String cv;
178                                                   181 
179   if(command == fVerboseCmd.get())             << 182   if (command == fVerboseCmd)
180   {                                               183   {
181     cv = fVerboseCmd->ConvertToString(fSchedul    184     cv = fVerboseCmd->ConvertToString(fScheduler->GetVerbose());
182   }                                               185   }
183   else if(command == fEndTime.get())           << 186   else if (command == fEndTime)
184   {                                               187   {
185     cv = fEndTime->ConvertToString(fScheduler-    188     cv = fEndTime->ConvertToString(fScheduler->GetEndTime());
186   }                                               189   }
187   else if(command == fTimeTolerance.get())     << 190   else if (command == fTimeTolerance)
188   {                                               191   {
189     cv = fTimeTolerance->ConvertToString(fSche    192     cv = fTimeTolerance->ConvertToString(fScheduler->GetTimeTolerance());
190   }                                               193   }
191   else if(command == fInitCmd.get())           << 194   else if (command == fInitCmd)
192   {                                               195   {
193     cv = fInitCmd->ConvertToString(fScheduler-    196     cv = fInitCmd->ConvertToString(fScheduler->IsInitialized());
194   }                                               197   }
195   else if(command == fMaxNULLTimeSteps.get())  << 198   else if (command == fMaxNULLTimeSteps)
196   {                                               199   {
197     cv =                                       << 200     cv = fMaxNULLTimeSteps->ConvertToString(
198       fMaxNULLTimeSteps->ConvertToString(fSche << 201         fScheduler->GetMaxZeroTimeAllowed());
199   }                                               202   }
200   else if(command == fMaxStepNumber.get())     << 203   else if (command == fMaxStepNumber)
201   {                                               204   {
202     cv = fMaxStepNumber->ConvertToString(fSche    205     cv = fMaxStepNumber->ConvertToString(fScheduler->GetMaxNbSteps());
203   }                                               206   }
204   else if(command == fUseDefaultTimeSteps.get( << 207   else if (command == fUseDefaultTimeSteps)
205   {                                               208   {
206     cv = fUseDefaultTimeSteps->ConvertToString << 209     cv = fUseDefaultTimeSteps->ConvertToString(fScheduler->AreDefaultTimeStepsUsed());
207       fScheduler->AreDefaultTimeStepsUsed());  << 
208   }                                               210   }
                                                   >> 211 
209   return cv;                                      212   return cv;
210 }                                                 213 }
                                                   >> 214 
211                                                   215