46 #ifndef __ophLightField_GPU_h 47 #define __ophLightField_GPU_h 50 #include <cuda_runtime_api.h> 52 #include <math_constants.h> 55 static void HandleError(cudaError_t err,
58 if (err != cudaSuccess) {
59 printf(
"%s in %s at line %d\n", cudaGetErrorString(err),
64 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 67 #define HANDLE_NULL( a ) {if (a == NULL) { \ 68 printf( "Host memory failed in %s at line %d\n", \ 69 __FILE__, __LINE__ ); \ 70 exit( EXIT_FAILURE );}} 103 const bool &random_phase
117 this->pi2 =
M_PI * 2;
120 this->randomPhase = random_phase;
127 void cudaFFT_LF(cufftHandle *plan, CUstream_st* stream,
const int &nBlocks,
const int &nThreads,
const int &nx,
const int &ny, cufftDoubleComplex* in_field, cufftDoubleComplex* output_field,
const int &direction);
129 void procMultiplyPhase(CUstream_st* stream,
const int &nBlocks,
const int &nThreads,
const LFGpuConst *config, cufftDoubleComplex* in, cufftDoubleComplex* output);
132 const int &nBlocks,
const int &nBlocks2,
const int &nThreads,
const int &nx,
const int &ny,
133 cufftDoubleComplex *src, cufftDoubleComplex *tmp, cufftDoubleComplex *tmp2, cufftDoubleComplex *dst,
int pnY
Number of pixel of SLM in x direction.
Real lambda
Wave Number = (2 * PI) / lambda;.
void cudaConvertLF2ComplexField_Kernel(CUstream_st *stream, const int &nBlocks, const int &nThreads, const LFGpuConst *config, uchar1 **LF, cufftDoubleComplex *output)
struct KernelConst LFGpuConst
Real distance
number of streams
Real ppY
Pixel pitch of SLM in x direction.
Real ppX
Number of pixel of SLM in y direction.
KernelConst(const int &channel, const int &iAmp, const int &pnX, const int &pnY, const Real &ppX, const Real &ppY, const int &nX, const int &nY, const int &rX, const int &rY, const Real &distance, const Real &k, const Real &lambda, const bool &random_phase)
void cudaFresnelPropagationLF(const int &nBlocks, const int &nBlocks2, const int &nThreads, const int &nx, const int &ny, cufftDoubleComplex *src, cufftDoubleComplex *tmp, cufftDoubleComplex *tmp2, cufftDoubleComplex *dst, const LFGpuConst *cuda_config)
void cudaFFT_LF(cufftHandle *plan, CUstream_st *stream, const int &nBlocks, const int &nThreads, const int &nx, const int &ny, cufftDoubleComplex *in_field, cufftDoubleComplex *output_field, const int &direction)
Real k
Pixel pitch of SLM in y direction.
void procMultiplyPhase(CUstream_st *stream, const int &nBlocks, const int &nThreads, const LFGpuConst *config, cufftDoubleComplex *in, cufftDoubleComplex *output)