1 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
2 | ! |
---|
3 | ! FFTPACK 5.0 |
---|
4 | ! |
---|
5 | ! Authors: Paul N. Swarztrauber and Richard A. Valent |
---|
6 | ! |
---|
7 | ! $Id: rfft2b.f,v 1.5 2004/07/06 00:58:41 rodney Exp $ |
---|
8 | ! |
---|
9 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
10 | |
---|
11 | SUBROUTINE RFFT2B (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 ('RFFT2B', 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 ('RFFT2B', 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 ('RFFT2B', -6) |
---|
44 | GO TO 100 |
---|
45 | ENDIF |
---|
46 | ! |
---|
47 | ! transform second dimension of array |
---|
48 | ! |
---|
49 | CALL CFFTMB(L/2+1,1,M,LDIM/2,R,M*LDIM/2, & |
---|
50 | & WSAVE(L+INT(LOG(REAL(L)))+5), & |
---|
51 | & 2*M+INT(LOG(REAL(M)))+4,WORK,2*(L/2+1)*M,IER1) |
---|
52 | IF(IER1.NE.0) THEN |
---|
53 | IER=20 |
---|
54 | CALL XERFFT('RFFT2B',-5) |
---|
55 | GO TO 100 |
---|
56 | ENDIF |
---|
57 | ! |
---|
58 | ! reshuffle |
---|
59 | ! |
---|
60 | DO J=1,M |
---|
61 | DO I=2,L |
---|
62 | R(I,J)=R(I+1,J) |
---|
63 | ENDDO |
---|
64 | ENDDO |
---|
65 | ! |
---|
66 | ! Transform first dimension of array |
---|
67 | ! |
---|
68 | CALL RFFTMB(M,LDIM,L,1,R,M*LDIM,WSAVE(1), & |
---|
69 | & L+INT(LOG(REAL(L)))+4,WORK,2*(L/2+1)*M,IER1) |
---|
70 | IF(IER1.NE.0) THEN |
---|
71 | IER=20 |
---|
72 | CALL XERFFT('RFFT2F',-5) |
---|
73 | GO TO 100 |
---|
74 | ENDIF |
---|
75 | ! |
---|
76 | 100 CONTINUE |
---|
77 | ! |
---|
78 | RETURN |
---|
79 | END |
---|