cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: FFTW 3.3.5: Wisdom of Fortran? cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:
cannam@127:

cannam@127: Previous: , Up: Calling FFTW from Legacy Fortran   [Contents][Index]

cannam@127:
cannam@127:
cannam@127: cannam@127:

8.5 Wisdom of Fortran?

cannam@127: cannam@127:

In this section, we discuss how one can import/export FFTW wisdom cannam@127: (saved plans) to/from a Fortran program; we assume that the reader is cannam@127: already familiar with wisdom, as described in Words of Wisdom-Saving Plans. cannam@127:

cannam@127: cannam@127:

The basic problem is that is difficult to (portably) pass files and cannam@127: strings between Fortran and C, so we cannot provide a direct Fortran cannam@127: equivalent to the fftw_export_wisdom_to_file, etcetera, cannam@127: functions. Fortran interfaces are provided for the functions cannam@127: that do not take file/string arguments, however: cannam@127: dfftw_import_system_wisdom, dfftw_import_wisdom, cannam@127: dfftw_export_wisdom, and dfftw_forget_wisdom. cannam@127: cannam@127: cannam@127: cannam@127: cannam@127:

cannam@127: cannam@127:

So, for example, to import the system-wide wisdom, you would do: cannam@127:

cannam@127:
cannam@127:
        integer isuccess
cannam@127:         call dfftw_import_system_wisdom(isuccess)
cannam@127: 
cannam@127: cannam@127:

As usual, the C return value is turned into a first parameter; cannam@127: isuccess is non-zero on success and zero on failure (e.g. if cannam@127: there is no system wisdom installed). cannam@127:

cannam@127:

If you want to import/export wisdom from/to an arbitrary file or cannam@127: elsewhere, you can employ the generic dfftw_import_wisdom and cannam@127: dfftw_export_wisdom functions, for which you must supply a cannam@127: subroutine to read/write one character at a time. The FFTW package cannam@127: contains an example file doc/f77_wisdom.f demonstrating how to cannam@127: implement import_wisdom_from_file and cannam@127: export_wisdom_to_file subroutines in this way. (These routines cannam@127: cannot be compiled into the FFTW library itself, lest all FFTW-using cannam@127: programs be required to link with the Fortran I/O library.) cannam@127:

cannam@127: cannam@127: cannam@127: cannam@127: