|
GGEMS
1.1
GPU GEant4-based Monte Carlo Simulations
|
Go to the documentation of this file.
42 GGcout(
"GGEMSSphere",
"GGEMSSphere", 3) <<
"GGEMSSphere creating..." <<
GGendl;
46 GGcout(
"GGEMSSphere",
"GGEMSSphere", 3) <<
"GGEMSSphere created!!!" <<
GGendl;
55 GGcout(
"GGEMSSphere",
"~GGEMSSphere", 3) <<
"GGEMSSphere erasing..." <<
GGendl;
57 GGcout(
"GGEMSSphere",
"~GGEMSSphere", 3) <<
"GGEMSSphere erased!!!" <<
GGendl;
66 GGcout(
"GGEMSSphere",
"Initialize", 3) <<
"Initializing GGEMSSphere solid volume..." <<
GGendl;
69 std::string
const kOpenCLKernelPath = OPENCL_KERNEL_PATH;
70 std::string
const kFilename = kOpenCLKernelPath +
"/DrawGGEMSSphere.cl";
79 std::string
const kDataType =
"-D" + volume_creator_manager.
GetDataType();
89 GGcout(
"GGEMSSphere",
"Draw", 3) <<
"Drawing Sphere..." <<
GGendl;
99 cl::Event*
event = opencl_manager.
GetEvent(0);
103 std::string device_name = opencl_manager.
GetDeviceName(device_index);
104 std::ostringstream oss(std::ostringstream::out);
105 oss <<
"GGEMSSphere::Draw on " << device_name <<
", index " << device_index;
110 GGint3 phantom_dimensions;
123 cl::NDRange global_wi(number_of_work_items);
124 cl::NDRange local_wi(work_group_size);
136 cl_int kernel_status = queue->enqueueNDRangeKernel(*
kernel_draw_volume_[0], 0, global_wi, local_wi,
nullptr, event);
152 return new(std::nothrow)
GGEMSSphere(radius, unit);
~GGEMSSphere(void)
GGEMSSphere destructor.
GGfloat3 GetElementsSizes() const
size of voxels in the voxelized volume
cl::Kernel ** kernel_draw_volume_
GGsize GetNumberElements(void) const
Return the total number of voxels.
Mother class handle volume.
void set_position_sphere(GGEMSSphere *sphere, GGfloat const pos_x, GGfloat const pos_y, GGfloat const pos_z, char const *unit)
Set the position of the sphere.
void draw_sphere(GGEMSSphere *sphere)
Draw analytical volume in voxelized phantom.
void set_label_value_sphere(GGEMSSphere *sphere, GGfloat const label_value)
Set the label value in sphere.
std::string GetDataType(void) const
get the type of data
static GGEMSVolumeCreatorManager & GetInstance(void)
Create at first time the Singleton.
void initialize_sphere(GGEMSSphere *sphere)
Initialize the solid and store it in Phantom creator manager.
Class GGEMSSphere inheriting from GGEMSVolume handling Sphere solid.
void delete_sphere(GGEMSSphere *sphere)
Delete instance of GGEMSSphere.
static GGEMSProfilerManager & GetInstance(void)
Create at first time the Singleton.
void Draw(void) override
Draw analytical volume in voxelized phantom.
void CheckOpenCLError(GGint const &error, std::string const &class_name, std::string const &method_name) const
check the OpenCL error
cl::Buffer * GetVoxelizedVolume(void) const
Return the voxelized volume on OpenCL device.
GGEMSSphere * create_sphere(GGfloat const radius, char const *unit)
Create instance of GGEMSSphere.
GGsize GetBestWorkItem(GGsize const &number_of_elements) const
get the best number of work item
cl::Event * GetEvent(GGsize const &thread_index) const
return an event to activated context
GGEMS class managing profiler data.
GGsize GetWorkGroupSize(void) const
Get the work group size defined in GGEMS on activated OpenCL context.
void Initialize(void) override
Initialize the solid and store it in Phantom creator manager.
Singleton class handling convertion from analytical volume to voxelized volume.
void SetLabelValue(GGfloat const &label_value)
Set the label value.
void CompileKernel(std::string const &kernel_filename, std::string const &kernel_name, cl::Kernel **kernel_list, char *const custom_options=nullptr, char *const additional_options=nullptr)
Compile the OpenCL kernel on the activated device.
GGsize3 GetVolumeDimensions() const
dimensions of volume
Namespace storing all the usefull physical units.
#define GGendl
overload C++ std::endl
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
GGEMSSphere(GGfloat const &radius, std::string const &unit="mm")
GGEMSSphere constructor.
std::string GetDeviceName(GGsize const &device_index) const
Get the name of the activated device.
GGEMS class managing profiler data.
void SetPosition(GGfloat const &pos_x, GGfloat const &pos_y, GGfloat const &pos_z, std::string const &unit="mm")
Set the solid phantom position.
void HandleEvent(cl::Event event, std::string const &profile_name)
handle an OpenCL event in profile_name type
GGsize GetIndexOfActivatedDevice(GGsize const &thread_index) const
get the index of activated device
Class GGEMSSphere inheriting from GGEMSVolume handling Sphere solid.
void set_material_sphere(GGEMSSphere *sphere, char const *material)
Set the material of the sphere.
cl::CommandQueue * GetCommandQueue(GGsize const &thread_index) const
Return the command queue to activated context.
T DistanceUnit(T const &value, std::string const &unit)
Choose best distance unit.
static GGEMSOpenCLManager & GetInstance(void)
Create at first time the Singleton.
void SetMaterial(std::string const &material)
set the material, Air by default