d@0: d@0:
d@0:d@0: d@0: d@0: Previous: Fortran Examples, d@0: Up: Calling FFTW from Fortran d@0:
In this section, we discuss how one can import/export FFTW wisdom d@0: (saved plans) to/from a Fortran program; we assume that the reader is d@0: already familiar with wisdom, as described in Words of Wisdom-Saving Plans. d@0: d@0:
The basic problem is that is difficult to (portably) pass files and
d@0: strings between Fortran and C, so we cannot provide a direct Fortran
d@0: equivalent to the fftw_export_wisdom_to_file
, etcetera,
d@0: functions. Fortran interfaces are provided for the functions
d@0: that do not take file/string arguments, however:
d@0: dfftw_import_system_wisdom
, dfftw_import_wisdom
,
d@0: dfftw_export_wisdom
, and dfftw_forget_wisdom
.
d@0:
d@0: So, for example, to import the system-wide wisdom, you would do:
d@0:
d@0:
integer isuccess d@0: call dfftw_import_system_wisdom(isuccess) d@0:d@0:
As usual, the C return value is turned into a first parameter;
d@0: isuccess
is non-zero on success and zero on failure (e.g. if
d@0: there is no system wisdom installed).
d@0:
d@0:
If you want to import/export wisdom from/to an arbitrary file or
d@0: elsewhere, you can employ the generic dfftw_import_wisdom
and
d@0: dfftw_export_wisdom
functions, for which you must supply a
d@0: subroutine to read/write one character at a time. The FFTW package
d@0: contains an example file doc/f77_wisdom.f
demonstrating how to
d@0: implement import_wisdom_from_file
and
d@0: export_wisdom_to_file
subroutines in this way. (These routines
d@0: cannot be compiled into the FFTW library itself, lest all FFTW-using
d@0: programs be required to link with the Fortran I/O library.)
d@0:
d@0:
d@0:
d@0: