#include #include #include #include #include #include #include #include #include using namespace std; #include "GPUMagneticFieldStepper.cu" //---------------- // TestGPUBfieldMap //---------------- void TestGPUBfieldMap(void) { cout << endl; cout << "Testing B-field map reads via GPU texture memory ..." < points; for(int i=0; i<10; i++){ float x = 80.0*(float)random()/(float)RAND_MAX; float y = 80.0*(float)random()/(float)RAND_MAX; float z = -100.0 + 700.0*(float)random()/(float)RAND_MAX; float3 tmp = {x,y,z}; points.push_back(tmp); } cout << " " << points.size() << " points generated for testing" <>>(points.size(), d_coordinates, d_B); // Copy memory back to host float3 *h_B = (float3*)malloc(Nbytes); cudaMemcpy(h_B, d_B, Nbytes, cudaMemcpyDeviceToHost); // Print results to screen cout << " Results:" << endl; cout << " ---------------" << endl; cout<steps; for(int i=0; i<10; i++, step++){ if(i>=traj->Nsteps)break; float3 &pos = step->pos; float3 &mom = step->mom; float epsilon = 1.0E-3; // this corresponds roughly to 1% resolution of a 12GeV particle float p = 1.0/(fabs(step->q_over_p)+epsilon); // epsilon handles case when q_over_p is zero mom.x *= p; mom.y *= p; mom.z *= p; cout << "(x,y,z)=("<