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: neighbour_mesh_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 boundary_dictionary_construct(int numTriangle, defaultTag,\
/* Python wrapper */
static PyObject *__pyx_pw_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_1boundary_dictionary_construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_1boundary_dictionary_construct = {"boundary_dictionary_construct", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_1boundary_dictionary_construct, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_1boundary_dictionary_construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_numTriangle;
  PyObject *__pyx_v_defaultTag = 0;
  PyArrayObject *__pyx_v_neighbours = 0;
  PyObject *__pyx_v_boundary = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boundary_dictionary_construct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_numTriangle,&__pyx_n_s_defaultTag,&__pyx_n_s_neighbours,&__pyx_n_s_boundary,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_numTriangle)) != 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_defaultTag)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("boundary_dictionary_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_neighbours)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("boundary_dictionary_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_boundary)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("boundary_dictionary_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, "boundary_dictionary_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_numTriangle = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_numTriangle == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 8, __pyx_L3_error)
    __pyx_v_defaultTag = values[1];
    __pyx_v_neighbours = ((PyArrayObject *)values[2]);
    __pyx_v_boundary = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boundary_dictionary_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.neighbour_mesh_ext.boundary_dictionary_construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_neighbours), __pyx_ptype_5numpy_ndarray, 0, "neighbours", 0))) __PYX_ERR(0, 9, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boundary), (&PyDict_Type), 1, "boundary", 1))) __PYX_ERR(0, 10, __pyx_L1_error)
  __pyx_r = __pyx_pf_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_boundary_dictionary_construct(__pyx_self, __pyx_v_numTriangle, __pyx_v_defaultTag, __pyx_v_neighbours, __pyx_v_boundary);
  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_18neighbour_mesh_ext_boundary_dictionary_construct(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_numTriangle, PyObject *__pyx_v_defaultTag, PyArrayObject *__pyx_v_neighbours, PyObject *__pyx_v_boundary) {
  int __pyx_v_a;
  int __pyx_v_b;
  int __pyx_v_vol_id;
  int __pyx_v_edge_id;
  PyObject *__pyx_v_msg = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbours;
  __Pyx_Buffer __pyx_pybuffer_neighbours;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boundary_dictionary_construct", 0);
  __pyx_pybuffer_neighbours.pybuffer.buf = NULL;
  __pyx_pybuffer_neighbours.refcount = 0;
  __pyx_pybuffernd_neighbours.data = NULL;
  __pyx_pybuffernd_neighbours.rcbuffer = &__pyx_pybuffer_neighbours;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    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)) __PYX_ERR(0, 8, __pyx_L1_error)
  }
  __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];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  { 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_neighbours.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("anuga.abstract_2d_finite_volumes.neighbour_mesh_ext.boundary_dictionary_construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__3 = PyTuple_Pack(9, __pyx_n_s_numTriangle, __pyx_n_s_defaultTag, __pyx_n_s_neighbours, __pyx_n_s_boundary, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_vol_id, __pyx_n_s_edge_id, __pyx_n_s_msg); 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_18neighbour_mesh_ext_1boundary_dictionary_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_boundary_dictionary_construct, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 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_abstract_2d_finite_volumes, __pyx_n_s_boundary_dictionary_construct, 8, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 8, __pyx_L1_error)
 09:                                 np.ndarray[long, ndim=2, mode="c"] neighbours not None,\
 10:                                 dict boundary):
 11: 
 12: 	cdef int a, b, vol_id, edge_id
 13: 
 14: 	#defaultTag = defaultTag.encode('utm-f')
 15: 
+16: 	a = neighbours.shape[0]
  __pyx_v_a = (__pyx_v_neighbours->dimensions[0]);
+17: 	b = neighbours.shape[1]
  __pyx_v_b = (__pyx_v_neighbours->dimensions[1]);
 18: 
+19: 	if bool(boundary):
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_boundary); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 19, __pyx_L1_error)
  if (((!(!__pyx_t_1)) != 0)) {
/* … */
  }
