The Elk Code
 
Loading...
Searching...
No Matches
cfftifc_fftw.f90
Go to the documentation of this file.
1
2! Copyright (C) 2022 J. K. Dewhurst and S. Sharma.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6subroutine cfftifc(nd,n,sgn,c)
7implicit none
8! arguments
9integer, intent(in) :: nd,n(nd),sgn
10complex(4), intent(inout) :: c(*)
11! local variables
12integer, parameter :: FFTW_ESTIMATE=64
13integer p
14integer(8) plan
15real(4) t1
16! interface to FFTW version 3
17!$OMP CRITICAL(fftw_)
18call sfftw_plan_dft(plan,nd,n,c,c,sgn,fftw_estimate)
19!$OMP END CRITICAL(fftw_)
20call sfftw_execute(plan)
21!$OMP CRITICAL(fftw_)
22call sfftw_destroy_plan(plan)
23!$OMP END CRITICAL(fftw_)
24if (sgn == -1) then
25 p=product(n(1:nd))
26 t1=1.e0/real(p)
27 call csscal(p,t1,c,1)
28end if
29end subroutine
30
31subroutine rcfftifc(nd,n,sgn,r,c)
32implicit none
33! arguments
34integer, intent(in) :: nd,n(nd),sgn
35real(4), intent(inout) :: r(*)
36complex(4), intent(inout) :: c(*)
37! local variables
38integer, parameter :: FFTW_ESTIMATE=64
39integer p
40integer(8) plan
41real(4) t1
42!$OMP CRITICAL(fftw_)
43if (sgn == -1) then
44 call sfftw_plan_dft_r2c(plan,nd,n,r,c,fftw_estimate)
45else
46 call sfftw_plan_dft_c2r(plan,nd,n,c,r,fftw_estimate)
47end if
48!$OMP END CRITICAL(fftw_)
49call sfftw_execute(plan)
50!$OMP CRITICAL(fftw_)
51call sfftw_destroy_plan(plan)
52!$OMP END CRITICAL(fftw_)
53if (sgn == -1) then
54 p=product(n(1:nd))
55 t1=1.e0/real(p)
56 p=p/n(1)
57 p=p*(n(1)/2+1)
58 call csscal(p,t1,c,1)
59end if
60end subroutine
61
subroutine cfftifc(nd, n, sgn, c)
subroutine rcfftifc(nd, n, sgn, r, c)