GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSWorld.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_NAVIGATORS_GGEMSWORLD_HH
2 #define GUARD_GGEMS_NAVIGATORS_GGEMSWORLD_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 "GGEMS/global/GGEMSExport.hh"
36 
41 typedef struct GGEMSWorldRecording_t
42 {
43  cl::Buffer** energy_tracking_;
44  cl::Buffer** energy_squared_tracking_;
45  cl::Buffer** photon_tracking_;
46  cl::Buffer** momentum_x_;
47  cl::Buffer** momentum_y_;
48  cl::Buffer** momentum_z_;
55 class GGEMS_EXPORT GGEMSWorld
56 {
57  public:
61  GGEMSWorld(void);
62 
66  ~GGEMSWorld(void);
67 
73  GGEMSWorld(GGEMSWorld const& world) = delete;
74 
80  GGEMSWorld& operator=(GGEMSWorld const& world) = delete;
81 
87  GGEMSWorld(GGEMSWorld const&& world) = delete;
88 
94  GGEMSWorld& operator=(GGEMSWorld const&& world) = delete;
95 
101  void SetOutputWorldBasename(std::string const& output_basename);
102 
110  void SetDimension(GGsize const& dimension_x, GGsize const& dimension_y, GGsize const& dimension_z);
111 
120  void SetElementSize(GGfloat const& size_x, GGfloat const& size_y, GGfloat const& size_z, std::string const& unit = "mm");
121 
127  void SetPhotonTracking(bool const& is_activated);
128 
134  void SetEnergyTracking(bool const& is_activated);
135 
141  void SetEnergySquaredTracking(bool const& is_activated);
142 
148  void SetMomentum(bool const& is_activated);
149 
154  void Initialize(void);
155 
161  void Tracking(GGsize const& thread_index);
162 
167  void SaveResults(void) const;
168 
173  void EnableTracking(void);
174 
175  private:
180  void CheckParameters(void) const;
181 
186  void InitializeKernel(void);
187 
192  void SavePhotonTracking(void) const;
193 
198  void SaveEnergyTracking(void) const;
199 
204  void SaveEnergySquaredTracking(void) const;
205 
210  void SaveMomentum(void) const;
211 
212  private:
222  cl::Kernel** kernel_world_tracking_;
224 };
225 
231 extern "C" GGEMS_EXPORT GGEMSWorld* create_ggems_world(void);
232 
241 extern "C" GGEMS_EXPORT void set_dimension_ggems_world(GGEMSWorld* world, GGsize const dimension_x, GGsize const dimension_y, GGsize const dimension_z);
242 
252 extern "C" GGEMS_EXPORT void set_size_ggems_world(GGEMSWorld* world, GGfloat const size_x, GGfloat const size_y, GGfloat const size_z, char const* unit);
253 
260 extern "C" GGEMS_EXPORT void photon_tracking_ggems_world(GGEMSWorld* world, bool const is_activated);
261 
268 extern "C" GGEMS_EXPORT void energy_tracking_ggems_world(GGEMSWorld* world, bool const is_activated);
269 
276 extern "C" GGEMS_EXPORT void energy_squared_tracking_ggems_world(GGEMSWorld* world, bool const is_activated);
277 
284 extern "C" GGEMS_EXPORT void set_output_ggems_world(GGEMSWorld* world, char const* world_output_basename);
285 
292 extern "C" GGEMS_EXPORT void momentum_ggems_world(GGEMSWorld* world, bool const is_activated);
293 
294 #endif // End of GUARD_GGEMS_NAVIGATORS_GGEMSWORLD_HH
GGEMSWorld::is_energy_tracking_
bool is_energy_tracking_
Definition: GGEMSWorld.hh:217
energy_squared_tracking_ggems_world
void energy_squared_tracking_ggems_world(GGEMSWorld *world, bool const is_activated)
storing results about energy squared tracking
Definition: GGEMSWorld.cc:622
GGEMSWorldRecording_t::momentum_y_
cl::Buffer ** momentum_y_
Definition: GGEMSWorld.hh:47
GGsize3_t
Structure storing 3 GGsize values.
Definition: GGEMSTypes.hh:267
GGEMSWorldRecording_t
Structure storing data for world data recording.
Definition: GGEMSWorld.hh:42
GGEMSWorldRecording_t::energy_tracking_
cl::Buffer ** energy_tracking_
Definition: GGEMSWorld.hh:43
GGEMSWorldRecording
struct GGEMSWorldRecording_t GGEMSWorldRecording
GGEMSWorld::world_output_basename_
std::string world_output_basename_
Definition: GGEMSWorld.hh:213
photon_tracking_ggems_world
void photon_tracking_ggems_world(GGEMSWorld *world, bool const is_activated)
storing results about photon tracking
Definition: GGEMSWorld.cc:595
set_size_ggems_world
void set_size_ggems_world(GGEMSWorld *world, GGfloat const size_x, GGfloat const size_y, GGfloat const size_z, char const *unit)
set the element sizes of the world
Definition: GGEMSWorld.cc:586
GGEMSWorldRecording_t::photon_tracking_
cl::Buffer ** photon_tracking_
Definition: GGEMSWorld.hh:45
energy_tracking_ggems_world
void energy_tracking_ggems_world(GGEMSWorld *world, bool const is_activated)
storing results about energy tracking
Definition: GGEMSWorld.cc:613
GGEMSWorld::tracking_kernel_option_
std::string tracking_kernel_option_
Definition: GGEMSWorld.hh:220
GGEMSWorld::dimensions_
GGsize3 dimensions_
Definition: GGEMSWorld.hh:214
GGEMSWorld::GGEMSWorld
GGEMSWorld(GGEMSWorld const &world)=delete
Avoid copy by reference.
GGEMSWorld::number_activated_devices_
GGsize number_activated_devices_
Definition: GGEMSWorld.hh:223
GGEMSWorld::is_photon_tracking_
bool is_photon_tracking_
Definition: GGEMSWorld.hh:216
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
set_output_ggems_world
void set_output_ggems_world(GGEMSWorld *world, char const *world_output_basename)
set output basename storing world tracking results
Definition: GGEMSWorld.cc:604
GGEMSWorld::operator=
GGEMSWorld & operator=(GGEMSWorld const &world)=delete
Avoid assignement by reference.
create_ggems_world
GGEMSWorld * create_ggems_world(void)
Get the GGEMSWorld pointer for python user.
Definition: GGEMSWorld.cc:568
GGEMSWorld
GGEMS class handling global world (space between navigators) in GGEMS.
Definition: GGEMSWorld.hh:56
GGEMSWorld::sizes_
GGfloat3 sizes_
Definition: GGEMSWorld.hh:215
GGfloat3
#define GGfloat3
Definition: GGEMSTypes.hh:275
GGEMSTypes.hh
Redefining types for OpenCL device and host.
GGEMSWorld::operator=
GGEMSWorld & operator=(GGEMSWorld const &&world)=delete
Avoid copy by rvalue reference.
momentum_ggems_world
void momentum_ggems_world(GGEMSWorld *world, bool const is_activated)
storing sum of momentum in world
Definition: GGEMSWorld.cc:631
GGEMSWorld::is_momentum_
bool is_momentum_
Definition: GGEMSWorld.hh:219
GGEMSWorld::is_energy_squared_tracking_
bool is_energy_squared_tracking_
Definition: GGEMSWorld.hh:218
GGEMSWorld::GGEMSWorld
GGEMSWorld(GGEMSWorld const &&world)=delete
Avoid copy by rvalue reference.
GGEMSWorld::kernel_world_tracking_
cl::Kernel ** kernel_world_tracking_
Definition: GGEMSWorld.hh:222
set_dimension_ggems_world
void set_dimension_ggems_world(GGEMSWorld *world, GGsize const dimension_x, GGsize const dimension_y, GGsize const dimension_z)
set the dimenstions of the world in X, Y and Z
Definition: GGEMSWorld.cc:577
GGEMSWorld::world_recording_
GGEMSWorldRecording world_recording_
Definition: GGEMSWorld.hh:221
GGEMSWorldRecording_t::momentum_z_
cl::Buffer ** momentum_z_
Definition: GGEMSWorld.hh:48
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273
GGEMSWorldRecording_t::momentum_x_
cl::Buffer ** momentum_x_
Definition: GGEMSWorld.hh:46
GGEMSWorldRecording_t::energy_squared_tracking_
cl::Buffer ** energy_squared_tracking_
Definition: GGEMSWorld.hh:44