2024-01-08 18:55:00 -05:00
|
|
|
subroutine fftbig(dd,nmax)
|
|
|
|
|
2024-01-10 15:16:44 -05:00
|
|
|
! Do the full length FFT of complex data stored in array dd(2,nmax).
|
2024-01-08 18:55:00 -05:00
|
|
|
|
2024-01-10 15:16:44 -05:00
|
|
|
use, intrinsic :: iso_c_binding
|
|
|
|
|
|
|
|
use FFTW3
|
2024-01-08 18:55:00 -05:00
|
|
|
use timer_module, only: timer
|
2024-01-10 15:16:44 -05:00
|
|
|
parameter (MAXFFT1=5376000)
|
2024-01-08 18:55:00 -05:00
|
|
|
real*4 dd(2,nmax) !Input data
|
|
|
|
complex ca(MAXFFT1) !FFT of input
|
|
|
|
real*8 df
|
2024-01-10 15:16:44 -05:00
|
|
|
type(C_PTR) :: plan1 !Pointer to FFTW plan
|
2024-01-08 18:55:00 -05:00
|
|
|
logical first
|
|
|
|
common/cacb/ca
|
|
|
|
equivalence (rfilt,cfilt)
|
2024-01-10 15:53:05 -05:00
|
|
|
data first/.true./,npatience/0/
|
2024-01-08 18:55:00 -05:00
|
|
|
save
|
|
|
|
|
|
|
|
if(nmax.lt.0) go to 900
|
|
|
|
|
|
|
|
nfft1=MAXFFT1
|
|
|
|
if(first) then
|
|
|
|
nflags=FFTW_ESTIMATE
|
|
|
|
if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT
|
|
|
|
if(npatience.eq.2) nflags=FFTW_MEASURE
|
|
|
|
if(npatience.eq.3) nflags=FFTW_PATIENT
|
|
|
|
if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE
|
|
|
|
|
|
|
|
! Plan the big FFT just once
|
|
|
|
call timer('FFTplan ',0)
|
2024-01-10 15:16:44 -05:00
|
|
|
plan1=fftwf_plan_dft_1d(nfft1,ca,ca,+1,nflags)
|
2024-01-08 18:55:00 -05:00
|
|
|
call timer('FFTplan ',1)
|
|
|
|
df=96000.d0/nfft1
|
|
|
|
first=.false.
|
|
|
|
endif
|
|
|
|
|
|
|
|
nz=min(nmax,nfft1)
|
|
|
|
do i=1,nz
|
|
|
|
ca(i)=cmplx(dd(1,i),dd(2,i))
|
|
|
|
enddo
|
|
|
|
|
|
|
|
if(nmax.lt.nfft1) then
|
|
|
|
do i=nmax+1,nfft1
|
|
|
|
ca(i)=0.
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
call timer('FFTbig ',0)
|
2024-01-10 15:16:44 -05:00
|
|
|
call fftwf_execute_dft(plan1,ca,ca)
|
2024-01-08 18:55:00 -05:00
|
|
|
call timer('FFTbig ',1)
|
|
|
|
go to 999
|
|
|
|
|
2024-01-10 15:16:44 -05:00
|
|
|
900 call fftwf_destroy_plan(plan1)
|
2024-01-08 18:55:00 -05:00
|
|
|
|
|
|
|
999 return
|
|
|
|
end subroutine fftbig
|