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