1 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
2 | ! |
---|
3 | ! FFTPACK 5.0 |
---|
4 | ! |
---|
5 | ! Authors: Paul N. Swarztrauber and Richard A. Valent |
---|
6 | ! |
---|
7 | ! $Id: rfft2f.f,v 1.5 2004/07/06 00:58:41 rodney Exp $ |
---|
8 | ! |
---|
9 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
10 | |
---|
11 | SUBROUTINE RFFT2F (LDIM, L, M, R, WSAVE, LENSAV, WORK, & |
---|
12 | & LENWRK, IER) |
---|
13 | INTEGER LDIM, L, M, LENSAV, LENWRK, IER |
---|
14 | REAL R(LDIM,M), WSAVE(LENSAV), WORK(LENWRK) |
---|
15 | ! |
---|
16 | ! |
---|
17 | ! Initialize IER |
---|
18 | ! |
---|
19 | IER = 0 |
---|
20 | ! |
---|
21 | ! Verify LENSAV |
---|
22 | ! |
---|
23 | LWSAV = L + INT(LOG (REAL(L))) +4 |
---|
24 | MWSAV = 2*M + INT(LOG (REAL(M))) +4 |
---|
25 | IF (LENSAV .LT. LWSAV+MWSAV) THEN |
---|
26 | IER = 2 |
---|
27 | CALL XERFFT ('RFFT2F', 6) |
---|
28 | GO TO 100 |
---|
29 | ENDIF |
---|
30 | ! |
---|
31 | ! Verify LENWRK |
---|
32 | ! |
---|
33 | IF (LENWRK .LT. 2*(L/2+1)*M) THEN |
---|
34 | IER = 3 |
---|
35 | CALL XERFFT ('RFFT2F', 8) |
---|
36 | GO TO 100 |
---|
37 | ENDIF |
---|
38 | ! |
---|
39 | ! Verify LDIM is as big as L |
---|
40 | ! |
---|
41 | IF (LDIM .LT. 2*(L/2+1)) THEN |
---|
42 | IER = 5 |
---|
43 | CALL XERFFT ('RFFT2F', -6) |
---|
44 | GO TO 100 |
---|
45 | ENDIF |
---|
46 | ! |
---|
47 | ! Transform first dimension of array |
---|
48 | ! |
---|
49 | CALL RFFTMF(M,LDIM,L,1,R,M*LDIM,WSAVE(1), & |
---|
50 | & L+INT(LOG(REAL(L)))+4,WORK,2*(L/2+1)*M,IER1) |
---|
51 | IF(IER1.NE.0) THEN |
---|
52 | IER=20 |
---|
53 | CALL XERFFT('RFFT2F',-5) |
---|
54 | GO TO 100 |
---|
55 | ENDIF |
---|
56 | ! |
---|
57 | ! reshuffle to add in nyquist imaginary components |
---|
58 | ! |
---|
59 | DO J=1,M |
---|
60 | IF(MOD(L,2).EQ.0) R(L+2,J)=0.0 |
---|
61 | DO I=L,2,-1 |
---|
62 | R(I+1,J)=R(I,J) |
---|
63 | ENDDO |
---|
64 | R(2,J)=0.0 |
---|
65 | ENDDO |
---|
66 | ! |
---|
67 | ! transform second dimension of array |
---|
68 | ! |
---|
69 | CALL CFFTMF(L/2+1,1,M,LDIM/2,R,M*LDIM/2, & |
---|
70 | & WSAVE(L+INT(LOG(REAL(L)))+5), & |
---|
71 | & 2*M+INT(LOG(REAL(M)))+4,WORK,2*(L/2+1)*M,IER1) |
---|
72 | IF(IER1.NE.0) THEN |
---|
73 | IER=20 |
---|
74 | CALL XERFFT('RFFT2F',-5) |
---|
75 | GO TO 100 |
---|
76 | ENDIF |
---|
77 | ! |
---|
78 | 100 CONTINUE |
---|
79 | ! |
---|
80 | RETURN |
---|
81 | END |
---|