Index: trunk/Cosmo/SimLSS/genefluct3d.cc
===================================================================
--- trunk/Cosmo/SimLSS/genefluct3d.cc	(revision 3516)
+++ trunk/Cosmo/SimLSS/genefluct3d.cc	(revision 3518)
@@ -24,5 +24,21 @@
 #include "genefluct3d.h"
 
-#define WITH_FFTW_THREAD
+#if defined(GEN3D_FLOAT)
+#define GEN3D_FFTW_INIT_THREADS       fftwf_init_threads
+#define GEN3D_FFTW_CLEANUP_THREADS    fftwf_cleanup_threads
+#define GEN3D_FFTW_PLAN_WITH_NTHREADS fftwf_plan_with_nthreads
+#define GEN3D_FFTW_PLAN_DFT_R2C_3D    fftwf_plan_dft_r2c_3d
+#define GEN3D_FFTW_PLAN_DFT_C2R_3D    fftwf_plan_dft_c2r_3d
+#define GEN3D_FFTW_DESTROY_PLAN       fftwf_destroy_plan
+#define GEN3D_FFTW_EXECUTE            fftwf_execute
+#else
+#define GEN3D_FFTW_INIT_THREADS       fftw_init_threads
+#define GEN3D_FFTW_CLEANUP_THREADS    fftw_cleanup_threads
+#define GEN3D_FFTW_PLAN_WITH_NTHREADS fftw_plan_with_nthreads
+#define GEN3D_FFTW_PLAN_DFT_R2C_3D    fftw_plan_dft_r2c_3d
+#define GEN3D_FFTW_PLAN_DFT_C2R_3D    fftw_plan_dft_c2r_3d
+#define GEN3D_FFTW_DESTROY_PLAN       fftw_destroy_plan
+#define GEN3D_FFTW_EXECUTE            fftw_execute
+#endif
 
 #define MODULE2(_x_) ((double)((_x_).real()*(_x_).real() + (_x_).imag()*(_x_).imag()))
@@ -64,5 +80,5 @@
 {
  Nx_ = Ny_ = Nz_ = 0;
- is_set_fftw_plan = false;
+ is_set_fft_plan = false;
  nthread_ = 0;
  lp_ = 0;
@@ -134,5 +150,5 @@
    T_.ReSize(3,SzK_);
    array_allocated_ = true;
-   if(lp_>1) cout<<"  allocating: "<<T_.Size()*sizeof(complex<r_8>)/1.e6<<" Mo"<<endl;
+   if(lp_>1) cout<<"  allocating: "<<T_.Size()*sizeof(complex<GEN3D_TYPE>)/1.e6<<" Mo"<<endl;
  } catch (...) {
    cout<<"GeneFluct3D::setalloc_Error: Problem allocating T_"<<endl;
@@ -147,11 +163,11 @@
    else        R_ = ArrCastC2R(T_);
  // On remplit les pointeurs
- fdata_ = (fftw_complex *) (&T_(0,0,0));
- data_ = (double *) (&R_(0,0,0));
+ fdata_ = (GEN3D_FFTW_COMPLEX *) (&T_(0,0,0));
+ data_ = (GEN3D_TYPE *) (&R_(0,0,0));
 }
 
 void GeneFluct3D::init_fftw(void)
 {
- if( is_set_fftw_plan ) delete_fftw();
+ if( is_set_fft_plan ) delete_fftw();
 
  // --- Initialisation de fftw3 (attention data est sur-ecrit a l'init)
@@ -160,24 +176,24 @@
  if(nthread_>0) {
    cout<<"...Computing with "<<nthread_<<" threads"<<endl;
-   fftw_init_threads();
-   fftw_plan_with_nthreads(nthread_);
+   GEN3D_FFTW_INIT_THREADS();
+   GEN3D_FFTW_PLAN_WITH_NTHREADS(nthread_);
  }
 #endif
  if(lp_>1) cout<<"...forward plan"<<endl;
- pf_ = fftw_plan_dft_r2c_3d(Nx_,Ny_,Nz_,data_,fdata_,FFTW_ESTIMATE);
+ pf_ = GEN3D_FFTW_PLAN_DFT_R2C_3D(Nx_,Ny_,Nz_,data_,fdata_,FFTW_ESTIMATE);
  if(lp_>1) cout<<"...backward plan"<<endl;
- pb_ = fftw_plan_dft_c2r_3d(Nx_,Ny_,Nz_,fdata_,data_,FFTW_ESTIMATE);
- is_set_fftw_plan = true;
+ pb_ = GEN3D_FFTW_PLAN_DFT_C2R_3D(Nx_,Ny_,Nz_,fdata_,data_,FFTW_ESTIMATE);
+ is_set_fft_plan = true;
 }
 
 void GeneFluct3D::delete_fftw(void)
 {
- if( !is_set_fftw_plan ) return;
- fftw_destroy_plan(pf_);
- fftw_destroy_plan(pb_);
+ if( !is_set_fft_plan ) return;
+ GEN3D_FFTW_DESTROY_PLAN(pf_);
+ GEN3D_FFTW_DESTROY_PLAN(pb_);
 #ifdef WITH_FFTW_THREAD
- if(nthread_>0) fftw_cleanup_threads();
+ if(nthread_>0) GEN3D_FFTW_CLEANUP_THREADS();
 #endif
- is_set_fftw_plan = false;
+ is_set_fft_plan = false;
 }
 
@@ -566,9 +582,9 @@
  // --- realisation d'un tableau de tirage gaussiens
  if(lp_>0) cout<<"...before fft real ---"<<endl;
- fftw_execute(pf_);
+ GEN3D_FFTW_EXECUTE(pf_);
 
  // --- On remplit avec une realisation
  if(lp_>0) cout<<"...before Fourier realization filling"<<endl;
- T_(0,0,0) = complex<r_8>(0.);  // on coupe le continue et on l'initialise
+ T_(0,0,0) = complex<GEN3D_TYPE>(0.);  // on coupe le continue et on l'initialise
  long lmod = Nx_/10; if(lmod<1) lmod=1;
  for(long i=0;i<Nx_;i++) {
@@ -609,5 +625,5 @@
 {
  // --- RaZ du tableau
- T_ = complex<r_8>(0.);
+ T_ = complex<GEN3D_TYPE>(0.);
 
  // --- On remplit avec une realisation
@@ -830,5 +846,5 @@
 
  // On fait la FFT
- fftw_execute(pb_);
+ GEN3D_FFTW_EXECUTE(pb_);
 }
 
@@ -840,5 +856,5 @@
 
  // On fait la FFT
- fftw_execute(pf_);
+ GEN3D_FFTW_EXECUTE(pf_);
  // On corrige du pb de la normalisation de FFTW3
  double v = (double)NRtot_;
