Overview |
GFT is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
GFT is a Generic Fortran 95 module which goal is to allow users to perform FFTs. It has been developped by Jalel Chergui at CNRS/IDRIS and built over core routines of JMFFT developped by Jean-Marie Teuler. It is also an attempt to define a set of standard Fortran generic FFT routines that combine ease of use and performance. In fact, three generic routines only can perform Forward/backward 1D, 2D, 3D and multiple 1D Complex-Complex and Real-Complex FFTs. Also, user has not to worry anymore about size and memory allocation/freeing of temporary work arrays since this job is done by GFT knowing the size of the FFT at an initialization step. Besides those three routines, an auxiliary subroutine has been defined for performance issues on vector processors.
Once GFT is installed, the user has to include GFT module files at compilation time and to link his own object files with the libgft.a archive. Also, each program unit, that makes calls to the GFT routines, must start with "USE GFT" instruction. The GFT archive contains all module objects. It mainly defines four generic routines:
and five derived data types to perform any kind of FFTs with a given floating point precision:
PROGRAM cc_2D USE GFT IMPLICIT NONE INTEGER, PARAMETER :: ni=257, nj=128 INTEGER :: n, m, si REAL(kind=GFT_Prec) :: sc COMPLEX(kind=GFT_Prec), DIMENSION(0:ni-1,nj) :: x, y TYPE(GFT_CC) :: cc !... Initialize Array to be Transformed x(0:,:) = ... !... Set size of FFT and cc object n=256 ; m=128 CALL GFT_set_fft(Nx=n, Ny=m, FFT=cc) !... Forward FFT si = +1 ! Sign of the FFT sc =1.0_GFT_Prec ! Scale factor CALL GFT_do_fft(FFT=cc, isign=si, scale=sc, c_in=x, c_out=y) !... Backward FFT si = -1 ! Sign of the FFT sc = 1.0_GFT_Prec / REAL(n*m, kind=GFT_Prec) ! Scale factor CALL GFT_do_fft(FFT=cc, isign=si, scale=sc, c_in=y, c_out=x) !... Free FFT object CALL GFT_end_fft(FFT=cc) END PROGRAM cc_2D |
PROGRAM cc_2D_bis USE GFT IMPLICIT NONE INTEGER, PARAMETER :: ni=257, nj=128 INTEGER :: n, m, si REAL(kind=GFT_Prec) :: sc COMPLEX(kind=GFT_Prec), DIMENSION(0:ni-1,nj) :: x, y TYPE(GFT_CC) :: cc !... Initialize Array to be Transformed x(0:,:) = ... !... Set size of FFT and cc object n=45 ; m=36 CALL GFT_set_fft(Nx=n, Ny=m, FFT=cc) !... Forward FFT si = +1 ! Sign of the FFT sc =1.0_GFT_Prec ! Scale factor CALL GFT_do_fft(FFT=cc, isign=si, scale=sc, c_in=x(5:n+5,10:m+10), & c_out=y(0:n-1,1:m)) !... Backward FFT si = -1 ! Sign of the FFT sc = 1.0_GFT_Prec / REAL(n*m, kind=GFT_Prec) ! Scale factor CALL GFT_do_fft(FFT=cc, isign=si, scale=sc, c_in=y(0:n-1,1:m), & c_out=x(5:n+5,10:m+10)) !... Free FFT object CALL GFT_end_fft(FFT=cc) END PROGRAM cc_2D_bis |
PROGRAM rcr_3D USE GFT IMPLICIT NONE INTEGER, PARAMETER :: ni=259,nj=128,nk=64 INTEGER :: n, m, l, si REAL(kind=GFT_Prec) :: sc COMPLEX(kind=GFT_Prec), DIMENSION(0:ni/2,nj,nk) :: x REAL(kind=GFT_Prec), DIMENSION(0:ni-1,nj,nk) :: y TYPE(GFT_RCR) :: rcr !... Initialize array to be Transformed x(0:,:,:) = ... !... Set the Blocking Factor CALL GFT_set_bf(FFT=rcr, BF=256) !... Set size of FFT n=256 ; m=128 ; l=64 CALL GFT_set_fft(Nx=n, Ny=m, Nz=l, FFT=rcr) !... Forward FFT si = +1 ! Sign of the FFT sc = 1.0_GFT_Prec ! Scale factor CALL GFT_do_fft(FFT=rcr, isign=si, scale=sc, c_in=x, r_out=y) !... Backward FFT si = -1 ! Sign of the FFT sc = 1.0_GFT_Prec / REAL(n*m*l, kind=GFT_Prec) ! Scale factor CALL GFT_do_fft(FFT=rcr, isign=si, scale=sc, r_in=y, c_out=x) !... Free rcr object CALL GFT_end_fft(FFT=rcr) END PROGRAM rcr_3D |