GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSCrossSections.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_PHYSICS_GGEMSCROSSSECTIONS_HH
2 #define GUARD_GGEMS_PHYSICS_GGEMSCROSSSECTIONS_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 #ifdef _MSC_VER
35 #pragma warning(disable: 4251) // Deleting warning exporting STL members!!!
36 #endif
37 
38 #include <vector>
39 #include <string>
40 
43 
44 class GGEMSEMProcess;
45 class GGEMSMaterials;
47 
52 class GGEMS_EXPORT GGEMSCrossSections
53 {
54  public:
58  GGEMSCrossSections(void);
59 
63  ~GGEMSCrossSections(void);
64 
70  GGEMSCrossSections(GGEMSCrossSections const& cross_sections) = delete;
71 
77  GGEMSCrossSections& operator=(GGEMSCrossSections const& cross_sections) = delete;
78 
84  GGEMSCrossSections(GGEMSCrossSections const&& cross_sections) = delete;
85 
91  GGEMSCrossSections& operator=(GGEMSCrossSections const&& cross_sections) = delete;
92 
100  void AddProcess(std::string const& process_name, std::string const& particle_type, bool const& is_secondary = false);
101 
107  void Initialize(GGEMSMaterials const* materials);
108 
114  inline GGEMSEMProcess** GetEMProcessesList(void) const {return em_processes_list_;}
115 
121  inline GGsize GetNumberOfActivatedEMProcesses(void) const {return number_of_activated_processes_;}
122 
129  inline cl::Buffer* GetCrossSections(GGsize const& thread_index) const {return particle_cross_sections_[thread_index];}
130 
140  GGfloat GetPhotonCrossSection(std::string const& process_name, std::string const& material_name, GGfloat const& energy, std::string const& unit) const;
141 
146  void Clean(void);
147 
148  private:
153  void LoadPhysicTablesOnHost(void);
154 
155  private:
158  std::vector<bool> is_process_activated_;
162 };
163 
169 extern "C" GGEMS_EXPORT GGEMSCrossSections* create_ggems_cross_sections(void);
170 
179 extern "C" GGEMS_EXPORT void add_process_ggems_cross_sections(GGEMSCrossSections* cross_sections, char const* process_name, char const* particle_name, bool const is_secondary);
180 
187 extern "C" GGEMS_EXPORT void initialize_ggems_cross_sections(GGEMSCrossSections* cross_sections, GGEMSMaterials* materials);
188 
199 extern "C" GGEMS_EXPORT GGfloat get_cs_cross_sections(GGEMSCrossSections* cross_sections, char const* process_name, char const* material_name, GGfloat const energy, char const* unit);
200 
206 extern "C" GGEMS_EXPORT void clean_ggems_cross_sections(GGEMSCrossSections* cross_sections);
207 
208 #endif // End of GUARD_GGEMS_PHYSICS_GGEMSCROSSSECTIONS_HH
GGEMSCrossSections::number_activated_devices_
GGsize number_activated_devices_
Definition: GGEMSCrossSections.hh:161
GGEMSCrossSections::em_processes_list_
GGEMSEMProcess ** em_processes_list_
Definition: GGEMSCrossSections.hh:156
add_process_ggems_cross_sections
void add_process_ggems_cross_sections(GGEMSCrossSections *cross_sections, char const *process_name, char const *particle_name, bool const is_secondary)
Add a process to cross section table.
Definition: GGEMSCrossSections.cc:351
GGEMSCrossSections
GGEMS class handling the cross sections tables.
Definition: GGEMSCrossSections.hh:53
GGEMSCrossSections::is_process_activated_
std::vector< bool > is_process_activated_
Definition: GGEMSCrossSections.hh:158
GGEMSMaterials
GGEMS class handling material(s) for a specific navigator.
Definition: GGEMSMaterials.hh:49
GGEMSCrossSections::GetCrossSections
cl::Buffer * GetCrossSections(GGsize const &thread_index) const
return the pointer to OpenCL buffer storing cross sections
Definition: GGEMSCrossSections.hh:129
GGEMSParticleCrossSections_t
Structure storing the photon cross sections for OpenCL device.
Definition: GGEMSParticleCrossSections.hh:41
get_cs_cross_sections
GGfloat get_cs_cross_sections(GGEMSCrossSections *cross_sections, char const *process_name, char const *material_name, GGfloat const energy, char const *unit)
get the cross section value of process
Definition: GGEMSCrossSections.cc:369
GGEMSCrossSections::number_of_activated_processes_
GGsize number_of_activated_processes_
Definition: GGEMSCrossSections.hh:157
GGEMSCrossSections::operator=
GGEMSCrossSections & operator=(GGEMSCrossSections const &&cross_sections)=delete
Avoid copy by rvalue reference.
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSCrossSections::particle_cross_sections_host_
GGEMSParticleCrossSections * particle_cross_sections_host_
Definition: GGEMSCrossSections.hh:160
GGEMSEMProcess
GGEMS mother class for electromagnectic process.
Definition: GGEMSEMProcess.hh:47
GGEMSCrossSections::particle_cross_sections_
cl::Buffer ** particle_cross_sections_
Definition: GGEMSCrossSections.hh:159
GGEMSParticleCrossSections.hh
Structure storing the particle (photon, electron, positron) cross sections for OpenCL device.
GGEMSCrossSections::operator=
GGEMSCrossSections & operator=(GGEMSCrossSections const &cross_sections)=delete
Avoid assignement by reference.
GGEMSCrossSections::GGEMSCrossSections
GGEMSCrossSections(GGEMSCrossSections const &cross_sections)=delete
Avoid copy by reference.
GGEMSProcessesManager
GGEMS class managing the processes in GGEMS simulation.
Definition: GGEMSProcessesManager.hh:42
GGEMSOpenCLManager.hh
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
initialize_ggems_cross_sections
void initialize_ggems_cross_sections(GGEMSCrossSections *cross_sections, GGEMSMaterials *materials)
Intialize the cross section tables for process and materials.
Definition: GGEMSCrossSections.cc:360
GGEMSCrossSections::GetNumberOfActivatedEMProcesses
GGsize GetNumberOfActivatedEMProcesses(void) const
get the number of activated processes
Definition: GGEMSCrossSections.hh:121
GGEMSCrossSections::GetEMProcessesList
GGEMSEMProcess ** GetEMProcessesList(void) const
get the pointer on activated process
Definition: GGEMSCrossSections.hh:114
clean_ggems_cross_sections
void clean_ggems_cross_sections(GGEMSCrossSections *cross_sections)
clean all cross sections on each OpenCL device
Definition: GGEMSCrossSections.cc:378
GGEMSCrossSections::GGEMSCrossSections
GGEMSCrossSections(GGEMSCrossSections const &&cross_sections)=delete
Avoid copy by rvalue reference.
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273
create_ggems_cross_sections
GGEMSCrossSections * create_ggems_cross_sections(void)
Get the GGEMSCrossSections pointer for python user.
Definition: GGEMSCrossSections.cc:342