82 # ifdef _COMPILER_VERSION 91 #if defined(_CRAY) || defined(sgi_mipspro) 96 use fms_mod,
only: write_version_number, &
232 real(R8_KIND),
allocatable,
dimension(:) ::
table8 233 real(R4_KIND),
allocatable,
dimension(:) ::
table4 235 integer ,
allocatable,
dimension(:) ::
ifax 243 #include<file_version.h> 292 real (R4_KIND),
intent(in),
dimension(:,:) :: grid
293 complex(R4_KIND),
dimension(lenc,size(grid,2)) :: fourier
298 real(R4_KIND),
dimension((2*leng+4)*size(grid,2)) :: work
301 real(R4_KIND),
dimension(leng2) :: work
306 real(R4_KIND),
dimension(size(grid,2),leng) :: data, work
309 real,
dimension(leng2,size(grid,2)) :: data
310 real,
dimension(leng1,size(grid,2)) :: work
314 #if defined(SGICRAY) || defined(NAGFFT) 315 real(R4_KIND) :: scale
317 integer :: j, k, num, len_grid
323 'fft_init must be called.')
327 len_grid =
size(grid,1)
330 'size of first dimension of input data is wrong')
333 'length of input data too small.')
342 scale = 1./
real(
leng)
355 'float kind not supported for nag fft')
359 scale = 1./sqrt(float(
leng))
361 fourier(1,:) = cmplx(
data(:,1), 0. )
363 fourier(k,:) = cmplx(
data(:,k),
data(:,
leng-k+2) )
365 fourier(
lenc,:) = cmplx(
data(:,
lenc), 0. )
374 fourier(k,j) = cmplx(
data(2*k-1,j),
data(2*k,j) )
428 complex(R4_KIND),
intent(in),
dimension(:,:) :: fourier
429 real (R4_KIND),
dimension(leng1,size(fourier,2)) :: grid
434 real(R4_KIND),
dimension((2*leng+4)*size(fourier,2)) :: work
437 real(R4_KIND),
dimension(leng2) :: work
442 real(R4_KIND),
dimension(size(fourier,2),leng) :: data, work
445 real,
dimension(leng2,size(fourier,2)) :: data
446 real,
dimension(leng1,size(fourier,2)) :: work
450 #if defined(SGICRAY) || defined(NAGFFT) 451 real(R4_KIND) :: scale
453 integer :: j, k, num, len_fourier
459 'fft_init must be called.')
463 len_fourier =
size(fourier,1)
464 num =
size(fourier,2)
468 'size of first dimension of input data is wrong')
471 'length of input data too small.')
480 call csfftm (+1,
leng,num,scale, fourier,len_fourier, &
483 call csfftm (+1,
leng,num,scale, fourier,len_fourier, &
491 'float kind not supported for nag fft')
495 data(:,k) =
real(fourier(k,:))
498 data(:,
leng-k+2) = aimag(fourier(k,:))
502 scale = sqrt(
real(
leng))
504 grid(1:
leng,j) =
data(j,1:
leng)*scale
510 data(2*k-1,j) = real(fourier(k,j))
511 data(2*k ,j) = aimag(fourier(k,j))
569 real (R8_KIND),
intent(in),
dimension(:,:) :: grid
570 complex(R8_KIND),
dimension(lenc,size(grid,2)) :: fourier
575 real(R8_KIND),
dimension((2*leng+4)*size(grid,2)) :: work
578 real(R8_KIND),
dimension(leng2) :: work
583 real(R8_KIND),
dimension(size(grid,2),leng) :: data, work
586 real,
dimension(leng2,size(grid,2)) :: data
587 real,
dimension(leng1,size(grid,2)) :: work
591 #if defined(SGICRAY) || defined(NAGFFT) 592 real(R8_KIND) :: scale
594 integer :: j, k, num, len_grid
603 'fft_init must be called.')
607 len_grid =
size(grid,1)
610 'size of first dimension of input data is wrong')
613 'length of input data too small.')
621 scale = 1./float(
leng)
635 call c06fpf ( num,
leng,
data,
's',
table8, work, ifail )
636 scale = 1./sqrt(float(
leng))
638 fourier(1,:) = cmplx(
data(:,1), 0. )
640 fourier(k,:) = cmplx(
data(:,k),
data(:,
leng-k+2) )
642 fourier(
lenc,:) = cmplx(
data(:,
lenc), 0. )
651 fourier(k,j) = cmplx(
data(2*k-1,j),
data(2*k,j) )
706 complex(R8_KIND),
intent(in),
dimension(:,:) :: fourier
707 real (R8_KIND),
dimension(leng1,size(fourier,2)) :: grid
712 real(R8_KIND),
dimension((2*leng+4)*size(fourier,2)) :: work
715 real(R8_KIND),
dimension(leng2) :: work
720 real(R8_KIND),
dimension(size(fourier,2),leng) :: data, work
723 real,
dimension(leng2,size(fourier,2)) :: data
724 real,
dimension(leng1,size(fourier,2)) :: work
728 #if defined(SGICRAY) || defined(NAGFFT) 729 real(R8_KIND) :: scale
731 integer :: j, k, num, len_fourier
740 'fft_init must be called.')
744 len_fourier =
size(fourier,1)
745 num =
size(fourier,2)
749 'size of first dimension of input data is wrong')
752 'length of input data too small.')
761 call csfftm (+1,
leng,num,scale, fourier,len_fourier, &
764 call zdfftm (+1,
leng,num,scale, fourier,len_fourier, &
773 data(:,k) =
real(fourier(k,:))
776 data(:,
leng-k+2) = aimag(fourier(k,:))
779 call c06gqf ( num,
leng,
data, ifail )
780 call c06fqf ( num,
leng,
data,
's',
table8, work, ifail )
783 scale = sqrt(
real(
leng))
785 grid(1:
leng,j) =
data(j,1:
leng)*scale
791 data(2*k-1,j) = real(fourier(k,j))
792 data(2*k ,j) = aimag(fourier(k,j))
828 real (R4_KIND),
intent(in),
dimension(:,:,:) :: grid
829 complex(R4_KIND),
dimension(lenc,size(grid,2),size(grid,3)) :: fourier
833 do n = 1,
size(grid,3)
859 complex(R4_KIND),
intent(in),
dimension(:,:,:) :: fourier
860 real (R4_KIND),
dimension(leng1,size(fourier,2),size(fourier,3)) :: grid
864 do n = 1,
size(fourier,3)
890 real (R8_KIND),
intent(in),
dimension(:,:,:) :: grid
891 complex(R8_KIND),
dimension(lenc,size(grid,2),size(grid,3)) :: fourier
895 do n = 1,
size(grid,3)
932 complex(R8_KIND),
intent(in),
dimension(:,:,:) :: fourier
933 real (R8_KIND),
dimension(leng1,size(fourier,2),size(fourier,3)) :: grid
937 do n = 1,
size(fourier,3)
976 integer,
intent(in) :: n
979 real (R4_KIND) :: dummy4(1)
980 complex(R4_KIND) :: cdummy4(1)
981 real (R8_KIND) :: dummy8(1)
982 complex(R8_KIND) :: cdummy8(1)
986 real(R8_KIND) :: data8(n), work8(n)
987 real(R4_KIND) :: data4(n), work4(n)
988 integer :: ifail4, ifail8
995 call error_handler (
'fft_init',
'attempted to reinitialize fft')
999 call write_version_number(
"FFT_MOD", version)
1011 call scfftm (0,
leng,1,0.0, dummy4, 1, cdummy4, 1,
table4, dummy4, 0)
1012 call scfftm (0,
leng,1,0.0, dummy8, 1, cdummy8, 1,
table8, dummy8, 0)
1017 call scfftm (0,
leng,1,0.0, dummy4, 1, cdummy4, 1,
table4, dummy8, isys)
1018 call dzfftm (0,
leng,1,0.0, dummy8, 1, cdummy8, 1,
table8, dummy8, isys)
1025 call c06fpf ( 1,
leng, data8,
'i',
table8, work8, ifail8 )
1032 if (ifail4 /= 0 .or. ifail8 /= 0)
then 1033 call error_handler (
'fft_init',
'nag fft initialization error')
1074 'attempt to un-initialize fft that has not been initialized')
1097 character(len=*),
intent(in) :: routine, message
1114 integer,
parameter :: lot = 2
1115 real ,
allocatable :: ain(:,:), aout(:,:)
1116 complex,
allocatable :: four(:,:)
1117 integer :: i, j, m, n
1118 integer :: ntrans(2) = (/ 60, 90 /)
1125 allocate (ain(n+1,lot),aout(n+1,lot),four(n/2+1,lot))
1126 call random_number (ain(1:n,:))
1127 aout(1:n,:) = ain(1:n,:)
1137 write (*,
'(2i4,3(2x,f15.9))') j, i, ain(i,j), aout(i,j), aout(i,j)-ain(i,j)
1142 deallocate (ain,aout,four)
real(r4_kind) function, dimension(leng1, size(fourier, 2), size(fourier, 3)) fft_fourier_to_grid_float_3d(fourier)
subroutine, public fft991(a, work, trigs, ifax, inc, jump, n, lot, isign)
subroutine error_handler(routine, message)
real(r8_kind) function, dimension(leng1, size(fourier, 2), size(fourier, 3)) fft_fourier_to_grid_double_3d(fourier)
logical module_is_initialized
real(r4_kind) function, dimension(leng1, size(fourier, 2)) fft_fourier_to_grid_float_2d(fourier)
integer, dimension(:), allocatable ifax
complex(r4_kind) function, dimension(lenc, size(grid, 2)) fft_grid_to_fourier_float_2d(grid)
subroutine, public fft_init(n)
subroutine, public set99(trigs, ifax, n)
Fortran module for Eigen FFTs.
complex(r8_kind) function, dimension(lenc, size(grid, 2)) fft_grid_to_fourier_double_2d(grid)
real(r8_kind), dimension(:), allocatable table8
real(r4_kind), dimension(:), allocatable table4
complex(r8_kind) function, dimension(lenc, size(grid, 2), size(grid, 3)) fft_grid_to_fourier_double_3d(grid)
real, dimension(:), allocatable table99
complex(r4_kind) function, dimension(lenc, size(grid, 2), size(grid, 3)) fft_grid_to_fourier_float_3d(grid)
subroutine, public fft_end
This routine is called to unset the transform size and deallocate memory.
subroutine, public error_mesg(routine, message, level)
real(r8_kind) function, dimension(leng1, size(fourier, 2)) fft_fourier_to_grid_double_2d(fourier)