EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
eb_iaeaphsp_source.h
Go to the documentation of this file.
1/*
2################################################################################
3#
4# egs_brachy eb_iaeaphsp_source.h
5# Copyright (C) 2016 Rowan Thomson, Dave Rogers, Randle Taylor, and Marc
6# Chamberland
7#
8# This file is part of egs_brachy
9#
10# egs_brachy is free software: you can redistribute it and/or modify it
11# under the terms of the GNU Affero General Public License as published
12# by the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# egs_brachy is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# Affero General Public License for more details:
19# <http://www.gnu.org/licenses/>.
20#
21################################################################################
22#
23# When egs_brachy is used for publications, please cite our paper:
24# M. J. P. Chamberland, R. E. P. Taylor, D. W. O. Rogers, and R. M. Thomson,
25# egs brachy: a versatile and fast Monte Carlo code for brachytherapy,
26# Phys. Med. Biol. 61, 8214-8231 (2016).
27#
28################################################################################
29#
30# Author: Randle Taylor, 2016
31#
32# Contributors: Marc Chamberland
33# Dave Rogers
34# Rowan Thomson
35#
36################################################################################
37*/
38
47#ifndef EB_IAEA_SOURCE_
48#define EB_IAEA_SOURCE_
49
50#include "egs_config1.h"
51#include "egs_vector.h"
52#include "egs_base_source.h"
53#include "egs_rndm.h"
54#include "egs_alias_table.h"
55#include "../iaea_phsp/iaea_phsp.h"
56
57#include <fstream>
58using namespace std;
59
60#ifdef WIN32
61
62 #ifdef BUILD_EB_IAEA_PHSP_SOURCE_DLL
63 #define EB_IAEA_SOURCE_EXPORT __declspec(dllexport)
64 #else
65 #define EB_IAEA_SOURCE_EXPORT __declspec(dllimport)
66 #endif
67 #define EB_IAEA_SOURCE_LOCAL
68
69#else
70
71 #ifdef HAVE_VISIBILITY
72 #define EB_IAEA_SOURCE_EXPORT __attribute__ ((visibility ("default")))
73 #define EB_IAEA_SOURCE_LOCAL __attribute__ ((visibility ("hidden")))
74 #else
75 #define EB_IAEA_SOURCE_EXPORT
76 #define EB_IAEA_SOURCE_LOCAL
77 #endif
78
79#endif
80
101class EB_IAEA_SOURCE_EXPORT EB_IAEASource : public EGS_BaseSource {
102
103public:
104
109 EB_IAEASource(EGS_Input *, EGS_ObjectFactory *f=0);
111
112 EGS_I64 getNextParticle(EGS_RandomGenerator *rndm,
113 int &q, int &latch, EGS_Float &E, EGS_Float &wt,
114 EGS_Vector &x, EGS_Vector &u);
115
116 EGS_Float getEmax() const;
117
118 EGS_Float getFluence() const;
119
120 void setSimulationChunk(EGS_I64 nstart, EGS_I64 nrun);
121 bool storeState(ostream &data) const;
122 bool setState(istream &data);
123 bool addState(istream &data);
124 void resetCounter();
125
126 bool isValid() const;
127
128
129protected:
130
133 ifstream phsp_file;
134
135 IAEA_I32 source_id;
136 IAEA_I32 *p_source_id;
137
138 EGS_Float Emax,
141
142 IAEA_I64 Nparticle,
150
151 IAEA_I32 n_parallel,
153
154 void openPHSPFile();
155 void initSourceParams();
156
157 static IAEA_I32 next_source_id;
158
159 static const string iaea_header_ext;
160
161
162};
163
164#endif
A phase space file source for egs_brachy.
static IAEA_I32 next_source_id
static const string iaea_header_ext
EGS_Float Emax
Maximum energy (obtained from the phsp file)
string phsp_file_name
The phase space file name.
IAEA_I64 Nfirst
first record this source can use
IAEA_I64 Nphoton
Number of photons in the file.
EGS_Float Nincident
Number of incident particles that created the file.
IAEA_I64 Nlast
Last record this source can use.
IAEA_I64 count
Particles delivered so far.
IAEA_I64 Nparticle
Number of particles in the file.
IAEA_I64 Npos
Next record to be read.
IAEA_I64 Nread
Number of particles read from file so far.
IAEA_I64 Nused
Number of particles used so far.
EGS_Float Emin
Minimum energy (obtained from the phsp file)
ifstream phsp_file
Phase space data stream.
#define EB_IAEA_SOURCE_EXPORT