Cython: swb2_domain_ext.pyx

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: swb2_domain_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: cdef extern from "swb2_domain.c":

     009: 	double _compute_fluxes_central(int number_of_elements, double timestep, double epsilon, double H0, double g, long* neighbours, long* neighbour_edges, double* normals, double* edgelengths, double* radii, double* areas, long* tri_full_flag, double* stage_edge_values, double* xmom_edge_values, double* ymom_edge_values, double* bed_edge_values, double* stage_boundary_values, double* xmom_boundary_values, double* ymom_boundary_values, long* boundary_flux_type, double* stage_explicit_update, double* xmom_explicit_update, double* ymom_explicit_update, long* already_computed_flux, double* max_speed_array, int optimise_dry_cells, double* stage_centroid_values, double* bed_centroid_values, double* bed_vertex_values)

     010: 	double _protect(int N, double minimum_allowed_height, double maximum_allowed_speed, double epsilon, double* wc, double* wv, double* zc, double* zv, double* xmomc, double* ymomc, double* areas)

     011: 	int _extrapolate_second_order_edge_sw(int number_of_elements, double epsilon, double minimum_allowed_height, double beta_w, double beta_w_dry, double beta_uh, double beta_uh_dry, double beta_vh, double beta_vh_dry, long* surrogate_neighbours, long* number_of_boundaries, double* centroid_coordinates, double* stage_centroid_values, double* xmom_centroid_values, double* ymom_centroid_values, double* elevation_centroid_values, double* edge_coordinates, double* stage_edge_values, double* xmom_edge_values, double* ymom_edge_values, double* elevation_edge_values, double* stage_vertex_values, double* xmom_vertex_values, double* ymom_vertex_values, double* elevation_vertex_values, int optimise_dry_cells, int extrapolate_velocity_second_order)

     012:

    +013: def compute_fluxes_ext_central(double timestep,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_1compute_fluxes_ext_central(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_15swb2_domain_ext_1compute_fluxes_ext_central = {"compute_fluxes_ext_central", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_1compute_fluxes_ext_central, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_1compute_fluxes_ext_central(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      double __pyx_v_timestep;
      double __pyx_v_epsilon;
      double __pyx_v_H0;
      double __pyx_v_g;
      PyArrayObject *__pyx_v_neighbours = 0;
      PyArrayObject *__pyx_v_neighbour_edges = 0;
      PyArrayObject *__pyx_v_normals = 0;
      PyArrayObject *__pyx_v_edgelengths = 0;
      PyArrayObject *__pyx_v_radii = 0;
      PyArrayObject *__pyx_v_areas = 0;
      PyArrayObject *__pyx_v_tri_full_flag = 0;
      PyArrayObject *__pyx_v_stage_edge_values = 0;
      PyArrayObject *__pyx_v_xmom_edge_values = 0;
      PyArrayObject *__pyx_v_ymom_edge_values = 0;
      PyArrayObject *__pyx_v_bed_edge_values = 0;
      PyArrayObject *__pyx_v_stage_boundary_values = 0;
      PyArrayObject *__pyx_v_xmom_boundary_values = 0;
      PyArrayObject *__pyx_v_ymom_boundary_values = 0;
      PyArrayObject *__pyx_v_boundary_flux_type = 0;
      PyArrayObject *__pyx_v_stage_explicit_update = 0;
      PyArrayObject *__pyx_v_xmom_explicit_update = 0;
      PyArrayObject *__pyx_v_ymom_explicit_update = 0;
      PyArrayObject *__pyx_v_already_computed_flux = 0;
      PyArrayObject *__pyx_v_max_speed_array = 0;
      long __pyx_v_optimise_dry_cells;
      PyArrayObject *__pyx_v_stage_centroid_values = 0;
      PyArrayObject *__pyx_v_bed_centroid_values = 0;
      PyArrayObject *__pyx_v_bed_vertex_values = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_central (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timestep,&__pyx_n_s_epsilon,&__pyx_n_s_H0,&__pyx_n_s_g,&__pyx_n_s_neighbours,&__pyx_n_s_neighbour_edges,&__pyx_n_s_normals,&__pyx_n_s_edgelengths,&__pyx_n_s_radii,&__pyx_n_s_areas,&__pyx_n_s_tri_full_flag,&__pyx_n_s_stage_edge_values,&__pyx_n_s_xmom_edge_values,&__pyx_n_s_ymom_edge_values,&__pyx_n_s_bed_edge_values,&__pyx_n_s_stage_boundary_values,&__pyx_n_s_xmom_boundary_values,&__pyx_n_s_ymom_boundary_values,&__pyx_n_s_boundary_flux_type,&__pyx_n_s_stage_explicit_update,&__pyx_n_s_xmom_explicit_update,&__pyx_n_s_ymom_explicit_update,&__pyx_n_s_already_computed_flux,&__pyx_n_s_max_speed_array,&__pyx_n_s_optimise_dry_cells,&__pyx_n_s_stage_centroid_values,&__pyx_n_s_bed_centroid_values,&__pyx_n_s_bed_vertex_values,0};
        PyObject* values[28] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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 28: values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
            CYTHON_FALLTHROUGH;
            case 27: values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
            CYTHON_FALLTHROUGH;
            case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
            CYTHON_FALLTHROUGH;
            case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
            CYTHON_FALLTHROUGH;
            case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
            CYTHON_FALLTHROUGH;
            case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
            CYTHON_FALLTHROUGH;
            case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
            CYTHON_FALLTHROUGH;
            case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
            CYTHON_FALLTHROUGH;
            case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
            CYTHON_FALLTHROUGH;
            case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
            CYTHON_FALLTHROUGH;
            case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
            CYTHON_FALLTHROUGH;
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            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_timestep)) != 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_epsilon)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 1); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H0)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 2); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 3); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neighbours)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 4); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neighbour_edges)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 5); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_normals)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 6); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_edgelengths)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 7); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_radii)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 8); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_areas)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 9); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 10:
            if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tri_full_flag)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 10); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 11:
            if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 11); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 12:
            if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 12); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 13:
            if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 13); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 14:
            if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bed_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 14); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 15:
            if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_boundary_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 15); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 16:
            if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom_boundary_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 16); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 17:
            if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom_boundary_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 17); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 18:
            if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boundary_flux_type)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 18); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 19:
            if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_explicit_update)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 19); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 20:
            if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom_explicit_update)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 20); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 21:
            if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom_explicit_update)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 21); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 22:
            if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_already_computed_flux)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 22); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 23:
            if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_speed_array)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 23); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 24:
            if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_optimise_dry_cells)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 24); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 25:
            if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_centroid_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 25); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 26:
            if (likely((values[26] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bed_centroid_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 26); __PYX_ERR(0, 13, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 27:
            if (likely((values[27] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bed_vertex_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, 27); __PYX_ERR(0, 13, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_fluxes_ext_central") < 0)) __PYX_ERR(0, 13, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 28) {
          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);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
          values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
          values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
          values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
          values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
          values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
          values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
          values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
          values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
          values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
          values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
          values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
          values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
          values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
          values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
          values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
          values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
          values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
          values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
          values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
          values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
          values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
          values[26] = PyTuple_GET_ITEM(__pyx_args, 26);
          values[27] = PyTuple_GET_ITEM(__pyx_args, 27);
        }
        __pyx_v_timestep = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_timestep == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 13, __pyx_L3_error)
        __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L3_error)
        __pyx_v_H0 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_H0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
        __pyx_v_g = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_g == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
        __pyx_v_neighbours = ((PyArrayObject *)values[4]);
        __pyx_v_neighbour_edges = ((PyArrayObject *)values[5]);
        __pyx_v_normals = ((PyArrayObject *)values[6]);
        __pyx_v_edgelengths = ((PyArrayObject *)values[7]);
        __pyx_v_radii = ((PyArrayObject *)values[8]);
        __pyx_v_areas = ((PyArrayObject *)values[9]);
        __pyx_v_tri_full_flag = ((PyArrayObject *)values[10]);
        __pyx_v_stage_edge_values = ((PyArrayObject *)values[11]);
        __pyx_v_xmom_edge_values = ((PyArrayObject *)values[12]);
        __pyx_v_ymom_edge_values = ((PyArrayObject *)values[13]);
        __pyx_v_bed_edge_values = ((PyArrayObject *)values[14]);
        __pyx_v_stage_boundary_values = ((PyArrayObject *)values[15]);
        __pyx_v_xmom_boundary_values = ((PyArrayObject *)values[16]);
        __pyx_v_ymom_boundary_values = ((PyArrayObject *)values[17]);
        __pyx_v_boundary_flux_type = ((PyArrayObject *)values[18]);
        __pyx_v_stage_explicit_update = ((PyArrayObject *)values[19]);
        __pyx_v_xmom_explicit_update = ((PyArrayObject *)values[20]);
        __pyx_v_ymom_explicit_update = ((PyArrayObject *)values[21]);
        __pyx_v_already_computed_flux = ((PyArrayObject *)values[22]);
        __pyx_v_max_speed_array = ((PyArrayObject *)values[23]);
        __pyx_v_optimise_dry_cells = __Pyx_PyInt_As_long(values[24]); if (unlikely((__pyx_v_optimise_dry_cells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error)
        __pyx_v_stage_centroid_values = ((PyArrayObject *)values[25]);
        __pyx_v_bed_centroid_values = ((PyArrayObject *)values[26]);
        __pyx_v_bed_vertex_values = ((PyArrayObject *)values[27]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("compute_fluxes_ext_central", 1, 28, 28, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 13, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.swb2_domain_ext.compute_fluxes_ext_central", __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, 17, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_neighbour_edges), __pyx_ptype_5numpy_ndarray, 0, "neighbour_edges", 0))) __PYX_ERR(0, 18, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_normals), __pyx_ptype_5numpy_ndarray, 0, "normals", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edgelengths), __pyx_ptype_5numpy_ndarray, 0, "edgelengths", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_radii), __pyx_ptype_5numpy_ndarray, 0, "radii", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_areas), __pyx_ptype_5numpy_ndarray, 0, "areas", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tri_full_flag), __pyx_ptype_5numpy_ndarray, 0, "tri_full_flag", 0))) __PYX_ERR(0, 23, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_edge_values), __pyx_ptype_5numpy_ndarray, 0, "stage_edge_values", 0))) __PYX_ERR(0, 24, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom_edge_values), __pyx_ptype_5numpy_ndarray, 0, "xmom_edge_values", 0))) __PYX_ERR(0, 25, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom_edge_values), __pyx_ptype_5numpy_ndarray, 0, "ymom_edge_values", 0))) __PYX_ERR(0, 26, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bed_edge_values), __pyx_ptype_5numpy_ndarray, 0, "bed_edge_values", 0))) __PYX_ERR(0, 27, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_boundary_values), __pyx_ptype_5numpy_ndarray, 0, "stage_boundary_values", 0))) __PYX_ERR(0, 28, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom_boundary_values), __pyx_ptype_5numpy_ndarray, 0, "xmom_boundary_values", 0))) __PYX_ERR(0, 29, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom_boundary_values), __pyx_ptype_5numpy_ndarray, 0, "ymom_boundary_values", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boundary_flux_type), __pyx_ptype_5numpy_ndarray, 0, "boundary_flux_type", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_explicit_update), __pyx_ptype_5numpy_ndarray, 0, "stage_explicit_update", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom_explicit_update), __pyx_ptype_5numpy_ndarray, 0, "xmom_explicit_update", 0))) __PYX_ERR(0, 33, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom_explicit_update), __pyx_ptype_5numpy_ndarray, 0, "ymom_explicit_update", 0))) __PYX_ERR(0, 34, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_already_computed_flux), __pyx_ptype_5numpy_ndarray, 0, "already_computed_flux", 0))) __PYX_ERR(0, 35, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_max_speed_array), __pyx_ptype_5numpy_ndarray, 0, "max_speed_array", 0))) __PYX_ERR(0, 36, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_centroid_values), __pyx_ptype_5numpy_ndarray, 0, "stage_centroid_values", 0))) __PYX_ERR(0, 38, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bed_centroid_values), __pyx_ptype_5numpy_ndarray, 0, "bed_centroid_values", 0))) __PYX_ERR(0, 39, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bed_vertex_values), __pyx_ptype_5numpy_ndarray, 0, "bed_vertex_values", 0))) __PYX_ERR(0, 40, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_15swb2_domain_ext_compute_fluxes_ext_central(__pyx_self, __pyx_v_timestep, __pyx_v_epsilon, __pyx_v_H0, __pyx_v_g, __pyx_v_neighbours, __pyx_v_neighbour_edges, __pyx_v_normals, __pyx_v_edgelengths, __pyx_v_radii, __pyx_v_areas, __pyx_v_tri_full_flag, __pyx_v_stage_edge_values, __pyx_v_xmom_edge_values, __pyx_v_ymom_edge_values, __pyx_v_bed_edge_values, __pyx_v_stage_boundary_values, __pyx_v_xmom_boundary_values, __pyx_v_ymom_boundary_values, __pyx_v_boundary_flux_type, __pyx_v_stage_explicit_update, __pyx_v_xmom_explicit_update, __pyx_v_ymom_explicit_update, __pyx_v_already_computed_flux, __pyx_v_max_speed_array, __pyx_v_optimise_dry_cells, __pyx_v_stage_centroid_values, __pyx_v_bed_centroid_values, __pyx_v_bed_vertex_values);
      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_13shallow_water_15swb2_domain_ext_compute_fluxes_ext_central(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_timestep, double __pyx_v_epsilon, double __pyx_v_H0, double __pyx_v_g, PyArrayObject *__pyx_v_neighbours, PyArrayObject *__pyx_v_neighbour_edges, PyArrayObject *__pyx_v_normals, PyArrayObject *__pyx_v_edgelengths, PyArrayObject *__pyx_v_radii, PyArrayObject *__pyx_v_areas, PyArrayObject *__pyx_v_tri_full_flag, PyArrayObject *__pyx_v_stage_edge_values, PyArrayObject *__pyx_v_xmom_edge_values, PyArrayObject *__pyx_v_ymom_edge_values, PyArrayObject *__pyx_v_bed_edge_values, PyArrayObject *__pyx_v_stage_boundary_values, PyArrayObject *__pyx_v_xmom_boundary_values, PyArrayObject *__pyx_v_ymom_boundary_values, PyArrayObject *__pyx_v_boundary_flux_type, PyArrayObject *__pyx_v_stage_explicit_update, PyArrayObject *__pyx_v_xmom_explicit_update, PyArrayObject *__pyx_v_ymom_explicit_update, PyArrayObject *__pyx_v_already_computed_flux, PyArrayObject *__pyx_v_max_speed_array, long __pyx_v_optimise_dry_cells, PyArrayObject *__pyx_v_stage_centroid_values, PyArrayObject *__pyx_v_bed_centroid_values, PyArrayObject *__pyx_v_bed_vertex_values) {
      int __pyx_v_number_of_elements;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_already_computed_flux;
      __Pyx_Buffer __pyx_pybuffer_already_computed_flux;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_areas;
      __Pyx_Buffer __pyx_pybuffer_areas;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_bed_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_bed_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_bed_edge_values;
      __Pyx_Buffer __pyx_pybuffer_bed_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_bed_vertex_values;
      __Pyx_Buffer __pyx_pybuffer_bed_vertex_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_boundary_flux_type;
      __Pyx_Buffer __pyx_pybuffer_boundary_flux_type;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edgelengths;
      __Pyx_Buffer __pyx_pybuffer_edgelengths;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_max_speed_array;
      __Pyx_Buffer __pyx_pybuffer_max_speed_array;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbour_edges;
      __Pyx_Buffer __pyx_pybuffer_neighbour_edges;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbours;
      __Pyx_Buffer __pyx_pybuffer_neighbours;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_normals;
      __Pyx_Buffer __pyx_pybuffer_normals;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_radii;
      __Pyx_Buffer __pyx_pybuffer_radii;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_boundary_values;
      __Pyx_Buffer __pyx_pybuffer_stage_boundary_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_stage_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_edge_values;
      __Pyx_Buffer __pyx_pybuffer_stage_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_explicit_update;
      __Pyx_Buffer __pyx_pybuffer_stage_explicit_update;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_tri_full_flag;
      __Pyx_Buffer __pyx_pybuffer_tri_full_flag;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom_boundary_values;
      __Pyx_Buffer __pyx_pybuffer_xmom_boundary_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom_edge_values;
      __Pyx_Buffer __pyx_pybuffer_xmom_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom_explicit_update;
      __Pyx_Buffer __pyx_pybuffer_xmom_explicit_update;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom_boundary_values;
      __Pyx_Buffer __pyx_pybuffer_ymom_boundary_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom_edge_values;
      __Pyx_Buffer __pyx_pybuffer_ymom_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom_explicit_update;
      __Pyx_Buffer __pyx_pybuffer_ymom_explicit_update;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_central", 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_pybuffer_neighbour_edges.pybuffer.buf = NULL;
      __pyx_pybuffer_neighbour_edges.refcount = 0;
      __pyx_pybuffernd_neighbour_edges.data = NULL;
      __pyx_pybuffernd_neighbour_edges.rcbuffer = &__pyx_pybuffer_neighbour_edges;
      __pyx_pybuffer_normals.pybuffer.buf = NULL;
      __pyx_pybuffer_normals.refcount = 0;
      __pyx_pybuffernd_normals.data = NULL;
      __pyx_pybuffernd_normals.rcbuffer = &__pyx_pybuffer_normals;
      __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_radii.pybuffer.buf = NULL;
      __pyx_pybuffer_radii.refcount = 0;
      __pyx_pybuffernd_radii.data = NULL;
      __pyx_pybuffernd_radii.rcbuffer = &__pyx_pybuffer_radii;
      __pyx_pybuffer_areas.pybuffer.buf = NULL;
      __pyx_pybuffer_areas.refcount = 0;
      __pyx_pybuffernd_areas.data = NULL;
      __pyx_pybuffernd_areas.rcbuffer = &__pyx_pybuffer_areas;
      __pyx_pybuffer_tri_full_flag.pybuffer.buf = NULL;
      __pyx_pybuffer_tri_full_flag.refcount = 0;
      __pyx_pybuffernd_tri_full_flag.data = NULL;
      __pyx_pybuffernd_tri_full_flag.rcbuffer = &__pyx_pybuffer_tri_full_flag;
      __pyx_pybuffer_stage_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_edge_values.refcount = 0;
      __pyx_pybuffernd_stage_edge_values.data = NULL;
      __pyx_pybuffernd_stage_edge_values.rcbuffer = &__pyx_pybuffer_stage_edge_values;
      __pyx_pybuffer_xmom_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom_edge_values.refcount = 0;
      __pyx_pybuffernd_xmom_edge_values.data = NULL;
      __pyx_pybuffernd_xmom_edge_values.rcbuffer = &__pyx_pybuffer_xmom_edge_values;
      __pyx_pybuffer_ymom_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom_edge_values.refcount = 0;
      __pyx_pybuffernd_ymom_edge_values.data = NULL;
      __pyx_pybuffernd_ymom_edge_values.rcbuffer = &__pyx_pybuffer_ymom_edge_values;
      __pyx_pybuffer_bed_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_bed_edge_values.refcount = 0;
      __pyx_pybuffernd_bed_edge_values.data = NULL;
      __pyx_pybuffernd_bed_edge_values.rcbuffer = &__pyx_pybuffer_bed_edge_values;
      __pyx_pybuffer_stage_boundary_values.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_boundary_values.refcount = 0;
      __pyx_pybuffernd_stage_boundary_values.data = NULL;
      __pyx_pybuffernd_stage_boundary_values.rcbuffer = &__pyx_pybuffer_stage_boundary_values;
      __pyx_pybuffer_xmom_boundary_values.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom_boundary_values.refcount = 0;
      __pyx_pybuffernd_xmom_boundary_values.data = NULL;
      __pyx_pybuffernd_xmom_boundary_values.rcbuffer = &__pyx_pybuffer_xmom_boundary_values;
      __pyx_pybuffer_ymom_boundary_values.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom_boundary_values.refcount = 0;
      __pyx_pybuffernd_ymom_boundary_values.data = NULL;
      __pyx_pybuffernd_ymom_boundary_values.rcbuffer = &__pyx_pybuffer_ymom_boundary_values;
      __pyx_pybuffer_boundary_flux_type.pybuffer.buf = NULL;
      __pyx_pybuffer_boundary_flux_type.refcount = 0;
      __pyx_pybuffernd_boundary_flux_type.data = NULL;
      __pyx_pybuffernd_boundary_flux_type.rcbuffer = &__pyx_pybuffer_boundary_flux_type;
      __pyx_pybuffer_stage_explicit_update.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_explicit_update.refcount = 0;
      __pyx_pybuffernd_stage_explicit_update.data = NULL;
      __pyx_pybuffernd_stage_explicit_update.rcbuffer = &__pyx_pybuffer_stage_explicit_update;
      __pyx_pybuffer_xmom_explicit_update.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom_explicit_update.refcount = 0;
      __pyx_pybuffernd_xmom_explicit_update.data = NULL;
      __pyx_pybuffernd_xmom_explicit_update.rcbuffer = &__pyx_pybuffer_xmom_explicit_update;
      __pyx_pybuffer_ymom_explicit_update.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom_explicit_update.refcount = 0;
      __pyx_pybuffernd_ymom_explicit_update.data = NULL;
      __pyx_pybuffernd_ymom_explicit_update.rcbuffer = &__pyx_pybuffer_ymom_explicit_update;
      __pyx_pybuffer_already_computed_flux.pybuffer.buf = NULL;
      __pyx_pybuffer_already_computed_flux.refcount = 0;
      __pyx_pybuffernd_already_computed_flux.data = NULL;
      __pyx_pybuffernd_already_computed_flux.rcbuffer = &__pyx_pybuffer_already_computed_flux;
      __pyx_pybuffer_max_speed_array.pybuffer.buf = NULL;
      __pyx_pybuffer_max_speed_array.refcount = 0;
      __pyx_pybuffernd_max_speed_array.data = NULL;
      __pyx_pybuffernd_max_speed_array.rcbuffer = &__pyx_pybuffer_max_speed_array;
      __pyx_pybuffer_stage_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_centroid_values.refcount = 0;
      __pyx_pybuffernd_stage_centroid_values.data = NULL;
      __pyx_pybuffernd_stage_centroid_values.rcbuffer = &__pyx_pybuffer_stage_centroid_values;
      __pyx_pybuffer_bed_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_bed_centroid_values.refcount = 0;
      __pyx_pybuffernd_bed_centroid_values.data = NULL;
      __pyx_pybuffernd_bed_centroid_values.rcbuffer = &__pyx_pybuffer_bed_centroid_values;
      __pyx_pybuffer_bed_vertex_values.pybuffer.buf = NULL;
      __pyx_pybuffer_bed_vertex_values.refcount = 0;
      __pyx_pybuffernd_bed_vertex_values.data = NULL;
      __pyx_pybuffernd_bed_vertex_values.rcbuffer = &__pyx_pybuffer_bed_vertex_values;
      {
        __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, 13, __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];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighbour_edges, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_neighbour_edges.diminfo[0].strides = __pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbour_edges.diminfo[0].shape = __pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_neighbour_edges.diminfo[1].strides = __pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_neighbour_edges.diminfo[1].shape = __pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normals.rcbuffer->pybuffer, (PyObject*)__pyx_v_normals, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_normals.diminfo[0].strides = __pyx_pybuffernd_normals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normals.diminfo[0].shape = __pyx_pybuffernd_normals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_normals.diminfo[1].strides = __pyx_pybuffernd_normals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_normals.diminfo[1].shape = __pyx_pybuffernd_normals.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        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)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __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];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_radii.rcbuffer->pybuffer, (PyObject*)__pyx_v_radii, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_radii.diminfo[0].strides = __pyx_pybuffernd_radii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_radii.diminfo[0].shape = __pyx_pybuffernd_radii.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_areas.rcbuffer->pybuffer, (PyObject*)__pyx_v_areas, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_areas.diminfo[0].strides = __pyx_pybuffernd_areas.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_areas.diminfo[0].shape = __pyx_pybuffernd_areas.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer, (PyObject*)__pyx_v_tri_full_flag, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_tri_full_flag.diminfo[0].strides = __pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tri_full_flag.diminfo[0].shape = __pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_edge_values.diminfo[0].strides = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_edge_values.diminfo[0].shape = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_stage_edge_values.diminfo[1].strides = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_stage_edge_values.diminfo[1].shape = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom_edge_values.diminfo[0].strides = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom_edge_values.diminfo[0].shape = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xmom_edge_values.diminfo[1].strides = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xmom_edge_values.diminfo[1].shape = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom_edge_values.diminfo[0].strides = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom_edge_values.diminfo[0].shape = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ymom_edge_values.diminfo[1].strides = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ymom_edge_values.diminfo[1].shape = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_bed_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_bed_edge_values.diminfo[0].strides = __pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bed_edge_values.diminfo[0].shape = __pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_bed_edge_values.diminfo[1].strides = __pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_bed_edge_values.diminfo[1].shape = __pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_boundary_values.diminfo[0].strides = __pyx_pybuffernd_stage_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_boundary_values.diminfo[0].shape = __pyx_pybuffernd_stage_boundary_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom_boundary_values.diminfo[0].strides = __pyx_pybuffernd_xmom_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom_boundary_values.diminfo[0].shape = __pyx_pybuffernd_xmom_boundary_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom_boundary_values.diminfo[0].strides = __pyx_pybuffernd_ymom_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom_boundary_values.diminfo[0].shape = __pyx_pybuffernd_ymom_boundary_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_flux_type.rcbuffer->pybuffer, (PyObject*)__pyx_v_boundary_flux_type, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_boundary_flux_type.diminfo[0].strides = __pyx_pybuffernd_boundary_flux_type.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boundary_flux_type.diminfo[0].shape = __pyx_pybuffernd_boundary_flux_type.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_explicit_update, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_explicit_update.diminfo[0].strides = __pyx_pybuffernd_stage_explicit_update.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_explicit_update.diminfo[0].shape = __pyx_pybuffernd_stage_explicit_update.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom_explicit_update, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom_explicit_update.diminfo[0].strides = __pyx_pybuffernd_xmom_explicit_update.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom_explicit_update.diminfo[0].shape = __pyx_pybuffernd_xmom_explicit_update.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom_explicit_update, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom_explicit_update.diminfo[0].strides = __pyx_pybuffernd_ymom_explicit_update.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom_explicit_update.diminfo[0].shape = __pyx_pybuffernd_ymom_explicit_update.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_already_computed_flux, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_already_computed_flux.diminfo[0].strides = __pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_already_computed_flux.diminfo[0].shape = __pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_already_computed_flux.diminfo[1].strides = __pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_already_computed_flux.diminfo[1].shape = __pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_speed_array.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_speed_array, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_max_speed_array.diminfo[0].strides = __pyx_pybuffernd_max_speed_array.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_speed_array.diminfo[0].shape = __pyx_pybuffernd_max_speed_array.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_centroid_values.diminfo[0].strides = __pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_centroid_values.diminfo[0].shape = __pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bed_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_bed_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_bed_centroid_values.diminfo[0].strides = __pyx_pybuffernd_bed_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bed_centroid_values.diminfo[0].shape = __pyx_pybuffernd_bed_centroid_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_bed_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 13, __pyx_L1_error)
      }
      __pyx_pybuffernd_bed_vertex_values.diminfo[0].strides = __pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bed_vertex_values.diminfo[0].shape = __pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_bed_vertex_values.diminfo[1].strides = __pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_bed_vertex_values.diminfo[1].shape = __pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer.shape[1];
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_34);
      { 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_already_computed_flux.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areas.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bed_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_flux_type.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_speed_array.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normals.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_radii.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_boundary_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_explicit_update.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_boundary_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_explicit_update.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_boundary_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_explicit_update.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.swb2_domain_ext.compute_fluxes_ext_central", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areas.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bed_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_flux_type.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_speed_array.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normals.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_radii.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_boundary_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_explicit_update.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_boundary_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_explicit_update.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_boundary_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_explicit_update.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__3 = PyTuple_Pack(29, __pyx_n_s_timestep, __pyx_n_s_epsilon, __pyx_n_s_H0, __pyx_n_s_g, __pyx_n_s_neighbours, __pyx_n_s_neighbour_edges, __pyx_n_s_normals, __pyx_n_s_edgelengths, __pyx_n_s_radii, __pyx_n_s_areas, __pyx_n_s_tri_full_flag, __pyx_n_s_stage_edge_values, __pyx_n_s_xmom_edge_values, __pyx_n_s_ymom_edge_values, __pyx_n_s_bed_edge_values, __pyx_n_s_stage_boundary_values, __pyx_n_s_xmom_boundary_values, __pyx_n_s_ymom_boundary_values, __pyx_n_s_boundary_flux_type, __pyx_n_s_stage_explicit_update, __pyx_n_s_xmom_explicit_update, __pyx_n_s_ymom_explicit_update, __pyx_n_s_already_computed_flux, __pyx_n_s_max_speed_array, __pyx_n_s_optimise_dry_cells, __pyx_n_s_stage_centroid_values, __pyx_n_s_bed_centroid_values, __pyx_n_s_bed_vertex_values, __pyx_n_s_number_of_elements); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__3);
      __Pyx_GIVEREF(__pyx_tuple__3);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_15swb2_domain_ext_1compute_fluxes_ext_central, NULL, __pyx_n_s_anuga_shallow_water_swb2_domain_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_fluxes_ext_central, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(28, 0, 29, 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_shallow_water_swb2_domain, __pyx_n_s_compute_fluxes_ext_central, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 13, __pyx_L1_error)

     014: 							double epsilon,\

     015: 							double H0,\

     016: 							double g,\

     017: 							np.ndarray[long, ndim=2, mode="c"] neighbours not None,\

     018: 							np.ndarray[long, ndim=2, mode="c"] neighbour_edges not None,\

     019: 							np.ndarray[double, ndim=2, mode="c"] normals not None,\

     020: 							np.ndarray[double, ndim=2, mode="c"] edgelengths not None,\

     021: 							np.ndarray[double, ndim=1, mode="c"] radii not None,\

     022: 							np.ndarray[double, ndim=1, mode="c"] areas not None,\

     023: 							np.ndarray[long, ndim=1, mode="c"] tri_full_flag not None,\

     024: 							np.ndarray[double, ndim=2, mode="c"] stage_edge_values not None,\

     025: 							np.ndarray[double, ndim=2, mode="c"] xmom_edge_values not None,\

     026: 							np.ndarray[double, ndim=2, mode="c"] ymom_edge_values not None,\

     027: 							np.ndarray[double, ndim=2, mode="c"] bed_edge_values not None,\

     028: 							np.ndarray[double, ndim=1, mode="c"] stage_boundary_values not None,\

     029: 							np.ndarray[double, ndim=1, mode="c"] xmom_boundary_values not None,\

     030: 							np.ndarray[double, ndim=1, mode="c"] ymom_boundary_values not None,\

     031: 							np.ndarray[long, ndim=1, mode="c"] boundary_flux_type not None,\

     032: 							np.ndarray[double, ndim=1, mode="c"] stage_explicit_update not None,\

     033: 							np.ndarray[double, ndim=1, mode="c"] xmom_explicit_update not None,\

     034: 							np.ndarray[double, ndim=1, mode="c"] ymom_explicit_update not None,\

     035: 							np.ndarray[long, ndim=2, mode="c"] already_computed_flux not None,\

     036: 							np.ndarray[double, ndim=1, mode="c"] max_speed_array not None,\

     037: 							long optimise_dry_cells,\

     038: 							np.ndarray[double, ndim=1, mode="c"] stage_centroid_values not None,\

     039: 							np.ndarray[double, ndim=1, mode="c"] bed_centroid_values not None,\

     040: 							np.ndarray[double, ndim=2, mode="c"] bed_vertex_values not None):

     041:

     042: 	cdef int number_of_elements

     043:

    +044: 	number_of_elements = stage_edge_values.shape[0]

      __pyx_v_number_of_elements = (__pyx_v_stage_edge_values->dimensions[0]);

     045:

    +046: 	timestep = _compute_fluxes_central(number_of_elements,\

      __pyx_v_timestep = _compute_fluxes_central(__pyx_v_number_of_elements, __pyx_v_timestep, __pyx_v_epsilon, __pyx_v_H0, __pyx_v_g, (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_neighbours.diminfo[0].strides, __pyx_t_2, __pyx_pybuffernd_neighbours.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_neighbour_edges.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_neighbour_edges.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_normals.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_normals.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_normals.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_edgelengths.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_edgelengths.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_radii.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_radii.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_areas.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_areas.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_tri_full_flag.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_stage_edge_values.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_stage_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_xmom_edge_values.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_xmom_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_ymom_edge_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_ymom_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_bed_edge_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_bed_edge_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_bed_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_stage_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_stage_boundary_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmom_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_xmom_boundary_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymom_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ymom_boundary_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_boundary_flux_type.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_boundary_flux_type.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_stage_explicit_update.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_stage_explicit_update.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmom_explicit_update.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_xmom_explicit_update.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymom_explicit_update.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ymom_explicit_update.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_already_computed_flux.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_already_computed_flux.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_max_speed_array.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_max_speed_array.diminfo[0].strides))), __pyx_v_optimise_dry_cells, (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_stage_centroid_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_bed_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_bed_centroid_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_bed_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_bed_vertex_values.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_bed_vertex_values.diminfo[1].strides))));

     047: 									timestep,\

     048: 									epsilon,\

     049: 									H0,\

     050: 									g,\

    +051: 									&neighbours[0,0],\

      __pyx_t_1 = 0;
      __pyx_t_2 = 0;

    +052: 									&neighbour_edges[0,0],\

      __pyx_t_3 = 0;
      __pyx_t_4 = 0;

    +053: 									&normals[0,0],\

      __pyx_t_5 = 0;
      __pyx_t_6 = 0;

    +054: 									&edgelengths[0,0],\

      __pyx_t_7 = 0;
      __pyx_t_8 = 0;

    +055: 									&radii[0],\

      __pyx_t_9 = 0;

    +056: 									&areas[0],\

      __pyx_t_10 = 0;

    +057: 									&tri_full_flag[0],\

      __pyx_t_11 = 0;

    +058: 									&stage_edge_values[0,0],\

      __pyx_t_12 = 0;
      __pyx_t_13 = 0;

    +059: 									&xmom_edge_values[0,0],\

      __pyx_t_14 = 0;
      __pyx_t_15 = 0;

    +060: 									&ymom_edge_values[0,0],\

      __pyx_t_16 = 0;
      __pyx_t_17 = 0;

    +061: 									&bed_edge_values[0,0],\

      __pyx_t_18 = 0;
      __pyx_t_19 = 0;

    +062: 									&stage_boundary_values[0],\

      __pyx_t_20 = 0;

    +063: 									&xmom_boundary_values[0],\

      __pyx_t_21 = 0;

    +064: 									&ymom_boundary_values[0],\

      __pyx_t_22 = 0;

    +065: 									&boundary_flux_type[0],\

      __pyx_t_23 = 0;

    +066: 									&stage_explicit_update[0],\

      __pyx_t_24 = 0;

    +067: 									&xmom_explicit_update[0],\

      __pyx_t_25 = 0;

    +068: 									&ymom_explicit_update[0],\

      __pyx_t_26 = 0;

    +069: 									&already_computed_flux[0,0],\

      __pyx_t_27 = 0;
      __pyx_t_28 = 0;

    +070: 									&max_speed_array[0],\

      __pyx_t_29 = 0;

     071: 									optimise_dry_cells,\

    +072: 									&stage_centroid_values[0],\

      __pyx_t_30 = 0;

    +073: 									&bed_centroid_values[0],\

      __pyx_t_31 = 0;

    +074: 									&bed_vertex_values[0,0])

      __pyx_t_32 = 0;
      __pyx_t_33 = 0;

     075:

    +076: 	return timestep

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_34 = PyFloat_FromDouble(__pyx_v_timestep); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_34);
      __pyx_r = __pyx_t_34;
      __pyx_t_34 = 0;
      goto __pyx_L0;

     077:

    +078: def protect(double minimum_allowed_height,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_3protect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_15swb2_domain_ext_3protect = {"protect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_3protect, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_3protect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      double __pyx_v_minimum_allowed_height;
      double __pyx_v_maximum_allowed_speed;
      double __pyx_v_epsilon;
      PyArrayObject *__pyx_v_wc = 0;
      PyArrayObject *__pyx_v_wv = 0;
      PyArrayObject *__pyx_v_zc = 0;
      PyArrayObject *__pyx_v_zv = 0;
      PyArrayObject *__pyx_v_xmomc = 0;
      PyArrayObject *__pyx_v_ymomc = 0;
      PyArrayObject *__pyx_v_areas = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("protect (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_minimum_allowed_height,&__pyx_n_s_maximum_allowed_speed,&__pyx_n_s_epsilon,&__pyx_n_s_wc,&__pyx_n_s_wv,&__pyx_n_s_zc,&__pyx_n_s_zv,&__pyx_n_s_xmomc,&__pyx_n_s_ymomc,&__pyx_n_s_areas,0};
        PyObject* values[10] = {0,0,0,0,0,0,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 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            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_minimum_allowed_height)) != 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_maximum_allowed_speed)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 1); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 2); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 3); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wv)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 4); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 5); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zv)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 6); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmomc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 7); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymomc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 8); __PYX_ERR(0, 78, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_areas)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, 9); __PYX_ERR(0, 78, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "protect") < 0)) __PYX_ERR(0, 78, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
          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);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
          values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
          values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
          values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
          values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
          values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        }
        __pyx_v_minimum_allowed_height = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_minimum_allowed_height == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L3_error)
        __pyx_v_maximum_allowed_speed = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_maximum_allowed_speed == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L3_error)
        __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L3_error)
        __pyx_v_wc = ((PyArrayObject *)values[3]);
        __pyx_v_wv = ((PyArrayObject *)values[4]);
        __pyx_v_zc = ((PyArrayObject *)values[5]);
        __pyx_v_zv = ((PyArrayObject *)values[6]);
        __pyx_v_xmomc = ((PyArrayObject *)values[7]);
        __pyx_v_ymomc = ((PyArrayObject *)values[8]);
        __pyx_v_areas = ((PyArrayObject *)values[9]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("protect", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 78, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.swb2_domain_ext.protect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wc), __pyx_ptype_5numpy_ndarray, 0, "wc", 0))) __PYX_ERR(0, 81, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wv), __pyx_ptype_5numpy_ndarray, 0, "wv", 0))) __PYX_ERR(0, 82, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zc), __pyx_ptype_5numpy_ndarray, 0, "zc", 0))) __PYX_ERR(0, 83, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zv), __pyx_ptype_5numpy_ndarray, 0, "zv", 0))) __PYX_ERR(0, 84, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmomc), __pyx_ptype_5numpy_ndarray, 0, "xmomc", 0))) __PYX_ERR(0, 85, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymomc), __pyx_ptype_5numpy_ndarray, 0, "ymomc", 0))) __PYX_ERR(0, 86, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_areas), __pyx_ptype_5numpy_ndarray, 0, "areas", 0))) __PYX_ERR(0, 87, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_15swb2_domain_ext_2protect(__pyx_self, __pyx_v_minimum_allowed_height, __pyx_v_maximum_allowed_speed, __pyx_v_epsilon, __pyx_v_wc, __pyx_v_wv, __pyx_v_zc, __pyx_v_zv, __pyx_v_xmomc, __pyx_v_ymomc, __pyx_v_areas);
      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_13shallow_water_15swb2_domain_ext_2protect(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_minimum_allowed_height, double __pyx_v_maximum_allowed_speed, double __pyx_v_epsilon, PyArrayObject *__pyx_v_wc, PyArrayObject *__pyx_v_wv, PyArrayObject *__pyx_v_zc, PyArrayObject *__pyx_v_zv, PyArrayObject *__pyx_v_xmomc, PyArrayObject *__pyx_v_ymomc, PyArrayObject *__pyx_v_areas) {
      int __pyx_v_N;
      double __pyx_v_mass_error;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_areas;
      __Pyx_Buffer __pyx_pybuffer_areas;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_wc;
      __Pyx_Buffer __pyx_pybuffer_wc;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_wv;
      __Pyx_Buffer __pyx_pybuffer_wv;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmomc;
      __Pyx_Buffer __pyx_pybuffer_xmomc;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymomc;
      __Pyx_Buffer __pyx_pybuffer_ymomc;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_zc;
      __Pyx_Buffer __pyx_pybuffer_zc;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_zv;
      __Pyx_Buffer __pyx_pybuffer_zv;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("protect", 0);
      __pyx_pybuffer_wc.pybuffer.buf = NULL;
      __pyx_pybuffer_wc.refcount = 0;
      __pyx_pybuffernd_wc.data = NULL;
      __pyx_pybuffernd_wc.rcbuffer = &__pyx_pybuffer_wc;
      __pyx_pybuffer_wv.pybuffer.buf = NULL;
      __pyx_pybuffer_wv.refcount = 0;
      __pyx_pybuffernd_wv.data = NULL;
      __pyx_pybuffernd_wv.rcbuffer = &__pyx_pybuffer_wv;
      __pyx_pybuffer_zc.pybuffer.buf = NULL;
      __pyx_pybuffer_zc.refcount = 0;
      __pyx_pybuffernd_zc.data = NULL;
      __pyx_pybuffernd_zc.rcbuffer = &__pyx_pybuffer_zc;
      __pyx_pybuffer_zv.pybuffer.buf = NULL;
      __pyx_pybuffer_zv.refcount = 0;
      __pyx_pybuffernd_zv.data = NULL;
      __pyx_pybuffernd_zv.rcbuffer = &__pyx_pybuffer_zv;
      __pyx_pybuffer_xmomc.pybuffer.buf = NULL;
      __pyx_pybuffer_xmomc.refcount = 0;
      __pyx_pybuffernd_xmomc.data = NULL;
      __pyx_pybuffernd_xmomc.rcbuffer = &__pyx_pybuffer_xmomc;
      __pyx_pybuffer_ymomc.pybuffer.buf = NULL;
      __pyx_pybuffer_ymomc.refcount = 0;
      __pyx_pybuffernd_ymomc.data = NULL;
      __pyx_pybuffernd_ymomc.rcbuffer = &__pyx_pybuffer_ymomc;
      __pyx_pybuffer_areas.pybuffer.buf = NULL;
      __pyx_pybuffer_areas.refcount = 0;
      __pyx_pybuffernd_areas.data = NULL;
      __pyx_pybuffernd_areas.rcbuffer = &__pyx_pybuffer_areas;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wc.rcbuffer->pybuffer, (PyObject*)__pyx_v_wc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_wc.diminfo[0].strides = __pyx_pybuffernd_wc.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wc.diminfo[0].shape = __pyx_pybuffernd_wc.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wv.rcbuffer->pybuffer, (PyObject*)__pyx_v_wv, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_wv.diminfo[0].strides = __pyx_pybuffernd_wv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wv.diminfo[0].shape = __pyx_pybuffernd_wv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_wv.diminfo[1].strides = __pyx_pybuffernd_wv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_wv.diminfo[1].shape = __pyx_pybuffernd_wv.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zc.rcbuffer->pybuffer, (PyObject*)__pyx_v_zc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_zc.diminfo[0].strides = __pyx_pybuffernd_zc.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zc.diminfo[0].shape = __pyx_pybuffernd_zc.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_zv.rcbuffer->pybuffer, (PyObject*)__pyx_v_zv, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_zv.diminfo[0].strides = __pyx_pybuffernd_zv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zv.diminfo[0].shape = __pyx_pybuffernd_zv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_zv.diminfo[1].strides = __pyx_pybuffernd_zv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_zv.diminfo[1].shape = __pyx_pybuffernd_zv.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmomc.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmomc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmomc.diminfo[0].strides = __pyx_pybuffernd_xmomc.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmomc.diminfo[0].shape = __pyx_pybuffernd_xmomc.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymomc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymomc.diminfo[0].strides = __pyx_pybuffernd_ymomc.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymomc.diminfo[0].shape = __pyx_pybuffernd_ymomc.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_areas.rcbuffer->pybuffer, (PyObject*)__pyx_v_areas, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __pyx_pybuffernd_areas.diminfo[0].strides = __pyx_pybuffernd_areas.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_areas.diminfo[0].shape = __pyx_pybuffernd_areas.rcbuffer->pybuffer.shape[0];
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_10);
      { 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_areas.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wv.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmomc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zv.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.swb2_domain_ext.protect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areas.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wv.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmomc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zv.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__5 = PyTuple_Pack(12, __pyx_n_s_minimum_allowed_height, __pyx_n_s_maximum_allowed_speed, __pyx_n_s_epsilon, __pyx_n_s_wc, __pyx_n_s_wv, __pyx_n_s_zc, __pyx_n_s_zv, __pyx_n_s_xmomc, __pyx_n_s_ymomc, __pyx_n_s_areas, __pyx_n_s_N, __pyx_n_s_mass_error); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__5);
      __Pyx_GIVEREF(__pyx_tuple__5);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_15swb2_domain_ext_3protect, NULL, __pyx_n_s_anuga_shallow_water_swb2_domain_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_protect, __pyx_t_1) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(10, 0, 12, 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_shallow_water_swb2_domain, __pyx_n_s_protect, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 78, __pyx_L1_error)

     079: 			double maximum_allowed_speed,\

     080: 			double epsilon,\

     081: 			np.ndarray[double, ndim=1, mode="c"] wc not None,\

     082: 			np.ndarray[double, ndim=2, mode="c"] wv not None,\

     083: 			np.ndarray[double, ndim=1, mode="c"] zc not None,\

     084: 			np.ndarray[double, ndim=2, mode="c"] zv not None,\

     085: 			np.ndarray[double, ndim=1, mode="c"] xmomc not None,\

     086: 			np.ndarray[double, ndim=1, mode="c"] ymomc not None,\

     087: 			np.ndarray[double, ndim=1, mode="c"] areas not None):

     088:

     089: 	cdef int N

     090:

     091: 	cdef double mass_error

     092:

    +093: 	N = wc.shape[0]

      __pyx_v_N = (__pyx_v_wc->dimensions[0]);

     094:

    +095: 	mass_error = _protect(N,\

      __pyx_v_mass_error = _protect(__pyx_v_N, __pyx_v_minimum_allowed_height, __pyx_v_maximum_allowed_speed, __pyx_v_epsilon, (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_wc.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_wc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_wv.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_wv.diminfo[0].strides, __pyx_t_3, __pyx_pybuffernd_wv.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_zc.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_zc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_zv.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_zv.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_zv.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmomc.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_xmomc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymomc.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ymomc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_areas.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_areas.diminfo[0].strides))));

     096: 					minimum_allowed_height,\

     097: 					maximum_allowed_speed,\

     098: 					epsilon,\

    +099: 					&wc[0],\

      __pyx_t_1 = 0;

    +100: 					&wv[0,0],\

      __pyx_t_2 = 0;
      __pyx_t_3 = 0;

    +101: 					&zc[0],\

      __pyx_t_4 = 0;

    +102: 					&zv[0,0],\

      __pyx_t_5 = 0;
      __pyx_t_6 = 0;

    +103: 					&xmomc[0],\

      __pyx_t_7 = 0;

    +104: 					&ymomc[0],\

      __pyx_t_8 = 0;

    +105: 					&areas[0])

      __pyx_t_9 = 0;

     106:

    +107: 	return mass_error

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = PyFloat_FromDouble(__pyx_v_mass_error); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;

     108:

    +109: def extrapolate_second_order_edge_sw(object domain,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_5extrapolate_second_order_edge_sw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_15swb2_domain_ext_5extrapolate_second_order_edge_sw = {"extrapolate_second_order_edge_sw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_5extrapolate_second_order_edge_sw, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_15swb2_domain_ext_5extrapolate_second_order_edge_sw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_domain = 0;
      PyArrayObject *__pyx_v_surrogate_neighbours = 0;
      PyArrayObject *__pyx_v_number_of_boundaries = 0;
      PyArrayObject *__pyx_v_centroid_coordinates = 0;
      PyArrayObject *__pyx_v_stage_centroid_values = 0;
      PyArrayObject *__pyx_v_xmom_centroid_values = 0;
      PyArrayObject *__pyx_v_ymom_centroid_values = 0;
      PyArrayObject *__pyx_v_elevation_centroid_values = 0;
      PyArrayObject *__pyx_v_edge_coordinates = 0;
      PyArrayObject *__pyx_v_stage_edge_values = 0;
      PyArrayObject *__pyx_v_xmom_edge_values = 0;
      PyArrayObject *__pyx_v_ymom_edge_values = 0;
      PyArrayObject *__pyx_v_elevation_edge_values = 0;
      PyArrayObject *__pyx_v_stage_vertex_values = 0;
      PyArrayObject *__pyx_v_xmom_vertex_values = 0;
      PyArrayObject *__pyx_v_ymom_vertex_values = 0;
      PyArrayObject *__pyx_v_elevation_vertex_values = 0;
      long __pyx_v_optimise_dry_cells;
      long __pyx_v_extrapolate_velocity_second_order;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("extrapolate_second_order_edge_sw (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domain,&__pyx_n_s_surrogate_neighbours,&__pyx_n_s_number_of_boundaries,&__pyx_n_s_centroid_coordinates,&__pyx_n_s_stage_centroid_values,&__pyx_n_s_xmom_centroid_values,&__pyx_n_s_ymom_centroid_values,&__pyx_n_s_elevation_centroid_values,&__pyx_n_s_edge_coordinates,&__pyx_n_s_stage_edge_values,&__pyx_n_s_xmom_edge_values,&__pyx_n_s_ymom_edge_values,&__pyx_n_s_elevation_edge_values,&__pyx_n_s_stage_vertex_values,&__pyx_n_s_xmom_vertex_values,&__pyx_n_s_ymom_vertex_values,&__pyx_n_s_elevation_vertex_values,&__pyx_n_s_optimise_dry_cells,&__pyx_n_s_extrapolate_velocity_second_orde,0};
        PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
            CYTHON_FALLTHROUGH;
            case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
            CYTHON_FALLTHROUGH;
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            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_domain)) != 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_surrogate_neighbours)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 1); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_number_of_boundaries)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 2); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_centroid_coordinates)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 3); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_centroid_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 4); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom_centroid_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 5); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom_centroid_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 6); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elevation_centroid_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 7); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_edge_coordinates)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 8); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 9); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 10:
            if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 10); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 11:
            if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 11); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 12:
            if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elevation_edge_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 12); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 13:
            if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stage_vertex_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 13); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 14:
            if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom_vertex_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 14); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 15:
            if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom_vertex_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 15); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 16:
            if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elevation_vertex_values)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 16); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 17:
            if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_optimise_dry_cells)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 17); __PYX_ERR(0, 109, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case 18:
            if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extrapolate_velocity_second_orde)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, 18); __PYX_ERR(0, 109, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "extrapolate_second_order_edge_sw") < 0)) __PYX_ERR(0, 109, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 19) {
          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);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
          values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
          values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
          values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
          values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
          values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
          values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
          values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
          values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
          values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
          values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
          values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
          values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
          values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
          values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
        }
        __pyx_v_domain = values[0];
        __pyx_v_surrogate_neighbours = ((PyArrayObject *)values[1]);
        __pyx_v_number_of_boundaries = ((PyArrayObject *)values[2]);
        __pyx_v_centroid_coordinates = ((PyArrayObject *)values[3]);
        __pyx_v_stage_centroid_values = ((PyArrayObject *)values[4]);
        __pyx_v_xmom_centroid_values = ((PyArrayObject *)values[5]);
        __pyx_v_ymom_centroid_values = ((PyArrayObject *)values[6]);
        __pyx_v_elevation_centroid_values = ((PyArrayObject *)values[7]);
        __pyx_v_edge_coordinates = ((PyArrayObject *)values[8]);
        __pyx_v_stage_edge_values = ((PyArrayObject *)values[9]);
        __pyx_v_xmom_edge_values = ((PyArrayObject *)values[10]);
        __pyx_v_ymom_edge_values = ((PyArrayObject *)values[11]);
        __pyx_v_elevation_edge_values = ((PyArrayObject *)values[12]);
        __pyx_v_stage_vertex_values = ((PyArrayObject *)values[13]);
        __pyx_v_xmom_vertex_values = ((PyArrayObject *)values[14]);
        __pyx_v_ymom_vertex_values = ((PyArrayObject *)values[15]);
        __pyx_v_elevation_vertex_values = ((PyArrayObject *)values[16]);
        __pyx_v_optimise_dry_cells = __Pyx_PyInt_As_long(values[17]); if (unlikely((__pyx_v_optimise_dry_cells == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error)
        __pyx_v_extrapolate_velocity_second_order = __Pyx_PyInt_As_long(values[18]); if (unlikely((__pyx_v_extrapolate_velocity_second_order == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("extrapolate_second_order_edge_sw", 1, 19, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 109, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.swb2_domain_ext.extrapolate_second_order_edge_sw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_surrogate_neighbours), __pyx_ptype_5numpy_ndarray, 0, "surrogate_neighbours", 0))) __PYX_ERR(0, 110, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_number_of_boundaries), __pyx_ptype_5numpy_ndarray, 0, "number_of_boundaries", 0))) __PYX_ERR(0, 111, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centroid_coordinates), __pyx_ptype_5numpy_ndarray, 0, "centroid_coordinates", 0))) __PYX_ERR(0, 112, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_centroid_values), __pyx_ptype_5numpy_ndarray, 0, "stage_centroid_values", 0))) __PYX_ERR(0, 113, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom_centroid_values), __pyx_ptype_5numpy_ndarray, 0, "xmom_centroid_values", 0))) __PYX_ERR(0, 114, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom_centroid_values), __pyx_ptype_5numpy_ndarray, 0, "ymom_centroid_values", 0))) __PYX_ERR(0, 115, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elevation_centroid_values), __pyx_ptype_5numpy_ndarray, 0, "elevation_centroid_values", 0))) __PYX_ERR(0, 116, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edge_coordinates), __pyx_ptype_5numpy_ndarray, 0, "edge_coordinates", 0))) __PYX_ERR(0, 117, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_edge_values), __pyx_ptype_5numpy_ndarray, 0, "stage_edge_values", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom_edge_values), __pyx_ptype_5numpy_ndarray, 0, "xmom_edge_values", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom_edge_values), __pyx_ptype_5numpy_ndarray, 0, "ymom_edge_values", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elevation_edge_values), __pyx_ptype_5numpy_ndarray, 0, "elevation_edge_values", 0))) __PYX_ERR(0, 121, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_stage_vertex_values), __pyx_ptype_5numpy_ndarray, 0, "stage_vertex_values", 0))) __PYX_ERR(0, 122, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom_vertex_values), __pyx_ptype_5numpy_ndarray, 0, "xmom_vertex_values", 0))) __PYX_ERR(0, 123, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom_vertex_values), __pyx_ptype_5numpy_ndarray, 0, "ymom_vertex_values", 0))) __PYX_ERR(0, 124, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elevation_vertex_values), __pyx_ptype_5numpy_ndarray, 0, "elevation_vertex_values", 0))) __PYX_ERR(0, 125, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_15swb2_domain_ext_4extrapolate_second_order_edge_sw(__pyx_self, __pyx_v_domain, __pyx_v_surrogate_neighbours, __pyx_v_number_of_boundaries, __pyx_v_centroid_coordinates, __pyx_v_stage_centroid_values, __pyx_v_xmom_centroid_values, __pyx_v_ymom_centroid_values, __pyx_v_elevation_centroid_values, __pyx_v_edge_coordinates, __pyx_v_stage_edge_values, __pyx_v_xmom_edge_values, __pyx_v_ymom_edge_values, __pyx_v_elevation_edge_values, __pyx_v_stage_vertex_values, __pyx_v_xmom_vertex_values, __pyx_v_ymom_vertex_values, __pyx_v_elevation_vertex_values, __pyx_v_optimise_dry_cells, __pyx_v_extrapolate_velocity_second_order);
      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_13shallow_water_15swb2_domain_ext_4extrapolate_second_order_edge_sw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain, PyArrayObject *__pyx_v_surrogate_neighbours, PyArrayObject *__pyx_v_number_of_boundaries, PyArrayObject *__pyx_v_centroid_coordinates, PyArrayObject *__pyx_v_stage_centroid_values, PyArrayObject *__pyx_v_xmom_centroid_values, PyArrayObject *__pyx_v_ymom_centroid_values, PyArrayObject *__pyx_v_elevation_centroid_values, PyArrayObject *__pyx_v_edge_coordinates, PyArrayObject *__pyx_v_stage_edge_values, PyArrayObject *__pyx_v_xmom_edge_values, PyArrayObject *__pyx_v_ymom_edge_values, PyArrayObject *__pyx_v_elevation_edge_values, PyArrayObject *__pyx_v_stage_vertex_values, PyArrayObject *__pyx_v_xmom_vertex_values, PyArrayObject *__pyx_v_ymom_vertex_values, PyArrayObject *__pyx_v_elevation_vertex_values, long __pyx_v_optimise_dry_cells, long __pyx_v_extrapolate_velocity_second_order) {
      double __pyx_v_beta_w;
      double __pyx_v_beta_w_dry;
      double __pyx_v_beta_uh;
      double __pyx_v_beta_uh_dry;
      double __pyx_v_beta_vh;
      double __pyx_v_beta_vh_dry;
      double __pyx_v_minimum_allowed_height;
      double __pyx_v_epsilon;
      int __pyx_v_number_of_elements;
      int __pyx_v_e;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_centroid_coordinates;
      __Pyx_Buffer __pyx_pybuffer_centroid_coordinates;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_coordinates;
      __Pyx_Buffer __pyx_pybuffer_edge_coordinates;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_elevation_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_elevation_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_elevation_edge_values;
      __Pyx_Buffer __pyx_pybuffer_elevation_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_elevation_vertex_values;
      __Pyx_Buffer __pyx_pybuffer_elevation_vertex_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_number_of_boundaries;
      __Pyx_Buffer __pyx_pybuffer_number_of_boundaries;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_stage_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_edge_values;
      __Pyx_Buffer __pyx_pybuffer_stage_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_stage_vertex_values;
      __Pyx_Buffer __pyx_pybuffer_stage_vertex_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_surrogate_neighbours;
      __Pyx_Buffer __pyx_pybuffer_surrogate_neighbours;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_xmom_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom_edge_values;
      __Pyx_Buffer __pyx_pybuffer_xmom_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom_vertex_values;
      __Pyx_Buffer __pyx_pybuffer_xmom_vertex_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_ymom_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom_edge_values;
      __Pyx_Buffer __pyx_pybuffer_ymom_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom_vertex_values;
      __Pyx_Buffer __pyx_pybuffer_ymom_vertex_values;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("extrapolate_second_order_edge_sw", 0);
      __pyx_pybuffer_surrogate_neighbours.pybuffer.buf = NULL;
      __pyx_pybuffer_surrogate_neighbours.refcount = 0;
      __pyx_pybuffernd_surrogate_neighbours.data = NULL;
      __pyx_pybuffernd_surrogate_neighbours.rcbuffer = &__pyx_pybuffer_surrogate_neighbours;
      __pyx_pybuffer_number_of_boundaries.pybuffer.buf = NULL;
      __pyx_pybuffer_number_of_boundaries.refcount = 0;
      __pyx_pybuffernd_number_of_boundaries.data = NULL;
      __pyx_pybuffernd_number_of_boundaries.rcbuffer = &__pyx_pybuffer_number_of_boundaries;
      __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_stage_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_centroid_values.refcount = 0;
      __pyx_pybuffernd_stage_centroid_values.data = NULL;
      __pyx_pybuffernd_stage_centroid_values.rcbuffer = &__pyx_pybuffer_stage_centroid_values;
      __pyx_pybuffer_xmom_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom_centroid_values.refcount = 0;
      __pyx_pybuffernd_xmom_centroid_values.data = NULL;
      __pyx_pybuffernd_xmom_centroid_values.rcbuffer = &__pyx_pybuffer_xmom_centroid_values;
      __pyx_pybuffer_ymom_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom_centroid_values.refcount = 0;
      __pyx_pybuffernd_ymom_centroid_values.data = NULL;
      __pyx_pybuffernd_ymom_centroid_values.rcbuffer = &__pyx_pybuffer_ymom_centroid_values;
      __pyx_pybuffer_elevation_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_elevation_centroid_values.refcount = 0;
      __pyx_pybuffernd_elevation_centroid_values.data = NULL;
      __pyx_pybuffernd_elevation_centroid_values.rcbuffer = &__pyx_pybuffer_elevation_centroid_values;
      __pyx_pybuffer_edge_coordinates.pybuffer.buf = NULL;
      __pyx_pybuffer_edge_coordinates.refcount = 0;
      __pyx_pybuffernd_edge_coordinates.data = NULL;
      __pyx_pybuffernd_edge_coordinates.rcbuffer = &__pyx_pybuffer_edge_coordinates;
      __pyx_pybuffer_stage_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_edge_values.refcount = 0;
      __pyx_pybuffernd_stage_edge_values.data = NULL;
      __pyx_pybuffernd_stage_edge_values.rcbuffer = &__pyx_pybuffer_stage_edge_values;
      __pyx_pybuffer_xmom_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom_edge_values.refcount = 0;
      __pyx_pybuffernd_xmom_edge_values.data = NULL;
      __pyx_pybuffernd_xmom_edge_values.rcbuffer = &__pyx_pybuffer_xmom_edge_values;
      __pyx_pybuffer_ymom_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom_edge_values.refcount = 0;
      __pyx_pybuffernd_ymom_edge_values.data = NULL;
      __pyx_pybuffernd_ymom_edge_values.rcbuffer = &__pyx_pybuffer_ymom_edge_values;
      __pyx_pybuffer_elevation_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_elevation_edge_values.refcount = 0;
      __pyx_pybuffernd_elevation_edge_values.data = NULL;
      __pyx_pybuffernd_elevation_edge_values.rcbuffer = &__pyx_pybuffer_elevation_edge_values;
      __pyx_pybuffer_stage_vertex_values.pybuffer.buf = NULL;
      __pyx_pybuffer_stage_vertex_values.refcount = 0;
      __pyx_pybuffernd_stage_vertex_values.data = NULL;
      __pyx_pybuffernd_stage_vertex_values.rcbuffer = &__pyx_pybuffer_stage_vertex_values;
      __pyx_pybuffer_xmom_vertex_values.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom_vertex_values.refcount = 0;
      __pyx_pybuffernd_xmom_vertex_values.data = NULL;
      __pyx_pybuffernd_xmom_vertex_values.rcbuffer = &__pyx_pybuffer_xmom_vertex_values;
      __pyx_pybuffer_ymom_vertex_values.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom_vertex_values.refcount = 0;
      __pyx_pybuffernd_ymom_vertex_values.data = NULL;
      __pyx_pybuffernd_ymom_vertex_values.rcbuffer = &__pyx_pybuffer_ymom_vertex_values;
      __pyx_pybuffer_elevation_vertex_values.pybuffer.buf = NULL;
      __pyx_pybuffer_elevation_vertex_values.refcount = 0;
      __pyx_pybuffernd_elevation_vertex_values.data = NULL;
      __pyx_pybuffernd_elevation_vertex_values.rcbuffer = &__pyx_pybuffer_elevation_vertex_values;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer, (PyObject*)__pyx_v_surrogate_neighbours, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_surrogate_neighbours.diminfo[0].strides = __pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_surrogate_neighbours.diminfo[0].shape = __pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_surrogate_neighbours.diminfo[1].strides = __pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_surrogate_neighbours.diminfo[1].shape = __pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer, (PyObject*)__pyx_v_number_of_boundaries, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_number_of_boundaries.diminfo[0].strides = __pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_number_of_boundaries.diminfo[0].shape = __pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        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)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __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];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_centroid_values.diminfo[0].strides = __pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_centroid_values.diminfo[0].shape = __pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom_centroid_values.diminfo[0].strides = __pyx_pybuffernd_xmom_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom_centroid_values.diminfo[0].shape = __pyx_pybuffernd_xmom_centroid_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom_centroid_values.diminfo[0].strides = __pyx_pybuffernd_ymom_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom_centroid_values.diminfo[0].shape = __pyx_pybuffernd_ymom_centroid_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elevation_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_elevation_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_elevation_centroid_values.diminfo[0].strides = __pyx_pybuffernd_elevation_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elevation_centroid_values.diminfo[0].shape = __pyx_pybuffernd_elevation_centroid_values.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_coordinates, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_edge_coordinates.diminfo[0].strides = __pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_coordinates.diminfo[0].shape = __pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_coordinates.diminfo[1].strides = __pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_coordinates.diminfo[1].shape = __pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_edge_values.diminfo[0].strides = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_edge_values.diminfo[0].shape = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_stage_edge_values.diminfo[1].strides = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_stage_edge_values.diminfo[1].shape = __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom_edge_values.diminfo[0].strides = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom_edge_values.diminfo[0].shape = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xmom_edge_values.diminfo[1].strides = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xmom_edge_values.diminfo[1].shape = __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom_edge_values.diminfo[0].strides = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom_edge_values.diminfo[0].shape = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ymom_edge_values.diminfo[1].strides = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ymom_edge_values.diminfo[1].shape = __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_elevation_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_elevation_edge_values.diminfo[0].strides = __pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elevation_edge_values.diminfo[0].shape = __pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elevation_edge_values.diminfo[1].strides = __pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elevation_edge_values.diminfo[1].shape = __pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_stage_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_stage_vertex_values.diminfo[0].strides = __pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stage_vertex_values.diminfo[0].shape = __pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_stage_vertex_values.diminfo[1].strides = __pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_stage_vertex_values.diminfo[1].shape = __pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom_vertex_values.diminfo[0].strides = __pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom_vertex_values.diminfo[0].shape = __pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xmom_vertex_values.diminfo[1].strides = __pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xmom_vertex_values.diminfo[1].shape = __pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom_vertex_values.diminfo[0].strides = __pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom_vertex_values.diminfo[0].shape = __pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ymom_vertex_values.diminfo[1].strides = __pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ymom_vertex_values.diminfo[1].shape = __pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_elevation_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 109, __pyx_L1_error)
      }
      __pyx_pybuffernd_elevation_vertex_values.diminfo[0].strides = __pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elevation_vertex_values.diminfo[0].shape = __pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elevation_vertex_values.diminfo[1].strides = __pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elevation_vertex_values.diminfo[1].shape = __pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer.shape[1];
    /* … */
      /* 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_coordinates.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elevation_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.swb2_domain_ext.extrapolate_second_order_edge_sw", __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_coordinates.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elevation_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__7 = PyTuple_Pack(29, __pyx_n_s_domain, __pyx_n_s_surrogate_neighbours, __pyx_n_s_number_of_boundaries, __pyx_n_s_centroid_coordinates, __pyx_n_s_stage_centroid_values, __pyx_n_s_xmom_centroid_values, __pyx_n_s_ymom_centroid_values, __pyx_n_s_elevation_centroid_values, __pyx_n_s_edge_coordinates, __pyx_n_s_stage_edge_values, __pyx_n_s_xmom_edge_values, __pyx_n_s_ymom_edge_values, __pyx_n_s_elevation_edge_values, __pyx_n_s_stage_vertex_values, __pyx_n_s_xmom_vertex_values, __pyx_n_s_ymom_vertex_values, __pyx_n_s_elevation_vertex_values, __pyx_n_s_optimise_dry_cells, __pyx_n_s_extrapolate_velocity_second_orde, __pyx_n_s_beta_w, __pyx_n_s_beta_w_dry, __pyx_n_s_beta_uh, __pyx_n_s_beta_uh_dry, __pyx_n_s_beta_vh, __pyx_n_s_beta_vh_dry, __pyx_n_s_minimum_allowed_height, __pyx_n_s_epsilon, __pyx_n_s_number_of_elements, __pyx_n_s_e); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__7);
      __Pyx_GIVEREF(__pyx_tuple__7);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_15swb2_domain_ext_5extrapolate_second_order_edge_sw, NULL, __pyx_n_s_anuga_shallow_water_swb2_domain_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_extrapolate_second_order_edge_sw, __pyx_t_1) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     110: 									np.ndarray[long, ndim=2, mode="c"] surrogate_neighbours not None,\

     111: 									np.ndarray[long, ndim=1, mode="c"] number_of_boundaries not None,\

     112: 									np.ndarray[double, ndim=2, mode="c"] centroid_coordinates not None,\

     113: 									np.ndarray[double, ndim=1, mode="c"] stage_centroid_values not None,\

     114: 									np.ndarray[double, ndim=1, mode="c"] xmom_centroid_values not None,\

     115: 									np.ndarray[double, ndim=1, mode="c"] ymom_centroid_values not None,\

     116: 									np.ndarray[double, ndim=1, mode="c"] elevation_centroid_values not None,\

     117: 									np.ndarray[double, ndim=2, mode="c"] edge_coordinates not None,\

     118: 									np.ndarray[double, ndim=2, mode="c"] stage_edge_values not None,\

     119: 									np.ndarray[double, ndim=2, mode="c"] xmom_edge_values not None,\

     120: 									np.ndarray[double, ndim=2, mode="c"] ymom_edge_values not None,\

     121: 									np.ndarray[double, ndim=2, mode="c"] elevation_edge_values not None,\

     122: 									np.ndarray[double, ndim=2, mode="c"] stage_vertex_values not None,\

     123: 									np.ndarray[double, ndim=2, mode="c"] xmom_vertex_values not None,\

     124: 									np.ndarray[double, ndim=2, mode="c"] ymom_vertex_values not None,\

     125: 									np.ndarray[double, ndim=2, mode="c"] elevation_vertex_values not None,\

     126: 									long optimise_dry_cells,\

     127: 									long extrapolate_velocity_second_order):

     128:

     129:

     130: 	cdef double beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry

     131: 	cdef double minimum_allowed_height, epsilon

     132: 	cdef int number_of_elements, e

     133:

    +134: 	beta_w = domain.beta_w

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_beta_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_beta_w = __pyx_t_2;

    +135: 	beta_w_dry = domain.beta_w_dry

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_beta_w_dry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_beta_w_dry = __pyx_t_2;

    +136: 	beta_uh = domain.beta_uh

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_beta_uh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_beta_uh = __pyx_t_2;

    +137: 	beta_uh_dry = domain.beta_uh_dry

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_beta_uh_dry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_beta_uh_dry = __pyx_t_2;

    +138: 	beta_vh = domain.beta_vh

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_beta_vh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_beta_vh = __pyx_t_2;

    +139: 	beta_vh_dry = domain.beta_vh_dry

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_beta_vh_dry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_beta_vh_dry = __pyx_t_2;

     140:

    +141: 	minimum_allowed_height = domain.minimum_allowed_height

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_minimum_allowed_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_minimum_allowed_height = __pyx_t_2;

    +142: 	epsilon = domain.epsilon

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain, __pyx_n_s_epsilon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_epsilon = __pyx_t_2;

     143:

    +144: 	number_of_elements = stage_centroid_values.shape[0]

      __pyx_v_number_of_elements = (__pyx_v_stage_centroid_values->dimensions[0]);

     145:

    +146: 	e = _extrapolate_second_order_edge_sw(number_of_elements,\

      __pyx_v_e = _extrapolate_second_order_edge_sw(__pyx_v_number_of_elements, __pyx_v_epsilon, __pyx_v_minimum_allowed_height, __pyx_v_beta_w, __pyx_v_beta_w_dry, __pyx_v_beta_uh, __pyx_v_beta_uh_dry, __pyx_v_beta_vh, __pyx_v_beta_vh_dry, (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_surrogate_neighbours.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_surrogate_neighbours.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_number_of_boundaries.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_centroid_coordinates.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_centroid_coordinates.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_stage_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_stage_centroid_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmom_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_xmom_centroid_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymom_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ymom_centroid_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_elevation_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elevation_centroid_values.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_edge_coordinates.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_edge_coordinates.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_stage_edge_values.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_stage_edge_values.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_stage_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_xmom_edge_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_xmom_edge_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_xmom_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_ymom_edge_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_ymom_edge_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_ymom_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_elevation_edge_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elevation_edge_values.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elevation_edge_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_stage_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_stage_vertex_values.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_stage_vertex_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_xmom_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_xmom_vertex_values.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_xmom_vertex_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_ymom_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ymom_vertex_values.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_ymom_vertex_values.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_elevation_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_elevation_vertex_values.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_elevation_vertex_values.diminfo[1].strides))), __pyx_v_optimise_dry_cells, __pyx_v_extrapolate_velocity_second_order);

     147: 										epsilon,\

     148: 										minimum_allowed_height,\

     149: 										beta_w,\

     150: 										beta_w_dry,\

     151: 										beta_uh,\

     152: 										beta_uh_dry,\

     153: 										beta_vh,\

     154: 										beta_vh_dry,\

    +155: 										&surrogate_neighbours[0,0],\

      __pyx_t_3 = 0;
      __pyx_t_4 = 0;

    +156: 										&number_of_boundaries[0],\

      __pyx_t_5 = 0;

    +157: 										&centroid_coordinates[0,0],\

      __pyx_t_6 = 0;
      __pyx_t_7 = 0;

    +158: 										&stage_centroid_values[0],\

      __pyx_t_8 = 0;

    +159: 										&xmom_centroid_values[0],\

      __pyx_t_9 = 0;

    +160: 										&ymom_centroid_values[0],\

      __pyx_t_10 = 0;

    +161: 										&elevation_centroid_values[0],\

      __pyx_t_11 = 0;

    +162: 										&edge_coordinates[0,0],\

      __pyx_t_12 = 0;
      __pyx_t_13 = 0;

    +163: 										&stage_edge_values[0,0],\

      __pyx_t_14 = 0;
      __pyx_t_15 = 0;

    +164: 										&xmom_edge_values[0,0],\

      __pyx_t_16 = 0;
      __pyx_t_17 = 0;

    +165: 										&ymom_edge_values[0,0],\

      __pyx_t_18 = 0;
      __pyx_t_19 = 0;

    +166: 										&elevation_edge_values[0,0],\

      __pyx_t_20 = 0;
      __pyx_t_21 = 0;

    +167: 										&stage_vertex_values[0,0],\

      __pyx_t_22 = 0;
      __pyx_t_23 = 0;

    +168: 										&xmom_vertex_values[0,0],\

      __pyx_t_24 = 0;
      __pyx_t_25 = 0;

    +169: 										&ymom_vertex_values[0,0],\

      __pyx_t_26 = 0;
      __pyx_t_27 = 0;

    +170: 										&elevation_vertex_values[0,0],\

      __pyx_t_28 = 0;
      __pyx_t_29 = 0;

     171: 										optimise_dry_cells,\

     172: 										extrapolate_velocity_second_order)

     173:

    +174: 	if e == -1:

      __pyx_t_30 = ((__pyx_v_e == -1L) != 0);
      if (__pyx_t_30) {
    /* … */
      }

    +175: 		return None

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

     176:

     177:

     178:

     179:

     180: