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