1!--------------------------------------------------------------------------------------------------!
2!   CP2K: A general program to perform molecular dynamics simulations                              !
3!   Copyright (C) 2000 - 2019  CP2K developers group                                               !
4!--------------------------------------------------------------------------------------------------!
5
6! **************************************************************************************************
7!> \brief Type to store data about a (1D or 3D) FFT, including FFTW plan
8!> \par History
9!>      IAB 09-Jan-2009 : initial version
10!>                        (c) The Numerical Algorithms Group (NAG) Ltd, 2009 on behalf of the HECToR project
11!>      IAB 09-Oct-2009 : Added additional fields needed when using OpenMP
12!>                        (c) The Numerical Algorithms Group (NAG) Ltd, 2009 on behalf of the HECToR project
13!> \author JGH
14! **************************************************************************************************
15
16MODULE fft_plan
17   USE fft_kinds,                       ONLY: integer8_kind
18
19   IMPLICIT NONE
20   PRIVATE
21
22   PUBLIC :: fft_plan_type
23
24   TYPE fft_plan_type
25
26      INTEGER                             :: fft_type
27      INTEGER                             :: fsign
28      LOGICAL                             :: trans, fft_in_place, valid, separated_plans
29      INTEGER                             :: n, m
30      INTEGER, DIMENSION(3)               :: n_3d
31
32!   Handle for the FFTW plan
33      INTEGER(KIND=integer8_kind)        :: fftw_plan
34
35!   Plan for the remaining rows for 1D FFT when number of threads does not divide the number of rows exactly
36!$    INTEGER(KIND=integer8_kind)        :: alt_fftw_plan
37!$    LOGICAL                             :: need_alt_plan
38!$    INTEGER                             :: num_threads_needed, num_rows, alt_num_rows
39
40!   Individual plans (used by hand-optimised 3D FFT)
41      INTEGER(KIND=integer8_kind)        :: fftw_plan_nx, fftw_plan_ny, fftw_plan_nz
42!   Plans for the remaining rows (when the number of threads does not divide the number of rows exactly)
43      INTEGER(KIND=integer8_kind)        :: fftw_plan_nx_r, fftw_plan_ny_r, fftw_plan_nz_r
44
45   END TYPE fft_plan_type
46
47END MODULE fft_plan
48