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