|
GGEMS
1.1
GPU GEant4-based Monte Carlo Simulations
|
Go to the documentation of this file.
42 : source_name_(source_name),
43 number_of_particles_(0),
44 number_of_particles_by_device_(nullptr),
45 number_of_particles_in_batch_(nullptr),
46 number_of_batchs_(nullptr),
48 tracking_kernel_option_(
"")
50 GGcout(
"GGEMSSource",
"GGEMSSource", 3) <<
"GGEMSSource creating..." <<
GGendl;
65 GGcout(
"GGEMSSource",
"GGEMSSource", 3) <<
"GGEMSSource created!!!" <<
GGendl;
74 GGcout(
"GGEMSSource",
"~GGEMSSource", 3) <<
"GGEMSSource erasing..." <<
GGendl;
105 GGcout(
"GGEMSSource",
"~GGEMSSource", 3) <<
"GGEMSSource erased!!!" <<
GGendl;
145 if (particle_type ==
"gamma") {
148 else if (particle_type ==
"e-") {
151 else if (particle_type ==
"e+") {
179 GGcout(
"GGEMSSource",
"CheckParameters", 3) <<
"Checking the mandatory parameters..." <<
GGendl;
183 std::ostringstream oss(std::ostringstream::out);
184 oss <<
"You have to set a particle type for the source:" << std::endl;
185 oss <<
" - Photon" << std::endl;
186 oss <<
" - Electron" << std::endl;
187 oss <<
" - Positron" << std::endl;
193 std::ostringstream oss(std::ostringstream::out);
194 oss <<
"You have to set a name for the source!!!";
200 std::ostringstream oss(std::ostringstream::out);
201 oss <<
"You have to set a number of particles > 0!!!";
207 if (kPosition.s[0] == std::numeric_limits<float>::min() || kPosition.s[1] == std::numeric_limits<float>::min() || kPosition.s[2] == std::numeric_limits<float>::min()) {
208 std::ostringstream oss(std::ostringstream::out);
209 oss <<
"You have to set a position for the source!!!";
215 if (kRotation.s[0] == std::numeric_limits<float>::min() || kRotation.s[1] == std::numeric_limits<float>::min() || kRotation.s[2] == std::numeric_limits<float>::min()) {
216 std::ostringstream oss(std::ostringstream::out);
217 oss <<
"You have to set a rotation for the source!!!";
228 GGcout(
"GGEMSSource",
"OrganizeParticlesInBatch", 3) <<
"Organizing the number of particles in batch..." <<
GGendl;
246 GGsize tmp_number_of_particles = 0;
289 GGcout(
"GGEMSSource",
"Initialize", 3) <<
"Initializing the a GGEMS source..." <<
GGendl;
300 GGcout(
"GGEMSSource",
"Initialize", 0) <<
"Particles arranged in batch OK" <<
GGendl;
GGfloat GetDeviceBalancing(GGsize const &thread_index) const
return the device load for a device
static GGEMSSourceManager & GetInstance(void)
Create at first time the Singleton.
Different namespaces storing constants useful for GGEMS.
This class handles everything about geometry transformation.
GGsize * number_of_batchs_
void SetSourceParticleType(std::string const &particle_type)
Set the type of the particle: electron, positron or photon.
void Store(GGEMSSource *source)
storing the source pointer to source manager
GGfloat3 GetRotation(void) const
Return the current rotation.
GGsize GetNumberOfActivatedDevice(void) const
get the number of activated devices
GGsize number_activated_devices_
void OrganizeParticlesInBatch(void)
Organize the particles in batch.
std::string tracking_kernel_option_
T AngleUnit(T const &value, std::string const &unit)
Choose best angle unit.
void EnableTracking(void)
Enabling tracking infos during simulation.
void SetTranslation(GGfloat const &tx, GGfloat const &ty, GGfloat const &tz)
Set the translation in X, Y and Z.
void SetPosition(GGfloat const &pos_x, GGfloat const &pos_y, GGfloat const &pos_z, std::string const &unit="mm")
Set the position of the source in the global coordinates.
cl::Kernel ** kernel_get_primaries_
virtual ~GGEMSSource(void)
GGEMSSource destructor.
void SetNumberOfParticles(GGsize const &number_of_particles)
Set the number of particles to simulate during the simulation.
void SetRotation(GGfloat const &rx, GGfloat const &ry, GGfloat const &rz)
Set the Rotation in X, Y and Z around global axis.
Structure storing the primary particle buffers for both OpenCL and GGEMS.
Structure storing the random buffers for both OpenCL and GGEMS.
void SetRotation(GGfloat const &rx, GGfloat const &ry, GGfloat const &rz, std::string const &unit="deg")
Set the rotation of the source around global axis.
__constant GGchar POSITRON
virtual void CheckParameters(void) const
Check mandatory parameters for a source.
GGEMS class handling the source(s)
GGfloat3 GetPosition(void) const
Return the current position.
#define GGendl
overload C++ std::endl
GGsize ** number_of_particles_in_batch_
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
GGEMSGeometryTransformation * geometry_transformation_
GGsize * number_of_particles_by_device_
GGEMSSource(std::string const &source_name)
GGEMSSource constructor.
virtual void Initialize(bool const &is_tracking=false)
Initialize a GGEMS source.
GGsize GetNumberDeviceLoads(void) const
return the size of device load vector
Class managing the geometry transformation.
GGsize number_of_particles_
void ThrowException(std::string const &class_name, std::string const &method_name, std::string const &message)
Throw a C++ exception.
T DistanceUnit(T const &value, std::string const &unit)
Choose best distance unit.
static GGEMSOpenCLManager & GetInstance(void)
Create at first time the Singleton.
__constant GGchar ELECTRON