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