Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit a476152e authored by David Rohr's avatar David Rohr

remove unnecessary copies

parent 07546137
......@@ -505,13 +505,10 @@ int bioem::createConvolutedProjectionMap(int iMap, int iConv, mycomplex_t* lproj
// *************** and Backtransforming it to real Space ********************************
// **************************************************************************************
myfloat_t* localconvFFT;
localconvFFT = (myfloat_t *) myfftw_malloc(sizeof(myfloat_t) * param.param_device.NumberPixels * param.param_device.NumberPixels);
mycomplex_t* tmp;
tmp = (mycomplex_t*) myfftw_malloc(sizeof(mycomplex_t) * param.param_device.NumberPixels * param.param_device.NumberFFTPixels1D);
// **** Multiplying FFTmap with corresponding kernel ****
const mycomplex_t* refCTF = &param.refCTF[iConv * param.FFTMapSize];
for(int i = 0; i < param.param_device.NumberPixels * param.param_device.NumberFFTPixels1D; i++)
{
......@@ -524,24 +521,15 @@ int bioem::createConvolutedProjectionMap(int iMap, int iConv, mycomplex_t* lproj
memcpy(tmp, localmultFFT, sizeof(mycomplex_t) * param.param_device.NumberPixels * param.param_device.NumberFFTPixels1D);
// **** Bringing convoluted Map to real Space ****
myfftw_execute_dft_c2r(param.fft_plan_c2r_backward, tmp, localconvFFT);
// ****Asigning convolution fftw_complex to bioem_map ****
for(int i = 0; i < param.param_device.NumberPixels ; i++ )
{
for(int j = 0; j < param.param_device.NumberPixels ; j++ )
{
Mapconv[i * param.param_device.NumberPixels + j] = localconvFFT[i * param.param_device.NumberPixels + j];
}
}
myfftw_execute_dft_c2r(param.fft_plan_c2r_backward, tmp, Mapconv);
// *** Calculating Cross-correlations of cal-convoluted map with its self *****
sumC = 0;
sumsquareC = 0;
for(int i = 0; i < param.param_device.NumberPixels * param.param_device.NumberPixels; i++)
{
sumC += localconvFFT[i];
sumsquareC += localconvFFT[i] * localconvFFT[i];
sumC += Mapconv[i];
sumsquareC += Mapconv[i] * Mapconv[i];
}
// *** The DTF gives an unnormalized value so have to divded by the total number of pixels in Fourier ***
// Normalizing
......@@ -551,7 +539,6 @@ int bioem::createConvolutedProjectionMap(int iMap, int iConv, mycomplex_t* lproj
sumsquareC = sumsquareC / norm4;
// **** Freeing fftw_complex created (dont know if omp critical is necessary) ****
myfftw_free(localconvFFT);
myfftw_free(tmp);
return(0);
......
......@@ -275,10 +275,12 @@ int bioem_param::CalculateRefCTF()
myfloat_t amp, env, phase, ctf, radsq;
myfloat_t* localCTF;
mycomplex_t* localout;
int nctfmax = param_device.NumberPixels / 2;
int n = 0;
localCTF = (myfloat_t *) myfftw_malloc(sizeof(myfloat_t) * param_device.NumberPixels * param_device.NumberPixels);
localout = (mycomplex_t *) myfftw_malloc(sizeof(mycomplex_t) * param_device.NumberPixels * param_device.NumberFFTPixels1D);
nTotCTFs = numberGridPointsCTF_amp * numberGridPointsCTF_phase * numberGridPointsEnvelop;
delete[] refCTF;
......@@ -314,9 +316,6 @@ int bioem_param::CalculateRefCTF()
localCTF[(param_device.NumberPixels - i - 1)*param_device.NumberPixels + param_device.NumberPixels - j - 1] = (myfloat_t) ctf;
}
}
//Creatting FFT_Forward of Kernel to store
mycomplex_t* localout;
localout = (mycomplex_t *) myfftw_malloc(sizeof(mycomplex_t) * param_device.NumberPixels * param_device.NumberFFTPixels1D);
//Calling FFT_Forward
myfftw_execute_dft_r2c(fft_plan_r2c_forward, localCTF, localout);
......@@ -331,12 +330,12 @@ int bioem_param::CalculateRefCTF()
CtfParam[n].pos[1] = phase;
CtfParam[n].pos[2] = env;
n++;
myfftw_free(localout);
}
}
}
myfftw_free(localCTF);
myfftw_free(localout);
if (nTotCTFs != n)
{
cout << "Internal error during CTF preparation\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment