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