EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs_space.h
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ space geometry 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: Reid Townson
27 #
28 ###############################################################################
29 */
30 
31 
37 #ifndef EGS_SPACE_
38 #define EGS_SPACE_
39 
40 #include "egs_base_geometry.h"
41 #include "egs_functions.h"
42 
43 #ifdef WIN32
44 
45  #ifdef BUILD_SPACE_DLL
46  #define EGS_SPACE_EXPORT __declspec(dllexport)
47  #else
48  #define EGS_SPACE_EXPORT __declspec(dllimport)
49  #endif
50  #define EGS_SPACE_LOCAL
51 
52 #else
53 
54  #ifdef HAVE_VISIBILITY
55  #define EGS_SPACE_EXPORT __attribute__ ((visibility ("default")))
56  #define EGS_SPACE_LOCAL __attribute__ ((visibility ("hidden")))
57  #else
58  #define EGS_SPACE_EXPORT
59  #define EGS_SPACE_LOCAL
60  #endif
61 
62 #endif
63 
83 class EGS_SPACE_EXPORT EGS_Space : public EGS_BaseGeometry {
84 
85 protected:
86 
87  static string type;
88 
89 public:
90 
91  EGS_Space(const string &Name) : EGS_BaseGeometry(Name) {
92  nreg=1;
93  };
94 
95  bool isInside(const EGS_Vector &x) {
96  return true;
97  };
98 
99  int isWhere(const EGS_Vector &x) {
100  return 0;
101  };
102 
103  int inside(const EGS_Vector &x) {
104  return 0;
105  };
106 
107  EGS_Float howfarToOutside(int ireg, const EGS_Vector &x,
108  const EGS_Vector &u) {
109  return veryFar;
110  };
111 
112  int howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u,
113  EGS_Float &t, int *newmed=0, EGS_Vector *normal=0) {
114  return ireg;
115  };
116 
117  EGS_Float hownear(int ireg, const EGS_Vector &x) {
118  return veryFar;
119  };
120 
121  const string &getType() const {
122  return type;
123  };
124 
125  void printInfo() const {
128  "=======================================================\n");
129  };
130 
131 };
132 
133 #endif
virtual const string & getType() const =0
Get the geometry type.
virtual bool isInside(const EGS_Vector &x)=0
Is the position x inside the geometry?
virtual void printInfo() const
Print information about this geometry.
virtual EGS_Float howfarToOutside(int ireg, const EGS_Vector &x, const EGS_Vector &u)
EGS_BaseGeometry(const string &Name)
Construct a geometry named Name.
A class representing 3D vectors.
Definition: egs_vector.h:56
Global egspp functions header file.
virtual int isWhere(const EGS_Vector &x)=0
In which region is poisition x?
virtual int howfar(int ireg, const EGS_Vector &x, const EGS_Vector &u, EGS_Float &t, int *newmed=0, EGS_Vector *normal=0)=0
Calculate the distance to a boundary from x along the direction u.
const EGS_Float veryFar
A very large float.
The entire space as a geometry object.
Definition: egs_space.h:83
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
virtual int inside(const EGS_Vector &x)=0
Returns the region index, if inside, or -1 if outside (obsolete)
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
virtual EGS_Float hownear(int ireg, const EGS_Vector &x)=0
Calculate the distance to a boundary for position x in any direction.
EGS_BaseGeometry class header file.