Changeset b36e7c7 in sasview for src/sas/sascalc/calculator/c_extensions/sld2i_module.c
- Timestamp:
- Mar 29, 2019 6:13:15 AM (5 years ago)
- Branches:
- magnetic_scatt
- Children:
- 1342f6a
- Parents:
- a48831a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/c_extensions/sld2i_module.c
r7ba6470 rb36e7c7 18 18 // Vector binding glue 19 19 #if (PY_VERSION_HEX > 0x03000000) && !defined(Py_LIMITED_API) 20 // Assuming that a view into a writable vector points to a 21 // non-changing pointer for the duration of the C call, capture 20 // Assuming that a view into a writable vector points to a 21 // non-changing pointer for the duration of the C call, capture 22 22 // the view pointer and immediately free the view. 23 23 #define VECTOR(VEC_obj, VEC_buf, VEC_len) do { \ … … 101 101 * GenI the given input (2D) according to a given object 102 102 */ 103 PyObject * genicom_inputXY(PyObject *self, PyObject *args) {104 PyObject *gen_obj;105 PyObject *qx_obj;106 PyObject *qy_obj;107 PyObject *I_out_obj;108 Py_ssize_t n_qx, n_qy, n_out;109 double *qx;110 double *qy;111 double *I_out;112 GenI* sld2i;113 114 //printf("in genicom_inputXY\n");115 if (!PyArg_ParseTuple(args, "OOOO", &gen_obj, &qx_obj, &qy_obj, &I_out_obj)) return NULL;116 sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI");117 VECTOR(qx_obj, qx, n_qx);118 VECTOR(qy_obj, qy, n_qy);119 VECTOR(I_out_obj, I_out, n_out);120 //printf("qx, qy, I_out: %d %d %d, %d %d %d\n", qx, qy, I_out, n_qx, n_qy, n_out);121 122 // Sanity check123 //if(n_q!=n_out) return Py_BuildValue("i",-1);124 125 genicomXY(sld2i, (int)n_qx, qx, qy, I_out);126 //printf("done calc\n");127 //return PyCObject_FromVoidPtr(s, del_genicom);128 return Py_BuildValue("i",1);129 }103 // PyObject * genicom_inputXY(PyObject *self, PyObject *args) { 104 // PyObject *gen_obj; 105 // PyObject *qx_obj; 106 // PyObject *qy_obj; 107 // PyObject *I_out_obj; 108 // Py_ssize_t n_qx, n_qy, n_out; 109 // double *qx; 110 // double *qy; 111 // double *I_out; 112 // GenI* sld2i; 113 // 114 // //printf("in genicom_inputXY\n"); 115 // if (!PyArg_ParseTuple(args, "OOOO", &gen_obj, &qx_obj, &qy_obj, &I_out_obj)) return NULL; 116 // sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI"); 117 // VECTOR(qx_obj, qx, n_qx); 118 // VECTOR(qy_obj, qy, n_qy); 119 // VECTOR(I_out_obj, I_out, n_out); 120 // //printf("qx, qy, I_out: %d %d %d, %d %d %d\n", qx, qy, I_out, n_qx, n_qy, n_out); 121 // 122 // // Sanity check 123 // //if(n_q!=n_out) return Py_BuildValue("i",-1); 124 // 125 // genicomXY(sld2i, (int)n_qx, qx, qy, I_out); 126 // //printf("done calc\n"); 127 // //return PyCObject_FromVoidPtr(s, del_genicom); 128 // return Py_BuildValue("i",1); 129 // } 130 130 131 131 /** … … 161 161 {"genicom",(PyCFunction)genicom_input, METH_VARARGS, 162 162 "genicom the given 1d input arrays"}, 163 {"genicomXY",(PyCFunction)genicom_inputXY, METH_VARARGS,164 "genicomXY the given 2d input arrays"},163 // {"genicomXY",(PyCFunction)genicom_inputXY, METH_VARARGS, 164 // "genicomXY the given 2d input arrays"}, 165 165 {NULL} 166 166 };
Note: See TracChangeset
for help on using the changeset viewer.