#ifndef _GPUMAGNETICFIELD_H_ #define _GPUMAGNETICFIELD_H_ #include using std::string; #include #include // The following defines a C structure that is used to hold parameters // that define the B-field map. A global variable is declared in device // constant memory called BFIELD_PARMS to hold this info so that it can // be accessed quickly and without having to pass a reference to the // structure with every call. //................ // Bfield_parms_t //................ typedef struct{ int Nzbins; int Nrbins; float zmin; float zmax; float rmin; float rmax; float z_scale; float r_scale; }Bfield_parms_t; // Host routines void InitCUDA(bool quiet=false); void CopyBfieldMapToGPU(string fname="solenoid_1350_poisson_20130925"); // Host callable device routines __global__ void GPU_GetBfieldPoints(int N, float3 *d_coordinates, float3 *d_B); // Device only routines static __device__ void GPU_GetBfield(float3 pos, float3 *B); static __device__ void GPU_GetBfieldXYZ(float x, float y, float z, float *Bx, float *By, float *Bz); static __device__ void GPU_GetBfieldRZ(float r, float z, float *Br, float *Bz); static __device__ void GPU_GetBfield(float3 pos, float4 *B); static __device__ void GPU_GetBfieldXYZ(float x, float y, float z, float *B, float *bx, float *by, float *bz); static __device__ void GPU_GetBfieldRZ(float r, float z, float *B, float *br, float *bz); #endif // _GPUMAGNETICFIELD_H_