+20: 		for vol_id, edge_id in boundary.keys():
    if (unlikely(__pyx_v_boundary == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
      __PYX_ERR(0, 20, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_Keys(__pyx_v_boundary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 20, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 20, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 20, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 20, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_vol_id = __pyx_t_10;
      __pyx_v_edge_id = __pyx_t_11;
/* … */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+21: 			msg = 'Segment (%d, %d) does not exist' %(vol_id, edge_id)
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_vol_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_edge_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Segment_d_d_does_not_exist, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_msg, __pyx_t_7);
      __pyx_t_7 = 0;
+22: 			assert vol_id < a and edge_id < b, msg
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_12 = ((__pyx_v_vol_id < __pyx_v_a) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_1 = __pyx_t_12;
          goto __pyx_L8_bool_binop_done;
        }
        __pyx_t_12 = ((__pyx_v_edge_id < __pyx_v_b) != 0);
        __pyx_t_1 = __pyx_t_12;
        __pyx_L8_bool_binop_done:;
        if (unlikely(!__pyx_t_1)) {
          __pyx_t_7 = PyTuple_Pack(1, __pyx_v_msg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __PYX_ERR(0, 22, __pyx_L1_error)
        }
      }
      #endif
 23: 
+24: 	for vol_id in xrange(numTriangle):
  __pyx_t_11 = __pyx_v_numTriangle;
  __pyx_t_10 = __pyx_t_11;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
    __pyx_v_vol_id = __pyx_t_13;
+25: 		for edge_id in xrange(0,3):
    for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) {
      __pyx_v_edge_id = __pyx_t_14;
+26: 			if neighbours[vol_id, edge_id] < 0:
      __pyx_t_15 = __pyx_v_vol_id;
      __pyx_t_16 = __pyx_v_edge_id;
      __pyx_t_1 = (((*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_neighbours.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_neighbours.diminfo[1].strides)) < 0) != 0);
      if (__pyx_t_1) {
/* … */
      }
    }
  }
