From e70a251fdd863e281bbf3ae30319e4ed8ae95a97 Mon Sep 17 00:00:00 2001 From: dmayerich Date: Wed, 11 Sep 2013 22:13:02 -0500 Subject: [PATCH] fixed double precision errors --- fieldslice.cpp | 28 ++++++++++++++++++++++------ scalarslice.cu | 13 +++++++++++++ win32/bimsim.exe | Bin 449536 -> 0 bytes 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/fieldslice.cpp b/fieldslice.cpp index 5df3b55..bf63766 100644 --- a/fieldslice.cpp +++ b/fieldslice.cpp @@ -23,19 +23,27 @@ fieldslice::fieldslice(unsigned int x_size, unsigned int y_size) void fieldslice::toAngularSpectrum() { cufftHandle plan; + cufftResult result; //create a CUFFT plan handle - if(cufftPlan2d(&plan, R[0], R[1], CUFFT_C2C) != CUFFT_SUCCESS) +#ifdef PRECISION_SINGLE + result = cufftPlan2d(&plan, R[0], R[1], CUFFT_C2C); +#elif defined PRECISION_DOUBLE + result = cufftPlan2d(&plan, R[0], R[1], CUFFT_Z2Z); +#endif + + if(result != CUFFT_SUCCESS) { cout<<"Error creating CUFFT plan for computing the angular spectrum."<