GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSParticles.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_PHYSICS_GGEMSPARTICLES_HH
2 #define GUARD_GGEMS_PHYSICS_GGEMSPARTICLES_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 
34 #include <map>
35 
38 
39 typedef std::map<GGchar, std::string> ParticleTypeMap;
40 typedef std::map<GGchar, std::string> ParticleStatusMap;
41 typedef std::map<GGchar, std::string> ParticleLevelMap;
47 class GGEMS_EXPORT GGEMSParticles
48 {
49  public:
53  GGEMSParticles(void);
54 
58  ~GGEMSParticles(void);
59 
65  GGEMSParticles(GGEMSParticles const& particle) = delete;
66 
72  GGEMSParticles& operator=(GGEMSParticles const& particle) = delete;
73 
79  GGEMSParticles(GGEMSParticles const&& particle) = delete;
80 
86  GGEMSParticles& operator=(GGEMSParticles const&& particle) = delete;
87 
92  void Initialize(void);
93 
100  inline cl::Buffer* GetPrimaryParticles(GGsize const& thread_index) const {return primary_particles_[thread_index];};
101 
108  void SetNumberOfParticles(GGsize const& thread_index, GGsize const& number_of_particles);
109 
116  inline GGsize GetNumberOfParticles(GGsize const& thread_index) const {return number_of_particles_[thread_index];};
117 
124  bool IsAlive(GGsize const& thread_index) const;
125 
131  void Dump(std::string const& message) const;
132 
133  private:
138  void AllocatePrimaryParticles(void);
139 
144  void InitializeKernel(void);
145 
146  private:
148  cl::Buffer** primary_particles_;
149  cl::Buffer** status_;
151  cl::Kernel** kernel_alive_;
152 };
153 
154 #endif // End of GUARD_GGEMS_PHYSICS_GGEMSPARTICLES_HH
GGEMSParticles
Class managing the particles in GGEMS.
Definition: GGEMSParticles.hh:48
GGEMSParticles::GGEMSParticles
GGEMSParticles(GGEMSParticles const &&particle)=delete
Avoid copy of the class by rvalue reference.
GGEMSParticles::GetNumberOfParticles
GGsize GetNumberOfParticles(GGsize const &thread_index) const
Get the number of particles on activated device.
Definition: GGEMSParticles.hh:116
ParticleTypeMap
std::map< GGchar, std::string > ParticleTypeMap
Definition: GGEMSParticles.hh:39
GGEMSParticles::GGEMSParticles
GGEMSParticles(GGEMSParticles const &particle)=delete
Avoid copy of the class by reference.
GGEMSParticles::primary_particles_
cl::Buffer ** primary_particles_
Definition: GGEMSParticles.hh:148
GGEMSParticles::number_of_particles_
GGsize * number_of_particles_
Definition: GGEMSParticles.hh:147
GGEMSParticleConstants.hh
Storing particle states for GGEMS.
ParticleStatusMap
std::map< GGchar, std::string > ParticleStatusMap
Definition: GGEMSParticles.hh:40
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSParticles::number_activated_devices_
GGsize number_activated_devices_
Definition: GGEMSParticles.hh:150
GGEMSOpenCLManager.hh
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
GGEMSParticles::Dump
void Dump(std::string const &message) const
dump particle infos
ParticleLevelMap
std::map< GGchar, std::string > ParticleLevelMap
Definition: GGEMSParticles.hh:41
GGEMSParticles::operator=
GGEMSParticles & operator=(GGEMSParticles const &&particle)=delete
Avoid copy of the class by rvalue reference.
GGEMSParticles::operator=
GGEMSParticles & operator=(GGEMSParticles const &particle)=delete
Avoid assignement of the class by reference.
GGEMSParticles::kernel_alive_
cl::Kernel ** kernel_alive_
Definition: GGEMSParticles.hh:151
GGEMSParticles::status_
cl::Buffer ** status_
Definition: GGEMSParticles.hh:149
GGEMSParticles::GetPrimaryParticles
cl::Buffer * GetPrimaryParticles(GGsize const &thread_index) const
return the pointer to OpenCL buffer storing particles
Definition: GGEMSParticles.hh:100