📄 fourier1d.f90
字号:
!***! 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -