Index: LMDZ4/branches/LMDZ4V5.0-dev/libf/filtrez/mod_filtre_fft.F90
===================================================================
--- LMDZ4/branches/LMDZ4V5.0-dev/libf/filtrez/mod_filtre_fft.F90	(revision 1292)
+++ LMDZ4/branches/LMDZ4V5.0-dev/libf/filtrez/mod_filtre_fft.F90	(revision 1383)
@@ -1,2 +1,6 @@
+!
+! $Id$
+!
+
 MODULE mod_filtre_fft
 
@@ -23,5 +27,6 @@
     INTEGER            :: index_vp(iim)
     INTEGER            :: i,j
-    
+    INTEGER            :: l,ll_nb
+
     index_vp(1)=1
     DO i=1,iim/2
@@ -98,7 +103,13 @@
     ENDDO
     
-    
+#ifdef FFT_FFTW
+
+    WRITE (*,*)"COTH jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv"
+    WRITE (*,*)jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv
+    WRITE (*,*)MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1
+    CALL Init_FFT(iim,(llm+1)*(MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1))
+#else    
     CALL Init_FFT(iim,(jjm+1)*(llm+1))
-        
+#endif        
     
   END SUBROUTINE Init_filtre_fft
@@ -118,11 +129,8 @@
 
     REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-!    REAL               :: vect_test(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX*16         :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
-!    COMPLEX*16         :: TF_vect_test(iim/2+1,jj_end-jj_begin+1,nbniv)
+    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
     INTEGER            :: nb_vect
     INTEGER :: i,j,l
     INTEGER :: ll_nb
-!    REAL               :: vect_tmp(iim+inc,jj_end-jj_begin+1,nbniv)
     
     ll_nb=0
@@ -140,15 +148,5 @@
     nb_vect=(jj_end-jj_begin+1)*ll_nb
 
-!    vect_tmp=vect
-
     CALL FFT_forward(vect,TF_vect,nb_vect)
-
-!    CALL FFT_forward(vect,TF_vect_test,nb_vect)
-!      PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"
-!      DO j=1,jj_end-jj_begin+1
-!      DO i=1,iim/2+1
-!         PRINT *,"====",i,j,"----->",TF_vect_test(i,j,1)
-!       ENDDO
-!      ENDDO
 
     DO l=1,ll_nb
@@ -159,15 +157,8 @@
       ENDDO
     ENDDO
-       
+  
     CALL FFT_backward(TF_vect,vect,nb_vect)
-!    CALL FFT_backward(TF_vect_test,vect_test,nb_vect)
-          
-!      PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"
-!      DO j=1,jj_end-jj_begin+1
-!         DO i=1,iim
-!           PRINT *,"====",i,j,"----->",vect_test(i,j,1)
-!         ENDDO
-!      ENDDO
-
+      
+      
     ll_nb=0
 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
@@ -199,5 +190,5 @@
 
     REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX*16         :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
+    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
     INTEGER            :: nb_vect
     INTEGER :: i,j,l
@@ -260,6 +251,6 @@
     REAL,INTENT(INOUT) :: vect_inout(iim+1,nlat,nbniv)
 
-    REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
-    COMPLEX*16         :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
+     REAL               :: vect(iim+inc,jj_end-jj_begin+1,nbniv)
+    COMPLEX            :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)
     INTEGER            :: nb_vect
     INTEGER :: i,j,l
@@ -305,37 +296,4 @@
 
   END SUBROUTINE Filtre_inv_fft  
-  
-  
-!  SUBROUTINE get_ll_index(nbniv,ll_index,ll_nb)
-!  IMPLICIT NONE
-!    INTEGER,INTENT(IN)  :: nbniv
-!    INTEGER,INTENT(OUT) :: ll_index(nbniv)
-!    INTEGER,INTENT(OUT) :: ll_nb
-!
-!    INTEGER :: l,ll_begin, ll_end
-!   INTEGER :: omp_rank,omp_size
-!   INTEGER :: OMP_GET_NUM_THREADS
-!   INTEGER :: omp_chunk
-!   EXTERNAL OMP_GET_NUM_THREADS
-!   INTEGER :: OMP_GET_THREAD_NUM
-!   EXTERNAL OMP_GET_THREAD_NUM
-!
-!   
-!   omp_size=OMP_GET_NUM_THREADS()
-!   omp_rank=OMP_GET_THREAD_NUM()    
-!   omp_chunk=nbniv/omp_size+min(1,MOD(nbniv,omp_size))
-!   
-!   ll_begin=omp_rank*OMP_CHUNK+1
-!   ll_nb=0
-!   DO WHILE (ll_begin<=nbniv)
-!     ll_end=min(ll_begin+OMP_CHUNK-1,nbniv)
-!     DO l=ll_begin,ll_end
-!       ll_nb=ll_nb+1
-!       ll_index(ll_nb)=l
-!     ENDDO
-!     ll_begin=ll_begin+omp_size*OMP_CHUNK
-!   ENDDO
-!  
-!  END SUBROUTINE get_ll_index
    
 END MODULE mod_filtre_fft
