Provides some wrappers for managing FFTW plans.
The initialisation routines (init_crfftw, init_rcfftw, init_ccfftw) create FFTW plans, storing them in an instance of fft_type, along with some useful metadata, notably scale.
The preprocessor macro FFTW_PREFIX
is provided to enable calling
the single or double precision FFTW routines.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | FFT_TO_SPECTRAL_SPACE | = | -1 |
Constant for forward transforms, from real space to spectral space |
integer, | public, | parameter | :: | FFT_TO_REAL_SPACE | = | 1 |
Constant for inverse transforms, from spectral space to real space |
logical, | public | :: | measure_plan | = | .true. |
If true, then use FFTW_PATIENT to pick the optimal 42 algorithm, otherwise use FFTW_ESTIMATE (potentially slower but more reproducible results). FFTW_PATIENT takes longer to set up the plan initially, but may be faster overall. |
|
integer, | private, | parameter | :: | FFTW_R2HC | = | 0 | |
integer, | private, | parameter | :: | FFTW_HC2R | = | 1 | |
integer, | private, | parameter | :: | FFTW_DHT | = | 2 | |
integer, | private, | parameter | :: | FFTW_REDFT00 | = | 3 | |
integer, | private, | parameter | :: | FFTW_REDFT01 | = | 4 | |
integer, | private, | parameter | :: | FFTW_REDFT10 | = | 5 | |
integer, | private, | parameter | :: | FFTW_REDFT11 | = | 6 | |
integer, | private, | parameter | :: | FFTW_RODFT00 | = | 7 | |
integer, | private, | parameter | :: | FFTW_RODFT01 | = | 8 | |
integer, | private, | parameter | :: | FFTW_RODFT10 | = | 9 | |
integer, | private, | parameter | :: | FFTW_RODFT11 | = | 10 | |
integer, | private, | parameter | :: | FFTW_FORWARD | = | -1 | |
integer, | private, | parameter | :: | FFTW_BACKWARD | = | +1 | |
integer, | private, | parameter | :: | FFTW_MEASURE | = | 0 | |
integer, | private, | parameter | :: | FFTW_DESTROY_INPUT | = | 1 | |
integer, | private, | parameter | :: | FFTW_UNALIGNED | = | 2 | |
integer, | private, | parameter | :: | FFTW_CONSERVE_MEMORY | = | 4 | |
integer, | private, | parameter | :: | FFTW_EXHAUSTIVE | = | 8 | |
integer, | private, | parameter | :: | FFTW_PRESERVE_INPUT | = | 16 | |
integer, | private, | parameter | :: | FFTW_PATIENT | = | 32 | |
integer, | private, | parameter | :: | FFTW_ESTIMATE | = | 64 | |
integer, | private, | parameter | :: | FFTW_WISDOM_ONLY | = | 2097152 | |
integer, | private, | parameter | :: | FFTW_ESTIMATE_PATIENT | = | 128 | |
integer, | private, | parameter | :: | FFTW_BELIEVE_PCOST | = | 256 | |
integer, | private, | parameter | :: | FFTW_NO_DFT_R2HC | = | 512 | |
integer, | private, | parameter | :: | FFTW_NO_NONTHREADED | = | 1024 | |
integer, | private, | parameter | :: | FFTW_NO_BUFFERING | = | 2048 | |
integer, | private, | parameter | :: | FFTW_NO_INDIRECT_OP | = | 4096 | |
integer, | private, | parameter | :: | FFTW_ALLOW_LARGE_GENERIC | = | 8192 | |
integer, | private, | parameter | :: | FFTW_NO_RANK_SPLITS | = | 16384 | |
integer, | private, | parameter | :: | FFTW_NO_VRANK_SPLITS | = | 32768 | |
integer, | private, | parameter | :: | FFTW_NO_VRECURSE | = | 65536 | |
integer, | private, | parameter | :: | FFTW_NO_SIMD | = | 131072 | |
integer, | private, | parameter | :: | FFTW_NO_SLOW | = | 262144 | |
integer, | private, | parameter | :: | FFTW_NO_FIXED_RADIX_LARGE_N | = | 524288 | |
integer, | private, | parameter | :: | FFTW_ALLOW_PRUNING | = | 1048576 | |
real, | public | :: | time_fft(2) | = | 0. |
Total time taken setting up and performing FFTs |
|
logical, | private | :: | initialised | = | .false. |
True if this module has been initialised |
Create FFTW plan suitable for 1D complex to real transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | n |
Number of points in array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
logical, | intent(in), | optional | :: | transposed |
If true, then take 42 of transpose of array |
Create FFTW plan suitable for 2D complex to real transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | m |
Number of points in first dimension of array to transform |
||
integer, | intent(in) | :: | n |
Number of points in second dimension of array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
integer, | intent(in), | optional | :: | stride_ |
Stride of array if different from |
Create FFTW plan suitable for 1D real to complex transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | n |
Number of points in array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
logical, | intent(in), | optional | :: | transposed |
If true, then take 42 of transpose of array |
Create FFTW plan suitable for 2D real to complex transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | m |
Number of points in first dimension of array to transform |
||
integer, | intent(in) | :: | n |
Number of points in second dimension of array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
integer, | intent(in), | optional | :: | stride_ |
Stride of array if different from |
Information about a planned 42 transform
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | created | = | .false. |
True if the plan has been created |
|
integer, | public | :: | n |
Number of points in the array to be transformed |
|||
integer, | public | :: | direction |
Direction of the 42, can be either FFT_FORWARD or FFTW_BACKWARD |
|||
integer(kind=kind_id), | public | :: | plan |
The FFTW plan object |
|||
integer, | public | :: | howmany |
How many independent slices in the array to be transformed |
|||
logical, | public | :: | strided |
True if the array is strided or 2D |
|||
real, | public | :: | scale |
Normalisation factor |
|||
logical, | public | :: | must_scale |
If true, then the result of the 42 needs to be multiplied by scale. If false, then the scaling can be skipped, saving some work |
Does some common initialisation for fft_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
Number of points |
||
integer, | intent(in) | :: | direction |
Direction of 42, must be either FFT_TO_REAL_SPACE or FFT_TO_SPECTRAL_SPACE |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs |
||
logical, | intent(in) | :: | strided |
Is array strided/2D |
Set flags for FFTW3
Perform any one off setup of the fft library. This is currently mostly only needed for builds with OpenMP for threaded transforms.
FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft | |||
integer, | intent(in) | :: | direction | |||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | howmany |
Create an FFTW plan for complex-to-complex transforms
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | n |
Number of points in array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
complex, | intent(inout), | dimension(:,:) | :: | data_array |
Example array to transform |
|
logical, | intent(in), | optional | :: | transpose |
If true, then take 42 of transpose of array |
|
integer, | intent(in), | optional | :: | m |
Size of transpose direction. Required if |
Create FFTW plan suitable for 1D real to complex transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | n |
Number of points in array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
logical, | intent(in), | optional | :: | transposed |
If true, then take 42 of transpose of array |
Create FFTW plan suitable for 1D complex to real transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | n |
Number of points in array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
logical, | intent(in), | optional | :: | transposed |
If true, then take 42 of transpose of array |
Create FFTW plan suitable for 2D real to complex transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | m |
Number of points in first dimension of array to transform |
||
integer, | intent(in) | :: | n |
Number of points in second dimension of array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
integer, | intent(in), | optional | :: | stride_ |
Stride of array if different from |
Create FFTW plan suitable for 2D complex to real transformation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(out) | :: | fft |
The created plan |
||
integer, | intent(in) | :: | direction |
Direction of the transformation, either FFT_TO_SPECTRAL_SPACE or FFT_TO_REAL_SPACE |
||
integer, | intent(in) | :: | m |
Number of points in first dimension of array to transform |
||
integer, | intent(in) | :: | n |
Number of points in second dimension of array to transform |
||
integer, | intent(in) | :: | howmany |
Number of independent FFTs in array |
||
integer, | intent(in), | optional | :: | stride_ |
Stride of array if different from |
Destroy 42 plan
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fft_type), | intent(inout) | :: | fft |
Restore FFTW to pristine state
Save FFTW wisdom to file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |
Load FFTW wisdom from file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |