PyFishPack 0.1.0__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. PyFishPack/__init__.py +86 -0
  2. PyFishPack/__pycache__/__init__.cpython-313.pyc +0 -0
  3. PyFishPack/__pycache__/apps.cpython-313.pyc +0 -0
  4. PyFishPack/_dummy.c +23 -0
  5. PyFishPack/_dummy.cp313-win_amd64.pyd +0 -0
  6. PyFishPack/apps.py +3640 -0
  7. PyFishPack/fishpack.cp313-win_amd64.dll.a +0 -0
  8. PyFishPack/fishpack.cp313-win_amd64.pyd +0 -0
  9. PyFishPack/meson.build +213 -0
  10. PyFishPack/src/archive/f77/Makefile +19 -0
  11. PyFishPack/src/archive/f77/blktri.f +1404 -0
  12. PyFishPack/src/archive/f77/cblktri.f +1414 -0
  13. PyFishPack/src/archive/f77/cmgnbn.f +1592 -0
  14. PyFishPack/src/archive/f77/comf.f +186 -0
  15. PyFishPack/src/archive/f77/fftpack.f +2968 -0
  16. PyFishPack/src/archive/f77/genbun.f +1335 -0
  17. PyFishPack/src/archive/f77/gnbnaux.f +314 -0
  18. PyFishPack/src/archive/f77/hstcrt.f +443 -0
  19. PyFishPack/src/archive/f77/hstcsp.f +683 -0
  20. PyFishPack/src/archive/f77/hstcyl.f +485 -0
  21. PyFishPack/src/archive/f77/hstplr.f +538 -0
  22. PyFishPack/src/archive/f77/hstssp.f +634 -0
  23. PyFishPack/src/archive/f77/hw3crt.f +687 -0
  24. PyFishPack/src/archive/f77/hwscrt.f +512 -0
  25. PyFishPack/src/archive/f77/hwscsp.f +728 -0
  26. PyFishPack/src/archive/f77/hwscyl.f +538 -0
  27. PyFishPack/src/archive/f77/hwsplr.f +602 -0
  28. PyFishPack/src/archive/f77/hwsssp.f +780 -0
  29. PyFishPack/src/archive/f77/pois3d.f +550 -0
  30. PyFishPack/src/archive/f77/poistg.f +875 -0
  31. PyFishPack/src/archive/f77/sepaux.f +361 -0
  32. PyFishPack/src/archive/f77/sepeli.f +1029 -0
  33. PyFishPack/src/archive/f77/sepx4.f +958 -0
  34. PyFishPack/src/centered_axisymmetric_spherical_solver.f90 +1002 -0
  35. PyFishPack/src/centered_cartesian_helmholtz_solver_3d.f90 +819 -0
  36. PyFishPack/src/centered_cartesian_solver.f90 +583 -0
  37. PyFishPack/src/centered_cylindrical_solver.f90 +634 -0
  38. PyFishPack/src/centered_helmholtz_solvers.f90 +156 -0
  39. PyFishPack/src/centered_polar_solver.f90 +746 -0
  40. PyFishPack/src/centered_real_linear_systems_solver.f90 +280 -0
  41. PyFishPack/src/centered_spherical_solver.f90 +928 -0
  42. PyFishPack/src/complex_block_tridiagonal_linear_systems_solver.f90 +1947 -0
  43. PyFishPack/src/complex_linear_systems_solver.f90 +1787 -0
  44. PyFishPack/src/fftpack_c_api.f90 +86 -0
  45. PyFishPack/src/fishpack.f90 +191 -0
  46. PyFishPack/src/fishpack.pyf +504 -0
  47. PyFishPack/src/fishpack_c_api.f90 +365 -0
  48. PyFishPack/src/fishpack_original.pyf +2119 -0
  49. PyFishPack/src/fishpack_precision.f90 +53 -0
  50. PyFishPack/src/general_linear_systems_solver_3d.f90 +296 -0
  51. PyFishPack/src/iterative_solvers.f90 +969 -0
  52. PyFishPack/src/main.f90 +10 -0
  53. PyFishPack/src/pyfishpack_module.c +1302 -0
  54. PyFishPack/src/real_block_tridiagonal_linear_systems_solver.f90 +319 -0
  55. PyFishPack/src/sepeli.f90 +1454 -0
  56. PyFishPack/src/sepx4.f90 +1338 -0
  57. PyFishPack/src/staggered_axisymmetric_spherical_solver.f90 +908 -0
  58. PyFishPack/src/staggered_cartesian_solver.f90 +553 -0
  59. PyFishPack/src/staggered_cylindrical_solver.f90 +630 -0
  60. PyFishPack/src/staggered_helmholtz_solvers.f90 +172 -0
  61. PyFishPack/src/staggered_polar_solver.f90 +651 -0
  62. PyFishPack/src/staggered_real_linear_systems_solver.f90 +258 -0
  63. PyFishPack/src/staggered_spherical_solver.f90 +758 -0
  64. PyFishPack/src/three_dimensional_solvers.f90 +602 -0
  65. PyFishPack/src/type_CenteredCyclicReductionUtility.f90 +1714 -0
  66. PyFishPack/src/type_CyclicReductionUtility.f90 +472 -0
  67. PyFishPack/src/type_FishpackWorkspace.f90 +290 -0
  68. PyFishPack/src/type_GeneralizedCyclicReductionUtility.f90 +1980 -0
  69. PyFishPack/src/type_PeriodicFastFourierTransform.f90 +3789 -0
  70. PyFishPack/src/type_SepAux.f90 +586 -0
  71. PyFishPack/src/type_StaggeredCyclicReductionUtility.f90 +893 -0
  72. pyfishpack-0.1.0.dist-info/DELVEWHEEL +2 -0
  73. pyfishpack-0.1.0.dist-info/METADATA +81 -0
  74. pyfishpack-0.1.0.dist-info/RECORD +81 -0
  75. pyfishpack-0.1.0.dist-info/WHEEL +5 -0
  76. pyfishpack-0.1.0.dist-info/licenses/LICENSE +21 -0
  77. pyfishpack-0.1.0.dist-info/top_level.txt +1 -0
  78. pyfishpack.libs/libgcc_s_seh-1-25d59ccffa1a9009644065b069829e07.dll +0 -0
  79. pyfishpack.libs/libgfortran-5-08f2195cfa0d823e13371c5c3186a82a.dll +0 -0
  80. pyfishpack.libs/libquadmath-0-c5abb9113f1ee64b87a889958e4b7418.dll +0 -0
  81. pyfishpack.libs/libwinpthread-1-83908d14abfafb8b3bfa38cf51ecee56.dll +0 -0
