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.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
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. |
|
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 | = | 0 |
Number of points in the array to be transformed |
|
integer, | public | :: | direction | = | 0 |
Direction of the 42, can be either FFT_FORWARD or FFTW_BACKWARD |
|
type(C_PTR), | public | :: | plan | = | C_NULL_PTR |
The FFTW plan object |
|
integer, | public | :: | howmany | = | 0 |
How many independent slices in the array to be transformed |
|
logical, | public | :: | strided | = | .false. |
True if the array is strided or 2D |
|
real, | public | :: | scale | = | 0 |
Normalisation factor |
|
logical, | public | :: | must_scale | = | .false. |
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 |
procedure , public :: execute_c2r Subroutine | |
procedure , public :: execute_r2c Subroutine | |
procedure , public :: execute_c2c Subroutine | |
procedure , public :: delete => delete_fft Subroutine | |
procedure , private :: init => basic_init Subroutine |
Set flags for FFTW3
Small wrapper to bind execute c2c to fft_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(fft_type), | intent(in) | :: | self | |||
complex, | intent(inout), | dimension(*) | :: | array_in | ||
complex, | intent(out), | dimension(*) | :: | array_out |
Small wrapper to bind execute r2c to fft_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(fft_type), | intent(in) | :: | self | |||
real, | intent(inout), | dimension(*) | :: | array_in | ||
complex, | intent(out), | dimension(*) | :: | array_out |
Small wrapper to bind execute c2r to fft_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(fft_type), | intent(in) | :: | self | |||
complex, | intent(inout), | dimension(*) | :: | array_in | ||
real, | intent(out), | dimension(*) | :: | array_out |
Destroy 42 plan
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(fft_type), | intent(inout) | :: | self |
Perform any one off setup of the fft library. This is currently mostly only needed for builds with OpenMP for threaded transforms.
Does some common initialisation for fft_type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(fft_type), | intent(inout) | :: | self | |||
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 |
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 |
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 |