Next: , Previous: , Up: Calling FFTW from Legacy Fortran   [Contents][Index]

8.2 FFTW Constants in Fortran

When creating plans in FFTW, a number of constants are used to specify options, such as FFTW_MEASURE or FFTW_ESTIMATE. The same constants must be used with the wrapper routines, but of course the C header files where the constants are defined can’t be incorporated directly into Fortran code.

Instead, we have placed Fortran equivalents of the FFTW constant definitions in the file fftw3.f, which can be found in the same directory as fftw3.h. If your Fortran compiler supports a preprocessor of some sort, you should be able to include or #include this file; otherwise, you can paste it directly into your code.

In C, you combine different flags (like FFTW_PRESERVE_INPUT and FFTW_MEASURE) using the ‘|’ operator; in Fortran you should just use ‘+’. (Take care not to add in the same flag more than once, though. Alternatively, you can use the ior intrinsic function standardized in Fortran 95.)