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 #
30 ###############################################################################
31 */
32 
33 
39 #ifndef EGS_ADVANCED_APPLICATION_
40 #define EGS_ADVANCED_APPLICATION_
41 
42 #include "egs_libconfig.h"
43 #include "egs_application.h"
44 #include <vector>
45 
46 class EGS_Input;
47 class EGS_Interpolator;
48 
59 class APP_EXPORT EGS_AdvancedApplication : public EGS_Application {
60 
61 public:
62 
63  //
64  // ********* constructor and destructor
65  //
72  EGS_AdvancedApplication(int argc, char **argv);
73 
78  virtual ~EGS_AdvancedApplication();
79 
86  void setAusgabCall(AusgabCall call, bool on_or_off);
87 
97  virtual void finishRun();
98 
99 
108  int outputData();
109 
114  int readData();
115 
122  int addState(istream &);
123 
130  void resetCounter();
131 
142  int finishSimulation();
143 
149  void describeSimulation();
150 
156  EGS_I64 randomNumbersUsed() const;
157 
163  void getElectronSteps(double &ch_steps, double &all_steps) const;
164 
166  virtual void saveRNGState();
167 
169  virtual void resetRNGState();
170 
171  void appInformation(const char *msg);
172  void appWarning(const char *msg);
173  void appFatal(const char *msg);
174 
186  void startNewParticle();
187  void enterNewRegion();
188 
194  void setRayleighData(const vector<string> &str_medium,
195  const vector<string> &str_file);
204  void setEIIData(EGS_I32 len);
205 
206  //************************************************************
207  // Utility functions for use with ausgab dose scoring objects
208  //************************************************************
209  EGS_Float getMediumRho(int ind);
210  EGS_Float getEdep();
211  void setEdep(EGS_Float edep);
212  EGS_Float getEcut();
213  EGS_Float getPcut();
214 
215  //************************************************************
216  // Utility function for ausgab phase space scoring objects
217  //************************************************************
218  void setLatch(int latch);
219 
220  //************************************************************
221  // Utility functions for fluence scoring objects
222  //************************************************************
223  EGS_Float getTVSTEP();
224  EGS_Interpolator *getDEDX(const int &imed, const int &iq);
225  void setLatch(const int &ip, const int &latch);
226  void incLatch(const int &ip, const int &increment);
227  int getNp();
228  int getNpOld();
229 
230  /* Needed by some sources */
231  EGS_Float getRM();
232  /* Turn ON/OFF radiative splitting */
233  void setRadiativeSplitting(const EGS_Float &nsplit);
234 
235 protected:
236 
237  int nmed;
245 
251 
254  EGS_Float *rng_buffer;
255 
268  int initEGSnrcBackEnd();
269 
285  int initCrossSections();
286 
293  int shower();
294 
295  bool final_job;
296 
299  int helpInit(EGS_Input *, bool do_hatch);
300 
303  static string base_revision;
304 
305  int io_flag;
306 
307 };
308 
309 #endif
310 
int io_flag
determines how to write info
int i_rng_buffer
Pointer to the RNG buffer.
virtual int readData()
Read intermediate results.
virtual void getElectronSteps(double &ch_steps, double &all_steps) const
Get the number of electron steps taken.
virtual void describeSimulation()
Describe the simulation.
virtual void resetCounter()
Reset the application to a &#39;pristine&#39; state.
EGS_Interpolator * i_pbr2
positron branching 2 interpolator
AusgabCall
Possible calls to the user scoring function ausgab().
EGS_Interpolator * i_gbr2
photon branching 2 interpolator
virtual void appInformation(const char *)
Write an information message.
virtual void appFatal(const char *)
Write a warning message and exit.
EGS_Interpolator * i_cohe
photon Rayleigh 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_ededx
electron stopping power interpolator
EGS_Float * rng_buffer
RNG buffer.
virtual int initEGSnrcBackEnd()
Initialize the EGSnrc backend.
virtual int shower()
Simulate a single shower.
EGS_Interpolator * i_gbr1
photon branching 1 interpolator
A class for fast run-time interpolations.
static string base_revision
Holds the CVS revision number of the egs_advanced_application.cpp file.
virtual int initCrossSections()
Initialize the EGSnrc cross sections and cross section/transport options.
virtual int outputData()
Output intermediate results.
EGS_Interpolator * i_ebr1
electron branching interpolator
virtual int finishSimulation()
Analyze and output the results.
virtual EGS_I64 randomNumbersUsed() const
Returns the number of random numbers used.
EGS_Interpolator * i_psig
positron cross section interpolator
virtual int addState(istream &data)
Add data from a parallel job.
int n_rng_buffer
Size of the RNG buffer.
virtual void startNewParticle()
Start the transport of a new particle.
virtual void appWarning(const char *)
Write a warning message.
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition: egs_input.h:182
Defines the EGS_EXPORT and EGS_LOCAL macros.
virtual void enterNewRegion()
Particle enters new region.
virtual void setAusgabCall(AusgabCall call, bool on_or_off)
Turns on or off a call to the user scoring function ausgab.
EGS_Interpolator * i_pdedx
positron stopping power interpolator
EGS_Application class header file.
Base class for advanced EGSnrc applications based on the mortran EGSnrc back-end. ...
Base class for advanced EGSnrc C++ applications.
EGS_Interpolator * i_photonuc
photonuclear interpolator
EGS_Interpolator * i_pbr1
positron branching 1 interpolator
EGS_Interpolator * i_esig
electron cross section interpolator