@@ -209,9 +209,9 @@ void FFT :: initplanf()
209209
210210 int *embed = NULL ;
211211 int bignpy = this ->nplane * this ->bigny ;
212- this ->planfxfor = fftwf_plan_many_dft ( 1 , &this ->nx , this ->nplane , (fftwf_complex *)auxf2, embed, bignpy, 1 ,
212+ this ->planfxfor1 = fftwf_plan_many_dft ( 1 , &this ->nx , this ->nplane * (liy + 1 ) , (fftwf_complex *)auxf2, embed, bignpy, 1 ,
213213 (fftwf_complex *)auxf2, embed, bignpy, 1 , FFTW_FORWARD, FFTW_MEASURE );
214- this ->planfxbac = fftwf_plan_many_dft ( 1 , &this ->nx , this ->nplane , (fftwf_complex *)auxf2, embed, bignpy, 1 ,
214+ this ->planfxbac1 = fftwf_plan_many_dft ( 1 , &this ->nx , this ->nplane * (liy + 1 ) , (fftwf_complex *)auxf2, embed, bignpy, 1 ,
215215 (fftwf_complex *)auxf2, embed, bignpy, 1 , FFTW_BACKWARD, FFTW_MEASURE );
216216 if (this ->gamma_only )
217217 {
@@ -222,6 +222,10 @@ void FFT :: initplanf()
222222 }
223223 else
224224 {
225+ this ->planfxfor2 = fftwf_plan_many_dft ( 1 , &this ->nx , this ->nplane * (bigny - riy), (fftwf_complex *)auxf2, embed, bignpy, 1 ,
226+ (fftwf_complex *)auxf2, embed, bignpy, 1 , FFTW_FORWARD, FFTW_MEASURE );
227+ this ->planfxbac2 = fftwf_plan_many_dft ( 1 , &this ->nx , this ->nplane * (bigny - riy), (fftwf_complex *)auxf2, embed, bignpy, 1 ,
228+ (fftwf_complex *)auxf2, embed, bignpy, 1 , FFTW_BACKWARD, FFTW_MEASURE );
225229 this ->planfyfor = fftwf_plan_many_dft ( 1 , &this ->bigny , this ->nplane , (fftwf_complex*)auxf2 , embed, this ->nplane , 1 ,
226230 (fftwf_complex*)auxf2, embed, this ->nplane , 1 , FFTW_FORWARD, FFTW_MEASURE );
227231 this ->planfybac = fftwf_plan_many_dft ( 1 , &this ->bigny , this ->nplane , (fftwf_complex*)auxf2 , embed, this ->nplane , 1 ,
@@ -271,15 +275,17 @@ void FFT:: cleanfFFT()
271275 if (destroypf==true ) return ;
272276 fftwf_destroy_plan (planfzfor);
273277 fftwf_destroy_plan (planfzbac);
274- fftwf_destroy_plan (planfxfor );
275- fftwf_destroy_plan (planfxbac );
278+ fftwf_destroy_plan (planfxfor1 );
279+ fftwf_destroy_plan (planfxbac1 );
276280 if (this ->gamma_only )
277281 {
278282 fftwf_destroy_plan (planfyr2c);
279283 fftwf_destroy_plan (planfyc2r);
280284 }
281285 else
282286 {
287+ fftwf_destroy_plan (planfxfor2);
288+ fftwf_destroy_plan (planfxbac2);
283289 fftwf_destroy_plan (planfyfor);
284290 fftwf_destroy_plan (planfybac);
285291 }
@@ -386,29 +392,17 @@ void FFT::fftfxyfor(std::complex<float>* & in, std::complex<float>* & out)
386392 fftwf_execute_dft ( this ->planfyfor , (fftwf_complex *)&in[i*bignpy], (fftwf_complex *)&out[i*bignpy]);
387393 }
388394
389- for (int i=0 ; i<=this ->liy ;++i)
390- {
391- fftwf_execute_dft ( this ->planfxfor , (fftwf_complex *)&in[i*nplane], (fftwf_complex *)&out[i*nplane]);
392- }
393- for (int i=this ->riy ; i<this ->ny ;++i)
394- {
395- fftwf_execute_dft ( this ->planfxfor , (fftwf_complex *)&in[i*nplane], (fftwf_complex *)&out[i*nplane]);
396- }
395+ fftwf_execute_dft ( this ->planfxfor1 , (fftwf_complex *)in, (fftwf_complex *)out);
396+ fftwf_execute_dft ( this ->planfxfor2 , (fftwf_complex *)&in[riy*nplane], (fftwf_complex *)&out[riy*nplane]);
397397 return ;
398398}
399399
400400void FFT::fftfxybac (std::complex <float >* & in, std::complex <float >* & out)
401401{
402402 int bignpy = this ->nplane * this -> bigny;
403403 // x-direction
404- for (int i=0 ; i<=this ->liy ;++i)
405- {
406- fftwf_execute_dft ( this ->planfxbac , (fftwf_complex *)&in[i*nplane], (fftwf_complex *)&out[i*nplane]);
407- }
408- for (int i=this ->riy ; i<this ->ny ;++i)
409- {
410- fftwf_execute_dft ( this ->planfxbac , (fftwf_complex *)&in[i*nplane], (fftwf_complex *)&out[i*nplane]);
411- }
404+ fftwf_execute_dft ( this ->planfxbac1 , (fftwf_complex *)in, (fftwf_complex *)out);
405+ fftwf_execute_dft ( this ->planfxbac2 , (fftwf_complex *)&in[riy*nplane], (fftwf_complex *)&out[riy*nplane]);
412406
413407 // //y-direction
414408 for (int i=0 ; i<this ->nx ;++i)
@@ -427,29 +421,15 @@ void FFT::fftfxyr2c(float* &in, std::complex<float>* & out)
427421 fftwf_execute_dft_r2c ( this ->planfyr2c , &in[i*bignpy*2 ], (fftwf_complex*)&out[i*bignpy] );
428422 }
429423
430- for (int i=0 ; i<=this ->liy ;++i)
431- {
432- fftwf_execute_dft ( this ->planfxfor , (fftwf_complex *)&out[i*nplane], (fftwf_complex *)&out[i*nplane]);
433- }
434- for (int i=this ->riy ; i<this ->ny ;++i)
435- {
436- fftwf_execute_dft ( this ->planfxfor , (fftwf_complex *)&out[i*nplane], (fftwf_complex *)&out[i*nplane]);
437- }
424+ fftwf_execute_dft ( this ->planfxfor1 , (fftwf_complex *)out, (fftwf_complex *)out);
438425 return ;
439426}
440427
441428
442429void FFT::fftfxyc2r (std::complex <float >* & in, float * & out)
443430{
444431 int bignpy = this ->nplane * this -> bigny;
445- for (int i=0 ; i<=this ->liy ;++i)
446- {
447- fftwf_execute_dft ( this ->planfxbac , (fftwf_complex *)&in[i*nplane], (fftwf_complex *)&in[i*nplane]);
448- }
449- for (int i=this ->riy ; i<this ->ny ;++i)
450- {
451- fftwf_execute_dft ( this ->planfxbac , (fftwf_complex *)&in[i*nplane], (fftwf_complex *)&in[i*nplane]);
452- }
432+ fftwf_execute_dft ( this ->planfxbac1 , (fftwf_complex *)in, (fftwf_complex *)in);
453433
454434 for (int i=0 ; i<this ->nx ;++i)
455435 {
0 commit comments