cannam@95: cannam@95: cannam@95: Defining an FFTW module - FFTW 3.3.3 cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95: cannam@95:
cannam@95: cannam@95:

cannam@95: Previous: Accessing the wisdom API from Fortran, cannam@95: Up: Calling FFTW from Modern Fortran cannam@95:


cannam@95:
cannam@95: cannam@95:

7.7 Defining an FFTW module

cannam@95: cannam@95:

Rather than using the include statement to include the cannam@95: fftw3.f03 interface file in any subroutine where you want to cannam@95: use FFTW, you might prefer to define an FFTW Fortran module. FFTW cannam@95: does not install itself as a module, primarily because cannam@95: fftw3.f03 can be shared between different Fortran compilers while cannam@95: modules (in general) cannot. However, it is trivial to define your cannam@95: own FFTW module if you want. Just create a file containing: cannam@95: cannam@95:

       module FFTW3
cannam@95:          use, intrinsic :: iso_c_binding
cannam@95:          include 'fftw3.f03'
cannam@95:        end module
cannam@95: 
cannam@95:

Compile this file into a module as usual for your compiler (e.g. with cannam@95: gfortran -c you will get a file fftw3.mod). Now, cannam@95: instead of include 'fftw3.f03', whenever you want to use FFTW cannam@95: routines you can just do: cannam@95: cannam@95:

       use FFTW3
cannam@95: 
cannam@95:

as usual for Fortran modules. (You still need to link to the FFTW cannam@95: library, of course.) cannam@95: cannam@95: cannam@95: