fourier1d.f90

来自「Ground state of the time-independent Gro」· F90 代码 · 共 56 行

F90
56
字号
!***! The following code is for use with the DFFTPACK library!***module fft_data  integer, parameter :: dp=kind(1.d0)  real(dp) :: fact  real(dp), dimension(:), allocatable :: wsaveend module fft_datasubroutine fft_init(ng)  !  ! Initialize the Fourier transform  !  use fft_data  implicit none  integer, intent(in) :: ng  allocate(wsave(2*ng+15))  call dffti(ng,wsave)  fact = 1.d0/real(ng,dp)  returnend subroutine fft_initsubroutine fourier1D(ng,fin,fout,direction)  !  ! 1D Fourier transform  !  use fft_data  implicit none  integer, intent(in) :: ng  real(dp), dimension(ng), intent(in) :: fin  real(dp), dimension(ng), intent(out) :: fout  integer, intent(in) :: direction  if(direction >= 0) then     ! Forward transform     fout = fin     call dfftf(ng,fout,wsave)  else     ! Backward transform     fout = fin     call dfftb(ng,fout,wsave)     fout = fout*fact  end if  returnend subroutine fourier1D

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?