Generated by Cython 0.29.28
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: kinematic_viscosity_operator_ext.c
+001: #cython: wraparound=False, boundscheck=False, cdivision=True, profile=False, nonecheck=False, overflowcheck=False, cdivision_warnings=False, unraisable_tracebacks=False
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
002: import cython
003:
004: # import both numpy and the Cython declarations for numpy
+005: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
006: cimport numpy as np
007:
008: # declare the interface to the C code
009: cdef extern from "kinematic_viscosity_operator.c":
010: int _build_geo_structure(int n, int tot_len, double* centroids, long* neighbours, double* edgelengths, double* edge_midpoints, long* geo_indices, double* geo_values)
011: int _build_elliptic_matrix(int n, int tot_len, long* geo_indices, double* geo_values, double* cell_data, double* bdry_data, double* data, long* colind)
012: int _update_elliptic_matrix(int n, int tot_len, long* geo_indices, double* geo_values, double* cell_data, double* bdry_data, double* data, long* colind)
013:
+014: def build_geo_structure(object kv_operator):
/* Python wrapper */ static PyObject *__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_1build_geo_structure(PyObject *__pyx_self, PyObject *__pyx_v_kv_operator); /*proto*/ static PyMethodDef __pyx_mdef_5anuga_9operators_32kinematic_viscosity_operator_ext_1build_geo_structure = {"build_geo_structure", (PyCFunction)__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_1build_geo_structure, METH_O, 0}; static PyObject *__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_1build_geo_structure(PyObject *__pyx_self, PyObject *__pyx_v_kv_operator) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build_geo_structure (wrapper)", 0); __pyx_r = __pyx_pf_5anuga_9operators_32kinematic_viscosity_operator_ext_build_geo_structure(__pyx_self, ((PyObject *)__pyx_v_kv_operator)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5anuga_9operators_32kinematic_viscosity_operator_ext_build_geo_structure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv_operator) { int __pyx_v_n; int __pyx_v_tot_len; int __pyx_v_err; PyArrayObject *__pyx_v_centroid_coordinates = 0; PyArrayObject *__pyx_v_neighbours = 0; PyArrayObject *__pyx_v_edgelengths = 0; PyArrayObject *__pyx_v_edge_midpoint_coordinates = 0; PyArrayObject *__pyx_v_geo_indices = 0; PyArrayObject *__pyx_v_geo_values = 0; PyObject *__pyx_v_mesh = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_centroid_coordinates; __Pyx_Buffer __pyx_pybuffer_centroid_coordinates; __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_midpoint_coordinates; __Pyx_Buffer __pyx_pybuffer_edge_midpoint_coordinates; __Pyx_LocalBuf_ND __pyx_pybuffernd_edgelengths; __Pyx_Buffer __pyx_pybuffer_edgelengths; __Pyx_LocalBuf_ND __pyx_pybuffernd_geo_indices; __Pyx_Buffer __pyx_pybuffer_geo_indices; __Pyx_LocalBuf_ND __pyx_pybuffernd_geo_values; __Pyx_Buffer __pyx_pybuffer_geo_values; __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbours; __Pyx_Buffer __pyx_pybuffer_neighbours; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build_geo_structure", 0); __pyx_pybuffer_centroid_coordinates.pybuffer.buf = NULL; __pyx_pybuffer_centroid_coordinates.refcount = 0; __pyx_pybuffernd_centroid_coordinates.data = NULL; __pyx_pybuffernd_centroid_coordinates.rcbuffer = &__pyx_pybuffer_centroid_coordinates; __pyx_pybuffer_neighbours.pybuffer.buf = NULL; __pyx_pybuffer_neighbours.refcount = 0; __pyx_pybuffernd_neighbours.data = NULL; __pyx_pybuffernd_neighbours.rcbuffer = &__pyx_pybuffer_neighbours; __pyx_pybuffer_edgelengths.pybuffer.buf = NULL; __pyx_pybuffer_edgelengths.refcount = 0; __pyx_pybuffernd_edgelengths.data = NULL; __pyx_pybuffernd_edgelengths.rcbuffer = &__pyx_pybuffer_edgelengths; __pyx_pybuffer_edge_midpoint_coordinates.pybuffer.buf = NULL; __pyx_pybuffer_edge_midpoint_coordinates.refcount = 0; __pyx_pybuffernd_edge_midpoint_coordinates.data = NULL; __pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer = &__pyx_pybuffer_edge_midpoint_coordinates; __pyx_pybuffer_geo_indices.pybuffer.buf = NULL; __pyx_pybuffer_geo_indices.refcount = 0; __pyx_pybuffernd_geo_indices.data = NULL; __pyx_pybuffernd_geo_indices.rcbuffer = &__pyx_pybuffer_geo_indices; __pyx_pybuffer_geo_values.pybuffer.buf = NULL; __pyx_pybuffer_geo_values.refcount = 0; __pyx_pybuffernd_geo_values.data = NULL; __pyx_pybuffernd_geo_values.rcbuffer = &__pyx_pybuffer_geo_values; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("anuga.operators.kinematic_viscosity_operator_ext.build_geo_structure", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_centroid_coordinates); __Pyx_XDECREF((PyObject *)__pyx_v_neighbours); __Pyx_XDECREF((PyObject *)__pyx_v_edgelengths); __Pyx_XDECREF((PyObject *)__pyx_v_edge_midpoint_coordinates); __Pyx_XDECREF((PyObject *)__pyx_v_geo_indices); __Pyx_XDECREF((PyObject *)__pyx_v_geo_values); __Pyx_XDECREF(__pyx_v_mesh); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__3 = PyTuple_Pack(11, __pyx_n_s_kv_operator, __pyx_n_s_n, __pyx_n_s_tot_len, __pyx_n_s_err, __pyx_n_s_centroid_coordinates, __pyx_n_s_neighbours, __pyx_n_s_edgelengths, __pyx_n_s_edge_midpoint_coordinates, __pyx_n_s_geo_indices, __pyx_n_s_geo_values, __pyx_n_s_mesh); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_9operators_32kinematic_viscosity_operator_ext_1build_geo_structure, NULL, __pyx_n_s_anuga_operators_kinematic_viscos_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_build_geo_structure, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_operators_kinematic_viscos, __pyx_n_s_build_geo_structure, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 14, __pyx_L1_error)
015:
016: cdef int n, tot_len, err
017:
018: cdef np.ndarray[double, ndim=2, mode="c"] centroid_coordinates
019: cdef np.ndarray[long, ndim=2, mode="c"] neighbours
020: cdef np.ndarray[double, ndim=2, mode="c"] edgelengths
021: cdef np.ndarray[double, ndim=2, mode="c"] edge_midpoint_coordinates
022: cdef np.ndarray[long, ndim=2, mode="c"] geo_indices
023: cdef np.ndarray[double, ndim=2, mode="c"] geo_values
024:
+025: mesh = kv_operator.mesh
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_mesh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_mesh = __pyx_t_1; __pyx_t_1 = 0;
026:
+027: n = kv_operator.n
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_2;
+028: tot_len = kv_operator.tot_len
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_tot_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_tot_len = __pyx_t_2;
029:
+030: centroid_coordinates = mesh.centroid_coordinates
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mesh, __pyx_n_s_centroid_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 30, __pyx_L1_error) __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_coordinates, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd_centroid_coordinates.diminfo[0].strides = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_coordinates.diminfo[0].shape = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centroid_coordinates.diminfo[1].strides = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centroid_coordinates.diminfo[1].shape = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 30, __pyx_L1_error) } __pyx_t_3 = 0; __pyx_v_centroid_coordinates = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+031: neighbours = mesh.neighbours
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mesh, __pyx_n_s_neighbours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 31, __pyx_L1_error) __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighbours, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_neighbours.diminfo[0].strides = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbours.diminfo[0].shape = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_neighbours.diminfo[1].strides = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_neighbours.diminfo[1].shape = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_t_7 = 0; __pyx_v_neighbours = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+032: edgelengths = mesh.edgelengths
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mesh, __pyx_n_s_edgelengths); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 32, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer, (PyObject*)__pyx_v_edgelengths, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd_edgelengths.diminfo[0].strides = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edgelengths.diminfo[0].shape = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edgelengths.diminfo[1].strides = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edgelengths.diminfo[1].shape = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 32, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v_edgelengths = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+033: edge_midpoint_coordinates = mesh.edge_midpoint_coordinates
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mesh, __pyx_n_s_edge_midpoint_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 33, __pyx_L1_error) __pyx_t_9 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_midpoint_coordinates, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_edge_midpoint_coordinates.diminfo[0].strides = __pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_midpoint_coordinates.diminfo[0].shape = __pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_midpoint_coordinates.diminfo[1].strides = __pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_midpoint_coordinates.diminfo[1].shape = __pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 33, __pyx_L1_error) } __pyx_t_9 = 0; __pyx_v_edge_midpoint_coordinates = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+034: geo_indices = kv_operator.geo_structure_indices
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_geo_structure_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 34, __pyx_L1_error) __pyx_t_10 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_geo_indices, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd_geo_indices.diminfo[0].strides = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_geo_indices.diminfo[0].shape = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_geo_indices.diminfo[1].strides = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_geo_indices.diminfo[1].shape = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 34, __pyx_L1_error) } __pyx_t_10 = 0; __pyx_v_geo_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+035: geo_values = kv_operator.geo_structure_values
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_geo_structure_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 35, __pyx_L1_error) __pyx_t_11 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_geo_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_geo_values.diminfo[0].strides = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_geo_values.diminfo[0].shape = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_geo_values.diminfo[1].strides = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_geo_values.diminfo[1].shape = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 35, __pyx_L1_error) } __pyx_t_11 = 0; __pyx_v_geo_values = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
036:
+037: err = _build_geo_structure(n, tot_len,\
__pyx_v_err = _build_geo_structure(__pyx_v_n, __pyx_v_tot_len, (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_centroid_coordinates.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_centroid_coordinates.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_neighbours.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_neighbours.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_edgelengths.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_edgelengths.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_midpoint_coordinates.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_edge_midpoint_coordinates.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_edge_midpoint_coordinates.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_geo_indices.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_geo_indices.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_geo_values.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_geo_values.diminfo[1].strides))));
+038: ¢roid_coordinates[0,0],\
__pyx_t_12 = 0; __pyx_t_13 = 0;
+039: &neighbours[0,0],\
__pyx_t_14 = 0; __pyx_t_15 = 0;
+040: &edgelengths[0,0],\
__pyx_t_16 = 0; __pyx_t_17 = 0;
+041: &edge_midpoint_coordinates[0,0],\
__pyx_t_18 = 0; __pyx_t_19 = 0;
+042: &geo_indices[0,0],\
__pyx_t_20 = 0; __pyx_t_21 = 0;
+043: &geo_values[0,0])
__pyx_t_22 = 0; __pyx_t_23 = 0;
044:
+045: assert err == 0, "Could not build geo structure"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_err == 0) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Could_not_build_geo_structure); __PYX_ERR(0, 45, __pyx_L1_error) } } #endif
046:
+047: def build_elliptic_matrix(object kv_operator,\
/* Python wrapper */ static PyObject *__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_3build_elliptic_matrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_5anuga_9operators_32kinematic_viscosity_operator_ext_3build_elliptic_matrix = {"build_elliptic_matrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_3build_elliptic_matrix, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_3build_elliptic_matrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_kv_operator = 0; PyArrayObject *__pyx_v_cell_data = 0; PyArrayObject *__pyx_v_bdry_data = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build_elliptic_matrix (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_kv_operator,&__pyx_n_s_cell_data,&__pyx_n_s_bdry_data,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kv_operator)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cell_data)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("build_elliptic_matrix", 1, 3, 3, 1); __PYX_ERR(0, 47, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bdry_data)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("build_elliptic_matrix", 1, 3, 3, 2); __PYX_ERR(0, 47, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build_elliptic_matrix") < 0)) __PYX_ERR(0, 47, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_kv_operator = values[0]; __pyx_v_cell_data = ((PyArrayObject *)values[1]); __pyx_v_bdry_data = ((PyArrayObject *)values[2]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("build_elliptic_matrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 47, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("anuga.operators.kinematic_viscosity_operator_ext.build_elliptic_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cell_data), __pyx_ptype_5numpy_ndarray, 0, "cell_data", 0))) __PYX_ERR(0, 48, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bdry_data), __pyx_ptype_5numpy_ndarray, 0, "bdry_data", 0))) __PYX_ERR(0, 49, __pyx_L1_error) __pyx_r = __pyx_pf_5anuga_9operators_32kinematic_viscosity_operator_ext_2build_elliptic_matrix(__pyx_self, __pyx_v_kv_operator, __pyx_v_cell_data, __pyx_v_bdry_data); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5anuga_9operators_32kinematic_viscosity_operator_ext_2build_elliptic_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv_operator, PyArrayObject *__pyx_v_cell_data, PyArrayObject *__pyx_v_bdry_data) { int __pyx_v_n; int __pyx_v_tot_len; int __pyx_v_err; PyArrayObject *__pyx_v_geo_indices = 0; PyArrayObject *__pyx_v_geo_values = 0; PyArrayObject *__pyx_v__data = 0; PyArrayObject *__pyx_v_colind = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd__data; __Pyx_Buffer __pyx_pybuffer__data; __Pyx_LocalBuf_ND __pyx_pybuffernd_bdry_data; __Pyx_Buffer __pyx_pybuffer_bdry_data; __Pyx_LocalBuf_ND __pyx_pybuffernd_cell_data; __Pyx_Buffer __pyx_pybuffer_cell_data; __Pyx_LocalBuf_ND __pyx_pybuffernd_colind; __Pyx_Buffer __pyx_pybuffer_colind; __Pyx_LocalBuf_ND __pyx_pybuffernd_geo_indices; __Pyx_Buffer __pyx_pybuffer_geo_indices; __Pyx_LocalBuf_ND __pyx_pybuffernd_geo_values; __Pyx_Buffer __pyx_pybuffer_geo_values; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build_elliptic_matrix", 0); __pyx_pybuffer_geo_indices.pybuffer.buf = NULL; __pyx_pybuffer_geo_indices.refcount = 0; __pyx_pybuffernd_geo_indices.data = NULL; __pyx_pybuffernd_geo_indices.rcbuffer = &__pyx_pybuffer_geo_indices; __pyx_pybuffer_geo_values.pybuffer.buf = NULL; __pyx_pybuffer_geo_values.refcount = 0; __pyx_pybuffernd_geo_values.data = NULL; __pyx_pybuffernd_geo_values.rcbuffer = &__pyx_pybuffer_geo_values; __pyx_pybuffer__data.pybuffer.buf = NULL; __pyx_pybuffer__data.refcount = 0; __pyx_pybuffernd__data.data = NULL; __pyx_pybuffernd__data.rcbuffer = &__pyx_pybuffer__data; __pyx_pybuffer_colind.pybuffer.buf = NULL; __pyx_pybuffer_colind.refcount = 0; __pyx_pybuffernd_colind.data = NULL; __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind; __pyx_pybuffer_cell_data.pybuffer.buf = NULL; __pyx_pybuffer_cell_data.refcount = 0; __pyx_pybuffernd_cell_data.data = NULL; __pyx_pybuffernd_cell_data.rcbuffer = &__pyx_pybuffer_cell_data; __pyx_pybuffer_bdry_data.pybuffer.buf = NULL; __pyx_pybuffer_bdry_data.refcount = 0; __pyx_pybuffernd_bdry_data.data = NULL; __pyx_pybuffernd_bdry_data.rcbuffer = &__pyx_pybuffer_bdry_data; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cell_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_cell_data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 47, __pyx_L1_error) } __pyx_pybuffernd_cell_data.diminfo[0].strides = __pyx_pybuffernd_cell_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cell_data.diminfo[0].shape = __pyx_pybuffernd_cell_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bdry_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_bdry_data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 47, __pyx_L1_error) } __pyx_pybuffernd_bdry_data.diminfo[0].strides = __pyx_pybuffernd_bdry_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bdry_data.diminfo[0].shape = __pyx_pybuffernd_bdry_data.rcbuffer->pybuffer.shape[0]; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bdry_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cell_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("anuga.operators.kinematic_viscosity_operator_ext.build_elliptic_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bdry_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cell_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_geo_indices); __Pyx_XDECREF((PyObject *)__pyx_v_geo_values); __Pyx_XDECREF((PyObject *)__pyx_v__data); __Pyx_XDECREF((PyObject *)__pyx_v_colind); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__5 = PyTuple_Pack(10, __pyx_n_s_kv_operator, __pyx_n_s_cell_data, __pyx_n_s_bdry_data, __pyx_n_s_n, __pyx_n_s_tot_len, __pyx_n_s_err, __pyx_n_s_geo_indices, __pyx_n_s_geo_values, __pyx_n_s_data, __pyx_n_s_colind); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_9operators_32kinematic_viscosity_operator_ext_3build_elliptic_matrix, NULL, __pyx_n_s_anuga_operators_kinematic_viscos_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_build_elliptic_matrix, __pyx_t_1) < 0) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_operators_kinematic_viscos, __pyx_n_s_build_elliptic_matrix, 47, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 47, __pyx_L1_error)
048: np.ndarray[double, ndim=1, mode="c"] cell_data not None,\
049: np.ndarray[double, ndim=1, mode="c"] bdry_data not None):
050:
051: cdef int n, tot_len, err
052:
053: cdef np.ndarray[long, ndim=2, mode="c"] geo_indices
054: cdef np.ndarray[double, ndim=2, mode="c"] geo_values
055: cdef np.ndarray[double, ndim=1, mode="c"] _data
056: cdef np.ndarray[long, ndim=1, mode="c"] colind
057:
+058: n = kv_operator.n
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_2;
+059: tot_len = kv_operator.tot_len
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_tot_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_tot_len = __pyx_t_2;
060:
+061: geo_indices = kv_operator.geo_structure_indices
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_geo_structure_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 61, __pyx_L1_error) __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_geo_indices, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd_geo_indices.diminfo[0].strides = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_geo_indices.diminfo[0].shape = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_geo_indices.diminfo[1].strides = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_geo_indices.diminfo[1].shape = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 61, __pyx_L1_error) } __pyx_t_3 = 0; __pyx_v_geo_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+062: geo_values = kv_operator.geo_structure_values
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_geo_structure_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 62, __pyx_L1_error) __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_geo_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_geo_values.diminfo[0].strides = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_geo_values.diminfo[0].shape = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_geo_values.diminfo[1].strides = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_geo_values.diminfo[1].shape = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 62, __pyx_L1_error) } __pyx_t_7 = 0; __pyx_v_geo_values = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+063: _data = kv_operator.operator_data
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_operator_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 63, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__data.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd__data.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd__data.rcbuffer->pybuffer, (PyObject*)__pyx_v__data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd__data.diminfo[0].strides = __pyx_pybuffernd__data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__data.diminfo[0].shape = __pyx_pybuffernd__data.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 63, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v__data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+064: colind = kv_operator.operator_colind
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_operator_colind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 64, __pyx_L1_error) __pyx_t_9 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 64, __pyx_L1_error) } __pyx_t_9 = 0; __pyx_v_colind = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
065:
+066: err = _build_elliptic_matrix(n, tot_len,\
__pyx_v_err = _build_elliptic_matrix(__pyx_v_n, __pyx_v_tot_len, (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_geo_indices.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_geo_indices.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_geo_values.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_geo_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_cell_data.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_cell_data.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_bdry_data.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bdry_data.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd__data.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd__data.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_colind.diminfo[0].strides))));
+067: &geo_indices[0,0],\
__pyx_t_10 = 0; __pyx_t_11 = 0;
+068: &geo_values[0,0],\
__pyx_t_12 = 0; __pyx_t_13 = 0;
+069: &cell_data[0],\
__pyx_t_14 = 0;
+070: &bdry_data[0],\
__pyx_t_15 = 0;
+071: &_data[0],\
__pyx_t_16 = 0;
+072: &colind[0])
__pyx_t_17 = 0;
073:
+074: assert err == 0, "Could not get stage height interactions"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_err == 0) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Could_not_get_stage_height_inter); __PYX_ERR(0, 74, __pyx_L1_error) } } #endif
075:
+076: def update_elliptic_matrix(object kv_operator,\
/* Python wrapper */ static PyObject *__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_5update_elliptic_matrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_5anuga_9operators_32kinematic_viscosity_operator_ext_5update_elliptic_matrix = {"update_elliptic_matrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_5update_elliptic_matrix, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_5anuga_9operators_32kinematic_viscosity_operator_ext_5update_elliptic_matrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_kv_operator = 0; PyArrayObject *__pyx_v_cell_data = 0; PyArrayObject *__pyx_v_bdry_data = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_elliptic_matrix (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_kv_operator,&__pyx_n_s_cell_data,&__pyx_n_s_bdry_data,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kv_operator)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cell_data)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("update_elliptic_matrix", 1, 3, 3, 1); __PYX_ERR(0, 76, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bdry_data)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("update_elliptic_matrix", 1, 3, 3, 2); __PYX_ERR(0, 76, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_elliptic_matrix") < 0)) __PYX_ERR(0, 76, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_kv_operator = values[0]; __pyx_v_cell_data = ((PyArrayObject *)values[1]); __pyx_v_bdry_data = ((PyArrayObject *)values[2]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("update_elliptic_matrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 76, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("anuga.operators.kinematic_viscosity_operator_ext.update_elliptic_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cell_data), __pyx_ptype_5numpy_ndarray, 0, "cell_data", 0))) __PYX_ERR(0, 77, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bdry_data), __pyx_ptype_5numpy_ndarray, 0, "bdry_data", 0))) __PYX_ERR(0, 78, __pyx_L1_error) __pyx_r = __pyx_pf_5anuga_9operators_32kinematic_viscosity_operator_ext_4update_elliptic_matrix(__pyx_self, __pyx_v_kv_operator, __pyx_v_cell_data, __pyx_v_bdry_data); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5anuga_9operators_32kinematic_viscosity_operator_ext_4update_elliptic_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kv_operator, PyArrayObject *__pyx_v_cell_data, PyArrayObject *__pyx_v_bdry_data) { int __pyx_v_n; int __pyx_v_tot_len; int __pyx_v_err; PyArrayObject *__pyx_v_geo_indices = 0; PyArrayObject *__pyx_v_geo_values = 0; PyArrayObject *__pyx_v__data = 0; PyArrayObject *__pyx_v_colind = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd__data; __Pyx_Buffer __pyx_pybuffer__data; __Pyx_LocalBuf_ND __pyx_pybuffernd_bdry_data; __Pyx_Buffer __pyx_pybuffer_bdry_data; __Pyx_LocalBuf_ND __pyx_pybuffernd_cell_data; __Pyx_Buffer __pyx_pybuffer_cell_data; __Pyx_LocalBuf_ND __pyx_pybuffernd_colind; __Pyx_Buffer __pyx_pybuffer_colind; __Pyx_LocalBuf_ND __pyx_pybuffernd_geo_indices; __Pyx_Buffer __pyx_pybuffer_geo_indices; __Pyx_LocalBuf_ND __pyx_pybuffernd_geo_values; __Pyx_Buffer __pyx_pybuffer_geo_values; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_elliptic_matrix", 0); __pyx_pybuffer_geo_indices.pybuffer.buf = NULL; __pyx_pybuffer_geo_indices.refcount = 0; __pyx_pybuffernd_geo_indices.data = NULL; __pyx_pybuffernd_geo_indices.rcbuffer = &__pyx_pybuffer_geo_indices; __pyx_pybuffer_geo_values.pybuffer.buf = NULL; __pyx_pybuffer_geo_values.refcount = 0; __pyx_pybuffernd_geo_values.data = NULL; __pyx_pybuffernd_geo_values.rcbuffer = &__pyx_pybuffer_geo_values; __pyx_pybuffer__data.pybuffer.buf = NULL; __pyx_pybuffer__data.refcount = 0; __pyx_pybuffernd__data.data = NULL; __pyx_pybuffernd__data.rcbuffer = &__pyx_pybuffer__data; __pyx_pybuffer_colind.pybuffer.buf = NULL; __pyx_pybuffer_colind.refcount = 0; __pyx_pybuffernd_colind.data = NULL; __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind; __pyx_pybuffer_cell_data.pybuffer.buf = NULL; __pyx_pybuffer_cell_data.refcount = 0; __pyx_pybuffernd_cell_data.data = NULL; __pyx_pybuffernd_cell_data.rcbuffer = &__pyx_pybuffer_cell_data; __pyx_pybuffer_bdry_data.pybuffer.buf = NULL; __pyx_pybuffer_bdry_data.refcount = 0; __pyx_pybuffernd_bdry_data.data = NULL; __pyx_pybuffernd_bdry_data.rcbuffer = &__pyx_pybuffer_bdry_data; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cell_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_cell_data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 76, __pyx_L1_error) } __pyx_pybuffernd_cell_data.diminfo[0].strides = __pyx_pybuffernd_cell_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cell_data.diminfo[0].shape = __pyx_pybuffernd_cell_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bdry_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_bdry_data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 76, __pyx_L1_error) } __pyx_pybuffernd_bdry_data.diminfo[0].strides = __pyx_pybuffernd_bdry_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bdry_data.diminfo[0].shape = __pyx_pybuffernd_bdry_data.rcbuffer->pybuffer.shape[0]; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bdry_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cell_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("anuga.operators.kinematic_viscosity_operator_ext.update_elliptic_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bdry_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cell_data.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_geo_indices); __Pyx_XDECREF((PyObject *)__pyx_v_geo_values); __Pyx_XDECREF((PyObject *)__pyx_v__data); __Pyx_XDECREF((PyObject *)__pyx_v_colind); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__7 = PyTuple_Pack(10, __pyx_n_s_kv_operator, __pyx_n_s_cell_data, __pyx_n_s_bdry_data, __pyx_n_s_n, __pyx_n_s_tot_len, __pyx_n_s_err, __pyx_n_s_geo_indices, __pyx_n_s_geo_values, __pyx_n_s_data, __pyx_n_s_colind); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_9operators_32kinematic_viscosity_operator_ext_5update_elliptic_matrix, NULL, __pyx_n_s_anuga_operators_kinematic_viscos_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_elliptic_matrix, __pyx_t_1) < 0) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
077: np.ndarray[double, ndim=1, mode="c"] cell_data not None,\
078: np.ndarray[double, ndim=1, mode="c"] bdry_data not None):
079:
080: cdef int n, tot_len, err
081:
082: cdef np.ndarray[long, ndim=2, mode="c"] geo_indices
083: cdef np.ndarray[double, ndim=2, mode="c"] geo_values
084: cdef np.ndarray[double, ndim=1, mode="c"] _data
085: cdef np.ndarray[long, ndim=1, mode="c"] colind
086:
+087: n = kv_operator.n
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_2;
+088: tot_len = kv_operator.tot_len
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_tot_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_tot_len = __pyx_t_2;
089:
+090: geo_indices = kv_operator.geo_structure_indices
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_geo_structure_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 90, __pyx_L1_error) __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_geo_indices, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd_geo_indices.diminfo[0].strides = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_geo_indices.diminfo[0].shape = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_geo_indices.diminfo[1].strides = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_geo_indices.diminfo[1].shape = __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 90, __pyx_L1_error) } __pyx_t_3 = 0; __pyx_v_geo_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+091: geo_values = kv_operator.geo_structure_values
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_geo_structure_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 91, __pyx_L1_error) __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_geo_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_geo_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_geo_values.diminfo[0].strides = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_geo_values.diminfo[0].shape = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_geo_values.diminfo[1].strides = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_geo_values.diminfo[1].shape = __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) } __pyx_t_7 = 0; __pyx_v_geo_values = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+092: _data = kv_operator.operator_data
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_operator_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 92, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__data.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd__data.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd__data.rcbuffer->pybuffer, (PyObject*)__pyx_v__data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_4, __pyx_t_5, __pyx_t_6); } __pyx_t_4 = __pyx_t_5 = __pyx_t_6 = 0; } __pyx_pybuffernd__data.diminfo[0].strides = __pyx_pybuffernd__data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__data.diminfo[0].shape = __pyx_pybuffernd__data.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 92, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v__data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+093: colind = kv_operator.operator_colind
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kv_operator, __pyx_n_s_operator_colind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 93, __pyx_L1_error) __pyx_t_9 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer); __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); if (unlikely(__pyx_t_2 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_5, __pyx_t_4); } __pyx_t_6 = __pyx_t_5 = __pyx_t_4 = 0; } __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 93, __pyx_L1_error) } __pyx_t_9 = 0; __pyx_v_colind = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
094:
+095: err = _update_elliptic_matrix(n, tot_len,\
__pyx_v_err = _update_elliptic_matrix(__pyx_v_n, __pyx_v_tot_len, (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_geo_indices.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_geo_indices.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_geo_indices.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_geo_values.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_geo_values.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_geo_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_cell_data.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_cell_data.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_bdry_data.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bdry_data.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd__data.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd__data.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_colind.diminfo[0].strides))));
+096: &geo_indices[0,0],\
__pyx_t_10 = 0; __pyx_t_11 = 0;
+097: &geo_values[0,0],\
__pyx_t_12 = 0; __pyx_t_13 = 0;
+098: &cell_data[0],\
__pyx_t_14 = 0;
+099: &bdry_data[0],\
__pyx_t_15 = 0;
+100: &_data[0],\
__pyx_t_16 = 0;
+101: &colind[0])
__pyx_t_17 = 0;
102:
+103: assert err == 0, "Could not get stage height interactions"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_err == 0) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Could_not_get_stage_height_inter); __PYX_ERR(0, 103, __pyx_L1_error) } } #endif