GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSVolume.cc
Go to the documentation of this file.
1 // ************************************************************************
2 // * This file is part of GGEMS. *
3 // * *
4 // * GGEMS is free software: you can redistribute it and/or modify *
5 // * it under the terms of the GNU General Public License as published by *
6 // * the Free Software Foundation, either version 3 of the License, or *
7 // * (at your option) any later version. *
8 // * *
9 // * GGEMS is distributed in the hope that it will be useful, *
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 // * GNU General Public License for more details. *
13 // * *
14 // * You should have received a copy of the GNU General Public License *
15 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
16 // * *
17 // ************************************************************************
18 
33 
37 
39 : label_value_(1.0f),
40  positions_(GGfloat3{{0.0f, 0.0f, 0.0f}})
41 {
42  GGcout("GGEMSVolume", "GGEMSVolume", 3) << "GGEMSVolume creating..." << GGendl;
43 
44  // Getting number of activated device. But only 1 device is used to create volume
46  GGsize number_activated_devices = opencl_manager.GetNumberOfActivatedDevice();
47 
48  // Storing a kernel for 1 device
49  kernel_draw_volume_ = new cl::Kernel*[number_activated_devices];
50 
51  GGcout("GGEMSVolume", "GGEMSVolume", 3) << "GGEMSVolume created!!!" << GGendl;
52 }
53 
57 
59 {
60  GGcout("GGEMSVolume", "~GGEMSVolume", 3) << "GGEMSVolume erasing..." << GGendl;
61 
62  if (kernel_draw_volume_) {
63  delete[] kernel_draw_volume_;
64  kernel_draw_volume_ = nullptr;
65  }
66 
67  GGcout("GGEMSVolume", "~GGEMSVolume", 3) << "GGEMSVolume erased!!!" << GGendl;
68 }
69 
73 
74 void GGEMSVolume::SetLabelValue(GGfloat const& label_value)
75 {
76  label_value_ = label_value;
77 }
78 
79 void GGEMSVolume::SetMaterial(std::string const& material)
80 {
81  // Get the volume creator manager
83 
84  // Adding the material to phantom creator manager
85  volume_creator_manager.AddLabelAndMaterial(label_value_, material);
86 }
87 
91 
92 void GGEMSVolume::SetPosition(GGfloat const& pos_x, GGfloat const& pos_y, GGfloat const& pos_z, std::string const& unit)
93 {
94  positions_.s[0] = DistanceUnit(pos_x, unit);
95  positions_.s[1] = DistanceUnit(pos_y, unit);
96  positions_.s[2] = DistanceUnit(pos_z, unit);
97 }
GGEMSVolumeCreatorManager::AddLabelAndMaterial
void AddLabelAndMaterial(GGfloat const &label, std::string const &material)
add the label and the material
Definition: GGEMSVolumeCreatorManager.cc:148
GGEMSVolume::kernel_draw_volume_
cl::Kernel ** kernel_draw_volume_
Definition: GGEMSVolume.hh:120
GGEMSOpenCLManager::GetNumberOfActivatedDevice
GGsize GetNumberOfActivatedDevice(void) const
get the number of activated devices
Definition: GGEMSOpenCLManager.hh:167
GGEMSVolumeCreatorManager::GetInstance
static GGEMSVolumeCreatorManager & GetInstance(void)
Create at first time the Singleton.
Definition: GGEMSVolumeCreatorManager.hh:67
GGEMSVolume.hh
Mother class handle solid volume.
GGEMSVolume::label_value_
GGfloat label_value_
Definition: GGEMSVolume.hh:118
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSVolumeCreatorManager
Singleton class handling convertion from analytical volume to voxelized volume.
Definition: GGEMSVolumeCreatorManager.hh:49
GGEMSVolume::GGEMSVolume
GGEMSVolume(void)
GGEMSVolume constructor.
Definition: GGEMSVolume.cc:38
GGEMSVolume::~GGEMSVolume
virtual ~GGEMSVolume(void)
GGEMSVolume destructor.
Definition: GGEMSVolume.cc:58
GGfloat3
#define GGfloat3
Definition: GGEMSTypes.hh:275
GGEMSVolume::SetLabelValue
void SetLabelValue(GGfloat const &label_value)
Set the label value.
Definition: GGEMSVolume.cc:74
GGEMSVolume::positions_
GGfloat3 positions_
Definition: GGEMSVolume.hh:119
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGEMSSystemOfUnits.hh
Namespace storing all the usefull physical units.
GGendl
#define GGendl
overload C++ std::endl
Definition: GGEMSPrint.hh:60
GGEMSOpenCLManager
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
Definition: GGEMSOpenCLManager.hh:54
GGEMSVolume::SetPosition
void SetPosition(GGfloat const &pos_x, GGfloat const &pos_y, GGfloat const &pos_z, std::string const &unit="mm")
Set the solid phantom position.
Definition: GGEMSVolume.cc:92
DistanceUnit
T DistanceUnit(T const &value, std::string const &unit)
Choose best distance unit.
Definition: GGEMSSystemOfUnits.hh:243
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273
GGEMSOpenCLManager::GetInstance
static GGEMSOpenCLManager & GetInstance(void)
Create at first time the Singleton.
Definition: GGEMSOpenCLManager.hh:72
GGEMSVolume::SetMaterial
void SetMaterial(std::string const &material)
set the material, Air by default
Definition: GGEMSVolume.cc:79