@@ -0,0 +1,1302 @@
1
+ #define PY_SSIZE_T_CLEAN
2
+ #define NPY_NO_DEPRECATED_API NPY_1_20_API_VERSION
3
+
4
+ #include <Python.h>
5
+ #include <numpy/arrayobject.h>
6
+ #include <string.h>
7
+
8
+ extern void pyfp_genbun(int nperod, int n, int mperod, int m, int idimy,
9
+ void *a, void *b, void *c, void *y, int *ierror);
10
+ extern void pyfp_poistg(int nperod, int n, int mperod, int m, int idimy,
11
+ void *a, void *b, void *c, void *y, int *ierror);
12
+ extern void pyfp_pois3d(int lperod, int l, double c1, int mperod, int m,
13
+ double c2, int nperod, int n, int ldimf, int mdimf,
14
+ void *a, void *b, void *c, void *f, int *ierror);
15
+ extern void pyfp_hwscrt(double a_lower, double b_upper, int m, int mbdcnd,
16
+ void *bda, int len_bda, void *bdb, int len_bdb,
17
+ double c_lower, double d_upper, int n, int nbdcnd,
18
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
19
+ double elmbda, int idimf, void *f, double *pertrb,
20
+ int *ierror);
21
+ extern void pyfp_hstcrt(double a_lower, double b_upper, int m, int mbdcnd,
22
+ void *bda, int len_bda, void *bdb, int len_bdb,
23
+ double c_lower, double d_upper, int n, int nbdcnd,
24
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
25
+ double elmbda, int idimf, void *f, double *pertrb,
26
+ int *ierror);
27
+ extern void pyfp_hwsplr(double a_lower, double b_upper, int m, int mbdcnd,
28
+ void *bda, int len_bda, void *bdb, int len_bdb,
29
+ double c_lower, double d_upper, int n, int nbdcnd,
30
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
31
+ double elmbda, int idimf, void *f, double *pertrb,
32
+ int *ierror);
33
+ extern void pyfp_hwscyl(double a_lower, double b_upper, int m, int mbdcnd,
34
+ void *bda, int len_bda, void *bdb, int len_bdb,
35
+ double c_lower, double d_upper, int n, int nbdcnd,
36
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
37
+ double elmbda, int idimf, void *f, double *pertrb,
38
+ int *ierror);
39
+ extern void pyfp_hstplr(double a_lower, double b_upper, int m, int mbdcnd,
40
+ void *bda, int len_bda, void *bdb, int len_bdb,
41
+ double c_lower, double d_upper, int n, int nbdcnd,
42
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
43
+ double elmbda, int idimf, void *f, double *pertrb,
44
+ int *ierror);
45
+ extern void pyfp_hstcyl(double a_lower, double b_upper, int m, int mbdcnd,
46
+ void *bda, int len_bda, void *bdb, int len_bdb,
47
+ double c_lower, double d_upper, int n, int nbdcnd,
48
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
49
+ double elmbda, int idimf, void *f, double *pertrb,
50
+ int *ierror);
51
+ extern void pyfp_hwsssp(double a_lower, double b_upper, int m, int mbdcnd,
52
+ void *bda, int len_bda, void *bdb, int len_bdb,
53
+ double c_lower, double d_upper, int n, int nbdcnd,
54
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
55
+ double elmbda, int idimf, void *f, double *pertrb,
56
+ int *ierror);
57
+ extern void pyfp_hstssp(double a_lower, double b_upper, int m, int mbdcnd,
58
+ void *bda, int len_bda, void *bdb, int len_bdb,
59
+ double c_lower, double d_upper, int n, int nbdcnd,
60
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
61
+ double elmbda, int idimf, void *f, double *pertrb,
62
+ int *ierror);
63
+ extern void pyfp_hwscsp(double a_lower, double b_upper, int m, int mbdcnd,
64
+ void *bda, int len_bda, void *bdb, int len_bdb,
65
+ double c_lower, double d_upper, int n, int nbdcnd,
66
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
67
+ double elmbda, int idimf, void *f, double *pertrb,
68
+ int *ierror);
69
+ extern void pyfp_hstcsp(double a_lower, double b_upper, int m, int mbdcnd,
70
+ void *bda, int len_bda, void *bdb, int len_bdb,
71
+ double c_lower, double d_upper, int n, int nbdcnd,
72
+ void *bdc, int len_bdc, void *bdd, int len_bdd,
73
+ double elmbda, int idimf, void *f, double *pertrb,
74
+ int *ierror);
75
+ extern void pyfp_hw3crt(double xs, double xf, int l, int lbdcnd,
76
+ void *bdxs, int bdxs_dim1, int bdxs_dim2,
77
+ void *bdxf, int bdxf_dim1, int bdxf_dim2,
78
+ double ys, double yf, int m, int mbdcnd,
79
+ void *bdys, int bdys_dim1, int bdys_dim2,
80
+ void *bdyf, int bdyf_dim1, int bdyf_dim2,
81
+ double zs, double zf, int n, int nbdcnd,
82
+ void *bdzs, int bdzs_dim1, int bdzs_dim2,
83
+ void *bdzf, int bdzf_dim1, int bdzf_dim2,
84
+ double elmbda, int ldimf, int mdimf, void *f,
85
+ double *pertrb, int *ierror);
86
+ extern void pyfp_sor_standard1d(int n, void *s, void *a, void *b, void *f,
87
+ double delx, int bcx, double optarg, double undef,
88
+ int mxloop, double tolerance, int *overflow,
89
+ double *relerr, int *loops);
90
+ extern void pyfp_sor_standard2d(int ny, int nx, void *s, void *a, void *b,
91
+ void *c, void *f, double dely, double delx,
92
+ int bcy, int bcx, double optarg, double undef,
93
+ int mxloop, double tolerance, int *overflow,
94
+ double *relerr, int *loops);
95
+ extern void pyfp_sor_standard3d(int nz, int ny, int nx, void *s, void *a,
96
+ void *b, void *c, void *f, double delz,
97
+ double dely, double delx, int bcz, int bcy,
98
+ int bcx, double optarg, double undef,
99
+ int mxloop, double tolerance, int *overflow,
100
+ double *relerr, int *loops);
101
+ extern void pyfp_sor_general2d(int ny, int nx, void *s, void *a, void *b,
102
+ void *c, void *d, void *e, void *fcoef, void *g,
103
+ double dely, double delx, int bcy, int bcx,
104
+ double optarg, double undef, int mxloop,
105
+ double tolerance, int *overflow, double *relerr,
106
+ int *loops);
107
+ extern void pyfp_sor_general3d(int nz, int ny, int nx, void *s, void *a,
108
+ void *b, void *c, void *d, void *e,
109
+ void *fcoef, void *g, void *h, double delz,
110
+ double dely, double delx, int bcz, int bcy,
111
+ int bcx, double optarg, double undef,
112
+ int mxloop, double tolerance, int *overflow,
113
+ double *relerr, int *loops);
114
+ extern void pyfp_sor_biharmonic2d(int ny, int nx, void *s, void *a, void *b,
115
+ void *c, void *d, void *e, void *fcoef,
116
+ void *g, void *h, void *icoef, void *jcoef,
117
+ double dely, double delx, int bcy, int bcx,
118
+ double optarg, double undef, int mxloop,
119
+ double tolerance, int *overflow,
120
+ double *relerr, int *loops);
121
+ extern void pyfp_fftpack_real_transform(int n, void *x, int kind, int direction);
122
+ extern void pyfp_fftpack_complex_transform(int n, void *c, int direction);
123
+
124
+ static PyArrayObject *as_double_1d(PyObject *obj, const char *name)
125
+ {
126
+ PyArrayObject *arr = (PyArrayObject *)PyArray_FROM_OTF(obj, NPY_DOUBLE, NPY_ARRAY_IN_ARRAY);
127
+ if (arr == NULL) {
128
+ return NULL;
129
+ }
130
+ if (PyArray_NDIM(arr) != 1) {
131
+ PyErr_Format(PyExc_ValueError, "%s must be a one-dimensional float64 array", name);
132
+ Py_DECREF(arr);
133
+ return NULL;
134
+ }
135
+ return arr;
136
+ }
137
+
138
+ static PyArrayObject *as_fortran_double_copy(PyObject *obj, int ndim, const char *name)
139
+ {
140
+ PyArray_Descr *descr = PyArray_DescrFromType(NPY_DOUBLE);
141
+ PyArrayObject *arr = (PyArrayObject *)PyArray_FromAny(
142
+ obj,
143
+ descr,
144
+ ndim,
145
+ ndim,
146
+ NPY_ARRAY_F_CONTIGUOUS | NPY_ARRAY_ALIGNED | NPY_ARRAY_WRITEABLE | NPY_ARRAY_ENSURECOPY,
147
+ NULL);
148
+ if (arr == NULL) {
149
+ return NULL;
150
+ }
151
+ if (!PyArray_ISFARRAY(arr)) {
152
+ PyErr_Format(PyExc_ValueError, "%s could not be converted to a Fortran-contiguous float64 array", name);
153
+ Py_DECREF(arr);
154
+ return NULL;
155
+ }
156
+ return arr;
157
+ }
158
+
159
+ static int require_len(PyArrayObject *arr, npy_intp expected, const char *name)
160
+ {
161
+ if (PyArray_DIM(arr, 0) < expected) {
162
+ PyErr_Format(PyExc_ValueError, "%s has length %zd, expected at least %zd",
163
+ name, (Py_ssize_t)PyArray_DIM(arr, 0), (Py_ssize_t)expected);
164
+ return 0;
165
+ }
166
+ return 1;
167
+ }
168
+
169
+ static int require_2d_shape(PyArrayObject *arr, npy_intp dim0, npy_intp dim1, const char *name)
170
+ {
171
+ if (PyArray_DIM(arr, 0) < dim0 || PyArray_DIM(arr, 1) < dim1) {
172
+ PyErr_Format(PyExc_ValueError, "%s has shape (%zd, %zd), expected at least (%zd, %zd)",
173
+ name,
174
+ (Py_ssize_t)PyArray_DIM(arr, 0), (Py_ssize_t)PyArray_DIM(arr, 1),
175
+ (Py_ssize_t)dim0, (Py_ssize_t)dim1);
176
+ return 0;
177
+ }
178
+ return 1;
179
+ }
180
+
181
+ static int require_3d_shape(PyArrayObject *arr, npy_intp dim0, npy_intp dim1, npy_intp dim2, const char *name)
182
+ {
183
+ if (PyArray_DIM(arr, 0) < dim0 || PyArray_DIM(arr, 1) < dim1 ||
184
+ PyArray_DIM(arr, 2) < dim2) {
185
+ PyErr_Format(PyExc_ValueError, "%s has shape (%zd, %zd, %zd), expected at least (%zd, %zd, %zd)",
186
+ name,
187
+ (Py_ssize_t)PyArray_DIM(arr, 0), (Py_ssize_t)PyArray_DIM(arr, 1),
188
+ (Py_ssize_t)PyArray_DIM(arr, 2),
189
+ (Py_ssize_t)dim0, (Py_ssize_t)dim1, (Py_ssize_t)dim2);
190
+ return 0;
191
+ }
192
+ return 1;
193
+ }
194
+
195
+ static int bc_code_from_string(const char *bc, const char *name)
196
+ {
197
+ if (strcmp(bc, "fixed") == 0) {
198
+ return 0;
199
+ }
200
+ if (strcmp(bc, "extend") == 0) {
201
+ return 1;
202
+ }
203
+ if (strcmp(bc, "periodic") == 0) {
204
+ return 2;
205
+ }
206
+ PyErr_Format(PyExc_NotImplementedError,
207
+ "%s must be one of 'fixed', 'extend', or 'periodic'", name);
208
+ return -1;
209
+ }
210
+
211
+ typedef void (*helmholtz_2d_solver)(double, double, int, int, void *, int, void *, int,
212
+ double, double, int, int, void *, int, void *, int,
213
+ double, int, void *, double *, int *);
214
+
215
+ static PyObject *fishpack_helmholtz_2d(PyObject *args, helmholtz_2d_solver solver, int centered_grid)
216
+ {
217
+ int m, mbdcnd, n, nbdcnd;
218
+ int idimf, ierror = 0;
219
+ double a_lower, b_upper, c_lower, d_upper, elmbda, pertrb = 0.0;
220
+ PyObject *bda_obj, *bdb_obj, *bdc_obj, *bdd_obj, *f_obj;
221
+ PyArrayObject *bda = NULL, *bdb = NULL, *bdc = NULL, *bdd = NULL, *f = NULL;
222
+
223
+ if (!PyArg_ParseTuple(args, "ddiiOOddiiOOdO",
224
+ &a_lower, &b_upper, &m, &mbdcnd, &bda_obj, &bdb_obj,
225
+ &c_lower, &d_upper, &n, &nbdcnd, &bdc_obj, &bdd_obj,
226
+ &elmbda, &f_obj)) {
227
+ return NULL;
228
+ }
229
+
230
+ bda = as_double_1d(bda_obj, "bda");
231
+ bdb = as_double_1d(bdb_obj, "bdb");
232
+ bdc = as_double_1d(bdc_obj, "bdc");
233
+ bdd = as_double_1d(bdd_obj, "bdd");
234
+ f = as_fortran_double_copy(f_obj, 2, "f");
235
+ if (bda == NULL || bdb == NULL || bdc == NULL || bdd == NULL || f == NULL) {
236
+ goto fail;
237
+ }
238
+
239
+ idimf = (int)PyArray_DIM(f, 0);
240
+ const int min_rows = centered_grid ? m + 1 : m;
241
+ const int min_cols = centered_grid ? n + 1 : n;
242
+ if (idimf < min_rows || PyArray_DIM(f, 1) < min_cols) {
243
+ PyErr_Format(PyExc_ValueError,
244
+ "f must have shape (idimf, n%s) with idimf >= m%s; got (%zd, %zd), m=%d, n=%d",
245
+ centered_grid ? " + 1" : "",
246
+ centered_grid ? " + 1" : "",
247
+ (Py_ssize_t)PyArray_DIM(f, 0), (Py_ssize_t)PyArray_DIM(f, 1), m, n);
248
+ goto fail;
249
+ }
250
+ if (PyArray_DIM(bda, 0) < 1 || PyArray_DIM(bdb, 0) < 1 ||
251
+ PyArray_DIM(bdc, 0) < 1 || PyArray_DIM(bdd, 0) < 1) {
252
+ PyErr_SetString(PyExc_ValueError, "boundary arrays must have at least one element");
253
+ goto fail;
254
+ }
255
+
256
+ solver(a_lower, b_upper, m, mbdcnd,
257
+ PyArray_DATA(bda), (int)PyArray_DIM(bda, 0),
258
+ PyArray_DATA(bdb), (int)PyArray_DIM(bdb, 0),
259
+ c_lower, d_upper, n, nbdcnd,
260
+ PyArray_DATA(bdc), (int)PyArray_DIM(bdc, 0),
261
+ PyArray_DATA(bdd), (int)PyArray_DIM(bdd, 0),
262
+ elmbda, idimf, PyArray_DATA(f), &pertrb, &ierror);
263
+
264
+ Py_DECREF(bda);
265
+ Py_DECREF(bdb);
266
+ Py_DECREF(bdc);
267
+ Py_DECREF(bdd);
268
+ return Py_BuildValue("Ndi", (PyObject *)f, pertrb, ierror);
269
+
270
+ fail:
271
+ Py_XDECREF(bda);
272
+ Py_XDECREF(bdb);
273
+ Py_XDECREF(bdc);
274
+ Py_XDECREF(bdd);
275
+ Py_XDECREF(f);
276
+ return NULL;
277
+ }
278
+
279
+ static PyObject *fishpack_backend_info(PyObject *self, PyObject *Py_UNUSED(args))
280
+ {
281
+ return Py_BuildValue(
282
+ "{s:s,s:s,s:s}",
283
+ "backend", "modern-fortran",
284
+ "abi", "fortran-bind-c",
285
+ "wrapper", "numpy-c-api");
286
+ }
287
+
288
+ static PyObject *fishpack_genbun(PyObject *self, PyObject *args)
289
+ {
290
+ int nperod, n, mperod, m;
291
+ int idimy, ierror = 0;
292
+ PyObject *a_obj, *b_obj, *c_obj, *y_obj;
293
+ PyArrayObject *a = NULL, *b = NULL, *c = NULL, *y = NULL;
294
+
295
+ if (!PyArg_ParseTuple(args, "iiiiOOOO:genbun", &nperod, &n, &mperod, &m,
296
+ &a_obj, &b_obj, &c_obj, &y_obj)) {
297
+ return NULL;
298
+ }
299
+
300
+ a = as_double_1d(a_obj, "a");
301
+ b = as_double_1d(b_obj, "b");
302
+ c = as_double_1d(c_obj, "c");
303
+ y = as_fortran_double_copy(y_obj, 2, "y");
304
+ if (a == NULL || b == NULL || c == NULL || y == NULL) {
305
+ goto fail;
306
+ }
307
+
308
+ idimy = (int)PyArray_DIM(y, 0);
309
+ if (!require_len(a, m, "a") || !require_len(b, m, "b") || !require_len(c, m, "c")) {
310
+ goto fail;
311
+ }
312
+ if (PyArray_DIM(y, 1) != n || idimy < m) {
313
+ PyErr_Format(PyExc_ValueError,
314
+ "y must have shape (idimy, n) with idimy >= m; got (%zd, %zd), m=%d, n=%d",
315
+ (Py_ssize_t)PyArray_DIM(y, 0), (Py_ssize_t)PyArray_DIM(y, 1), m, n);
316
+ goto fail;
317
+ }
318
+
319
+ pyfp_genbun(nperod, n, mperod, m, idimy,
320
+ PyArray_DATA(a), PyArray_DATA(b), PyArray_DATA(c), PyArray_DATA(y), &ierror);
321
+
322
+ Py_DECREF(a);
323
+ Py_DECREF(b);
324
+ Py_DECREF(c);
325
+ return Py_BuildValue("Ni", (PyObject *)y, ierror);
326
+
327
+ fail:
328
+ Py_XDECREF(a);
329
+ Py_XDECREF(b);
330
+ Py_XDECREF(c);
331
+ Py_XDECREF(y);
332
+ return NULL;
333
+ }
334
+
335
+ static PyObject *fishpack_poistg(PyObject *self, PyObject *args)
336
+ {
337
+ int nperod, n, mperod, m;
338
+ int idimy, ierror = 0;
339
+ PyObject *a_obj, *b_obj, *c_obj, *y_obj;
340
+ PyArrayObject *a = NULL, *b = NULL, *c = NULL, *y = NULL;
341
+
342
+ if (!PyArg_ParseTuple(args, "iiiiOOOO:poistg", &nperod, &n, &mperod, &m,
343
+ &a_obj, &b_obj, &c_obj, &y_obj)) {
344
+ return NULL;
345
+ }
346
+
347
+ a = as_double_1d(a_obj, "a");
348
+ b = as_double_1d(b_obj, "b");
349
+ c = as_double_1d(c_obj, "c");
350
+ y = as_fortran_double_copy(y_obj, 2, "y");
351
+ if (a == NULL || b == NULL || c == NULL || y == NULL) {
352
+ goto fail;
353
+ }
354
+
355
+ idimy = (int)PyArray_DIM(y, 0);
356
+ if (!require_len(a, m, "a") || !require_len(b, m, "b") || !require_len(c, m, "c")) {
357
+ goto fail;
358
+ }
359
+ if (PyArray_DIM(y, 1) != n || idimy < m) {
360
+ PyErr_Format(PyExc_ValueError,
361
+ "y must have shape (idimy, n) with idimy >= m; got (%zd, %zd), m=%d, n=%d",
362
+ (Py_ssize_t)PyArray_DIM(y, 0), (Py_ssize_t)PyArray_DIM(y, 1), m, n);
363
+ goto fail;
364
+ }
365
+
366
+ pyfp_poistg(nperod, n, mperod, m, idimy,
367
+ PyArray_DATA(a), PyArray_DATA(b), PyArray_DATA(c), PyArray_DATA(y), &ierror);
368
+
369
+ Py_DECREF(a);
370
+ Py_DECREF(b);
371
+ Py_DECREF(c);
372
+ return Py_BuildValue("Ni", (PyObject *)y, ierror);
373
+
374
+ fail:
375
+ Py_XDECREF(a);
376
+ Py_XDECREF(b);
377
+ Py_XDECREF(c);
378
+ Py_XDECREF(y);
379
+ return NULL;
380
+ }
381
+
382
+ static PyObject *fishpack_pois3d(PyObject *self, PyObject *args)
383
+ {
384
+ int lperod, l, mperod, m, nperod, n;
385
+ int ldimf, mdimf, ierror = 0;
386
+ double c1, c2;
387
+ PyObject *a_obj, *b_obj, *c_obj, *f_obj;
388
+ PyArrayObject *a = NULL, *b = NULL, *c = NULL, *f = NULL;
389
+
390
+ if (!PyArg_ParseTuple(args, "iidiidiiOOOO:pois3d", &lperod, &l, &c1,
391
+ &mperod, &m, &c2, &nperod, &n,
392
+ &a_obj, &b_obj, &c_obj, &f_obj)) {
393
+ return NULL;
394
+ }
395
+
396
+ a = as_double_1d(a_obj, "a");
397
+ b = as_double_1d(b_obj, "b");
398
+ c = as_double_1d(c_obj, "c");
399
+ f = as_fortran_double_copy(f_obj, 3, "f");
400
+ if (a == NULL || b == NULL || c == NULL || f == NULL) {
401
+ goto fail;
402
+ }
403
+
404
+ ldimf = (int)PyArray_DIM(f, 0);
405
+ mdimf = (int)PyArray_DIM(f, 1);
406
+ if (!require_len(a, n, "a") || !require_len(b, n, "b") || !require_len(c, n, "c")) {
407
+ goto fail;
408
+ }
409
+ if (PyArray_DIM(f, 2) != n || ldimf < l || mdimf < m) {
410
+ PyErr_Format(PyExc_ValueError,
411
+ "f must have shape (ldimf, mdimf, n) with ldimf >= l and mdimf >= m; got (%zd, %zd, %zd)",
412
+ (Py_ssize_t)PyArray_DIM(f, 0), (Py_ssize_t)PyArray_DIM(f, 1),
413
+ (Py_ssize_t)PyArray_DIM(f, 2));
414
+ goto fail;
415
+ }
416
+
417
+ pyfp_pois3d(lperod, l, c1, mperod, m, c2, nperod, n, ldimf, mdimf,
418
+ PyArray_DATA(a), PyArray_DATA(b), PyArray_DATA(c), PyArray_DATA(f), &ierror);
419
+
420
+ Py_DECREF(a);
421
+ Py_DECREF(b);
422
+ Py_DECREF(c);
423
+ return Py_BuildValue("Ni", (PyObject *)f, ierror);
424
+
425
+ fail:
426
+ Py_XDECREF(a);
427
+ Py_XDECREF(b);
428
+ Py_XDECREF(c);
429
+ Py_XDECREF(f);
430
+ return NULL;
431
+ }
432
+
433
+ static PyObject *fishpack_hwscrt(PyObject *self, PyObject *args)
434
+ {
435
+ int m, mbdcnd, n, nbdcnd;
436
+ int idimf, ierror = 0;
437
+ double a_lower, b_upper, c_lower, d_upper, elmbda, pertrb = 0.0;
438
+ PyObject *bda_obj, *bdb_obj, *bdc_obj, *bdd_obj, *f_obj;
439
+ PyArrayObject *bda = NULL, *bdb = NULL, *bdc = NULL, *bdd = NULL, *f = NULL;
440
+
441
+ if (!PyArg_ParseTuple(args, "ddiiOOddiiOOdO:hwscrt",
442
+ &a_lower, &b_upper, &m, &mbdcnd, &bda_obj, &bdb_obj,
443
+ &c_lower, &d_upper, &n, &nbdcnd, &bdc_obj, &bdd_obj,
444
+ &elmbda, &f_obj)) {
445
+ return NULL;
446
+ }
447
+
448
+ bda = as_double_1d(bda_obj, "bda");
449
+ bdb = as_double_1d(bdb_obj, "bdb");
450
+ bdc = as_double_1d(bdc_obj, "bdc");
451
+ bdd = as_double_1d(bdd_obj, "bdd");
452
+ f = as_fortran_double_copy(f_obj, 2, "f");
453
+ if (bda == NULL || bdb == NULL || bdc == NULL || bdd == NULL || f == NULL) {
454
+ goto fail;
455
+ }
456
+
457
+ idimf = (int)PyArray_DIM(f, 0);
458
+ if (idimf < m + 1 || PyArray_DIM(f, 1) < n + 1) {
459
+ PyErr_Format(PyExc_ValueError,
460
+ "f must have shape (idimf, n + 1) with idimf >= m + 1; got (%zd, %zd), m=%d, n=%d",
461
+ (Py_ssize_t)PyArray_DIM(f, 0), (Py_ssize_t)PyArray_DIM(f, 1), m, n);
462
+ goto fail;
463
+ }
464
+ if (PyArray_DIM(bda, 0) < 1 || PyArray_DIM(bdb, 0) < 1 ||
465
+ PyArray_DIM(bdc, 0) < 1 || PyArray_DIM(bdd, 0) < 1) {
466
+ PyErr_SetString(PyExc_ValueError, "boundary arrays must have at least one element");
467
+ goto fail;
468
+ }
469
+
470
+ pyfp_hwscrt(a_lower, b_upper, m, mbdcnd,
471
+ PyArray_DATA(bda), (int)PyArray_DIM(bda, 0),
472
+ PyArray_DATA(bdb), (int)PyArray_DIM(bdb, 0),
473
+ c_lower, d_upper, n, nbdcnd,
474
+ PyArray_DATA(bdc), (int)PyArray_DIM(bdc, 0),
475
+ PyArray_DATA(bdd), (int)PyArray_DIM(bdd, 0),
476
+ elmbda, idimf, PyArray_DATA(f), &pertrb, &ierror);
477
+
478
+ Py_DECREF(bda);
479
+ Py_DECREF(bdb);
480
+ Py_DECREF(bdc);
481
+ Py_DECREF(bdd);
482
+ return Py_BuildValue("Ndi", (PyObject *)f, pertrb, ierror);
483
+
484
+ fail:
485
+ Py_XDECREF(bda);
486
+ Py_XDECREF(bdb);
487
+ Py_XDECREF(bdc);
488
+ Py_XDECREF(bdd);
489
+ Py_XDECREF(f);
490
+ return NULL;
491
+ }
492
+
493
+ static PyObject *fishpack_hstcrt(PyObject *self, PyObject *args)
494
+ {
495
+ int m, mbdcnd, n, nbdcnd;
496
+ int idimf, ierror = 0;
497
+ double a_lower, b_upper, c_lower, d_upper, elmbda, pertrb = 0.0;
498
+ PyObject *bda_obj, *bdb_obj, *bdc_obj, *bdd_obj, *f_obj;
499
+ PyArrayObject *bda = NULL, *bdb = NULL, *bdc = NULL, *bdd = NULL, *f = NULL;
500
+
501
+ if (!PyArg_ParseTuple(args, "ddiiOOddiiOOdO:hstcrt",
502
+ &a_lower, &b_upper, &m, &mbdcnd, &bda_obj, &bdb_obj,
503
+ &c_lower, &d_upper, &n, &nbdcnd, &bdc_obj, &bdd_obj,
504
+ &elmbda, &f_obj)) {
505
+ return NULL;
506
+ }
507
+
508
+ bda = as_double_1d(bda_obj, "bda");
509
+ bdb = as_double_1d(bdb_obj, "bdb");
510
+ bdc = as_double_1d(bdc_obj, "bdc");
511
+ bdd = as_double_1d(bdd_obj, "bdd");
512
+ f = as_fortran_double_copy(f_obj, 2, "f");
513
+ if (bda == NULL || bdb == NULL || bdc == NULL || bdd == NULL || f == NULL) {
514
+ goto fail;
515
+ }
516
+
517
+ idimf = (int)PyArray_DIM(f, 0);
518
+ if (idimf < m || PyArray_DIM(f, 1) < n) {
519
+ PyErr_Format(PyExc_ValueError,
520
+ "f must have shape (idimf, n) with idimf >= m; got (%zd, %zd), m=%d, n=%d",
521
+ (Py_ssize_t)PyArray_DIM(f, 0), (Py_ssize_t)PyArray_DIM(f, 1), m, n);
522
+ goto fail;
523
+ }
524
+ if (PyArray_DIM(bda, 0) < 1 || PyArray_DIM(bdb, 0) < 1 ||
525
+ PyArray_DIM(bdc, 0) < 1 || PyArray_DIM(bdd, 0) < 1) {
526
+ PyErr_SetString(PyExc_ValueError, "boundary arrays must have at least one element");
527
+ goto fail;
528
+ }
529
+
530
+ pyfp_hstcrt(a_lower, b_upper, m, mbdcnd,
531
+ PyArray_DATA(bda), (int)PyArray_DIM(bda, 0),
532
+ PyArray_DATA(bdb), (int)PyArray_DIM(bdb, 0),
533
+ c_lower, d_upper, n, nbdcnd,
534
+ PyArray_DATA(bdc), (int)PyArray_DIM(bdc, 0),
535
+ PyArray_DATA(bdd), (int)PyArray_DIM(bdd, 0),
536
+ elmbda, idimf, PyArray_DATA(f), &pertrb, &ierror);
537
+
538
+ Py_DECREF(bda);
539
+ Py_DECREF(bdb);
540
+ Py_DECREF(bdc);
541
+ Py_DECREF(bdd);
542
+ return Py_BuildValue("Ndi", (PyObject *)f, pertrb, ierror);
543
+
544
+ fail:
545
+ Py_XDECREF(bda);
546
+ Py_XDECREF(bdb);
547
+ Py_XDECREF(bdc);
548
+ Py_XDECREF(bdd);
549
+ Py_XDECREF(f);
550
+ return NULL;
551
+ }
552
+
553
+ static PyObject *fishpack_hw3crt(PyObject *self, PyObject *args)
554
+ {
555
+ int l, lbdcnd, m, mbdcnd, n, nbdcnd;
556
+ int ldimf, mdimf, ierror = 0;
557
+ double xs, xf, ys, yf, zs, zf, elmbda, pertrb = 0.0;
558
+ PyObject *bdxs_obj, *bdxf_obj, *bdys_obj, *bdyf_obj, *bdzs_obj, *bdzf_obj, *f_obj;
559
+ PyArrayObject *bdxs = NULL, *bdxf = NULL, *bdys = NULL, *bdyf = NULL;
560
+ PyArrayObject *bdzs = NULL, *bdzf = NULL, *f = NULL;
561
+
562
+ if (!PyArg_ParseTuple(args, "ddiiOOddiiOOddiiOOdO:hw3crt",
563
+ &xs, &xf, &l, &lbdcnd, &bdxs_obj, &bdxf_obj,
564
+ &ys, &yf, &m, &mbdcnd, &bdys_obj, &bdyf_obj,
565
+ &zs, &zf, &n, &nbdcnd, &bdzs_obj, &bdzf_obj,
566
+ &elmbda, &f_obj)) {
567
+ return NULL;
568
+ }
569
+
570
+ bdxs = as_fortran_double_copy(bdxs_obj, 2, "bdxs");
571
+ bdxf = as_fortran_double_copy(bdxf_obj, 2, "bdxf");
572
+ bdys = as_fortran_double_copy(bdys_obj, 2, "bdys");
573
+ bdyf = as_fortran_double_copy(bdyf_obj, 2, "bdyf");
574
+ bdzs = as_fortran_double_copy(bdzs_obj, 2, "bdzs");
575
+ bdzf = as_fortran_double_copy(bdzf_obj, 2, "bdzf");
576
+ f = as_fortran_double_copy(f_obj, 3, "f");
577
+ if (bdxs == NULL || bdxf == NULL || bdys == NULL || bdyf == NULL ||
578
+ bdzs == NULL || bdzf == NULL || f == NULL) {
579
+ goto fail;
580
+ }
581
+
582
+ ldimf = (int)PyArray_DIM(f, 0);
583
+ mdimf = (int)PyArray_DIM(f, 1);
584
+ if (ldimf < l + 1 || mdimf < m + 1 || PyArray_DIM(f, 2) < n + 1) {
585
+ PyErr_Format(PyExc_ValueError,
586
+ "f must have shape (ldimf, mdimf, n + 1) with ldimf >= l + 1 and mdimf >= m + 1; got (%zd, %zd, %zd)",
587
+ (Py_ssize_t)PyArray_DIM(f, 0), (Py_ssize_t)PyArray_DIM(f, 1),
588
+ (Py_ssize_t)PyArray_DIM(f, 2));
589
+ goto fail;
590
+ }
591
+ if (lbdcnd == 3 || lbdcnd == 4) {
592
+ if (!require_2d_shape(bdxs, m + 1, n + 1, "bdxs")) goto fail;
593
+ }
594
+ if (lbdcnd == 2 || lbdcnd == 3) {
595
+ if (!require_2d_shape(bdxf, m + 1, n + 1, "bdxf")) goto fail;
596
+ }
597
+ if (mbdcnd == 3 || mbdcnd == 4) {
598
+ if (!require_2d_shape(bdys, l + 1, n + 1, "bdys")) goto fail;
599
+ }
600
+ if (mbdcnd == 2 || mbdcnd == 3) {
601
+ if (!require_2d_shape(bdyf, l + 1, n + 1, "bdyf")) goto fail;
602
+ }
603
+ if (nbdcnd == 3 || nbdcnd == 4) {
604
+ if (!require_2d_shape(bdzs, l + 1, m + 1, "bdzs")) goto fail;
605
+ }
606
+ if (nbdcnd == 2 || nbdcnd == 3) {
607
+ if (!require_2d_shape(bdzf, l + 1, m + 1, "bdzf")) goto fail;
608
+ }
609
+
610
+ pyfp_hw3crt(xs, xf, l, lbdcnd,
611
+ PyArray_DATA(bdxs), (int)PyArray_DIM(bdxs, 0), (int)PyArray_DIM(bdxs, 1),
612
+ PyArray_DATA(bdxf), (int)PyArray_DIM(bdxf, 0), (int)PyArray_DIM(bdxf, 1),
613
+ ys, yf, m, mbdcnd,
614
+ PyArray_DATA(bdys), (int)PyArray_DIM(bdys, 0), (int)PyArray_DIM(bdys, 1),
615
+ PyArray_DATA(bdyf), (int)PyArray_DIM(bdyf, 0), (int)PyArray_DIM(bdyf, 1),
616
+ zs, zf, n, nbdcnd,
617
+ PyArray_DATA(bdzs), (int)PyArray_DIM(bdzs, 0), (int)PyArray_DIM(bdzs, 1),
618
+ PyArray_DATA(bdzf), (int)PyArray_DIM(bdzf, 0), (int)PyArray_DIM(bdzf, 1),
619
+ elmbda, ldimf, mdimf, PyArray_DATA(f), &pertrb, &ierror);
620
+
621
+ Py_DECREF(bdxs);
622
+ Py_DECREF(bdxf);
623
+ Py_DECREF(bdys);
624
+ Py_DECREF(bdyf);
625
+ Py_DECREF(bdzs);
626
+ Py_DECREF(bdzf);
627
+ return Py_BuildValue("Ndi", (PyObject *)f, pertrb, ierror);
628
+
629
+ fail:
630
+ Py_XDECREF(bdxs);
631
+ Py_XDECREF(bdxf);
632
+ Py_XDECREF(bdys);
633
+ Py_XDECREF(bdyf);
634
+ Py_XDECREF(bdzs);
635
+ Py_XDECREF(bdzf);
636
+ Py_XDECREF(f);
637
+ return NULL;
638
+ }
639
+
640
+ static PyObject *fishpack_sor_standard1d(PyObject *self, PyObject *args)
641
+ {
642
+ (void)self;
643
+ PyObject *s_obj, *a_obj, *b_obj, *f_obj;
644
+ PyArrayObject *s = NULL, *a = NULL, *b = NULL, *f = NULL;
645
+ const char *bcx_name;
646
+ int bcx, mxloop, overflow = 0, loops = 0;
647
+ double delx, optarg, undef, tolerance, relerr = 1.0;
648
+
649
+ if (!PyArg_ParseTuple(args, "OOOOdsddid:sor_standard1d",
650
+ &s_obj, &a_obj, &b_obj, &f_obj,
651
+ &delx, &bcx_name, &optarg, &undef, &mxloop, &tolerance)) {
652
+ return NULL;
653
+ }
654
+
655
+ bcx = bc_code_from_string(bcx_name, "bcx");
656
+ if (bcx < 0) {
657
+ return NULL;
658
+ }
659
+
660
+ s = as_fortran_double_copy(s_obj, 1, "s");
661
+ a = as_fortran_double_copy(a_obj, 1, "a");
662
+ b = as_fortran_double_copy(b_obj, 1, "b");
663
+ f = as_fortran_double_copy(f_obj, 1, "f");
664
+ if (s == NULL || a == NULL || b == NULL || f == NULL) {
665
+ goto fail;
666
+ }
667
+
668
+ const npy_intp n = PyArray_DIM(s, 0);
669
+ if (!require_len(a, n, "a") || !require_len(b, n, "b") || !require_len(f, n, "f")) {
670
+ goto fail;
671
+ }
672
+ if (n < 3) {
673
+ PyErr_SetString(PyExc_ValueError, "sor_standard1d requires at least 3 grid points");
674
+ goto fail;
675
+ }
676
+
677
+ pyfp_sor_standard1d((int)n, PyArray_DATA(s), PyArray_DATA(a), PyArray_DATA(b),
678
+ PyArray_DATA(f), delx, bcx, optarg, undef, mxloop,
679
+ tolerance, &overflow, &relerr, &loops);
680
+
681
+ Py_DECREF(a);
682
+ Py_DECREF(b);
683
+ Py_DECREF(f);
684
+ return Py_BuildValue("Ndii", (PyObject *)s, relerr, overflow, loops);
685
+
686
+ fail:
687
+ Py_XDECREF(s);
688
+ Py_XDECREF(a);
689
+ Py_XDECREF(b);
690
+ Py_XDECREF(f);
691
+ return NULL;
692
+ }
693
+
694
+ static PyObject *fishpack_sor_standard2d(PyObject *self, PyObject *args)
695
+ {
696
+ (void)self;
697
+ PyObject *s_obj, *a_obj, *b_obj, *c_obj, *f_obj;
698
+ PyArrayObject *s = NULL, *a = NULL, *b = NULL, *c = NULL, *f = NULL;
699
+ const char *bcy_name, *bcx_name;
700
+ int bcy, bcx, mxloop, overflow = 0, loops = 0;
701
+ double dely, delx, optarg, undef, tolerance, relerr = 1.0;
702
+
703
+ if (!PyArg_ParseTuple(args, "OOOOOddssddid:sor_standard2d",
704
+ &s_obj, &a_obj, &b_obj, &c_obj, &f_obj,
705
+ &dely, &delx, &bcy_name, &bcx_name, &optarg,
706
+ &undef, &mxloop, &tolerance)) {
707
+ return NULL;
708
+ }
709
+
710
+ bcy = bc_code_from_string(bcy_name, "bcy");
711
+ bcx = bc_code_from_string(bcx_name, "bcx");
712
+ if (bcy < 0 || bcx < 0) {
713
+ return NULL;
714
+ }
715
+
716
+ s = as_fortran_double_copy(s_obj, 2, "s");
717
+ a = as_fortran_double_copy(a_obj, 2, "a");
718
+ b = as_fortran_double_copy(b_obj, 2, "b");
719
+ c = as_fortran_double_copy(c_obj, 2, "c");
720
+ f = as_fortran_double_copy(f_obj, 2, "f");
721
+ if (s == NULL || a == NULL || b == NULL || c == NULL || f == NULL) {
722
+ goto fail;
723
+ }
724
+
725
+ const npy_intp ny = PyArray_DIM(s, 0);
726
+ const npy_intp nx = PyArray_DIM(s, 1);
727
+ if (!require_2d_shape(a, ny, nx, "a") || !require_2d_shape(b, ny, nx, "b") ||
728
+ !require_2d_shape(c, ny, nx, "c") || !require_2d_shape(f, ny, nx, "f")) {
729
+ goto fail;
730
+ }
731
+ if (ny < 3 || nx < 3) {
732
+ PyErr_SetString(PyExc_ValueError, "sor_standard2d requires at least a 3 by 3 grid");
733
+ goto fail;
734
+ }
735
+
736
+ pyfp_sor_standard2d((int)ny, (int)nx, PyArray_DATA(s), PyArray_DATA(a),
737
+ PyArray_DATA(b), PyArray_DATA(c), PyArray_DATA(f),
738
+ dely, delx, bcy, bcx, optarg, undef, mxloop, tolerance,
739
+ &overflow, &relerr, &loops);
740
+
741
+ Py_DECREF(a);
742
+ Py_DECREF(b);
743
+ Py_DECREF(c);
744
+ Py_DECREF(f);
745
+ return Py_BuildValue("Ndii", (PyObject *)s, relerr, overflow, loops);
746
+
747
+ fail:
748
+ Py_XDECREF(s);
749
+ Py_XDECREF(a);
750
+ Py_XDECREF(b);
751
+ Py_XDECREF(c);
752
+ Py_XDECREF(f);
753
+ return NULL;
754
+ }
755
+
756
+ static PyObject *fishpack_sor_standard3d(PyObject *self, PyObject *args)
757
+ {
758
+ (void)self;
759
+ PyObject *s_obj, *a_obj, *b_obj, *c_obj, *f_obj;
760
+ PyArrayObject *s = NULL, *a = NULL, *b = NULL, *c = NULL, *f = NULL;
761
+ const char *bcz_name, *bcy_name, *bcx_name;
762
+ int bcz, bcy, bcx, mxloop, overflow = 0, loops = 0;
763
+ double delz, dely, delx, optarg, undef, tolerance, relerr = 1.0;
764
+
765
+ if (!PyArg_ParseTuple(args, "OOOOOdddsssddid:sor_standard3d",
766
+ &s_obj, &a_obj, &b_obj, &c_obj, &f_obj,
767
+ &delz, &dely, &delx, &bcz_name, &bcy_name, &bcx_name,
768
+ &optarg, &undef, &mxloop, &tolerance)) {
769
+ return NULL;
770
+ }
771
+
772
+ bcz = bc_code_from_string(bcz_name, "bcz");
773
+ bcy = bc_code_from_string(bcy_name, "bcy");
774
+ bcx = bc_code_from_string(bcx_name, "bcx");
775
+ if (bcz < 0 || bcy < 0 || bcx < 0) {
776
+ return NULL;
777
+ }
778
+
779
+ s = as_fortran_double_copy(s_obj, 3, "s");
780
+ a = as_fortran_double_copy(a_obj, 3, "a");
781
+ b = as_fortran_double_copy(b_obj, 3, "b");
782
+ c = as_fortran_double_copy(c_obj, 3, "c");
783
+ f = as_fortran_double_copy(f_obj, 3, "f");
784
+ if (s == NULL || a == NULL || b == NULL || c == NULL || f == NULL) {
785
+ goto fail;
786
+ }
787
+
788
+ const npy_intp nz = PyArray_DIM(s, 0);
789
+ const npy_intp ny = PyArray_DIM(s, 1);
790
+ const npy_intp nx = PyArray_DIM(s, 2);
791
+ if (!require_3d_shape(a, nz, ny, nx, "a") || !require_3d_shape(b, nz, ny, nx, "b") ||
792
+ !require_3d_shape(c, nz, ny, nx, "c") || !require_3d_shape(f, nz, ny, nx, "f")) {
793
+ goto fail;
794
+ }
795
+ if (nz < 3 || ny < 3 || nx < 3) {
796
+ PyErr_SetString(PyExc_ValueError, "sor_standard3d requires at least a 3 by 3 by 3 grid");
797
+ goto fail;
798
+ }
799
+
800
+ pyfp_sor_standard3d((int)nz, (int)ny, (int)nx, PyArray_DATA(s),
801
+ PyArray_DATA(a), PyArray_DATA(b), PyArray_DATA(c),
802
+ PyArray_DATA(f), delz, dely, delx, bcz, bcy, bcx,
803
+ optarg, undef, mxloop, tolerance, &overflow, &relerr,
804
+ &loops);
805
+
806
+ Py_DECREF(a);
807
+ Py_DECREF(b);
808
+ Py_DECREF(c);
809
+ Py_DECREF(f);
810
+ return Py_BuildValue("Ndii", (PyObject *)s, relerr, overflow, loops);
811
+
812
+ fail:
813
+ Py_XDECREF(s);
814
+ Py_XDECREF(a);
815
+ Py_XDECREF(b);
816
+ Py_XDECREF(c);
817
+ Py_XDECREF(f);
818
+ return NULL;
819
+ }
820
+
821
+ static PyObject *fishpack_sor_general2d(PyObject *self, PyObject *args)
822
+ {
823
+ (void)self;
824
+ PyObject *s_obj, *a_obj, *b_obj, *c_obj, *d_obj, *e_obj, *fcoef_obj, *g_obj;
825
+ PyArrayObject *s = NULL, *a = NULL, *b = NULL, *c = NULL;
826
+ PyArrayObject *d = NULL, *e = NULL, *fcoef = NULL, *g = NULL;
827
+ const char *bcy_name, *bcx_name;
828
+ int bcy, bcx, mxloop, overflow = 0, loops = 0;
829
+ double dely, delx, optarg, undef, tolerance, relerr = 1.0;
830
+
831
+ if (!PyArg_ParseTuple(args, "OOOOOOOOddssddid:sor_general2d",
832
+ &s_obj, &a_obj, &b_obj, &c_obj, &d_obj, &e_obj,
833
+ &fcoef_obj, &g_obj, &dely, &delx, &bcy_name, &bcx_name,
834
+ &optarg, &undef, &mxloop, &tolerance)) {
835
+ return NULL;
836
+ }
837
+
838
+ bcy = bc_code_from_string(bcy_name, "bcy");
839
+ bcx = bc_code_from_string(bcx_name, "bcx");
840
+ if (bcy < 0 || bcx < 0) {
841
+ return NULL;
842
+ }
843
+
844
+ s = as_fortran_double_copy(s_obj, 2, "s");
845
+ a = as_fortran_double_copy(a_obj, 2, "a");
846
+ b = as_fortran_double_copy(b_obj, 2, "b");
847
+ c = as_fortran_double_copy(c_obj, 2, "c");
848
+ d = as_fortran_double_copy(d_obj, 2, "d");
849
+ e = as_fortran_double_copy(e_obj, 2, "e");
850
+ fcoef = as_fortran_double_copy(fcoef_obj, 2, "fcoef");
851
+ g = as_fortran_double_copy(g_obj, 2, "g");
852
+ if (s == NULL || a == NULL || b == NULL || c == NULL ||
853
+ d == NULL || e == NULL || fcoef == NULL || g == NULL) {
854
+ goto fail;
855
+ }
856
+
857
+ const npy_intp ny = PyArray_DIM(s, 0);
858
+ const npy_intp nx = PyArray_DIM(s, 1);
859
+ if (!require_2d_shape(a, ny, nx, "a") || !require_2d_shape(b, ny, nx, "b") ||
860
+ !require_2d_shape(c, ny, nx, "c") || !require_2d_shape(d, ny, nx, "d") ||
861
+ !require_2d_shape(e, ny, nx, "e") || !require_2d_shape(fcoef, ny, nx, "fcoef") ||
862
+ !require_2d_shape(g, ny, nx, "g")) {
863
+ goto fail;
864
+ }
865
+ if (ny < 3 || nx < 3) {
866
+ PyErr_SetString(PyExc_ValueError, "sor_general2d requires at least a 3 by 3 grid");
867
+ goto fail;
868
+ }
869
+
870
+ pyfp_sor_general2d((int)ny, (int)nx, PyArray_DATA(s), PyArray_DATA(a),
871
+ PyArray_DATA(b), PyArray_DATA(c), PyArray_DATA(d),
872
+ PyArray_DATA(e), PyArray_DATA(fcoef), PyArray_DATA(g),
873
+ dely, delx, bcy, bcx, optarg, undef, mxloop, tolerance,
874
+ &overflow, &relerr, &loops);
875
+
876
+ Py_DECREF(a);
877
+ Py_DECREF(b);
878
+ Py_DECREF(c);
879
+ Py_DECREF(d);
880
+ Py_DECREF(e);
881
+ Py_DECREF(fcoef);
882
+ Py_DECREF(g);
883
+ return Py_BuildValue("Ndii", (PyObject *)s, relerr, overflow, loops);
884
+
885
+ fail:
886
+ Py_XDECREF(s);
887
+ Py_XDECREF(a);
888
+ Py_XDECREF(b);
889
+ Py_XDECREF(c);
890
+ Py_XDECREF(d);
891
+ Py_XDECREF(e);
892
+ Py_XDECREF(fcoef);
893
+ Py_XDECREF(g);
894
+ return NULL;
895
+ }
896
+
897
+ static PyObject *fishpack_sor_general3d(PyObject *self, PyObject *args)
898
+ {
899
+ (void)self;
900
+ PyObject *s_obj, *a_obj, *b_obj, *c_obj, *d_obj, *e_obj, *fcoef_obj, *g_obj, *h_obj;
901
+ PyArrayObject *s = NULL, *a = NULL, *b = NULL, *c = NULL;
902
+ PyArrayObject *d = NULL, *e = NULL, *fcoef = NULL, *g = NULL, *h = NULL;
903
+ const char *bcz_name, *bcy_name, *bcx_name;
904
+ int bcz, bcy, bcx, mxloop, overflow = 0, loops = 0;
905
+ double delz, dely, delx, optarg, undef, tolerance, relerr = 1.0;
906
+
907
+ if (!PyArg_ParseTuple(args, "OOOOOOOOOdddsssddid:sor_general3d",
908
+ &s_obj, &a_obj, &b_obj, &c_obj, &d_obj, &e_obj,
909
+ &fcoef_obj, &g_obj, &h_obj, &delz, &dely, &delx,
910
+ &bcz_name, &bcy_name, &bcx_name, &optarg, &undef,
911
+ &mxloop, &tolerance)) {
912
+ return NULL;
913
+ }
914
+
915
+ bcz = bc_code_from_string(bcz_name, "bcz");
916
+ bcy = bc_code_from_string(bcy_name, "bcy");
917
+ bcx = bc_code_from_string(bcx_name, "bcx");
918
+ if (bcz < 0 || bcy < 0 || bcx < 0) {
919
+ return NULL;
920
+ }
921
+
922
+ s = as_fortran_double_copy(s_obj, 3, "s");
923
+ a = as_fortran_double_copy(a_obj, 3, "a");
924
+ b = as_fortran_double_copy(b_obj, 3, "b");
925
+ c = as_fortran_double_copy(c_obj, 3, "c");
926
+ d = as_fortran_double_copy(d_obj, 3, "d");
927
+ e = as_fortran_double_copy(e_obj, 3, "e");
928
+ fcoef = as_fortran_double_copy(fcoef_obj, 3, "fcoef");
929
+ g = as_fortran_double_copy(g_obj, 3, "g");
930
+ h = as_fortran_double_copy(h_obj, 3, "h");
931
+ if (s == NULL || a == NULL || b == NULL || c == NULL || d == NULL ||
932
+ e == NULL || fcoef == NULL || g == NULL || h == NULL) {
933
+ goto fail;
934
+ }
935
+
936
+ const npy_intp nz = PyArray_DIM(s, 0);
937
+ const npy_intp ny = PyArray_DIM(s, 1);
938
+ const npy_intp nx = PyArray_DIM(s, 2);
939
+ if (!require_3d_shape(a, nz, ny, nx, "a") || !require_3d_shape(b, nz, ny, nx, "b") ||
940
+ !require_3d_shape(c, nz, ny, nx, "c") || !require_3d_shape(d, nz, ny, nx, "d") ||
941
+ !require_3d_shape(e, nz, ny, nx, "e") ||
942
+ !require_3d_shape(fcoef, nz, ny, nx, "fcoef") ||
943
+ !require_3d_shape(g, nz, ny, nx, "g") || !require_3d_shape(h, nz, ny, nx, "h")) {
944
+ goto fail;
945
+ }
946
+ if (nz < 3 || ny < 3 || nx < 3) {
947
+ PyErr_SetString(PyExc_ValueError, "sor_general3d requires at least a 3 by 3 by 3 grid");
948
+ goto fail;
949
+ }
950
+
951
+ pyfp_sor_general3d((int)nz, (int)ny, (int)nx, PyArray_DATA(s),
952
+ PyArray_DATA(a), PyArray_DATA(b), PyArray_DATA(c),
953
+ PyArray_DATA(d), PyArray_DATA(e), PyArray_DATA(fcoef),
954
+ PyArray_DATA(g), PyArray_DATA(h), delz, dely, delx,
955
+ bcz, bcy, bcx, optarg, undef, mxloop, tolerance,
956
+ &overflow, &relerr, &loops);
957
+
958
+ Py_DECREF(a);
959
+ Py_DECREF(b);
960
+ Py_DECREF(c);
961
+ Py_DECREF(d);
962
+ Py_DECREF(e);
963
+ Py_DECREF(fcoef);
964
+ Py_DECREF(g);
965
+ Py_DECREF(h);
966
+ return Py_BuildValue("Ndii", (PyObject *)s, relerr, overflow, loops);
967
+
968
+ fail:
969
+ Py_XDECREF(s);
970
+ Py_XDECREF(a);
971
+ Py_XDECREF(b);
972
+ Py_XDECREF(c);
973
+ Py_XDECREF(d);
974
+ Py_XDECREF(e);
975
+ Py_XDECREF(fcoef);
976
+ Py_XDECREF(g);
977
+ Py_XDECREF(h);
978
+ return NULL;
979
+ }
980
+
981
+ static PyObject *fishpack_sor_biharmonic2d(PyObject *self, PyObject *args)
982
+ {
983
+ (void)self;
984
+ PyObject *s_obj, *a_obj, *b_obj, *c_obj, *d_obj, *e_obj, *fcoef_obj;
985
+ PyObject *g_obj, *h_obj, *icoef_obj, *jcoef_obj;
986
+ PyArrayObject *s = NULL, *a = NULL, *b = NULL, *c = NULL, *d = NULL;
987
+ PyArrayObject *e = NULL, *fcoef = NULL, *g = NULL, *h = NULL;
988
+ PyArrayObject *icoef = NULL, *jcoef = NULL;
989
+ const char *bcy_name, *bcx_name;
990
+ int bcy, bcx, mxloop, overflow = 0, loops = 0;
991
+ double dely, delx, optarg, undef, tolerance, relerr = 1.0;
992
+
993
+ if (!PyArg_ParseTuple(args, "OOOOOOOOOOOddssddid:sor_biharmonic2d",
994
+ &s_obj, &a_obj, &b_obj, &c_obj, &d_obj, &e_obj,
995
+ &fcoef_obj, &g_obj, &h_obj, &icoef_obj, &jcoef_obj,
996
+ &dely, &delx, &bcy_name, &bcx_name, &optarg,
997
+ &undef, &mxloop, &tolerance)) {
998
+ return NULL;
999
+ }
1000
+
1001
+ bcy = bc_code_from_string(bcy_name, "bcy");
1002
+ bcx = bc_code_from_string(bcx_name, "bcx");
1003
+ if (bcy < 0 || bcx < 0) {
1004
+ return NULL;
1005
+ }
1006
+
1007
+ s = as_fortran_double_copy(s_obj, 2, "s");
1008
+ a = as_fortran_double_copy(a_obj, 2, "a");
1009
+ b = as_fortran_double_copy(b_obj, 2, "b");
1010
+ c = as_fortran_double_copy(c_obj, 2, "c");
1011
+ d = as_fortran_double_copy(d_obj, 2, "d");
1012
+ e = as_fortran_double_copy(e_obj, 2, "e");
1013
+ fcoef = as_fortran_double_copy(fcoef_obj, 2, "fcoef");
1014
+ g = as_fortran_double_copy(g_obj, 2, "g");
1015
+ h = as_fortran_double_copy(h_obj, 2, "h");
1016
+ icoef = as_fortran_double_copy(icoef_obj, 2, "icoef");
1017
+ jcoef = as_fortran_double_copy(jcoef_obj, 2, "jcoef");
1018
+ if (s == NULL || a == NULL || b == NULL || c == NULL || d == NULL ||
1019
+ e == NULL || fcoef == NULL || g == NULL || h == NULL ||
1020
+ icoef == NULL || jcoef == NULL) {
1021
+ goto fail;
1022
+ }
1023
+
1024
+ const npy_intp ny = PyArray_DIM(s, 0);
1025
+ const npy_intp nx = PyArray_DIM(s, 1);
1026
+ if (!require_2d_shape(a, ny, nx, "a") || !require_2d_shape(b, ny, nx, "b") ||
1027
+ !require_2d_shape(c, ny, nx, "c") || !require_2d_shape(d, ny, nx, "d") ||
1028
+ !require_2d_shape(e, ny, nx, "e") || !require_2d_shape(fcoef, ny, nx, "fcoef") ||
1029
+ !require_2d_shape(g, ny, nx, "g") || !require_2d_shape(h, ny, nx, "h") ||
1030
+ !require_2d_shape(icoef, ny, nx, "icoef") || !require_2d_shape(jcoef, ny, nx, "jcoef")) {
1031
+ goto fail;
1032
+ }
1033
+ if (ny < 5 || nx < 5) {
1034
+ PyErr_SetString(PyExc_ValueError, "sor_biharmonic2d requires at least a 5 by 5 grid");
1035
+ goto fail;
1036
+ }
1037
+
1038
+ pyfp_sor_biharmonic2d((int)ny, (int)nx, PyArray_DATA(s),
1039
+ PyArray_DATA(a), PyArray_DATA(b), PyArray_DATA(c),
1040
+ PyArray_DATA(d), PyArray_DATA(e), PyArray_DATA(fcoef),
1041
+ PyArray_DATA(g), PyArray_DATA(h), PyArray_DATA(icoef),
1042
+ PyArray_DATA(jcoef), dely, delx, bcy, bcx, optarg,
1043
+ undef, mxloop, tolerance, &overflow, &relerr, &loops);
1044
+
1045
+ Py_DECREF(a);
1046
+ Py_DECREF(b);
1047
+ Py_DECREF(c);
1048
+ Py_DECREF(d);
1049
+ Py_DECREF(e);
1050
+ Py_DECREF(fcoef);
1051
+ Py_DECREF(g);
1052
+ Py_DECREF(h);
1053
+ Py_DECREF(icoef);
1054
+ Py_DECREF(jcoef);
1055
+ return Py_BuildValue("Ndii", (PyObject *)s, relerr, overflow, loops);
1056
+
1057
+ fail:
1058
+ Py_XDECREF(s);
1059
+ Py_XDECREF(a);
1060
+ Py_XDECREF(b);
1061
+ Py_XDECREF(c);
1062
+ Py_XDECREF(d);
1063
+ Py_XDECREF(e);
1064
+ Py_XDECREF(fcoef);
1065
+ Py_XDECREF(g);
1066
+ Py_XDECREF(h);
1067
+ Py_XDECREF(icoef);
1068
+ Py_XDECREF(jcoef);
1069
+ return NULL;
1070
+ }
1071
+
1072
+ static PyObject *fishpack_fftpack_real(PyObject *args, int kind, int direction, const char *name)
1073
+ {
1074
+ PyObject *x_obj;
1075
+ PyArrayObject *x = NULL;
1076
+
1077
+ if (!PyArg_ParseTuple(args, "O", &x_obj)) {
1078
+ return NULL;
1079
+ }
1080
+ x = as_fortran_double_copy(x_obj, 1, name);
1081
+ if (x == NULL) {
1082
+ return NULL;
1083
+ }
1084
+ const npy_intp n = PyArray_DIM(x, 0);
1085
+ if (n < 1) {
1086
+ PyErr_Format(PyExc_ValueError, "%s requires at least one sample", name);
1087
+ Py_DECREF(x);
1088
+ return NULL;
1089
+ }
1090
+ pyfp_fftpack_real_transform((int)n, PyArray_DATA(x), kind, direction);
1091
+ return (PyObject *)x;
1092
+ }
1093
+
1094
+ static PyObject *fishpack_fftpack_complex(PyObject *args, int direction, const char *name)
1095
+ {
1096
+ PyObject *x_obj;
1097
+ PyArrayObject *x = NULL;
1098
+
1099
+ if (!PyArg_ParseTuple(args, "O", &x_obj)) {
1100
+ return NULL;
1101
+ }
1102
+ x = as_fortran_double_copy(x_obj, 1, name);
1103
+ if (x == NULL) {
1104
+ return NULL;
1105
+ }
1106
+ const npy_intp n2 = PyArray_DIM(x, 0);
1107
+ if (n2 < 2 || n2 % 2 != 0) {
1108
+ PyErr_Format(PyExc_ValueError, "%s expects an interleaved real/imag float64 array with even length", name);
1109
+ Py_DECREF(x);
1110
+ return NULL;
1111
+ }
1112
+ pyfp_fftpack_complex_transform((int)(n2 / 2), PyArray_DATA(x), direction);
1113
+ return (PyObject *)x;
1114
+ }
1115
+
1116
+ static PyObject *fishpack_rfftf(PyObject *self, PyObject *args)
1117
+ {
1118
+ (void)self;
1119
+ return fishpack_fftpack_real(args, 0, 0, "rfftf");
1120
+ }
1121
+
1122
+ static PyObject *fishpack_rfftb(PyObject *self, PyObject *args)
1123
+ {
1124
+ (void)self;
1125
+ return fishpack_fftpack_real(args, 0, 1, "rfftb");
1126
+ }
1127
+
1128
+ static PyObject *fishpack_sint(PyObject *self, PyObject *args)
1129
+ {
1130
+ (void)self;
1131
+ return fishpack_fftpack_real(args, 1, 0, "sint");
1132
+ }
1133
+
1134
+ static PyObject *fishpack_cost(PyObject *self, PyObject *args)
1135
+ {
1136
+ (void)self;
1137
+ return fishpack_fftpack_real(args, 2, 0, "cost");
1138
+ }
1139
+
1140
+ static PyObject *fishpack_sinqf(PyObject *self, PyObject *args)
1141
+ {
1142
+ (void)self;
1143
+ return fishpack_fftpack_real(args, 3, 0, "sinqf");
1144
+ }
1145
+
1146
+ static PyObject *fishpack_sinqb(PyObject *self, PyObject *args)
1147
+ {
1148
+ (void)self;
1149
+ return fishpack_fftpack_real(args, 3, 1, "sinqb");
1150
+ }
1151
+
1152
+ static PyObject *fishpack_cosqf(PyObject *self, PyObject *args)
1153
+ {
1154
+ (void)self;
1155
+ return fishpack_fftpack_real(args, 4, 0, "cosqf");
1156
+ }
1157
+
1158
+ static PyObject *fishpack_cosqb(PyObject *self, PyObject *args)
1159
+ {
1160
+ (void)self;
1161
+ return fishpack_fftpack_real(args, 4, 1, "cosqb");
1162
+ }
1163
+
1164
+ static PyObject *fishpack_cfftf(PyObject *self, PyObject *args)
1165
+ {
1166
+ (void)self;
1167
+ return fishpack_fftpack_complex(args, 0, "cfftf");
1168
+ }
1169
+
1170
+ static PyObject *fishpack_cfftb(PyObject *self, PyObject *args)
1171
+ {
1172
+ (void)self;
1173
+ return fishpack_fftpack_complex(args, 1, "cfftb");
1174
+ }
1175
+
1176
+ static PyObject *fishpack_hwsplr(PyObject *self, PyObject *args)
1177
+ {
1178
+ (void)self;
1179
+ return fishpack_helmholtz_2d(args, pyfp_hwsplr, 1);
1180
+ }
1181
+
1182
+ static PyObject *fishpack_hwscyl(PyObject *self, PyObject *args)
1183
+ {
1184
+ (void)self;
1185
+ return fishpack_helmholtz_2d(args, pyfp_hwscyl, 1);
1186
+ }
1187
+
1188
+ static PyObject *fishpack_hstplr(PyObject *self, PyObject *args)
1189
+ {
1190
+ (void)self;
1191
+ return fishpack_helmholtz_2d(args, pyfp_hstplr, 0);
1192
+ }
1193
+
1194
+ static PyObject *fishpack_hstcyl(PyObject *self, PyObject *args)
1195
+ {
1196
+ (void)self;
1197
+ return fishpack_helmholtz_2d(args, pyfp_hstcyl, 0);
1198
+ }
1199
+
1200
+ static PyObject *fishpack_hwsssp(PyObject *self, PyObject *args)
1201
+ {
1202
+ (void)self;
1203
+ return fishpack_helmholtz_2d(args, pyfp_hwsssp, 1);
1204
+ }
1205
+
1206
+ static PyObject *fishpack_hstssp(PyObject *self, PyObject *args)
1207
+ {
1208
+ (void)self;
1209
+ return fishpack_helmholtz_2d(args, pyfp_hstssp, 0);
1210
+ }
1211
+
1212
+ static PyObject *fishpack_hwscsp(PyObject *self, PyObject *args)
1213
+ {
1214
+ (void)self;
1215
+ return fishpack_helmholtz_2d(args, pyfp_hwscsp, 1);
1216
+ }
1217
+
1218
+ static PyObject *fishpack_hstcsp(PyObject *self, PyObject *args)
1219
+ {
1220
+ (void)self;
1221
+ return fishpack_helmholtz_2d(args, pyfp_hstcsp, 0);
1222
+ }
1223
+
1224
+ static PyMethodDef fishpack_methods[] = {
1225
+ {"backend_info", (PyCFunction)fishpack_backend_info, METH_NOARGS,
1226
+ "Return details about the compiled PyFishPack backend."},
1227
+ {"genbun", (PyCFunction)fishpack_genbun, METH_VARARGS,
1228
+ "Solve a centered-grid separable elliptic system using the modern Fortran GENBUN backend."},
1229
+ {"poistg", (PyCFunction)fishpack_poistg, METH_VARARGS,
1230
+ "Solve a staggered-grid separable elliptic system using the modern Fortran POISTG backend."},
1231
+ {"pois3d", (PyCFunction)fishpack_pois3d, METH_VARARGS,
1232
+ "Solve a 3D separable elliptic system using the modern Fortran POIS3D backend."},
1233
+ {"hwscrt", (PyCFunction)fishpack_hwscrt, METH_VARARGS,
1234
+ "Solve a centered-grid Cartesian Helmholtz equation using the modern Fortran HWSCRT backend."},
1235
+ {"hstcrt", (PyCFunction)fishpack_hstcrt, METH_VARARGS,
1236
+ "Solve a staggered-grid Cartesian Helmholtz equation using the modern Fortran HSTCRT backend."},
1237
+ {"hw3crt", (PyCFunction)fishpack_hw3crt, METH_VARARGS,
1238
+ "Solve a 3D centered-grid Cartesian Helmholtz equation using the modern Fortran HW3CRT backend."},
1239
+ {"hwsplr", (PyCFunction)fishpack_hwsplr, METH_VARARGS,
1240
+ "Solve a centered-grid polar Helmholtz equation using the modern Fortran HWSPLR backend."},
1241
+ {"hwscyl", (PyCFunction)fishpack_hwscyl, METH_VARARGS,
1242
+ "Solve a centered-grid cylindrical Helmholtz equation using the modern Fortran HWSCYL backend."},
1243
+ {"hstplr", (PyCFunction)fishpack_hstplr, METH_VARARGS,
1244
+ "Solve a staggered-grid polar Helmholtz equation using the modern Fortran HSTPLR backend."},
1245
+ {"hstcyl", (PyCFunction)fishpack_hstcyl, METH_VARARGS,
1246
+ "Solve a staggered-grid cylindrical Helmholtz equation using the modern Fortran HSTCYL backend."},
1247
+ {"hwsssp", (PyCFunction)fishpack_hwsssp, METH_VARARGS,
1248
+ "Solve a centered-grid spherical Helmholtz equation using the modern Fortran HWSSSP backend."},
1249
+ {"hstssp", (PyCFunction)fishpack_hstssp, METH_VARARGS,
1250
+ "Solve a staggered-grid spherical Helmholtz equation using the modern Fortran HSTSSP backend."},
1251
+ {"hwscsp", (PyCFunction)fishpack_hwscsp, METH_VARARGS,
1252
+ "Solve a centered-grid axisymmetric spherical Helmholtz equation using the modern Fortran HWSCSP backend."},
1253
+ {"hstcsp", (PyCFunction)fishpack_hstcsp, METH_VARARGS,
1254
+ "Solve a staggered-grid axisymmetric spherical Helmholtz equation using the modern Fortran HSTCSP backend."},
1255
+ {"sor_standard1d", (PyCFunction)fishpack_sor_standard1d, METH_VARARGS,
1256
+ "Solve a one-dimensional variable-coefficient elliptic equation using the modern Fortran SOR backend."},
1257
+ {"sor_standard2d", (PyCFunction)fishpack_sor_standard2d, METH_VARARGS,
1258
+ "Solve a two-dimensional variable-coefficient elliptic equation using the modern Fortran SOR backend."},
1259
+ {"sor_standard3d", (PyCFunction)fishpack_sor_standard3d, METH_VARARGS,
1260
+ "Solve a three-dimensional variable-coefficient elliptic equation using the modern Fortran SOR backend."},
1261
+ {"sor_general2d", (PyCFunction)fishpack_sor_general2d, METH_VARARGS,
1262
+ "Solve a two-dimensional general-form elliptic equation using the modern Fortran SOR backend."},
1263
+ {"sor_general3d", (PyCFunction)fishpack_sor_general3d, METH_VARARGS,
1264
+ "Solve a three-dimensional general-form elliptic equation using the modern Fortran SOR backend."},
1265
+ {"sor_biharmonic2d", (PyCFunction)fishpack_sor_biharmonic2d, METH_VARARGS,
1266
+ "Solve a two-dimensional general-form biharmonic equation using the modern Fortran SOR backend."},
1267
+ {"rfftf", (PyCFunction)fishpack_rfftf, METH_VARARGS,
1268
+ "Apply the FFTPACK real periodic forward transform to a one-dimensional float64 array."},
1269
+ {"rfftb", (PyCFunction)fishpack_rfftb, METH_VARARGS,
1270
+ "Apply the FFTPACK real periodic backward transform to a one-dimensional float64 array."},
1271
+ {"sint", (PyCFunction)fishpack_sint, METH_VARARGS,
1272
+ "Apply the FFTPACK sine transform to a one-dimensional float64 array."},
1273
+ {"cost", (PyCFunction)fishpack_cost, METH_VARARGS,
1274
+ "Apply the FFTPACK cosine transform to a one-dimensional float64 array."},
1275
+ {"sinqf", (PyCFunction)fishpack_sinqf, METH_VARARGS,
1276
+ "Apply the FFTPACK quarter-wave sine forward transform to a one-dimensional float64 array."},
1277
+ {"sinqb", (PyCFunction)fishpack_sinqb, METH_VARARGS,
1278
+ "Apply the FFTPACK quarter-wave sine backward transform to a one-dimensional float64 array."},
1279
+ {"cosqf", (PyCFunction)fishpack_cosqf, METH_VARARGS,
1280
+ "Apply the FFTPACK quarter-wave cosine forward transform to a one-dimensional float64 array."},
1281
+ {"cosqb", (PyCFunction)fishpack_cosqb, METH_VARARGS,
1282
+ "Apply the FFTPACK quarter-wave cosine backward transform to a one-dimensional float64 array."},
1283
+ {"cfftf", (PyCFunction)fishpack_cfftf, METH_VARARGS,
1284
+ "Apply the FFTPACK complex forward transform to an interleaved real/imag float64 array."},
1285
+ {"cfftb", (PyCFunction)fishpack_cfftb, METH_VARARGS,
1286
+ "Apply the FFTPACK complex backward transform to an interleaved real/imag float64 array."},
1287
+ {NULL, NULL, 0, NULL}
1288
+ };
1289
+
1290
+ static struct PyModuleDef fishpack_module = {
1291
+ PyModuleDef_HEAD_INIT,
1292
+ "fishpack",
1293
+ "C extension wrapper for the modern Fortran PyFishPack backend.",
1294
+ -1,
1295
+ fishpack_methods
1296
+ };
1297
+
1298
+ PyMODINIT_FUNC PyInit_fishpack(void)
1299
+ {
1300
+ import_array();
1301
+ return PyModule_Create(&fishpack_module);
1302
+ }