+27: 				if not boundary.has_key((vol_id, edge_id)):
        if (unlikely(__pyx_v_boundary == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "has_key");
          __PYX_ERR(0, 27, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_vol_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_edge_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
        __pyx_t_3 = 0;
        __pyx_t_7 = 0;
        __pyx_t_1 = PyDict_Contains(__pyx_v_boundary, __pyx_t_6); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 27, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_12 = ((!(__pyx_t_1 != 0)) != 0);
        if (__pyx_t_12) {
/* … */
        }
+28: 					boundary[(vol_id, edge_id)] = defaultTag
          if (unlikely(__pyx_v_boundary == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 28, __pyx_L1_error)
          }
          __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_vol_id); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 28, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_edge_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 28, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
          __pyx_t_6 = 0;
          __pyx_t_7 = 0;
          if (unlikely(PyDict_SetItem(__pyx_v_boundary, __pyx_t_3, __pyx_v_defaultTag) < 0)) __PYX_ERR(0, 28, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 29: 
+30: 	return boundary
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_boundary);
  __pyx_r = __pyx_v_boundary;
  goto __pyx_L0;
 31: 
+32: def check_integrity_c(np.ndarray[long, ndim=1, mode="c"] vertex_value_indices not None,\
/* Python wrapper */
static PyObject *__pyx_pw_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_3check_integrity_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_3check_integrity_c = {"check_integrity_c", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_3check_integrity_c, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_3check_integrity_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_vertex_value_indices = 0;
  PyArrayObject *__pyx_v_triangles = 0;
  PyArrayObject *__pyx_v_node_index = 0;
  PyArrayObject *__pyx_v_number_of_triangles_per_node = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_integrity_c (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vertex_value_indices,&__pyx_n_s_triangles,&__pyx_n_s_node_index,&__pyx_n_s_number_of_triangles_per_node,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_vertex_value_indices)) != 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_triangles)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_integrity_c", 1, 4, 4, 1); __PYX_ERR(0, 32, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_integrity_c", 1, 4, 4, 2); __PYX_ERR(0, 32, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_number_of_triangles_per_node)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("check_integrity_c", 1, 4, 4, 3); __PYX_ERR(0, 32, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_integrity_c") < 0)) __PYX_ERR(0, 32, __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_vertex_value_indices = ((PyArrayObject *)values[0]);
    __pyx_v_triangles = ((PyArrayObject *)values[1]);
    __pyx_v_node_index = ((PyArrayObject *)values[2]);
    __pyx_v_number_of_triangles_per_node = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("check_integrity_c", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 32, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("anuga.abstract_2d_finite_volumes.neighbour_mesh_ext.check_integrity_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vertex_value_indices), __pyx_ptype_5numpy_ndarray, 0, "vertex_value_indices", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_triangles), __pyx_ptype_5numpy_ndarray, 0, "triangles", 0))) __PYX_ERR(0, 33, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_node_index), __pyx_ptype_5numpy_ndarray, 0, "node_index", 0))) __PYX_ERR(0, 34, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_number_of_triangles_per_node), __pyx_ptype_5numpy_ndarray, 0, "number_of_triangles_per_node", 0))) __PYX_ERR(0, 35, __pyx_L1_error)
  __pyx_r = __pyx_pf_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_2check_integrity_c(__pyx_self, __pyx_v_vertex_value_indices, __pyx_v_triangles, __pyx_v_node_index, __pyx_v_number_of_triangles_per_node);
  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_18neighbour_mesh_ext_2check_integrity_c(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_vertex_value_indices, PyArrayObject *__pyx_v_triangles, PyArrayObject *__pyx_v_node_index, PyArrayObject *__pyx_v_number_of_triangles_per_node) {
  int __pyx_v_nt;
  int __pyx_v_nt3;
  int __pyx_v_tri;
  int __pyx_v_n_node;
  int __pyx_v_n_node_1;
  int __pyx_v_current_node;
  int __pyx_v_k;
  int __pyx_v_i;
  int __pyx_v_index;
  long __pyx_v_cumsum;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_node_index;
  __Pyx_Buffer __pyx_pybuffer_node_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_number_of_triangles_per_node;
  __Pyx_Buffer __pyx_pybuffer_number_of_triangles_per_node;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_triangles;
  __Pyx_Buffer __pyx_pybuffer_triangles;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_vertex_value_indices;
  __Pyx_Buffer __pyx_pybuffer_vertex_value_indices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_integrity_c", 0);
  __pyx_pybuffer_vertex_value_indices.pybuffer.buf = NULL;
  __pyx_pybuffer_vertex_value_indices.refcount = 0;
  __pyx_pybuffernd_vertex_value_indices.data = NULL;
  __pyx_pybuffernd_vertex_value_indices.rcbuffer = &__pyx_pybuffer_vertex_value_indices;
  __pyx_pybuffer_triangles.pybuffer.buf = NULL;
  __pyx_pybuffer_triangles.refcount = 0;
  __pyx_pybuffernd_triangles.data = NULL;
  __pyx_pybuffernd_triangles.rcbuffer = &__pyx_pybuffer_triangles;
  __pyx_pybuffer_node_index.pybuffer.buf = NULL;
  __pyx_pybuffer_node_index.refcount = 0;
  __pyx_pybuffernd_node_index.data = NULL;
  __pyx_pybuffernd_node_index.rcbuffer = &__pyx_pybuffer_node_index;
  __pyx_pybuffer_number_of_triangles_per_node.pybuffer.buf = NULL;
  __pyx_pybuffer_number_of_triangles_per_node.refcount = 0;
  __pyx_pybuffernd_number_of_triangles_per_node.data = NULL;
  __pyx_pybuffernd_number_of_triangles_per_node.rcbuffer = &__pyx_pybuffer_number_of_triangles_per_node;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_value_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_value_indices, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 32, __pyx_L1_error)
  }
  __pyx_pybuffernd_vertex_value_indices.diminfo[0].strides = __pyx_pybuffernd_vertex_value_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_value_indices.diminfo[0].shape = __pyx_pybuffernd_vertex_value_indices.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_triangles.rcbuffer->pybuffer, (PyObject*)__pyx_v_triangles, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 32, __pyx_L1_error)
  }
  __pyx_pybuffernd_triangles.diminfo[0].strides = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_triangles.diminfo[0].shape = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_triangles.diminfo[1].strides = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_triangles.diminfo[1].shape = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_node_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_node_index, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 32, __pyx_L1_error)
  }
  __pyx_pybuffernd_node_index.diminfo[0].strides = __pyx_pybuffernd_node_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_node_index.diminfo[0].shape = __pyx_pybuffernd_node_index.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer, (PyObject*)__pyx_v_number_of_triangles_per_node, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 32, __pyx_L1_error)
  }
  __pyx_pybuffernd_number_of_triangles_per_node.diminfo[0].strides = __pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_number_of_triangles_per_node.diminfo[0].shape = __pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer.shape[0];
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  { 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_node_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_triangles.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_value_indices.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("anuga.abstract_2d_finite_volumes.neighbour_mesh_ext.check_integrity_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_node_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_triangles.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_value_indices.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__5 = PyTuple_Pack(14, __pyx_n_s_vertex_value_indices, __pyx_n_s_triangles, __pyx_n_s_node_index, __pyx_n_s_number_of_triangles_per_node, __pyx_n_s_nt, __pyx_n_s_nt3, __pyx_n_s_tri, __pyx_n_s_n_node, __pyx_n_s_n_node_1, __pyx_n_s_current_node, __pyx_n_s_k, __pyx_n_s_i, __pyx_n_s_index, __pyx_n_s_cumsum); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
/* … */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_26abstract_2d_finite_volumes_18neighbour_mesh_ext_3check_integrity_c, NULL, __pyx_n_s_anuga_abstract_2d_finite_volumes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_integrity_c, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 33: 					np.ndarray[long, ndim=2, mode="c"] triangles not None,\
 34: 					np.ndarray[long, ndim=1, mode="c"] node_index not None,\
 35: 					np.ndarray[long, ndim=1, mode="c"] number_of_triangles_per_node not None):
 36: 
 37: 	cdef int nt, nt3, tri, n_node, n_node_1
 38: 	cdef int current_node, k, i, index
 39: 
 40: 	cdef long cumsum
 41: 
+42: 	nt3 = vertex_value_indices.shape[0]
  __pyx_v_nt3 = (__pyx_v_vertex_value_indices->dimensions[0]);
 43: 
+44: 	nt = triangles.shape[0]
  __pyx_v_nt = (__pyx_v_triangles->dimensions[0]);
+45: 	tri = triangles.shape[1]
  __pyx_v_tri = (__pyx_v_triangles->dimensions[1]);
 46: 
+47: 	n_node_1 = node_index.shape[0]
  __pyx_v_n_node_1 = (__pyx_v_node_index->dimensions[0]);
 48: 
+49: 	n_node = number_of_triangles_per_node.shape[0]
  __pyx_v_n_node = (__pyx_v_number_of_triangles_per_node->dimensions[0]);
 50: 
+51: 	assert nt3 == 3*nt, "Mismatch in size of triangles and vertex_value_indices"
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_nt3 == (3 * __pyx_v_nt)) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Mismatch_in_size_of_triangles_an);
      __PYX_ERR(0, 51, __pyx_L1_error)
    }
  }
  #endif
 52: 
