The FFTW, like many numerical FFT codes, requires two different types of calls. First, the parameters are passed to it so it can properly allocate memory. Second, the actual FFT is computed.
During the first iteration of the code, we invoke the subroutine ``makeplans'', which proceeds to call out all the plans we will need later. Since these are stored as pointers in the C-language part of the code, they are treated by Fortran as if they are integers. Attempting to display the plans in the Fortran code will yield you nothing more than a memory address.
Next, the Fortran code calls out the routines ``rcfft'' for the real-to-complex, 3-d forward FFTs, and ``crfft'' for the complex-to-real, 3-D inverse FFTs. These routines, written by us based on templates found within the FFT release, actually do several important steps.
For the forward FFTs, we first run a 2-d real-to-complex transform on the dimensions which are stored completely within each processor. This step requires no communication whatsoever between processors. Next, we call on an MPI-based transpose routine found within the FFTW code, though not within the libraries. This transpose switches two of the dimensions of the array, so the untransformed dimension now lies within a processor, rather than across all of them. Finally, we run a 1-dimensional complex-to-complex transform on this last dimension. The resultant complex data structure is left in the transposed form, since the transpose is undone by the inverse FFT.
The inverse FFT works in essentially the opposite order. We inverse FFT the second dimension within each processor, transpose the grid back to the original form, and run a 2-d complex-to-real transform within each processor on the remaining dimensions.
It is extremely important to note that the authors of the FFTW have changed the format of the transpose routines between the previous releases and the current one. If you must use an older version of the FFTW (version 2.0.x), please replace our file ``fftw_f77.c'' with ``fftw_f77.c.old''. The only difference is in the calling sequence of variables, the calculation is performed in the same way for either case.
It is VITAL to get the subroutine name syntax right when calling a routine in C from a routine in Fortran. We have encountered problems in the past with any C-based subroutine which has an underscore character in its name (i.e. make_plans instead of makeplans). Consider yourself warned.