NCEPLIBS-sp  2.3.3
spfft.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Perform multiple fast fourier transforms.
4 C> @author IREDELL ORG: W/NMC23 @date 96-02-20
5 
6 C> This subprogram performs multiple fast fourier transforms
7 C> between complex amplitudes in fourier space and real values
8 C> in cyclic physical space.
9 C> Subprogram spfft must be invoked first with idir=0
10 C> to initialize trigonemetric data. Use subprogram spfft1
11 C> to perform an fft without previous initialization.
12 C> This version invokes the ibm essl fft.
13 C>
14 C> the restrictions on imax are that it must be a multiple
15 C> of 1 to 25 factors of two, up to 2 factors of three,
16 C> and up to 1 factor of five, seven and eleven.
17 C>
18 C> If IDIR=0, then W and G need not contain any valid data.
19 C> the other parameters must be supplied and cannot change
20 C> in succeeding calls until the next time it is called with IDIR=0.
21 C>
22 C> This subprogram is not thread-safe when IDIR=0. On the other hand,
23 C> when IDIR is not zero, it can be called from a threaded region.
24 C>
25 C> @param IMAX - INTEGER NUMBER OF VALUES IN THE CYCLIC PHYSICAL SPACE
26 C> (SEE LIMITATIONS ON IMAX IN REMARKS BELOW.)
27 C> @param INCW - INTEGER FIRST DIMENSION OF THE COMPLEX AMPLITUDE ARRAY
28 C> (INCW >= IMAX/2+1)
29 C> @param INCG - INTEGER FIRST DIMENSION OF THE REAL VALUE ARRAY
30 C> (INCG >= IMAX)
31 C> @param KMAX - INTEGER NUMBER OF TRANSFORMS TO PERFORM
32 C> @param[out] W - COMPLEX(INCW,KMAX) COMPLEX AMPLITUDES IF IDIR>0
33 C> @param[out] G - REAL(INCG,KMAX) REAL VALUES IF IDIR<0
34 C> @param IDIR - INTEGER DIRECTION FLAG
35 C> IDIR=0 TO INITIALIZE INTERNAL TRIGONOMETRIC DATA
36 C> IDIR>0 TO TRANSFORM FROM FOURIER TO PHYSICAL SPACE
37 C> IDIR<0 TO TRANSFORM FROM PHYSICAL TO FOURIER SPACE
38 C>
39 C> CALLED:
40 C> - SCRFT() IBM ESSL COMPLEX TO REAL FOURIER TRANSFORM
41 C> - SRCFT() IBM ESSL REAL TO COMPLEX FOURIER TRANSFORM
42  SUBROUTINE spfft(IMAX,INCW,INCG,KMAX,W,G,IDIR)
43 
44  IMPLICIT NONE
45  INTEGER,INTENT(IN):: IMAX,INCW,INCG,KMAX,IDIR
46  COMPLEX,INTENT(INOUT):: W(INCW,KMAX)
47  REAL,INTENT(INOUT):: G(INCG,KMAX)
48  INTEGER,SAVE:: NAUX1=0
49  REAL,SAVE,ALLOCATABLE:: AUX1CR(:),AUX1RC(:)
50  INTEGER:: NAUX2
51  REAL:: AUX2(20000+INT(0.57*IMAX))
52 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53  naux2=20000+int(0.57*imax)
54 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 C INITIALIZATION.
56 C ALLOCATE AND FILL AUXILIARY ARRAYS WITH TRIGONOMETRIC DATA
57  SELECT CASE(idir)
58  CASE(0)
59  IF(naux1.GT.0) DEALLOCATE(aux1cr,aux1rc)
60  naux1=25000+int(0.82*imax)
61  ALLOCATE(aux1cr(naux1),aux1rc(naux1))
62  CALL scrft(1,w,incw,g,incg,imax,kmax,-1,1.,
63  & aux1cr,naux1,aux2,naux2,0.,0)
64  CALL srcft(1,g,incg,w,incw,imax,kmax,+1,1./imax,
65  & aux1rc,naux1,aux2,naux2,0.,0)
66 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
67 C FOURIER TO PHYSICAL TRANSFORM.
68  CASE(1:)
69  CALL scrft(0,w,incw,g,incg,imax,kmax,-1,1.,
70  & aux1cr,naux1,aux2,naux2,0.,0)
71 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72 C PHYSICAL TO FOURIER TRANSFORM.
73  CASE(:-1)
74  CALL srcft(0,g,incg,w,incw,imax,kmax,+1,1./imax,
75  & aux1rc,naux1,aux2,naux2,0.,0)
76  END SELECT
77  END SUBROUTINE
spfft
subroutine spfft(IMAX, INCW, INCG, KMAX, W, G, IDIR)
This subprogram performs multiple fast fourier transforms between complex amplitudes in fourier space...
Definition: spfft.f:43