#include "nearfield.h" #include #include "rts/cuda/error.h" #include "rts/cuda/timer.h" __global__ void gpuScalarUsp(bsComplex* Ufx, bsComplex* Ufy, bsComplex* Ufz, bsComplex* Ux, bsComplex* Uy, bsComplex* Uz, bsPoint* ps, ptype* as, int ns, bsRect ABCD, int uR, int vR) { //get the current coordinate in the plane slice int iu = blockIdx.x * blockDim.x + threadIdx.x; int iv = blockIdx.y * blockDim.y + threadIdx.y; //make sure that the thread indices are in-bounds if(iu >= uR || iv >= vR) return; //compute the index (easier access to the scalar field array) int i = iv*uR + iu; //compute the parameters for u and v ptype u = (ptype)iu / uR; ptype v = (ptype)iv / vR; //get the rtsPoint in world space and then the r vector bsPoint p = ABCD(u, v); bsVector r; ptype d; //if we are inside of a sphere, return for(int is=0; is>>(Uf.x_hat, Uf.y_hat, Uf.z_hat, U.x_hat, U.y_hat, U.z_hat, gpu_p, gpu_a, nSpheres, pos, U.R[0], U.R[1]); //free sphere lists HANDLE_ERROR(cudaFree(gpu_p)); HANDLE_ERROR(cudaFree(gpu_a)); //float t = gpuStopTimer(); //std::cout<<"Add Us Time: "<