52 #define __DEBUG_LOG_GPU_SPEC_ 54 #include <cuda_runtime_api.h> 57 #define __CUDA_INTERNAL_COMPILATION__ //for CUDA Math Module 58 #include <math_constants.h> 60 #include <vector_functions.h> 61 #undef __CUDA_INTERNAL_COMPILATION__ 63 static void HandleError(cudaError_t err,
66 if (err != cudaSuccess) {
67 printf(
"%s in %s at line %d\n", cudaGetErrorString(err),
72 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 75 #define HANDLE_NULL( a ) {if (a == NULL) { \ 76 printf( "Host memory failed in %s at line %d\n", \ 77 __FILE__, __LINE__ ); \ 78 exit( EXIT_FAILURE );}} 112 const ivec2 &pixel_number,
113 const vec2 &pixel_pitch,
115 const Real propagation_distance,
116 const Real depth_max,
119 const bool &random_phase,
120 const int &index_amplitude
130 this->pn_X = pixel_number[
_X];
131 this->pn_Y = pixel_number[
_Y];
134 this->pp_X = pixel_pitch[
_X];
135 this->pp_Y = pixel_pitch[
_Y];
138 this->wrp_d = wrp_dis;
139 this->propa_d = propagation_distance;
140 this->zmax = depth_max;
148 this->bRandomPhase = random_phase;
151 this->iAmplitude = index_amplitude;
153 this->pi2 =
M_PI * 2;
157 this->det_tx =
tx / sqrt(1 -
tx *
tx);
158 this->det_ty =
ty / sqrt(1 -
ty *
ty);
169 const int &nBlocks,
const int &nBlocks2,
const int &nThreads,
const int &nx,
const int &ny,
170 cuDoubleComplex *src, cuDoubleComplex *dst, cufftDoubleComplex *fftsrc, cufftDoubleComplex *fftdst,
174 const int &nBlocks,
const int &nThreads,
const int &n_pts_per_stream,
177 cuDoubleComplex* cuda_dst,
const WRPGpuConst* cuda_config);
void cudaGenWRP(const int &nBlocks, const int &nThreads, const int &n_pts_per_stream, Vertex *cuda_pc_data, cuDoubleComplex *cuda_dst, const WRPGpuConst *cuda_config)
bool bRandomPhase
wave length = lambda;
Real lambda
Wave Number = (2 * PI) / lambda;.
void cudaFresnelPropagationWRP(const int &nBlocks, const int &nBlocks2, const int &nThreads, const int &nx, const int &ny, cuDoubleComplex *src, cuDoubleComplex *dst, cufftDoubleComplex *fftsrc, cufftDoubleComplex *fftdst, const WRPGpuConst *cuda_config)
struct KernelConst WRPGpuConst
double pp_Y
Pixel pitch of SLM in x direction.
Real wrp_d
number of streams
structure for 2-dimensional integer vector and its arithmetic.
double pp_X
Number of pixel of SLM in y direction.
Real zmax
wave length = lambda;
structure for 2-dimensional Real type vector and its arithmetic.
int n_streams
number of colors per point cloud
int pn_X
propagation distance
KernelConst(const int &n_points, const int &n_colors, const int &n_streams, const ivec2 &pixel_number, const vec2 &pixel_pitch, const Real wrp_dis, const Real propagation_distance, const Real depth_max, const Real &k, const Real &lambda, const bool &random_phase, const int &index_amplitude)
int n_colors
number of point cloud
int pn_Y
Number of pixel of SLM in x direction.
Real k
Pixel pitch of SLM in y direction.