Skip to content

Commit 0054c54

Browse files
authored
Merge pull request #249 from mfem/fix_mfem_real_t
Fix some wrapper code not handling mfem::real_t correctly
2 parents 95a58de + 70e00e5 commit 0054c54

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

mfem/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ def debug_print(message):
2020

2121
print(message)
2222

23-
__version__ = '4.7.0'
23+
__version__ = '4.7.0.1'
2424

mfem/_par/hypre.i

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ bool is_HYPRE_USING_CUDA(){
6666
HYPRE_Int *col);
6767
6868
*/
69-
%typemap(in) (double *data_, HYPRE_BigInt *col)(PyArrayObject * tmp_arr1_ = NULL, PyArrayObject * tmp_arr2_ = NULL){
69+
%typemap(in) (mfem::real_t *data_, HYPRE_BigInt *col)(PyArrayObject * tmp_arr1_ = NULL, PyArrayObject * tmp_arr2_ = NULL){
7070
//HypreParVec constructer requires outside object alive
7171
// We keep reference to such outside numpy array in ProxyClass
7272
tmp_arr1_ = (PyArrayObject *)PyList_GetItem($input,0);
@@ -75,9 +75,9 @@ bool is_HYPRE_USING_CUDA(){
7575
$1 = (double *) PyArray_DATA(tmp_arr1_);
7676
$2 = (HYPRE_BigInt *) PyArray_DATA(tmp_arr2_);
7777
}
78-
%typemap(freearg) (double *data_, HYPRE_BigInt *col){
78+
%typemap(freearg) (mfem::real_t *data_, HYPRE_BigInt *col){
7979
}
80-
%typemap(typecheck )(double *data_, HYPRE_BigInt *col){
80+
%typemap(typecheck )(mfem::real_t *data_, HYPRE_BigInt *col){
8181
/* check if list of 2 numpy array or not */
8282
if (!PyList_Check($input)) $1 = 0;
8383
else {
@@ -103,7 +103,7 @@ bool is_HYPRE_USING_CUDA(){
103103

104104
%typemap(in) (int *I,
105105
HYPRE_BigInt *J,
106-
double *data,
106+
mfem::real_t *data,
107107
HYPRE_BigInt *rows,
108108
HYPRE_BigInt *cols)
109109
(PyArrayObject *tmp_arr1_ = NULL,
@@ -131,7 +131,7 @@ bool is_HYPRE_USING_CUDA(){
131131
}
132132
}
133133
%typemap(freearg) (int *I, HYPRE_BigInt *J,
134-
double *data, HYPRE_BigInt *rows, HYPRE_BigInt *cols){
134+
mfem::real_t *data, HYPRE_BigInt *rows, HYPRE_BigInt *cols){
135135
Py_XDECREF(tmp_arr1_$argnum);
136136
Py_XDECREF(tmp_arr2_$argnum);
137137
Py_XDECREF(tmp_arr3_$argnum);
@@ -142,7 +142,7 @@ bool is_HYPRE_USING_CUDA(){
142142
}
143143

144144
%typemap(typecheck ) (int *I, HYPRE_BigInt *J,
145-
double *data, HYPRE_BigInt *rows,
145+
mfem::real_t *data, HYPRE_BigInt *rows,
146146
HYPRE_BigInt *cols){
147147
/* check if list of 5 numpy array or not */
148148
if (!PyList_Check($input)) $1 = 0;

mfem/_par/sparsemat.i

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ using namespace mfem;
2020
import_array();
2121
%}
2222

23+
%import "../common/mfem_config.i"
24+
2325
%include "exception.i"
2426
%import "array.i"
2527
%import "mem_manager.i"
@@ -100,7 +102,7 @@ if len(args) == 1 and isinstance(args[0], csr_matrix):
100102
SparseMatrix(int *i, int *j, double *data, int m, int n);
101103
allows to use numpy array to call this
102104
*/
103-
%typemap(in) (int *i, int *j, double *data, int m, int n)
105+
%typemap(in) (int *i, int *j, mfem::real_t *data, int m, int n)
104106
(PyArrayObject *tmp_arr1_ = NULL,
105107
PyArrayObject *tmp_arr2_ = NULL,
106108
PyArrayObject *tmp_arr3_ = NULL,
@@ -121,13 +123,13 @@ if len(args) == 1 and isinstance(args[0], csr_matrix):
121123
//
122124
PyArray_CLEARFLAGS(tmp_arr3_, NPY_ARRAY_OWNDATA);
123125
}
124-
%typemap(freearg) (int *i, int *j, double *data, int m, int n){
126+
%typemap(freearg) (int *i, int *j, mfem::real_t *data, int m, int n){
125127
//Py_XDECREF(tmp_arr1_$argnum); Dont do this.. We set OwnsGraph and OwnsData to Fase in Python
126128
//Py_XDECREF(tmp_arr2_$argnum);
127129
//Py_XDECREF(tmp_arr3_$argnum);
128130
}
129131

130-
%typemap(typecheck ) (int *i, int *j, double *data, int m, int n){
132+
%typemap(typecheck ) (int *i, int *j, mfem::real_t *data, int m, int n){
131133
/* check if list of 5 numpy array or not */
132134
if (!PyList_Check($input)) $1 = 0;
133135
else {

mfem/_ser/sparsemat.i

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ if len(args) == 1 and isinstance(args[0], csr_matrix):
9999
SparseMatrix(int *i, int *j, double *data, int m, int n);
100100
allows to use numpy array to call this
101101
*/
102-
%typemap(in) (int *i, int *j, double *data, int m, int n)
102+
%typemap(in) (int *i, int *j, mfem::real_t *data, int m, int n)
103103
(PyArrayObject *tmp_arr1_ = NULL,
104104
PyArrayObject *tmp_arr2_ = NULL,
105105
PyArrayObject *tmp_arr3_ = NULL,
@@ -120,13 +120,13 @@ if len(args) == 1 and isinstance(args[0], csr_matrix):
120120
//
121121
PyArray_CLEARFLAGS(tmp_arr3_, NPY_ARRAY_OWNDATA);
122122
}
123-
%typemap(freearg) (int *i, int *j, double *data, int m, int n){
123+
%typemap(freearg) (int *i, int *j, mfem::real_t *data, int m, int n){
124124
//Py_XDECREF(tmp_arr1_$argnum); Dont do this.. We set OwnsGraph and OwnsData to Fase in Python
125125
//Py_XDECREF(tmp_arr2_$argnum);
126126
//Py_XDECREF(tmp_arr3_$argnum);
127127
}
128128

129-
%typemap(typecheck ) (int *i, int *j, double *data, int m, int n){
129+
%typemap(typecheck ) (int *i, int *j, mfem::real_t *data, int m, int n){
130130
/* check if list of 5 numpy array or not */
131131
if (!PyList_Check($input)) $1 = 0;
132132
else {

0 commit comments

Comments
 (0)