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 |
subroutine init_rcfftw_1d (fft, direction, n, howmany, transposed)
use job_manage, only: time_message
implicit none
!> The created plan
type (fft_type), intent (out) :: fft
!> Direction of the transformation, either [[FFT_TO_SPECTRAL_SPACE]] or [[FFT_TO_REAL_SPACE]]
integer, intent (in) :: direction
!> Number of points in array to transform
integer, intent (in) :: n
!> Number of independent FFTs in array
integer, intent (in) :: howmany
!> If true, then take FFT of transpose of array
logical, optional, intent(in) :: transposed
#if FFT == _FFTW3_
integer, dimension(1) :: vector_sizes_real, vector_sizes_complex
! we need two dummy arrays for the planner. Since at
! present we are not using SSE instructions, these are save
! to be local to this routine
real, dimension(:,:), allocatable :: dummy_real_data
complex, dimension (:,:), allocatable :: dummy_complex_data
#endif
call time_message(.false., time_fft, ' FFT')
fft = basic_init(n, direction, howmany, .false.)
#if FFT == _FFTW3_
if (present(transposed)) then
allocate (dummy_real_data(max (1, howmany), N))
allocate (dummy_complex_data(max(1, howmany), N/2+1))
else
allocate (dummy_real_data(N, max (1, howmany)))
allocate (dummy_complex_data(N/2+1, max(1, howmany)))
endif
vector_sizes_real = N
vector_sizes_complex = N/2+1
if ( present(transposed)) then
call FFTW_PREFIX(_plan_many_dft_r2c) (fft%plan, 1, &
vector_sizes_real, howmany, &
dummy_real_data, vector_sizes_real, howmany, 1, &
dummy_complex_data, vector_sizes_complex, howmany, 1, &
fftw_flags())
else
call FFTW_PREFIX(_plan_many_dft_r2c) (fft%plan, 1, &
vector_sizes_real, howmany, &
dummy_real_data, vector_sizes_real, 1, N, &
dummy_complex_data, vector_sizes_complex, 1, N/2+1, &
fftw_flags())
endif
deallocate (dummy_real_data, dummy_complex_data)
#endif
call time_message(.false., time_fft, ' FFT')
end subroutine init_rcfftw_1d