Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | /* |
2 | * Copyright (c) 1997-1999 Massachusetts Institute of Technology |
||
3 | * |
||
4 | * This program is free software; you can redistribute it and/or modify |
||
5 | * it under the terms of the GNU General Public License as published by |
||
6 | * the Free Software Foundation; either version 2 of the License, or |
||
7 | * (at your option) any later version. |
||
8 | * |
||
9 | * This program is distributed in the hope that it will be useful, |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | * GNU General Public License for more details. |
||
13 | * |
||
14 | * You should have received a copy of the GNU General Public License |
||
15 | * along with this program; if not, write to the Free Software |
||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
17 | * |
||
18 | */ |
||
19 | |||
20 | #include <ports/rfftw.h> |
||
21 | #include <ports/f77_func.h> |
||
22 | |||
23 | #ifdef F77_FUNC_ /* only compile wrappers if fortran mangling is known */ |
||
24 | |||
25 | /* rfftwf77.c: FORTRAN-callable "wrappers" for some of the RFFTW routines. |
||
26 | |||
27 | See also fftwf77.c. */ |
||
28 | |||
29 | #ifdef __cplusplus |
||
30 | extern "C" { |
||
31 | #endif /* __cplusplus */ |
||
32 | |||
33 | /************************************************************************/ |
||
34 | |||
35 | void F77_FUNC_(rfftw_f77_create_plan,RFFTW_F77_CREATE_PLAN) |
||
36 | (fftw_plan *p, int *n, int *idir, int *flags) |
||
37 | { |
||
38 | fftw_direction dir = *idir < 0 ? FFTW_FORWARD : FFTW_BACKWARD; |
||
39 | |||
40 | *p = rfftw_create_plan(*n,dir,*flags); |
||
41 | } |
||
42 | |||
43 | void F77_FUNC_(rfftw_f77_destroy_plan,RFFTW_F77_DESTROY_PLAN) |
||
44 | (fftw_plan *p) |
||
45 | { |
||
46 | rfftw_destroy_plan(*p); |
||
47 | } |
||
48 | |||
49 | void F77_FUNC_(rfftw_f77,RFFTW_F77) |
||
50 | (fftw_plan *p, int *howmany, fftw_real *in, int *istride, int *idist, |
||
51 | fftw_real *out, int *ostride, int *odist) |
||
52 | { |
||
53 | rfftw(*p,*howmany,in,*istride,*idist,out,*ostride,*odist); |
||
54 | } |
||
55 | |||
56 | void F77_FUNC_(rfftw_f77_one,RFFTW_F77_ONE) |
||
57 | (fftw_plan *p, fftw_real *in, fftw_real *out) |
||
58 | { |
||
59 | rfftw_one(*p,in,out); |
||
60 | } |
||
61 | |||
62 | extern void fftw_reverse_int_array(int *a, int n); |
||
63 | |||
64 | void F77_FUNC_(rfftwnd_f77_create_plan,RFFTWND_F77_CREATE_PLAN) |
||
65 | (fftwnd_plan *p, int *rank, int *n, int *idir, int *flags) |
||
66 | { |
||
67 | fftw_direction dir = *idir < 0 ? FFTW_FORWARD : FFTW_BACKWARD; |
||
68 | |||
69 | fftw_reverse_int_array(n,*rank); /* column-major -> row-major */ |
||
70 | *p = rfftwnd_create_plan(*rank,n,dir,*flags); |
||
71 | fftw_reverse_int_array(n,*rank); /* reverse back */ |
||
72 | } |
||
73 | |||
74 | void F77_FUNC_(rfftw2d_f77_create_plan,RFFTW2D_F77_CREATE_PLAN) |
||
75 | (fftwnd_plan *p, int *nx, int *ny, int *idir, int *flags) |
||
76 | { |
||
77 | fftw_direction dir = *idir < 0 ? FFTW_FORWARD : FFTW_BACKWARD; |
||
78 | |||
79 | *p = rfftw2d_create_plan(*ny,*nx,dir,*flags); |
||
80 | } |
||
81 | |||
82 | void F77_FUNC_(rfftw3d_f77_create_plan,RFFTW3D_F77_CREATE_PLAN) |
||
83 | (fftwnd_plan *p, int *nx, int *ny, int *nz, int *idir, int *flags) |
||
84 | { |
||
85 | fftw_direction dir = *idir < 0 ? FFTW_FORWARD : FFTW_BACKWARD; |
||
86 | |||
87 | *p = rfftw3d_create_plan(*nz,*ny,*nx,dir,*flags); |
||
88 | } |
||
89 | |||
90 | void F77_FUNC_(rfftwnd_f77_destroy_plan,RFFTWND_F77_DESTROY_PLAN) |
||
91 | (fftwnd_plan *p) |
||
92 | { |
||
93 | rfftwnd_destroy_plan(*p); |
||
94 | } |
||
95 | |||
96 | void F77_FUNC_(rfftwnd_f77_real_to_complex,RFFTWND_F77_REAL_TO_COMPLEX) |
||
97 | (fftwnd_plan *p, int *howmany, fftw_real *in, int *istride, int *idist, |
||
98 | fftw_complex *out, int *ostride, int *odist) |
||
99 | { |
||
100 | rfftwnd_real_to_complex(*p,*howmany,in,*istride,*idist, |
||
101 | out,*ostride,*odist); |
||
102 | } |
||
103 | |||
104 | void F77_FUNC_(rfftwnd_f77_one_real_to_complex,RFFTWND_F77_ONE_REAL_TO_COMPLEX) |
||
105 | (fftwnd_plan *p, fftw_real *in, fftw_complex *out) |
||
106 | { |
||
107 | rfftwnd_one_real_to_complex(*p,in,out); |
||
108 | } |
||
109 | |||
110 | void F77_FUNC_(rfftwnd_f77_complex_to_real,RFFTWND_F77_COMPLEX_TO_REAL) |
||
111 | (fftwnd_plan *p, int *howmany, fftw_complex *in, int *istride, int *idist, |
||
112 | fftw_real *out, int *ostride, int *odist) |
||
113 | { |
||
114 | rfftwnd_complex_to_real(*p,*howmany,in,*istride,*idist, |
||
115 | out,*ostride,*odist); |
||
116 | } |
||
117 | |||
118 | void F77_FUNC_(rfftwnd_f77_one_complex_to_real,RFFTWND_F77_ONE_COMPLEX_TO_REAL) |
||
119 | (fftwnd_plan *p, fftw_complex *in, fftw_real *out) |
||
120 | { |
||
121 | rfftwnd_one_complex_to_real(*p,in,out); |
||
122 | } |
||
123 | |||
124 | /****************************************************************************/ |
||
125 | |||
126 | #ifdef __cplusplus |
||
127 | } /* extern "C" */ |
||
128 | #endif /* __cplusplus */ |
||
129 | |||
130 | #endif /* defined(F77_FUNC_) */ |