@@ -118,29 +118,33 @@ void FFT :: initplan()
118118 this ->plan1bac = fftw_plan_many_dft ( 1 , &this ->nz , this ->ns ,
119119 (fftw_complex*) c_gspace, &this ->nz , 1 , this ->nz ,
120120 (fftw_complex*) c_gspace2, &this ->nz , 1 , this ->nz , FFTW_BACKWARD, FFTW_MEASURE);
121-
122121
123122 // ---------------------------------------------------------
124123 // 2 D
125124 // ---------------------------------------------------------
126125
127126 int nrank[2 ] = {this ->nx ,this ->bigny };
128127 int *embed = NULL ;
129- this ->plan2for = fftw_plan_many_dft ( 2 , nrank, this ->nplane ,
130- (fftw_complex*) c_rspace, embed, this ->nplane , 1 ,
131- (fftw_complex*) c_rspace2, embed, this ->nplane , 1 , FFTW_FORWARD, FFTW_MEASURE);
128+ if (this ->gamma_only )
129+ {
130+ this ->plan2r2c = fftw_plan_many_dft_r2c ( 2 , nrank, this ->nplane ,
131+ r_rspace, embed, this ->nplane , 1 ,
132+ (fftw_complex*) c_rspace, embed, this ->nplane , 1 , FFTW_MEASURE);
132133
133- this ->plan2bac = fftw_plan_many_dft ( 2 , nrank, this ->nplane ,
134- (fftw_complex*) c_rspace, embed, this ->nplane , 1 ,
135- (fftw_complex*) c_rspace2, embed, this ->nplane , 1 , FFTW_BACKWARD, FFTW_MEASURE);
136-
137- this ->plan2r2c = fftw_plan_many_dft_r2c ( 2 , nrank, this ->nplane ,
138- r_rspace, embed, this ->nplane , 1 ,
139- (fftw_complex*) c_rspace, embed, this ->nplane , 1 , FFTW_MEASURE);
140-
141- this ->plan2c2r = fftw_plan_many_dft_c2r ( 2 , nrank, this ->nplane ,
142- (fftw_complex*) c_rspace, embed, this ->nplane , 1 ,
143- r_rspace, embed, this ->nplane , 1 , FFTW_MEASURE);
134+ this ->plan2c2r = fftw_plan_many_dft_c2r ( 2 , nrank, this ->nplane ,
135+ (fftw_complex*) c_rspace, embed, this ->nplane , 1 ,
136+ r_rspace, embed, this ->nplane , 1 , FFTW_MEASURE);
137+ }
138+ else
139+ {
140+ this ->plan2for = fftw_plan_many_dft ( 2 , nrank, this ->nplane ,
141+ (fftw_complex*) c_rspace, embed, this ->nplane , 1 ,
142+ (fftw_complex*) c_rspace2, embed, this ->nplane , 1 , FFTW_FORWARD, FFTW_MEASURE);
143+
144+ this ->plan2bac = fftw_plan_many_dft ( 2 , nrank, this ->nplane ,
145+ (fftw_complex*) c_rspace, embed, this ->nplane , 1 ,
146+ (fftw_complex*) c_rspace2, embed, this ->nplane , 1 , FFTW_BACKWARD, FFTW_MEASURE);
147+ }
144148 destroyp = false ;
145149}
146150
@@ -169,21 +173,27 @@ void FFT :: initplanf()
169173 // ---------------------------------------------------------
170174
171175 int nrank[2 ] = {this ->nx ,this ->bigny };
172- this ->planf2for = fftwf_plan_many_dft ( 2 , nrank, this ->nplane ,
173- (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 ,
174- (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 , FFTW_FORWARD, FFTW_MEASURE);
175-
176- this ->planf2bac = fftwf_plan_many_dft ( 2 , nrank, this ->nplane ,
177- (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 ,
178- (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 , FFTW_BACKWARD, FFTW_MEASURE);
179176
180- this ->planf2r2c = fftwf_plan_many_dft_r2c ( 2 , nrank, this ->nplane ,
181- r_rspace, nrank, this ->nplane , 1 ,
182- (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 , FFTW_MEASURE);
183-
184- this ->planf2c2r = fftwf_plan_many_dft_c2r ( 2 , nrank, this ->nplane ,
185- (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 ,
186- r_rspace, nrank, this ->nplane , 1 , FFTW_MEASURE);
177+ if (this ->gamma_only )
178+ {
179+ this ->planf2r2c = fftwf_plan_many_dft_r2c ( 2 , nrank, this ->nplane ,
180+ r_rspace, nrank, this ->nplane , 1 ,
181+ (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 , FFTW_MEASURE);
182+
183+ this ->planf2c2r = fftwf_plan_many_dft_c2r ( 2 , nrank, this ->nplane ,
184+ (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 ,
185+ r_rspace, nrank, this ->nplane , 1 , FFTW_MEASURE);
186+ }
187+ else
188+ {
189+ this ->planf2for = fftwf_plan_many_dft ( 2 , nrank, this ->nplane ,
190+ (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 ,
191+ (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 , FFTW_FORWARD, FFTW_MEASURE);
192+
193+ this ->planf2bac = fftwf_plan_many_dft ( 2 , nrank, this ->nplane ,
194+ (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 ,
195+ (fftwf_complex*)c_rspace, nrank, this ->nplane , 1 , FFTW_BACKWARD, FFTW_MEASURE);
196+ }
187197 destroypf = false ;
188198}
189199#endif
@@ -205,21 +215,33 @@ void FFT:: cleanFFT()
205215 if (destroyp==true ) return ;
206216 fftw_destroy_plan (plan1for);
207217 fftw_destroy_plan (plan1bac);
208- fftw_destroy_plan (plan2for);
209- fftw_destroy_plan (plan2bac);
210- fftw_destroy_plan (plan2r2c);
211- fftw_destroy_plan (plan2c2r);
212- destroyp == true ;
218+ if (this ->gamma_only )
219+ {
220+ fftw_destroy_plan (plan2r2c);
221+ fftw_destroy_plan (plan2c2r);
222+ }
223+ else
224+ {
225+ fftw_destroy_plan (plan2for);
226+ fftw_destroy_plan (plan2bac);
227+ }
228+ destroyp = true ;
213229
214230#ifdef __MIX_PRECISION
215231 if (destroypf==true ) return ;
216232 fftw_destroy_plan (planf1for);
217233 fftw_destroy_plan (planf1bac);
218- fftw_destroy_plan (planf2for);
219- fftw_destroy_plan (planf2bac);
220- fftw_destroy_plan (planf2r2c);
221- fftw_destroy_plan (planf2c2r);
222- destroypf == true ;
234+ if (this ->gamma_only )
235+ {
236+ fftw_destroy_plan (planf2r2c);
237+ fftw_destroy_plan (planf2c2r);
238+ }
239+ else
240+ {
241+ fftw_destroy_plan (planf2for);
242+ fftw_destroy_plan (planf2bac);
243+ }
244+ destroypf = true ;
223245#endif
224246
225247 return ;
0 commit comments