Generated by Cython 0.29.30
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: mesh_factory_ext.c
+01: #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;
02: import cython
03:
04: # import both numpy and the Cython declarations for numpy
+05: 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;
06: cimport numpy as np
07:
+08: def rectangular_cross_construct(np.ndarray[double, ndim=1, mode="c"] params not None,\
/* Python wrapper */ static PyObject *__pyx_pw_5anuga_26abstract_2d_finite_volumes_16mesh_factory_ext_1rectangular_cross_construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_5anuga_26abstract_2d_finite_volumes_16mesh_factory_ext_1rectangular_cross_construct = {"rectangular_cross_construct", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_26abstract_2d_finite_volumes_16mesh_factory_ext_1rectangular_cross_construct, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_5anuga_26abstract_2d_finite_volumes_16mesh_factory_ext_1rectangular_cross_construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_params = 0; PyArrayObject *__pyx_v_origin = 0; PyArrayObject *__pyx_v_points = 0; PyArrayObject *__pyx_v_elements = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rectangular_cross_construct (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_params,&__pyx_n_s_origin,&__pyx_n_s_points,&__pyx_n_s_elements,0}; PyObject* values[4] = {0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; 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_params)) != 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_origin)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rectangular_cross_construct", 1, 4, 4, 1); __PYX_ERR(0, 8, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rectangular_cross_construct", 1, 4, 4, 2); __PYX_ERR(0, 8, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elements)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("rectangular_cross_construct", 1, 4, 4, 3); __PYX_ERR(0, 8, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rectangular_cross_construct") < 0)) __PYX_ERR(0, 8, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { 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); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_params = ((PyArrayObject *)values[0]); __pyx_v_origin = ((PyArrayObject *)values[1]); __pyx_v_points = ((PyArrayObject *)values[2]); __pyx_v_elements = ((PyArrayObject *)values[3]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("rectangular_cross_construct", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 8, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("anuga.abstract_2d_finite_volumes.mesh_factory_ext.rectangular_cross_construct", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_params), __pyx_ptype_5numpy_ndarray, 0, "params", 0))) __PYX_ERR(0, 8, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_origin), __pyx_ptype_5numpy_ndarray, 0, "origin", 0))) __PYX_ERR(0, 9, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_points), __pyx_ptype_5numpy_ndarray, 0, "points", 0))) __PYX_ERR(0, 10, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elements), __pyx_ptype_5numpy_ndarray, 0, "elements", 0))) __PYX_ERR(0, 11, __pyx_L1_error) __pyx_r = __pyx_pf_5anuga_26abstract_2d_finite_volumes_16mesh_factory_ext_rectangular_cross_construct(__pyx_self, __pyx_v_params, __pyx_v_origin, __pyx_v_points, __pyx_v_elements); 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_26abstract_2d_finite_volumes_16mesh_factory_ext_rectangular_cross_construct(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_params, PyArrayObject *__pyx_v_origin, PyArrayObject *__pyx_v_points, PyArrayObject *__pyx_v_elements) { int __pyx_v_m; int __pyx_v_n; int __pyx_v_i; int __pyx_v_j; int __pyx_v_v1; int __pyx_v_v2; int __pyx_v_v3; int __pyx_v_v4; int __pyx_v_v5; int __pyx_v_numPoints; int __pyx_v_numElements; double __pyx_v_len1; double __pyx_v_len2; double __pyx_v_delta1; double __pyx_v_delta2; double __pyx_v_x; double __pyx_v_y; PyArrayObject *__pyx_v_vertices = 0; PyObject *__pyx_v_boundary = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_elements; __Pyx_Buffer __pyx_pybuffer_elements; __Pyx_LocalBuf_ND __pyx_pybuffernd_origin; __Pyx_Buffer __pyx_pybuffer_origin; __Pyx_LocalBuf_ND __pyx_pybuffernd_params; __Pyx_Buffer __pyx_pybuffer_params; __Pyx_LocalBuf_ND __pyx_pybuffernd_points; __Pyx_Buffer __pyx_pybuffer_points; __Pyx_LocalBuf_ND __pyx_pybuffernd_vertices; __Pyx_Buffer __pyx_pybuffer_vertices; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rectangular_cross_construct", 0); __pyx_pybuffer_vertices.pybuffer.buf = NULL; __pyx_pybuffer_vertices.refcount = 0; __pyx_pybuffernd_vertices.data = NULL; __pyx_pybuffernd_vertices.rcbuffer = &__pyx_pybuffer_vertices; __pyx_pybuffer_params.pybuffer.buf = NULL; __pyx_pybuffer_params.refcount = 0; __pyx_pybuffernd_params.data = NULL; __pyx_pybuffernd_params.rcbuffer = &__pyx_pybuffer_params; __pyx_pybuffer_origin.pybuffer.buf = NULL; __pyx_pybuffer_origin.refcount = 0; __pyx_pybuffernd_origin.data = NULL; __pyx_pybuffernd_origin.rcbuffer = &__pyx_pybuffer_origin; __pyx_pybuffer_points.pybuffer.buf = NULL; __pyx_pybuffer_points.refcount = 0; __pyx_pybuffernd_points.data = NULL; __pyx_pybuffernd_points.rcbuffer = &__pyx_pybuffer_points; __pyx_pybuffer_elements.pybuffer.buf = NULL; __pyx_pybuffer_elements.refcount = 0; __pyx_pybuffernd_elements.data = NULL; __pyx_pybuffernd_elements.rcbuffer = &__pyx_pybuffer_elements; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_params.rcbuffer->pybuffer, (PyObject*)__pyx_v_params, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 8, __pyx_L1_error) } __pyx_pybuffernd_params.diminfo[0].strides = __pyx_pybuffernd_params.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_params.diminfo[0].shape = __pyx_pybuffernd_params.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_origin.rcbuffer->pybuffer, (PyObject*)__pyx_v_origin, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 8, __pyx_L1_error) } __pyx_pybuffernd_origin.diminfo[0].strides = __pyx_pybuffernd_origin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_origin.diminfo[0].shape = __pyx_pybuffernd_origin.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_points.rcbuffer->pybuffer, (PyObject*)__pyx_v_points, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 8, __pyx_L1_error) } __pyx_pybuffernd_points.diminfo[0].strides = __pyx_pybuffernd_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_points.diminfo[0].shape = __pyx_pybuffernd_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_points.diminfo[1].strides = __pyx_pybuffernd_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_points.diminfo[1].shape = __pyx_pybuffernd_points.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elements.rcbuffer->pybuffer, (PyObject*)__pyx_v_elements, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 8, __pyx_L1_error) } __pyx_pybuffernd_elements.diminfo[0].strides = __pyx_pybuffernd_elements.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elements.diminfo[0].shape = __pyx_pybuffernd_elements.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elements.diminfo[1].strides = __pyx_pybuffernd_elements.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elements.diminfo[1].shape = __pyx_pybuffernd_elements.rcbuffer->pybuffer.shape[1]; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { 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_elements.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_origin.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_params.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_points.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertices.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("anuga.abstract_2d_finite_volumes.mesh_factory_ext.rectangular_cross_construct", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elements.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_origin.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_params.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_points.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertices.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_vertices); __Pyx_XDECREF(__pyx_v_boundary); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__3 = PyTuple_Pack(23, __pyx_n_s_params, __pyx_n_s_origin, __pyx_n_s_points, __pyx_n_s_elements, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_v1, __pyx_n_s_v2, __pyx_n_s_v3, __pyx_n_s_v4, __pyx_n_s_v5, __pyx_n_s_numPoints, __pyx_n_s_numElements, __pyx_n_s_len1, __pyx_n_s_len2, __pyx_n_s_delta1, __pyx_n_s_delta2, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_vertices, __pyx_n_s_boundary); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* … */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_26abstract_2d_finite_volumes_16mesh_factory_ext_1rectangular_cross_construct, NULL, __pyx_n_s_anuga_abstract_2d_finite_volumes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_rectangular_cross_construct, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
09: np.ndarray[double, ndim=1, mode="c"] origin not None,\
10: np.ndarray[double, ndim=2, mode="c"] points not None,\
11: np.ndarray[long, ndim=2, mode="c"] elements not None):
12:
13:
14: cdef int m, n, i, j, v1, v2 ,v3 ,v4, v5
15: cdef int numPoints, numElements
16: cdef double len1, len2, delta1, delta2, x, y
17:
+18: m = int(params[0])
__pyx_t_1 = 0; __pyx_v_m = ((int)(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_params.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_params.diminfo[0].strides)));
+19: n = int(params[1])
__pyx_t_1 = 1; __pyx_v_n = ((int)(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_params.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_params.diminfo[0].strides)));
+20: len1 = params[2]
__pyx_t_1 = 2; __pyx_v_len1 = (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_params.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_params.diminfo[0].strides));
+21: len2 = params[3]
__pyx_t_1 = 3; __pyx_v_len2 = (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_params.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_params.diminfo[0].strides));
22:
+23: cdef np.ndarray[long, ndim=2, mode="c"] vertices = np.ascontiguousarray(np.zeros((m+1,n+1),dtype=int))
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_m + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_v_n + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __pyx_t_3 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 23, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertices.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_vertices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_vertices.rcbuffer->pybuffer.buf = NULL; __PYX_ERR(0, 23, __pyx_L1_error) } else {__pyx_pybuffernd_vertices.diminfo[0].strides = __pyx_pybuffernd_vertices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertices.diminfo[0].shape = __pyx_pybuffernd_vertices.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertices.diminfo[1].strides = __pyx_pybuffernd_vertices.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertices.diminfo[1].shape = __pyx_pybuffernd_vertices.rcbuffer->pybuffer.shape[1]; } } __pyx_t_8 = 0; __pyx_v_vertices = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0;
24:
+25: delta1 = len1/m
__pyx_v_delta1 = (__pyx_v_len1 / __pyx_v_m);
+26: delta2 = len2/n
__pyx_v_delta2 = (__pyx_v_len2 / __pyx_v_n);
27:
+28: numPoints = 0
__pyx_v_numPoints = 0;
+29: for i in xrange(m+1):
__pyx_t_9 = (__pyx_v_m + 1); __pyx_t_10 = __pyx_t_9; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11;
+30: for j in xrange(n+1):
__pyx_t_12 = (__pyx_v_n + 1); __pyx_t_13 = __pyx_t_12; for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_j = __pyx_t_14;
+31: vertices[i,j] = numPoints
__pyx_t_1 = __pyx_v_i; __pyx_t_15 = __pyx_v_j; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_vertices.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_vertices.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_vertices.diminfo[1].strides) = __pyx_v_numPoints;
+32: points[numPoints,0] = i*delta1 + origin[0]
__pyx_t_15 = 0; __pyx_t_1 = __pyx_v_numPoints; __pyx_t_16 = 0; *__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_points.diminfo[1].strides) = ((__pyx_v_i * __pyx_v_delta1) + (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_origin.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_origin.diminfo[0].strides)));
+33: points[numPoints,1] = j*delta2 + origin[1]
__pyx_t_15 = 1; __pyx_t_16 = __pyx_v_numPoints; __pyx_t_1 = 1; *__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_points.diminfo[1].strides) = ((__pyx_v_j * __pyx_v_delta2) + (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_origin.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_origin.diminfo[0].strides)));
+34: numPoints += 1
__pyx_v_numPoints = (__pyx_v_numPoints + 1); } }
35:
+36: boundary = {}
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_boundary = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+37: numElements = 0
__pyx_v_numElements = 0;
+38: for i in xrange(m):
__pyx_t_11 = __pyx_v_m; __pyx_t_14 = __pyx_t_11; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_14; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17;
+39: for j in xrange(n):
__pyx_t_18 = __pyx_v_n; __pyx_t_19 = __pyx_t_18; for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { __pyx_v_j = __pyx_t_20;
+40: v1 = vertices[i,j+1]
__pyx_t_15 = __pyx_v_i; __pyx_t_1 = (__pyx_v_j + 1); __pyx_v_v1 = (*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_vertices.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_vertices.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_vertices.diminfo[1].strides));
+41: v2 = vertices[i,j]
__pyx_t_1 = __pyx_v_i; __pyx_t_15 = __pyx_v_j; __pyx_v_v2 = (*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_vertices.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_vertices.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_vertices.diminfo[1].strides));
+42: v3 = vertices[i+1,j+1]
__pyx_t_15 = (__pyx_v_i + 1); __pyx_t_1 = (__pyx_v_j + 1); __pyx_v_v3 = (*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_vertices.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_vertices.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_vertices.diminfo[1].strides));
+43: v4 = vertices[i+1,j]
__pyx_t_1 = (__pyx_v_i + 1); __pyx_t_15 = __pyx_v_j; __pyx_v_v4 = (*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_vertices.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_vertices.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_vertices.diminfo[1].strides));
+44: x = (points[v1,0] + points[v2,0] + points[v3,0] + points[v4,0])*0.25
__pyx_t_15 = __pyx_v_v1; __pyx_t_1 = 0; __pyx_t_16 = __pyx_v_v2; __pyx_t_21 = 0; __pyx_t_22 = __pyx_v_v3; __pyx_t_23 = 0; __pyx_t_24 = __pyx_v_v4; __pyx_t_25 = 0; __pyx_v_x = (((((*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_points.diminfo[1].strides)) + (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_points.diminfo[1].strides))) + (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_points.diminfo[1].strides))) + (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_points.diminfo[1].strides))) * 0.25);
+45: y = (points[v1,1] + points[v2,1] + points[v3,1] + points[v4,1])*0.25
__pyx_t_25 = __pyx_v_v1; __pyx_t_24 = 1; __pyx_t_23 = __pyx_v_v2; __pyx_t_22 = 1; __pyx_t_21 = __pyx_v_v3; __pyx_t_16 = 1; __pyx_t_1 = __pyx_v_v4; __pyx_t_15 = 1; __pyx_v_y = (((((*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_points.diminfo[1].strides)) + (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_points.diminfo[1].strides))) + (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_points.diminfo[1].strides))) + (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_points.diminfo[1].strides))) * 0.25);
46:
47: # Create centre point
+48: v5 = numPoints
__pyx_v_v5 = __pyx_v_numPoints;
+49: points[numPoints,0] = x
__pyx_t_15 = __pyx_v_numPoints; __pyx_t_1 = 0; *__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_points.diminfo[1].strides) = __pyx_v_x;
+50: points[numPoints,1] = y
__pyx_t_1 = __pyx_v_numPoints; __pyx_t_15 = 1; *__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_points.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_points.diminfo[1].strides) = __pyx_v_y;
+51: numPoints += 1
__pyx_v_numPoints = (__pyx_v_numPoints + 1);
52:
53: # Create left triangle
+54: if i == 0:
__pyx_t_26 = ((__pyx_v_i == 0) != 0); if (__pyx_t_26) { /* … */ }
+55: boundary[(numElements,1)] = "left"
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_numElements); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1); __pyx_t_2 = 0; if (unlikely(PyDict_SetItem(__pyx_v_boundary, __pyx_t_4, __pyx_n_s_left) < 0)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
56:
+57: elements[numElements,0] = v2
__pyx_t_15 = __pyx_v_numElements; __pyx_t_1 = 0; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v2;
+58: elements[numElements,1] = v5
__pyx_t_1 = __pyx_v_numElements; __pyx_t_15 = 1; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v5;
+59: elements[numElements,2] = v1
__pyx_t_15 = __pyx_v_numElements; __pyx_t_1 = 2; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v1;
+60: numElements += 1
__pyx_v_numElements = (__pyx_v_numElements + 1);
61:
62: # Create bottom triangle
+63: if j == 0:
__pyx_t_26 = ((__pyx_v_j == 0) != 0); if (__pyx_t_26) { /* … */ }
+64: boundary[(numElements,1)] = "bottom"
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_numElements); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); __pyx_t_4 = 0; if (unlikely(PyDict_SetItem(__pyx_v_boundary, __pyx_t_2, __pyx_n_s_bottom) < 0)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
65:
+66: elements[numElements,0] = v4
__pyx_t_1 = __pyx_v_numElements; __pyx_t_15 = 0; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v4;
+67: elements[numElements,1] = v5
__pyx_t_15 = __pyx_v_numElements; __pyx_t_1 = 1; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v5;
+68: elements[numElements,2] = v2
__pyx_t_1 = __pyx_v_numElements; __pyx_t_15 = 2; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v2;
+69: numElements += 1
__pyx_v_numElements = (__pyx_v_numElements + 1);
70:
71: # Create right triangle
+72: if i == m-1:
__pyx_t_26 = ((__pyx_v_i == (__pyx_v_m - 1)) != 0); if (__pyx_t_26) { /* … */ }
+73: boundary[(numElements,1)] = "right"
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_numElements); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1); __pyx_t_2 = 0; if (unlikely(PyDict_SetItem(__pyx_v_boundary, __pyx_t_4, __pyx_n_s_right) < 0)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
74:
+75: elements[numElements,0] = v3
__pyx_t_15 = __pyx_v_numElements; __pyx_t_1 = 0; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v3;
+76: elements[numElements,1] = v5
__pyx_t_1 = __pyx_v_numElements; __pyx_t_15 = 1; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v5;
+77: elements[numElements,2] = v4
__pyx_t_15 = __pyx_v_numElements; __pyx_t_1 = 2; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v4;
+78: numElements += 1
__pyx_v_numElements = (__pyx_v_numElements + 1);
79:
80: # Create top triangle
+81: if j == n-1:
__pyx_t_26 = ((__pyx_v_j == (__pyx_v_n - 1)) != 0); if (__pyx_t_26) { /* … */ }
+82: boundary[(numElements,1)] = "top"
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_numElements); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); __pyx_t_4 = 0; if (unlikely(PyDict_SetItem(__pyx_v_boundary, __pyx_t_2, __pyx_n_s_top) < 0)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
83:
+84: elements[numElements,0] = v1
__pyx_t_1 = __pyx_v_numElements; __pyx_t_15 = 0; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v1;
+85: elements[numElements,1] = v5
__pyx_t_15 = __pyx_v_numElements; __pyx_t_1 = 1; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v5;
+86: elements[numElements,2] = v3
__pyx_t_1 = __pyx_v_numElements; __pyx_t_15 = 2; *__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_elements.diminfo[1].strides) = __pyx_v_v3;
+87: numElements += 1
__pyx_v_numElements = (__pyx_v_numElements + 1); } }
88:
+89: return boundary
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_boundary); __pyx_r = __pyx_v_boundary; goto __pyx_L0;