init_ccfftw Subroutine

public subroutine init_ccfftw(fft, direction, n, howmany, data_array, transpose, m)

Create an FFTW plan for complex-to-complex transforms

Arguments

Type IntentOptional 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 transpose is true


Contents

Source Code


Source Code

  subroutine init_ccfftw (fft, direction, n, howmany, data_array, transpose, m)
    use mp, only: mp_abort
    use job_manage, only: time_message
    use optionals, only: get_option_with_default
    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
    !> Example array to transform
    complex, dimension(:,:), intent(inout) :: data_array
    !> If true, then take FFT of transpose of array
    logical, optional, intent(in) :: transpose
    !> Size of transpose direction. Required if `transpose` is true
    integer, optional, intent(in) :: m
# if FFT == _FFTW3_
    integer, dimension(1) :: array_n
# endif
    call time_message(.false., time_fft, ' FFT')
    fft = basic_init(n, direction, howmany, .false.)
#if FFT == _FFTW3_
    ! the planer expects this as an array of size 1
    array_n = n

    if (get_option_with_default(transpose, .false.)) then
       if (.not. present(m)) call mp_abort("Missing argument 'm' for transpose FFT")
       call FFTW_PREFIX(_plan_many_dft)(fft%plan, 1, array_n, howmany, &
            data_array, array_n, howmany*m, 1, &
            data_array, array_n, howmany*m, 1, &
            direction, fftw_flags())
    else
       call FFTW_PREFIX(_plan_many_dft)(fft%plan, 1, array_n, howmany, &
            data_array, array_n, 1, n, &
            data_array, array_n, 1, n, &
            direction, fftw_flags())
    endif
# endif
    call time_message(.false., time_fft, ' FFT')
  end subroutine init_ccfftw