Changeset 8968 for trunk/anuga_core/source/anuga/utilities/util_ext.h
- Timestamp:
- Sep 9, 2013, 9:01:13 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/utilities/util_ext.h
r8813 r8968 28 28 #define P_ERROR_BUFFER_SIZE 65 29 29 30 31 // check that numpy array objects are C contiguous memory 32 #define CHECK_C_CONTIG(varname) if (!PyArray_ISCONTIGUOUS(varname)) { \ 33 char msg[1024]; \ 34 sprintf(msg, \ 35 "%s(): file %s, line %d: " \ 36 "'%s' object is not C contiguous memory", \ 37 __func__, __FILE__, __LINE__, #varname); \ 38 PyErr_SetString(PyExc_RuntimeError, msg); \ 39 return NULL; \ 40 } 41 42 43 44 45 46 47 30 48 void report_python_error(const char *location, const char *msg) 31 49 { … … 303 321 return NULL; 304 322 } 305 323 324 325 CHECK_C_CONTIG(B); 326 A = B; 306 327 //Convert to consecutive array 307 A = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*) B,308 B -> descr -> type, 0, 0); // New Reference309 310 Py_DECREF(B); //FIXME: Is this really needed??328 //A = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*) B, 329 // B -> descr -> type, 0, 0); // New Reference 330 331 //Py_DECREF(B); //FIXME: Is this really needed?? 311 332 312 333 if (!A) { … … 409 430 410 431 411 // check that numpy array objects are C contiguous memory 412 #define CHECK_C_CONTIG(varname) if (!PyArray_ISCONTIGUOUS(varname)) { \ 413 char msg[1024]; \ 414 sprintf(msg, \ 415 "%s(): file %s, line %d: " \ 416 "'%s' object is not C contiguous memory", \ 417 __func__, __FILE__, __LINE__, #varname); \ 418 PyErr_SetString(PyExc_RuntimeError, msg); \ 419 return NULL; \ 420 } 421 422 423 #endif 432 #endif /* ANUGA_UTIL_EXT_H */
Note: See TracChangeset
for help on using the changeset viewer.