GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSSource.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_SOURCES_GGEMSSOURCE_HH
2 #define GUARD_GGEMS_SOURCES_GGEMSSOURCE_HH
3 
4 // ************************************************************************
5 // * This file is part of GGEMS. *
6 // * *
7 // * GGEMS is free software: you can redistribute it and/or modify *
8 // * it under the terms of the GNU General Public License as published by *
9 // * the Free Software Foundation, either version 3 of the License, or *
10 // * (at your option) any later version. *
11 // * *
12 // * GGEMS is distributed in the hope that it will be useful, *
13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 // * GNU General Public License for more details. *
16 // * *
17 // * You should have received a copy of the GNU General Public License *
18 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
19 // * *
20 // ************************************************************************
21 
35 
36 class GGEMSParticles;
39 
44 class GGEMS_EXPORT GGEMSSource
45 {
46  public:
51  explicit GGEMSSource(std::string const& source_name);
52 
56  virtual ~GGEMSSource(void);
57 
63  GGEMSSource(GGEMSSource const& source) = delete;
64 
70  GGEMSSource& operator=(GGEMSSource const& source) = delete;
71 
77  GGEMSSource(GGEMSSource const&& source) = delete;
78 
84  GGEMSSource& operator=(GGEMSSource const&& source) = delete;
85 
91  inline std::string GetNameOfSource(void) const {return source_name_;}
92 
101  void SetPosition(GGfloat const& pos_x, GGfloat const& pos_y, GGfloat const& pos_z, std::string const& unit = "mm");
102 
108  void SetSourceParticleType(std::string const& particle_type);
109 
118  void SetRotation(GGfloat const& rx, GGfloat const& ry, GGfloat const& rz, std::string const& unit = "deg");
119 
125  void SetNumberOfParticles(GGsize const& number_of_particles);
126 
131  void EnableTracking(void);
132 
139  inline GGsize GetNumberOfBatchs(GGsize const& device_index) const {return number_of_batchs_[device_index];}
140 
148  inline GGsize GetNumberOfParticlesInBatch(GGsize const& device_index, GGsize const& batch_index) {return number_of_particles_in_batch_[device_index][batch_index];}
149 
154  virtual void CheckParameters(void) const;
155 
161  virtual void Initialize(bool const& is_tracking = false);
162 
169  virtual void GetPrimaries(GGsize const& thread_index, GGsize const& number_of_particles) = 0;
170 
175  virtual void PrintInfos(void) const = 0;
176 
177  protected:
182  virtual void InitializeKernel(void) = 0;
183 
184  private:
189  void OrganizeParticlesInBatch(void);
190 
191  protected:
192  std::string source_name_;
203  cl::Kernel** kernel_get_primaries_;
205 };
206 
207 #endif // End of GUARD_GGEMS_SOURCES_GGEMSSOURCE_HH
GGEMSParticles
Class managing the particles in GGEMS.
Definition: GGEMSParticles.hh:48
GGEMSGeometryTransformation
This class handles everything about geometry transformation.
Definition: GGEMSGeometryTransformation.hh:42
GGEMSSource::number_of_batchs_
GGsize * number_of_batchs_
Definition: GGEMSSource.hh:197
GGEMSPseudoRandomGenerator
Class managing the random number in GGEMS.
Definition: GGEMSPseudoRandomGenerator.hh:42
GGEMSSource::particle_type_
GGchar particle_type_
Definition: GGEMSSource.hh:199
GGEMSSource::number_activated_devices_
GGsize number_activated_devices_
Definition: GGEMSSource.hh:204
GGEMSSource::tracking_kernel_option_
std::string tracking_kernel_option_
Definition: GGEMSSource.hh:200
GGEMSSource::InitializeKernel
virtual void InitializeKernel(void)=0
Initialize kernel for specific source in OpenCL.
GGEMSSource::kernel_get_primaries_
cl::Kernel ** kernel_get_primaries_
Definition: GGEMSSource.hh:203
GGchar
#define GGchar
Definition: GGEMSTypes.hh:196
GGEMSSource::GetPrimaries
virtual void GetPrimaries(GGsize const &thread_index, GGsize const &number_of_particles)=0
Generate primary particles.
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSSource::GGEMSSource
GGEMSSource(GGEMSSource const &&source)=delete
Avoid copy by rvalue reference.
GGEMSSource::GetNumberOfParticlesInBatch
GGsize GetNumberOfParticlesInBatch(GGsize const &device_index, GGsize const &batch_index)
method returning the number of particles in a specific batch
Definition: GGEMSSource.hh:148
GGEMSSource::PrintInfos
virtual void PrintInfos(void) const =0
Printing infos about the source.
GGEMSSource::operator=
GGEMSSource & operator=(GGEMSSource const &&source)=delete
Avoid copy by rvalue reference.
GGEMSSource::source_name_
std::string source_name_
Definition: GGEMSSource.hh:192
GGEMSOpenCLManager.hh
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
GGEMSSource::GetNameOfSource
std::string GetNameOfSource(void) const
get the name of the source
Definition: GGEMSSource.hh:91
GGEMSSource::number_of_particles_in_batch_
GGsize ** number_of_particles_in_batch_
Definition: GGEMSSource.hh:196
GGEMSSource::GGEMSSource
GGEMSSource(GGEMSSource const &source)=delete
Avoid copy by reference.
GGEMSSource::geometry_transformation_
GGEMSGeometryTransformation * geometry_transformation_
Definition: GGEMSSource.hh:201
GGEMSSource::number_of_particles_by_device_
GGsize * number_of_particles_by_device_
Definition: GGEMSSource.hh:194
GGEMSSource::GetNumberOfBatchs
GGsize GetNumberOfBatchs(GGsize const &device_index) const
method returning the number of particles by batch
Definition: GGEMSSource.hh:139
GGEMSSource::number_of_particles_
GGsize number_of_particles_
Definition: GGEMSSource.hh:193
GGEMSSource::operator=
GGEMSSource & operator=(GGEMSSource const &source)=delete
Avoid assignement by reference.
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273
GGEMSSource
GGEMS mother class for the source.
Definition: GGEMSSource.hh:45