EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs_spherical_shell.h
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ spherical shell shape headers
5 # Copyright (C) 2016 Randle E. P. Taylor, Rowan M. Thomson,
6 # Marc J. P. Chamberland, D. W. O. Rogers
7 #
8 # This file is part of EGSnrc.
9 #
10 # EGSnrc is free software: you can redistribute it and/or modify it under
11 # the terms of the GNU Affero General Public License as published by the
12 # Free Software Foundation, either version 3 of the License, or (at your
13 # option) any later version.
14 #
15 # EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
18 # more details.
19 #
20 # You should have received a copy of the GNU Affero General Public License
21 # along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
22 #
23 ###############################################################################
24 #
25 # Author: Randle Taylor, 2016
26 #
27 # Contributors: Marc Chamberland
28 # Rowan Thomson
29 # Dave Rogers
30 #
31 ###############################################################################
32 #
33 # egs_spherical_shell was developed for the Carleton Laboratory for
34 # Radiotherapy Physics.
35 #
36 ###############################################################################
37 */
38 
39 
45 #ifndef EGS_SPHERICAL_SHELL_
46 #define EGS_SPHERICAL_SHELL_
47 
48 #include "egs_shapes.h"
49 #include "egs_rndm.h"
50 #include "egs_math.h"
51 #include <fstream>
52 
53 #ifdef WIN32
54 
55  #ifdef BUILD_SPHERICAL_SHELL_DLL
56  #define EGS_SPHERICAL_SHELL_EXPORT __declspec(dllexport)
57  #else
58  #define EGS_SPHERICAL_SHELL_EXPORT __declspec(dllimport)
59  #endif
60  #define EGS_SPHERICAL_SHELL_LOCAL
61 
62 #else
63 
64  #ifdef HAVE_VISIBILITY
65  #define EGS_SPHERICAL_SHELL_EXPORT __attribute__ ((visibility ("default")))
66  #define EGS_SPHERICAL_SHELL_LOCAL __attribute__ ((visibility ("hidden")))
67  #else
68  #define EGS_SPHERICAL_SHELL_EXPORT
69  #define EGS_SPHERICAL_SHELL_LOCAL
70  #endif
71 
72 #endif
73 
74 
101 class EGS_SPHERICAL_SHELL_EXPORT EGS_SphericalShellShape : public EGS_BaseShape {
102 
103 public:
104 
106  EGS_SphericalShellShape(EGS_Float ri, EGS_Float ro, int hemisph = 0, EGS_Float halfangle=0, const EGS_Vector &Xo = EGS_Vector(0,0,0),
107  const string &Name="",EGS_ObjectFactory *f=0);
108 
110 
113 
117  bool supportsDirectionMethod() const {
118  return true;
119  };
120 
125  void getPointSourceDirection(const EGS_Vector &Xo,
126  EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt);
127 
129  EGS_Float area() const;
130 
131 protected:
132 
133  EGS_Float r_inner, r_outer, sgn;
134  int hemisphere;
135  EGS_Float half_angle;
137 
138 };
139 
140 
141 #endif
EGS_Float sgn
The sphere radius.
A class representing 3D vectors.
Definition: egs_vector.h:56
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
Definition: egs_shapes.h:112
bool supportsDirectionMethod() const
Returns true. (It is easy to implement the getPointSourceDirection() method for a sphere...
virtual EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Sample and return a random 3D vector.
Definition: egs_shapes.h:149
Base random number generator class. All random number generators should be derived from this class...
Definition: egs_rndm.h:67
virtual EGS_Float area() const
Definition: egs_shapes.h:232
EGS_RandomGenerator class header file.
virtual void getPointSourceDirection(const EGS_Vector &xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
Definition: egs_shapes.h:220
EGS_BaseShape and shape classes header file.
A spherical shell shape.
An object factory.
Attempts to fix broken math header files.
EGS_Vector xo
The sphere midpoint.
EGS_Float half_angle
Half angle of conical section.