cannam@167: cannam@167: cannam@167: cannam@167: cannam@167:
cannam@167:cannam@167: Previous: Accessing the wisdom API from Fortran, Up: Calling FFTW from Modern Fortran [Contents][Index]
cannam@167:Rather than using the include
statement to include the
cannam@167: fftw3.f03
interface file in any subroutine where you want to
cannam@167: use FFTW, you might prefer to define an FFTW Fortran module. FFTW
cannam@167: does not install itself as a module, primarily because
cannam@167: fftw3.f03
can be shared between different Fortran compilers while
cannam@167: modules (in general) cannot. However, it is trivial to define your
cannam@167: own FFTW module if you want. Just create a file containing:
cannam@167:
module FFTW3 cannam@167: use, intrinsic :: iso_c_binding cannam@167: include 'fftw3.f03' cannam@167: end module cannam@167:
Compile this file into a module as usual for your compiler (e.g. with
cannam@167: gfortran -c
you will get a file fftw3.mod
). Now,
cannam@167: instead of include 'fftw3.f03'
, whenever you want to use FFTW
cannam@167: routines you can just do:
cannam@167:
use FFTW3 cannam@167:
as usual for Fortran modules. (You still need to link to the FFTW cannam@167: library, of course.) cannam@167:
cannam@167: cannam@167: cannam@167: cannam@167: