Cython: mannings_operator_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: mannings_operator_ext.c

    +01: #cython: wraparound=False, boundscheck=False, cdivision=True, profile=False, nonecheck=False, overflowcheck=False, cdivision_warnings=False, unraisable_tracebacks=False

      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     02: import cython

     03:

     04: # import both numpy and the Cython declarations for numpy

    +05: import numpy as np

      __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     06: cimport numpy as np

     07:

     08: # declare the interface to the C code

     09: cdef extern from "mannings_operator.c":

     10: 	void _manning_friction_sloped(double g, double eps, int N, double* x, double* w, double* zv, double* uh, double* vh, double* eta, double* xmom_update, double* ymom_update)

     11: 	void _manning_friction_flat(double g, double eps, int N, double* w, double* zv, double* uh, double* vh, double* eta, double* xmom, double* ymom)

     12: 	void _chezy_friction(double g, double eps, int N, double* x, double* w, double* zv, double* uh, double* vh, double* chezy, double* xmom_update, double* ymom_update)

     13:

    +14: def manning_friction_flat(double g,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_9operators_21mannings_operator_ext_1manning_friction_flat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_9operators_21mannings_operator_ext_1manning_friction_flat = {"manning_friction_flat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_9operators_21mannings_operator_ext_1manning_friction_flat, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_9operators_21mannings_operator_ext_1manning_friction_flat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      double __pyx_v_g;
      double __pyx_v_eps;
      PyArrayObject *__pyx_v_w = 0;
      PyArrayObject *__pyx_v_uh = 0;
      PyArrayObject *__pyx_v_vh = 0;
      PyArrayObject *__pyx_v_z = 0;
      PyArrayObject *__pyx_v_eta = 0;
      PyArrayObject *__pyx_v_xmom = 0;
      PyArrayObject *__pyx_v_ymom = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("manning_friction_flat (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,&__pyx_n_s_eps,&__pyx_n_s_w,&__pyx_n_s_uh,&__pyx_n_s_vh,&__pyx_n_s_z,&__pyx_n_s_eta,&__pyx_n_s_xmom,&__pyx_n_s_ymom,0};
        PyObject* values[9] = {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  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_g)) != 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_eps)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 1); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 2); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 3); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 4); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 5); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eta)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 6); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 7); __PYX_ERR(0, 14, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, 8); __PYX_ERR(0, 14, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manning_friction_flat") < 0)) __PYX_ERR(0, 14, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
          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);
        }
        __pyx_v_g = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_g == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L3_error)
        __pyx_v_eps = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
        __pyx_v_w = ((PyArrayObject *)values[2]);
        __pyx_v_uh = ((PyArrayObject *)values[3]);
        __pyx_v_vh = ((PyArrayObject *)values[4]);
        __pyx_v_z = ((PyArrayObject *)values[5]);
        __pyx_v_eta = ((PyArrayObject *)values[6]);
        __pyx_v_xmom = ((PyArrayObject *)values[7]);
        __pyx_v_ymom = ((PyArrayObject *)values[8]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("manning_friction_flat", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 14, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.operators.mannings_operator_ext.manning_friction_flat", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 0, "w", 0))) __PYX_ERR(0, 16, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_uh), __pyx_ptype_5numpy_ndarray, 0, "uh", 0))) __PYX_ERR(0, 17, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vh), __pyx_ptype_5numpy_ndarray, 0, "vh", 0))) __PYX_ERR(0, 18, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 0, "z", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eta), __pyx_ptype_5numpy_ndarray, 0, "eta", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom), __pyx_ptype_5numpy_ndarray, 0, "xmom", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom), __pyx_ptype_5numpy_ndarray, 0, "ymom", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_9operators_21mannings_operator_ext_manning_friction_flat(__pyx_self, __pyx_v_g, __pyx_v_eps, __pyx_v_w, __pyx_v_uh, __pyx_v_vh, __pyx_v_z, __pyx_v_eta, __pyx_v_xmom, __pyx_v_ymom);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_9operators_21mannings_operator_ext_manning_friction_flat(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_g, double __pyx_v_eps, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_uh, PyArrayObject *__pyx_v_vh, PyArrayObject *__pyx_v_z, PyArrayObject *__pyx_v_eta, PyArrayObject *__pyx_v_xmom, PyArrayObject *__pyx_v_ymom) {
      int __pyx_v_N;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_eta;
      __Pyx_Buffer __pyx_pybuffer_eta;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_uh;
      __Pyx_Buffer __pyx_pybuffer_uh;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_vh;
      __Pyx_Buffer __pyx_pybuffer_vh;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
      __Pyx_Buffer __pyx_pybuffer_w;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom;
      __Pyx_Buffer __pyx_pybuffer_xmom;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom;
      __Pyx_Buffer __pyx_pybuffer_ymom;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_z;
      __Pyx_Buffer __pyx_pybuffer_z;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("manning_friction_flat", 0);
      __pyx_pybuffer_w.pybuffer.buf = NULL;
      __pyx_pybuffer_w.refcount = 0;
      __pyx_pybuffernd_w.data = NULL;
      __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
      __pyx_pybuffer_uh.pybuffer.buf = NULL;
      __pyx_pybuffer_uh.refcount = 0;
      __pyx_pybuffernd_uh.data = NULL;
      __pyx_pybuffernd_uh.rcbuffer = &__pyx_pybuffer_uh;
      __pyx_pybuffer_vh.pybuffer.buf = NULL;
      __pyx_pybuffer_vh.refcount = 0;
      __pyx_pybuffernd_vh.data = NULL;
      __pyx_pybuffernd_vh.rcbuffer = &__pyx_pybuffer_vh;
      __pyx_pybuffer_z.pybuffer.buf = NULL;
      __pyx_pybuffer_z.refcount = 0;
      __pyx_pybuffernd_z.data = NULL;
      __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;
      __pyx_pybuffer_eta.pybuffer.buf = NULL;
      __pyx_pybuffer_eta.refcount = 0;
      __pyx_pybuffernd_eta.data = NULL;
      __pyx_pybuffernd_eta.rcbuffer = &__pyx_pybuffer_eta;
      __pyx_pybuffer_xmom.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom.refcount = 0;
      __pyx_pybuffernd_xmom.data = NULL;
      __pyx_pybuffernd_xmom.rcbuffer = &__pyx_pybuffer_xmom;
      __pyx_pybuffer_ymom.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom.refcount = 0;
      __pyx_pybuffernd_ymom.data = NULL;
      __pyx_pybuffernd_ymom.rcbuffer = &__pyx_pybuffer_ymom;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_uh.rcbuffer->pybuffer, (PyObject*)__pyx_v_uh, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_uh.diminfo[0].strides = __pyx_pybuffernd_uh.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_uh.diminfo[0].shape = __pyx_pybuffernd_uh.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vh.rcbuffer->pybuffer, (PyObject*)__pyx_v_vh, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_vh.diminfo[0].strides = __pyx_pybuffernd_vh.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vh.diminfo[0].shape = __pyx_pybuffernd_vh.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_z.diminfo[1].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_z.diminfo[1].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_eta.rcbuffer->pybuffer, (PyObject*)__pyx_v_eta, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_eta.diminfo[0].strides = __pyx_pybuffernd_eta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_eta.diminfo[0].shape = __pyx_pybuffernd_eta.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom.diminfo[0].strides = __pyx_pybuffernd_xmom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom.diminfo[0].shape = __pyx_pybuffernd_xmom.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 14, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom.diminfo[0].strides = __pyx_pybuffernd_ymom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom.diminfo[0].shape = __pyx_pybuffernd_ymom.rcbuffer->pybuffer.shape[0];
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_eta.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_uh.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vh.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.operators.mannings_operator_ext.manning_friction_flat", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_eta.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_uh.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vh.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__3 = PyTuple_Pack(10, __pyx_n_s_g, __pyx_n_s_eps, __pyx_n_s_w, __pyx_n_s_uh, __pyx_n_s_vh, __pyx_n_s_z, __pyx_n_s_eta, __pyx_n_s_xmom, __pyx_n_s_ymom, __pyx_n_s_N); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__3);
      __Pyx_GIVEREF(__pyx_tuple__3);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_9operators_21mannings_operator_ext_1manning_friction_flat, NULL, __pyx_n_s_anuga_operators_mannings_operato_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_manning_friction_flat, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(9, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_operators_mannings_operato, __pyx_n_s_manning_friction_flat, 14, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 14, __pyx_L1_error)

     15: 						double eps,\

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

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

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

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

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

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

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

     23:

     24: 	cdef int N

     25:

    +26: 	N = w.shape[0]

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

     27:

    +28: 	_manning_friction_flat(g, eps, N,\

      _manning_friction_flat(__pyx_v_g, __pyx_v_eps, __pyx_v_N, (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_w.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_z.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_z.diminfo[0].strides, __pyx_t_3, __pyx_pybuffernd_z.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_uh.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_uh.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_vh.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_vh.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_eta.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_eta.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmom.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_xmom.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymom.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ymom.diminfo[0].strides))));

    +29: 						&w[0],\

      __pyx_t_1 = 0;

    +30: 						&z[0,0],\

      __pyx_t_2 = 0;
      __pyx_t_3 = 0;

    +31: 						&uh[0],\

      __pyx_t_4 = 0;

    +32: 						&vh[0],\

      __pyx_t_5 = 0;

    +33: 						&eta[0],\

      __pyx_t_6 = 0;

    +34: 						&xmom[0],\

      __pyx_t_7 = 0;

    +35: 						&ymom[0])

      __pyx_t_8 = 0;

     36:

    +37: def manning_friction_sloped(double g,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_9operators_21mannings_operator_ext_3manning_friction_sloped(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_9operators_21mannings_operator_ext_3manning_friction_sloped = {"manning_friction_sloped", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_9operators_21mannings_operator_ext_3manning_friction_sloped, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_9operators_21mannings_operator_ext_3manning_friction_sloped(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      double __pyx_v_g;
      double __pyx_v_eps;
      PyArrayObject *__pyx_v_x = 0;
      PyArrayObject *__pyx_v_w = 0;
      PyArrayObject *__pyx_v_uh = 0;
      PyArrayObject *__pyx_v_vh = 0;
      PyArrayObject *__pyx_v_z = 0;
      PyArrayObject *__pyx_v_eta = 0;
      PyArrayObject *__pyx_v_xmom = 0;
      PyArrayObject *__pyx_v_ymom = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("manning_friction_sloped (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,&__pyx_n_s_eps,&__pyx_n_s_x,&__pyx_n_s_w,&__pyx_n_s_uh,&__pyx_n_s_vh,&__pyx_n_s_z,&__pyx_n_s_eta,&__pyx_n_s_xmom,&__pyx_n_s_ymom,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_g)) != 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_eps)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 1); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 2); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 3); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 4); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 5); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 6); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eta)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 7); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 8); __PYX_ERR(0, 37, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, 9); __PYX_ERR(0, 37, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manning_friction_sloped") < 0)) __PYX_ERR(0, 37, __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_g = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_g == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error)
        __pyx_v_eps = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error)
        __pyx_v_x = ((PyArrayObject *)values[2]);
        __pyx_v_w = ((PyArrayObject *)values[3]);
        __pyx_v_uh = ((PyArrayObject *)values[4]);
        __pyx_v_vh = ((PyArrayObject *)values[5]);
        __pyx_v_z = ((PyArrayObject *)values[6]);
        __pyx_v_eta = ((PyArrayObject *)values[7]);
        __pyx_v_xmom = ((PyArrayObject *)values[8]);
        __pyx_v_ymom = ((PyArrayObject *)values[9]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("manning_friction_sloped", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 37, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.operators.mannings_operator_ext.manning_friction_sloped", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 0, "x", 0))) __PYX_ERR(0, 39, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 0, "w", 0))) __PYX_ERR(0, 40, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_uh), __pyx_ptype_5numpy_ndarray, 0, "uh", 0))) __PYX_ERR(0, 41, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vh), __pyx_ptype_5numpy_ndarray, 0, "vh", 0))) __PYX_ERR(0, 42, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 0, "z", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eta), __pyx_ptype_5numpy_ndarray, 0, "eta", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom), __pyx_ptype_5numpy_ndarray, 0, "xmom", 0))) __PYX_ERR(0, 45, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom), __pyx_ptype_5numpy_ndarray, 0, "ymom", 0))) __PYX_ERR(0, 46, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_9operators_21mannings_operator_ext_2manning_friction_sloped(__pyx_self, __pyx_v_g, __pyx_v_eps, __pyx_v_x, __pyx_v_w, __pyx_v_uh, __pyx_v_vh, __pyx_v_z, __pyx_v_eta, __pyx_v_xmom, __pyx_v_ymom);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_9operators_21mannings_operator_ext_2manning_friction_sloped(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_g, double __pyx_v_eps, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_uh, PyArrayObject *__pyx_v_vh, PyArrayObject *__pyx_v_z, PyArrayObject *__pyx_v_eta, PyArrayObject *__pyx_v_xmom, PyArrayObject *__pyx_v_ymom) {
      int __pyx_v_N;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_eta;
      __Pyx_Buffer __pyx_pybuffer_eta;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_uh;
      __Pyx_Buffer __pyx_pybuffer_uh;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_vh;
      __Pyx_Buffer __pyx_pybuffer_vh;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
      __Pyx_Buffer __pyx_pybuffer_w;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
      __Pyx_Buffer __pyx_pybuffer_x;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom;
      __Pyx_Buffer __pyx_pybuffer_xmom;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom;
      __Pyx_Buffer __pyx_pybuffer_ymom;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_z;
      __Pyx_Buffer __pyx_pybuffer_z;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("manning_friction_sloped", 0);
      __pyx_pybuffer_x.pybuffer.buf = NULL;
      __pyx_pybuffer_x.refcount = 0;
      __pyx_pybuffernd_x.data = NULL;
      __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
      __pyx_pybuffer_w.pybuffer.buf = NULL;
      __pyx_pybuffer_w.refcount = 0;
      __pyx_pybuffernd_w.data = NULL;
      __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
      __pyx_pybuffer_uh.pybuffer.buf = NULL;
      __pyx_pybuffer_uh.refcount = 0;
      __pyx_pybuffernd_uh.data = NULL;
      __pyx_pybuffernd_uh.rcbuffer = &__pyx_pybuffer_uh;
      __pyx_pybuffer_vh.pybuffer.buf = NULL;
      __pyx_pybuffer_vh.refcount = 0;
      __pyx_pybuffernd_vh.data = NULL;
      __pyx_pybuffernd_vh.rcbuffer = &__pyx_pybuffer_vh;
      __pyx_pybuffer_z.pybuffer.buf = NULL;
      __pyx_pybuffer_z.refcount = 0;
      __pyx_pybuffernd_z.data = NULL;
      __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;
      __pyx_pybuffer_eta.pybuffer.buf = NULL;
      __pyx_pybuffer_eta.refcount = 0;
      __pyx_pybuffernd_eta.data = NULL;
      __pyx_pybuffernd_eta.rcbuffer = &__pyx_pybuffer_eta;
      __pyx_pybuffer_xmom.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom.refcount = 0;
      __pyx_pybuffernd_xmom.data = NULL;
      __pyx_pybuffernd_xmom.rcbuffer = &__pyx_pybuffer_xmom;
      __pyx_pybuffer_ymom.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom.refcount = 0;
      __pyx_pybuffernd_ymom.data = NULL;
      __pyx_pybuffernd_ymom.rcbuffer = &__pyx_pybuffer_ymom;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_uh.rcbuffer->pybuffer, (PyObject*)__pyx_v_uh, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_uh.diminfo[0].strides = __pyx_pybuffernd_uh.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_uh.diminfo[0].shape = __pyx_pybuffernd_uh.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vh.rcbuffer->pybuffer, (PyObject*)__pyx_v_vh, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_vh.diminfo[0].strides = __pyx_pybuffernd_vh.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vh.diminfo[0].shape = __pyx_pybuffernd_vh.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_z.diminfo[1].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_z.diminfo[1].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_eta.rcbuffer->pybuffer, (PyObject*)__pyx_v_eta, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_eta.diminfo[0].strides = __pyx_pybuffernd_eta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_eta.diminfo[0].shape = __pyx_pybuffernd_eta.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom.diminfo[0].strides = __pyx_pybuffernd_xmom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom.diminfo[0].shape = __pyx_pybuffernd_xmom.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 37, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom.diminfo[0].strides = __pyx_pybuffernd_ymom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom.diminfo[0].shape = __pyx_pybuffernd_ymom.rcbuffer->pybuffer.shape[0];
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_eta.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_uh.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vh.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.operators.mannings_operator_ext.manning_friction_sloped", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_eta.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_uh.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vh.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__5 = PyTuple_Pack(11, __pyx_n_s_g, __pyx_n_s_eps, __pyx_n_s_x, __pyx_n_s_w, __pyx_n_s_uh, __pyx_n_s_vh, __pyx_n_s_z, __pyx_n_s_eta, __pyx_n_s_xmom, __pyx_n_s_ymom, __pyx_n_s_N); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 37, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__5);
      __Pyx_GIVEREF(__pyx_tuple__5);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_9operators_21mannings_operator_ext_3manning_friction_sloped, NULL, __pyx_n_s_anuga_operators_mannings_operato_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_manning_friction_sloped, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(10, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_operators_mannings_operato, __pyx_n_s_manning_friction_sloped, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 37, __pyx_L1_error)

     38: 							double eps,\

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

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

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

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

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

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

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

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

     47:

     48: 	cdef int N

     49:

    +50: 	N = w.shape[0]

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

     51:

    +52: 	_manning_friction_sloped(g, eps, N,\

      _manning_friction_sloped(__pyx_v_g, __pyx_v_eps, __pyx_v_N, (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_2, __pyx_pybuffernd_x.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_w.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_z.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_z.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_z.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_uh.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_uh.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_vh.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_vh.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_eta.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_eta.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmom.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_xmom.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymom.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ymom.diminfo[0].strides))));

    +53: 							&x[0,0],\

      __pyx_t_1 = 0;
      __pyx_t_2 = 0;

    +54: 							&w[0],\

      __pyx_t_3 = 0;

    +55: 							&z[0,0],\

      __pyx_t_4 = 0;
      __pyx_t_5 = 0;

    +56: 							&uh[0],\

      __pyx_t_6 = 0;

    +57: 							&vh[0],\

      __pyx_t_7 = 0;

    +58: 							&eta[0],\

      __pyx_t_8 = 0;

    +59: 							&xmom[0],\

      __pyx_t_9 = 0;

    +60: 							&ymom[0])

      __pyx_t_10 = 0;

     61:

    +62: def chezy_friction(double g,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_9operators_21mannings_operator_ext_5chezy_friction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_9operators_21mannings_operator_ext_5chezy_friction = {"chezy_friction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_9operators_21mannings_operator_ext_5chezy_friction, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_9operators_21mannings_operator_ext_5chezy_friction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      double __pyx_v_g;
      double __pyx_v_eps;
      PyArrayObject *__pyx_v_x = 0;
      PyArrayObject *__pyx_v_w = 0;
      PyArrayObject *__pyx_v_uh = 0;
      PyArrayObject *__pyx_v_vh = 0;
      PyArrayObject *__pyx_v_z = 0;
      PyArrayObject *__pyx_v_chezy = 0;
      PyArrayObject *__pyx_v_xmom = 0;
      PyArrayObject *__pyx_v_ymom = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("chezy_friction (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,&__pyx_n_s_eps,&__pyx_n_s_x,&__pyx_n_s_w,&__pyx_n_s_uh,&__pyx_n_s_vh,&__pyx_n_s_z,&__pyx_n_s_chezy,&__pyx_n_s_xmom,&__pyx_n_s_ymom,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_g)) != 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_eps)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 1); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 2); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 3); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 4); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 5); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 6); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chezy)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 7); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmom)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 8); __PYX_ERR(0, 62, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymom)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, 9); __PYX_ERR(0, 62, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chezy_friction") < 0)) __PYX_ERR(0, 62, __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_g = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_g == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error)
        __pyx_v_eps = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error)
        __pyx_v_x = ((PyArrayObject *)values[2]);
        __pyx_v_w = ((PyArrayObject *)values[3]);
        __pyx_v_uh = ((PyArrayObject *)values[4]);
        __pyx_v_vh = ((PyArrayObject *)values[5]);
        __pyx_v_z = ((PyArrayObject *)values[6]);
        __pyx_v_chezy = ((PyArrayObject *)values[7]);
        __pyx_v_xmom = ((PyArrayObject *)values[8]);
        __pyx_v_ymom = ((PyArrayObject *)values[9]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("chezy_friction", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 62, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.operators.mannings_operator_ext.chezy_friction", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 0, "x", 0))) __PYX_ERR(0, 64, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 0, "w", 0))) __PYX_ERR(0, 65, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_uh), __pyx_ptype_5numpy_ndarray, 0, "uh", 0))) __PYX_ERR(0, 66, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vh), __pyx_ptype_5numpy_ndarray, 0, "vh", 0))) __PYX_ERR(0, 67, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 0, "z", 0))) __PYX_ERR(0, 68, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chezy), __pyx_ptype_5numpy_ndarray, 0, "chezy", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom), __pyx_ptype_5numpy_ndarray, 0, "xmom", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom), __pyx_ptype_5numpy_ndarray, 0, "ymom", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_9operators_21mannings_operator_ext_4chezy_friction(__pyx_self, __pyx_v_g, __pyx_v_eps, __pyx_v_x, __pyx_v_w, __pyx_v_uh, __pyx_v_vh, __pyx_v_z, __pyx_v_chezy, __pyx_v_xmom, __pyx_v_ymom);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_9operators_21mannings_operator_ext_4chezy_friction(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_g, double __pyx_v_eps, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_uh, PyArrayObject *__pyx_v_vh, PyArrayObject *__pyx_v_z, PyArrayObject *__pyx_v_chezy, PyArrayObject *__pyx_v_xmom, PyArrayObject *__pyx_v_ymom) {
      int __pyx_v_N;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_chezy;
      __Pyx_Buffer __pyx_pybuffer_chezy;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_uh;
      __Pyx_Buffer __pyx_pybuffer_uh;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_vh;
      __Pyx_Buffer __pyx_pybuffer_vh;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
      __Pyx_Buffer __pyx_pybuffer_w;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
      __Pyx_Buffer __pyx_pybuffer_x;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_xmom;
      __Pyx_Buffer __pyx_pybuffer_xmom;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymom;
      __Pyx_Buffer __pyx_pybuffer_ymom;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_z;
      __Pyx_Buffer __pyx_pybuffer_z;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("chezy_friction", 0);
      __pyx_pybuffer_x.pybuffer.buf = NULL;
      __pyx_pybuffer_x.refcount = 0;
      __pyx_pybuffernd_x.data = NULL;
      __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
      __pyx_pybuffer_w.pybuffer.buf = NULL;
      __pyx_pybuffer_w.refcount = 0;
      __pyx_pybuffernd_w.data = NULL;
      __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
      __pyx_pybuffer_uh.pybuffer.buf = NULL;
      __pyx_pybuffer_uh.refcount = 0;
      __pyx_pybuffernd_uh.data = NULL;
      __pyx_pybuffernd_uh.rcbuffer = &__pyx_pybuffer_uh;
      __pyx_pybuffer_vh.pybuffer.buf = NULL;
      __pyx_pybuffer_vh.refcount = 0;
      __pyx_pybuffernd_vh.data = NULL;
      __pyx_pybuffernd_vh.rcbuffer = &__pyx_pybuffer_vh;
      __pyx_pybuffer_z.pybuffer.buf = NULL;
      __pyx_pybuffer_z.refcount = 0;
      __pyx_pybuffernd_z.data = NULL;
      __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;
      __pyx_pybuffer_chezy.pybuffer.buf = NULL;
      __pyx_pybuffer_chezy.refcount = 0;
      __pyx_pybuffernd_chezy.data = NULL;
      __pyx_pybuffernd_chezy.rcbuffer = &__pyx_pybuffer_chezy;
      __pyx_pybuffer_xmom.pybuffer.buf = NULL;
      __pyx_pybuffer_xmom.refcount = 0;
      __pyx_pybuffernd_xmom.data = NULL;
      __pyx_pybuffernd_xmom.rcbuffer = &__pyx_pybuffer_xmom;
      __pyx_pybuffer_ymom.pybuffer.buf = NULL;
      __pyx_pybuffer_ymom.refcount = 0;
      __pyx_pybuffernd_ymom.data = NULL;
      __pyx_pybuffernd_ymom.rcbuffer = &__pyx_pybuffer_ymom;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_uh.rcbuffer->pybuffer, (PyObject*)__pyx_v_uh, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_uh.diminfo[0].strides = __pyx_pybuffernd_uh.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_uh.diminfo[0].shape = __pyx_pybuffernd_uh.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vh.rcbuffer->pybuffer, (PyObject*)__pyx_v_vh, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_vh.diminfo[0].strides = __pyx_pybuffernd_vh.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vh.diminfo[0].shape = __pyx_pybuffernd_vh.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_z.diminfo[1].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_z.diminfo[1].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_chezy.rcbuffer->pybuffer, (PyObject*)__pyx_v_chezy, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_chezy.diminfo[0].strides = __pyx_pybuffernd_chezy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_chezy.diminfo[0].shape = __pyx_pybuffernd_chezy.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmom, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmom.diminfo[0].strides = __pyx_pybuffernd_xmom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmom.diminfo[0].shape = __pyx_pybuffernd_xmom.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymom, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymom.diminfo[0].strides = __pyx_pybuffernd_ymom.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymom.diminfo[0].shape = __pyx_pybuffernd_ymom.rcbuffer->pybuffer.shape[0];
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chezy.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_uh.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vh.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.operators.mannings_operator_ext.chezy_friction", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_chezy.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_uh.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vh.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmom.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymom.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_z.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__7 = PyTuple_Pack(11, __pyx_n_s_g, __pyx_n_s_eps, __pyx_n_s_x, __pyx_n_s_w, __pyx_n_s_uh, __pyx_n_s_vh, __pyx_n_s_z, __pyx_n_s_chezy, __pyx_n_s_xmom, __pyx_n_s_ymom, __pyx_n_s_N); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__7);
      __Pyx_GIVEREF(__pyx_tuple__7);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_9operators_21mannings_operator_ext_5chezy_friction, NULL, __pyx_n_s_anuga_operators_mannings_operato_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_chezy_friction, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     63: 							double eps,\

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

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

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

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

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

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

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

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

     72:

     73: 	cdef int N

     74:

    +75: 	N = w.shape[0]

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

     76:

    +77: 	_manning_friction_sloped(g, eps, N,\

      _manning_friction_sloped(__pyx_v_g, __pyx_v_eps, __pyx_v_N, (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_2, __pyx_pybuffernd_x.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_w.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_z.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_z.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_z.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_uh.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_uh.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_vh.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_vh.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_chezy.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_chezy.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmom.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_xmom.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymom.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ymom.diminfo[0].strides))));

    +78: 							&x[0,0],\

      __pyx_t_1 = 0;
      __pyx_t_2 = 0;

    +79: 							&w[0],\

      __pyx_t_3 = 0;

    +80: 							&z[0,0],\

      __pyx_t_4 = 0;
      __pyx_t_5 = 0;

    +81: 							&uh[0],\

      __pyx_t_6 = 0;

    +82: 							&vh[0],\

      __pyx_t_7 = 0;

    +83: 							&chezy[0],\

      __pyx_t_8 = 0;

    +84: 							&xmom[0],\

      __pyx_t_9 = 0;

    +85: 							&ymom[0])

      __pyx_t_10 = 0;