+53: 	assert n_node_1 == n_node + 1, "Mismatch in size of node_index and number_of_triangles_per_node"
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_n_node_1 == (__pyx_v_n_node + 1)) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Mismatch_in_size_of_node_index_a);
      __PYX_ERR(0, 53, __pyx_L1_error)
    }
  }
  #endif
 54: 
+55: 	assert tri == 3, "Triangle array should be ny by 3"
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_tri == 3) != 0))) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Triangle_array_should_be_ny_by_3);
      __PYX_ERR(0, 55, __pyx_L1_error)
    }
  }
  #endif
 56: 
+57: 	current_node = 0
  __pyx_v_current_node = 0;
+58: 	k = 0
  __pyx_v_k = 0;
 59: 
+60: 	for i in xrange(nt3):
  __pyx_t_1 = __pyx_v_nt3;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
+61: 		index = vertex_value_indices[i]
    __pyx_t_4 = __pyx_v_i;
    __pyx_v_index = (*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_vertex_value_indices.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_vertex_value_indices.diminfo[0].strides));
 62: 
+63: 		if number_of_triangles_per_node[current_node] == 0:
    __pyx_t_4 = __pyx_v_current_node;
    __pyx_t_5 = (((*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_number_of_triangles_per_node.diminfo[0].strides)) == 0) != 0);
    if (__pyx_t_5) {
/* … */
    }
+64: 			continue
      goto __pyx_L3_continue;
 65: 
+66: 		k += 1
    __pyx_v_k = (__pyx_v_k + 1);
 67: 
+68: 		assert triangles[index/tri, index%tri] == current_node, "Inconsistency between triangles and vertex_values_indices"
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = (__pyx_v_index / __pyx_v_tri);
      __pyx_t_6 = (__pyx_v_index % __pyx_v_tri);
      if (unlikely(!(((*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_triangles.diminfo[1].strides)) == __pyx_v_current_node) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Inconsistency_between_triangles);
        __PYX_ERR(0, 68, __pyx_L1_error)
      }
    }
    #endif
 69: 
+70: 		if number_of_triangles_per_node[current_node] == k:
    __pyx_t_6 = __pyx_v_current_node;
    __pyx_t_5 = (((*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_number_of_triangles_per_node.diminfo[0].strides)) == __pyx_v_k) != 0);
    if (__pyx_t_5) {
/* … */
    }
    __pyx_L3_continue:;
  }
+71: 			k = 0
      __pyx_v_k = 0;
+72: 			current_node += 1
      __pyx_v_current_node = (__pyx_v_current_node + 1);
 73: 
+74: 	cumsum = 0
  __pyx_v_cumsum = 0;
 75: 
+76: 	for i in xrange(n_node):
  __pyx_t_1 = __pyx_v_n_node;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
+77: 		cumsum += number_of_triangles_per_node[i]
    __pyx_t_6 = __pyx_v_i;
    __pyx_v_cumsum = (__pyx_v_cumsum + (*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_number_of_triangles_per_node.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_number_of_triangles_per_node.diminfo[0].strides)));
+78: 		assert cumsum == node_index[i+1], "Inconsistency between node_index and number_of_triangles_per_node"
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = (__pyx_v_i + 1);
      if (unlikely(!((__pyx_v_cumsum == (*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_node_index.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_node_index.diminfo[0].strides))) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Inconsistency_between_node_index);
        __PYX_ERR(0, 78, __pyx_L1_error)
      }
    }
    #endif
  }