EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs_advanced_application.h
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ advanced application headers
5 # Copyright (C) 2015 National Research Council Canada
6 #
7 # This file is part of EGSnrc.
8 #
9 # EGSnrc is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU Affero General Public License as published by the
11 # Free Software Foundation, either version 3 of the License, or (at your
12 # option) any later version.
13 #
14 # EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17 # more details.
18 #
19 # You should have received a copy of the GNU Affero General Public License
20 # along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ###############################################################################
23 #
24 # Author: Iwan Kawrakow, 2005
25 #
26 # Contributors: Ernesto Mainegra-Hing
27 # Frederic Tessier
28 # Reid Townson
29 # Blake Walters
30 #
31 ###############################################################################
32 */
33 
34 
40 #ifndef EGS_ADVANCED_APPLICATION_
41 #define EGS_ADVANCED_APPLICATION_
42 
43 #include "egs_libconfig.h"
44 #include "egs_application.h"
45 #include <vector>
46 
47 class EGS_Input;
48 class EGS_Interpolator;
49 
60 class APP_EXPORT EGS_AdvancedApplication : public EGS_Application {
61 
62 public:
63 
64  //
65  // ********* constructor and destructor
66  //
73  EGS_AdvancedApplication(int argc, char **argv);
74 
79  virtual ~EGS_AdvancedApplication();
80 
87  void setAusgabCall(AusgabCall call, bool on_or_off);
88 
98  virtual void finishRun();
99 
100 
109  int outputData();
110 
115  int readData();
116 
123  int addState(istream &);
124 
131  void resetCounter();
132 
143  int finishSimulation();
144 
150  void describeSimulation();
151 
157  EGS_I64 randomNumbersUsed() const;
158 
164  void getElectronSteps(double &ch_steps, double &all_steps) const;
165 
167  virtual void saveRNGState();
168 
170  virtual void resetRNGState();
171 
172  void appInformation(const char *msg);
173  void appWarning(const char *msg);
174  void appFatal(const char *msg);
175 
187  void startNewParticle();
188  void enterNewRegion();
189 
195  void setRayleighData(const vector<string> &str_medium,
196  const vector<string> &str_file);
205  void setEIIData(EGS_I32 len);
206 
207  //************************************************************
208  // Utility functions for use with ausgab dose scoring objects
209  //************************************************************
210  EGS_Float getMediumRho(int ind);
211  EGS_Float getEdep();
212  void setEdep(EGS_Float edep);
213  EGS_Float getEcut();
214  EGS_Float getPcut();
215 
216  //************************************************************
217  // Utility function for ausgab phase space scoring objects
218  //************************************************************
219  void setLatch(int latch);
220 
221  //************************************************************
222  // Utility functions for fluence scoring objects
223  //************************************************************
224  EGS_Float getTVSTEP();
225  EGS_Interpolator *getDEDX(const int &imed, const int &iq);
226  void setLatch(const int &ip, const int &latch);
227  void incLatch(const int &ip, const int &increment);
228  int getNp();
229  int getNpOld();
230 
231  /* Needed by some sources */
232  EGS_Float getRM();
233 
234  //************************************************
235  // For use with ausgab radiative splitting objects
236  //************************************************
237 
238  /* Turn ON/OFF EGSnrc internal radiative splitting (UBS) */
239  void setRadiativeSplitting(const EGS_Float &nsplit);
240  /* Turn ON/OFF EGSnrc internal Russian Roultette + UBS */
241  void setRussianRoulette(const EGS_Float &iSwitchRR);
242  void splitTopParticleIsotropically(const EGS_Float &fsplit);
243 
244 protected:
245 
246  int nmed;
254 
260 
263  EGS_Float *rng_buffer;
264 
277  int initEGSnrcBackEnd();
278 
294  int initCrossSections();
295 
302  int shower();
303 
304  bool final_job;
305 
308  int helpInit(EGS_Input *, bool do_hatch);
309 
312  static string base_revision;
313 
314  int io_flag;
315 
316 };
317 
318 #endif
319 
Base class for advanced EGSnrc applications based on the mortran EGSnrc back-end.
int io_flag
determines how to write info
EGS_Interpolator * i_gbr2
photon branching 2 interpolator
EGS_Interpolator * i_esig
electron cross section interpolator
EGS_Float * rng_buffer
RNG buffer.
EGS_Interpolator * i_pbr1
positron branching 1 interpolator
int i_rng_buffer
Pointer to the RNG buffer.
static string base_revision
Holds the CVS revision number of the egs_advanced_application.cpp file.
EGS_Interpolator * i_psig
positron cross section interpolator
EGS_Interpolator * i_ededx
electron stopping power interpolator
bool final_job
Is this the final job of a parallel run ?
EGS_Interpolator * i_gmfp
photon mean-free-path interpolator
EGS_Interpolator * i_cohe
photon Rayleigh interpolator
EGS_Interpolator * i_ebr1
electron branching interpolator
EGS_Interpolator * i_photonuc
photonuclear interpolator
EGS_Interpolator * i_pdedx
positron stopping power interpolator
EGS_Interpolator * i_pbr2
positron branching 2 interpolator
int n_rng_buffer
Size of the RNG buffer.
EGS_Interpolator * i_gbr1
photon branching 1 interpolator
Base class for advanced EGSnrc C++ applications.
virtual EGS_I64 randomNumbersUsed() const
Returns the number of random numbers used.
virtual void resetCounter()
Reset the application to a 'pristine' state.
virtual void setAusgabCall(AusgabCall call, bool on_or_off)
Turns on or off a call to the user scoring function ausgab.
virtual void describeSimulation()
Describe the simulation.
virtual int addState(istream &data)
Add data from a parallel job.
virtual int finishSimulation()
Analyze and output the results.
virtual void startNewParticle()
Start the transport of a new particle.
virtual void appFatal(const char *)
Write a warning message and exit.
virtual int outputData()
Output intermediate results.
virtual void getElectronSteps(double &ch_steps, double &all_steps) const
Get the number of electron steps taken.
AusgabCall
Possible calls to the user scoring function ausgab().
virtual int initCrossSections()
Initialize the EGSnrc cross sections and cross section/transport options.
virtual void appInformation(const char *)
Write an information message.
virtual void enterNewRegion()
Particle enters new region.
virtual void appWarning(const char *)
Write a warning message.
virtual int initEGSnrcBackEnd()
Initialize the EGSnrc backend.
virtual int shower()
Simulate a single shower.
virtual int readData()
Read intermediate results.
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition: egs_input.h:182
A class for fast run-time interpolations.
EGS_Application class header file.
Defines the EGS_EXPORT and EGS_LOCAL macros.