Cython: shallow_water_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: shallow_water_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 "shallow_water.c":

     009: 	struct domain:

     010: 		long number_of_elements

     011: 		double epsilon

     012: 		double H0

     013: 		double g

     014: 		long optimise_dry_cells

     015: 		double evolve_max_timestep

     016: 		long extrapolate_velocity_second_order

     017: 		double minimum_allowed_height

     018: 		double maximum_allowed_speed

     019: 		long low_froude

     020: 		long timestep_fluxcalls

     021: 		double beta_w

     022: 		double beta_w_dry

     023: 		double beta_uh

     024: 		double beta_uh_dry

     025: 		double beta_vh

     026: 		double beta_vh_dry

     027: 		long max_flux_update_frequency

     028: 		long ncol_riverwall_hydraulic_properties

     029: 		long* neighbours

     030: 		long* neighbour_edges

     031: 		long* surrogate_neighbours

     032: 		double* normals

     033: 		double* edgelengths

     034: 		double* radii

     035: 		double* areas

     036: 		long* edge_flux_type

     037: 		long* tri_full_flag

     038: 		long* already_computed_flux

     039: 		double* max_speed

     040: 		double* vertex_coordinates

     041: 		double* edge_coordinates

     042: 		double* centroid_coordinates

     043: 		long* number_of_boundaries

     044: 		double* stage_edge_values

     045: 		double* xmom_edge_values

     046: 		double* ymom_edge_values

     047: 		double* bed_edge_values

     048: 		double* height_edge_values

     049: 		double* stage_centroid_values

     050: 		double* xmom_centroid_values

     051: 		double* ymom_centroid_values

     052: 		double* bed_centroid_values

     053: 		double* height_centroid_values

     054: 		double* stage_vertex_values

     055: 		double* xmom_vertex_values

     056: 		double* ymom_vertex_values

     057: 		double* bed_vertex_values

     058: 		double* height_vertex_values

     059: 		double* stage_boundary_values

     060: 		double* xmom_boundary_values

     061: 		double* ymom_boundary_values

     062: 		double* bed_boundary_values

     063: 		double* stage_explicit_update

     064: 		double* xmom_explicit_update

     065: 		double* ymom_explicit_update

     066: 		long* flux_update_frequency

     067: 		long* update_next_flux

     068: 		long* update_extrapolation

     069: 		double* edge_timestep

     070: 		double* edge_flux_work

     071: 		double* pressuregrad_work

     072: 		double* x_centroid_work

     073: 		double* y_centroid_work

     074: 		double* boundary_flux_sum

     075: 		long* allow_timestep_increase

     076: 		double* riverwall_elevation

     077: 		long* riverwall_rowIndex

     078: 		double* riverwall_hydraulic_properties

     079: 	struct edge:

     080: 		pass

     081: 	int _rotate(double *q, double n1, double n2)

     082: 	int _flux_function_central(double* q_left, double* q_right, double z_left, double z_right, double n1, double n2, double epsilon, double h0, double limiting_threshold, double g, double* edgeflux, double* max_speed)

     083: 	int _extrapolate_second_order_sw(domain* D)

     084: 	double _compute_fluxes_central_structure(domain* D)

     085: 	int _gravity(domain* D)

     086: 	int _gravity_wb(domain* D)

     087: 	double _compute_fluxes_central_wb(domain* D)

     088: 	double _compute_fluxes_central_wb_3(domain* D)

     089: 	int _protect(int N, double minimum_allowed_height, double maximum_allowed_speed, double epsilon, double* wc, double* zc, double* xmomc, double* ymomc)

     090: 	int _balance_deep_and_shallow(int N, double* wc, double* zc, double* wv, double* zv, double* hvbar, double* xmomc, double* ymomc, double* xmomv, double* ymomv, double H0, int tight_slope_limiters, int use_centroid_velocities, double alpha_balance)

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

     092: 	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)

     093:

    +094: cdef inline get_python_domain(domain* D, object domain_object):

    static CYTHON_INLINE PyObject *__pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain(struct domain *__pyx_v_D, PyObject *__pyx_v_domain_object) {
      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_edge_flux_type = 0;
      PyArrayObject *__pyx_v_tri_full_flag = 0;
      PyArrayObject *__pyx_v_already_computed_flux = 0;
      PyArrayObject *__pyx_v_vertex_coordinates = 0;
      PyArrayObject *__pyx_v_edge_coordinates = 0;
      PyArrayObject *__pyx_v_centroid_coordinates = 0;
      PyArrayObject *__pyx_v_number_of_boundaries = 0;
      PyArrayObject *__pyx_v_surrogate_neighbours = 0;
      PyArrayObject *__pyx_v_max_speed = 0;
      PyArrayObject *__pyx_v_flux_update_frequency = 0;
      PyArrayObject *__pyx_v_update_next_flux = 0;
      PyArrayObject *__pyx_v_update_extrapolation = 0;
      PyArrayObject *__pyx_v_allow_timestep_increase = 0;
      PyArrayObject *__pyx_v_edge_timestep = 0;
      PyArrayObject *__pyx_v_edge_flux_work = 0;
      PyArrayObject *__pyx_v_pressuregrad_work = 0;
      PyArrayObject *__pyx_v_x_centroid_work = 0;
      PyArrayObject *__pyx_v_y_centroid_work = 0;
      PyArrayObject *__pyx_v_boundary_flux_sum = 0;
      PyArrayObject *__pyx_v_riverwall_elevation = 0;
      PyArrayObject *__pyx_v_riverwall_rowIndex = 0;
      PyArrayObject *__pyx_v_riverwall_hydraulic_properties = 0;
      PyArrayObject *__pyx_v_edge_values = 0;
      PyArrayObject *__pyx_v_centroid_values = 0;
      PyArrayObject *__pyx_v_vertex_values = 0;
      PyArrayObject *__pyx_v_boundary_values = 0;
      PyArrayObject *__pyx_v_explicit_update = 0;
      PyObject *__pyx_v_quantities = 0;
      PyObject *__pyx_v_riverwallData = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_allow_timestep_increase;
      __Pyx_Buffer __pyx_pybuffer_allow_timestep_increase;
      __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_boundary_flux_sum;
      __Pyx_Buffer __pyx_pybuffer_boundary_flux_sum;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_boundary_values;
      __Pyx_Buffer __pyx_pybuffer_boundary_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_centroid_coordinates;
      __Pyx_Buffer __pyx_pybuffer_centroid_coordinates;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_centroid_values;
      __Pyx_Buffer __pyx_pybuffer_centroid_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_coordinates;
      __Pyx_Buffer __pyx_pybuffer_edge_coordinates;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_flux_type;
      __Pyx_Buffer __pyx_pybuffer_edge_flux_type;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_flux_work;
      __Pyx_Buffer __pyx_pybuffer_edge_flux_work;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_timestep;
      __Pyx_Buffer __pyx_pybuffer_edge_timestep;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edge_values;
      __Pyx_Buffer __pyx_pybuffer_edge_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edgelengths;
      __Pyx_Buffer __pyx_pybuffer_edgelengths;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_explicit_update;
      __Pyx_Buffer __pyx_pybuffer_explicit_update;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_flux_update_frequency;
      __Pyx_Buffer __pyx_pybuffer_flux_update_frequency;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_max_speed;
      __Pyx_Buffer __pyx_pybuffer_max_speed;
      __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_number_of_boundaries;
      __Pyx_Buffer __pyx_pybuffer_number_of_boundaries;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_pressuregrad_work;
      __Pyx_Buffer __pyx_pybuffer_pressuregrad_work;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_radii;
      __Pyx_Buffer __pyx_pybuffer_radii;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_riverwall_elevation;
      __Pyx_Buffer __pyx_pybuffer_riverwall_elevation;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_riverwall_hydraulic_properties;
      __Pyx_Buffer __pyx_pybuffer_riverwall_hydraulic_properties;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_riverwall_rowIndex;
      __Pyx_Buffer __pyx_pybuffer_riverwall_rowIndex;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_surrogate_neighbours;
      __Pyx_Buffer __pyx_pybuffer_surrogate_neighbours;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_tri_full_flag;
      __Pyx_Buffer __pyx_pybuffer_tri_full_flag;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_update_extrapolation;
      __Pyx_Buffer __pyx_pybuffer_update_extrapolation;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_update_next_flux;
      __Pyx_Buffer __pyx_pybuffer_update_next_flux;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_vertex_coordinates;
      __Pyx_Buffer __pyx_pybuffer_vertex_coordinates;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_vertex_values;
      __Pyx_Buffer __pyx_pybuffer_vertex_values;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_x_centroid_work;
      __Pyx_Buffer __pyx_pybuffer_x_centroid_work;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_y_centroid_work;
      __Pyx_Buffer __pyx_pybuffer_y_centroid_work;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("get_python_domain", 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_edge_flux_type.pybuffer.buf = NULL;
      __pyx_pybuffer_edge_flux_type.refcount = 0;
      __pyx_pybuffernd_edge_flux_type.data = NULL;
      __pyx_pybuffernd_edge_flux_type.rcbuffer = &__pyx_pybuffer_edge_flux_type;
      __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_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_vertex_coordinates.pybuffer.buf = NULL;
      __pyx_pybuffer_vertex_coordinates.refcount = 0;
      __pyx_pybuffernd_vertex_coordinates.data = NULL;
      __pyx_pybuffernd_vertex_coordinates.rcbuffer = &__pyx_pybuffer_vertex_coordinates;
      __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_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_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_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_max_speed.pybuffer.buf = NULL;
      __pyx_pybuffer_max_speed.refcount = 0;
      __pyx_pybuffernd_max_speed.data = NULL;
      __pyx_pybuffernd_max_speed.rcbuffer = &__pyx_pybuffer_max_speed;
      __pyx_pybuffer_flux_update_frequency.pybuffer.buf = NULL;
      __pyx_pybuffer_flux_update_frequency.refcount = 0;
      __pyx_pybuffernd_flux_update_frequency.data = NULL;
      __pyx_pybuffernd_flux_update_frequency.rcbuffer = &__pyx_pybuffer_flux_update_frequency;
      __pyx_pybuffer_update_next_flux.pybuffer.buf = NULL;
      __pyx_pybuffer_update_next_flux.refcount = 0;
      __pyx_pybuffernd_update_next_flux.data = NULL;
      __pyx_pybuffernd_update_next_flux.rcbuffer = &__pyx_pybuffer_update_next_flux;
      __pyx_pybuffer_update_extrapolation.pybuffer.buf = NULL;
      __pyx_pybuffer_update_extrapolation.refcount = 0;
      __pyx_pybuffernd_update_extrapolation.data = NULL;
      __pyx_pybuffernd_update_extrapolation.rcbuffer = &__pyx_pybuffer_update_extrapolation;
      __pyx_pybuffer_allow_timestep_increase.pybuffer.buf = NULL;
      __pyx_pybuffer_allow_timestep_increase.refcount = 0;
      __pyx_pybuffernd_allow_timestep_increase.data = NULL;
      __pyx_pybuffernd_allow_timestep_increase.rcbuffer = &__pyx_pybuffer_allow_timestep_increase;
      __pyx_pybuffer_edge_timestep.pybuffer.buf = NULL;
      __pyx_pybuffer_edge_timestep.refcount = 0;
      __pyx_pybuffernd_edge_timestep.data = NULL;
      __pyx_pybuffernd_edge_timestep.rcbuffer = &__pyx_pybuffer_edge_timestep;
      __pyx_pybuffer_edge_flux_work.pybuffer.buf = NULL;
      __pyx_pybuffer_edge_flux_work.refcount = 0;
      __pyx_pybuffernd_edge_flux_work.data = NULL;
      __pyx_pybuffernd_edge_flux_work.rcbuffer = &__pyx_pybuffer_edge_flux_work;
      __pyx_pybuffer_pressuregrad_work.pybuffer.buf = NULL;
      __pyx_pybuffer_pressuregrad_work.refcount = 0;
      __pyx_pybuffernd_pressuregrad_work.data = NULL;
      __pyx_pybuffernd_pressuregrad_work.rcbuffer = &__pyx_pybuffer_pressuregrad_work;
      __pyx_pybuffer_x_centroid_work.pybuffer.buf = NULL;
      __pyx_pybuffer_x_centroid_work.refcount = 0;
      __pyx_pybuffernd_x_centroid_work.data = NULL;
      __pyx_pybuffernd_x_centroid_work.rcbuffer = &__pyx_pybuffer_x_centroid_work;
      __pyx_pybuffer_y_centroid_work.pybuffer.buf = NULL;
      __pyx_pybuffer_y_centroid_work.refcount = 0;
      __pyx_pybuffernd_y_centroid_work.data = NULL;
      __pyx_pybuffernd_y_centroid_work.rcbuffer = &__pyx_pybuffer_y_centroid_work;
      __pyx_pybuffer_boundary_flux_sum.pybuffer.buf = NULL;
      __pyx_pybuffer_boundary_flux_sum.refcount = 0;
      __pyx_pybuffernd_boundary_flux_sum.data = NULL;
      __pyx_pybuffernd_boundary_flux_sum.rcbuffer = &__pyx_pybuffer_boundary_flux_sum;
      __pyx_pybuffer_riverwall_elevation.pybuffer.buf = NULL;
      __pyx_pybuffer_riverwall_elevation.refcount = 0;
      __pyx_pybuffernd_riverwall_elevation.data = NULL;
      __pyx_pybuffernd_riverwall_elevation.rcbuffer = &__pyx_pybuffer_riverwall_elevation;
      __pyx_pybuffer_riverwall_rowIndex.pybuffer.buf = NULL;
      __pyx_pybuffer_riverwall_rowIndex.refcount = 0;
      __pyx_pybuffernd_riverwall_rowIndex.data = NULL;
      __pyx_pybuffernd_riverwall_rowIndex.rcbuffer = &__pyx_pybuffer_riverwall_rowIndex;
      __pyx_pybuffer_riverwall_hydraulic_properties.pybuffer.buf = NULL;
      __pyx_pybuffer_riverwall_hydraulic_properties.refcount = 0;
      __pyx_pybuffernd_riverwall_hydraulic_properties.data = NULL;
      __pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer = &__pyx_pybuffer_riverwall_hydraulic_properties;
      __pyx_pybuffer_edge_values.pybuffer.buf = NULL;
      __pyx_pybuffer_edge_values.refcount = 0;
      __pyx_pybuffernd_edge_values.data = NULL;
      __pyx_pybuffernd_edge_values.rcbuffer = &__pyx_pybuffer_edge_values;
      __pyx_pybuffer_centroid_values.pybuffer.buf = NULL;
      __pyx_pybuffer_centroid_values.refcount = 0;
      __pyx_pybuffernd_centroid_values.data = NULL;
      __pyx_pybuffernd_centroid_values.rcbuffer = &__pyx_pybuffer_centroid_values;
      __pyx_pybuffer_vertex_values.pybuffer.buf = NULL;
      __pyx_pybuffer_vertex_values.refcount = 0;
      __pyx_pybuffernd_vertex_values.data = NULL;
      __pyx_pybuffernd_vertex_values.rcbuffer = &__pyx_pybuffer_vertex_values;
      __pyx_pybuffer_boundary_values.pybuffer.buf = NULL;
      __pyx_pybuffer_boundary_values.refcount = 0;
      __pyx_pybuffernd_boundary_values.data = NULL;
      __pyx_pybuffernd_boundary_values.rcbuffer = &__pyx_pybuffer_boundary_values;
      __pyx_pybuffer_explicit_update.pybuffer.buf = NULL;
      __pyx_pybuffer_explicit_update.refcount = 0;
      __pyx_pybuffernd_explicit_update.data = NULL;
      __pyx_pybuffernd_explicit_update.rcbuffer = &__pyx_pybuffer_explicit_update;
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_35);
      { 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_allow_timestep_increase.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areas.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_speed.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_number_of_boundaries.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_radii.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.get_python_domain", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areas.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_speed.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_number_of_boundaries.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_radii.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_neighbours);
      __Pyx_XDECREF((PyObject *)__pyx_v_neighbour_edges);
      __Pyx_XDECREF((PyObject *)__pyx_v_normals);
      __Pyx_XDECREF((PyObject *)__pyx_v_edgelengths);
      __Pyx_XDECREF((PyObject *)__pyx_v_radii);
      __Pyx_XDECREF((PyObject *)__pyx_v_areas);
      __Pyx_XDECREF((PyObject *)__pyx_v_edge_flux_type);
      __Pyx_XDECREF((PyObject *)__pyx_v_tri_full_flag);
      __Pyx_XDECREF((PyObject *)__pyx_v_already_computed_flux);
      __Pyx_XDECREF((PyObject *)__pyx_v_vertex_coordinates);
      __Pyx_XDECREF((PyObject *)__pyx_v_edge_coordinates);
      __Pyx_XDECREF((PyObject *)__pyx_v_centroid_coordinates);
      __Pyx_XDECREF((PyObject *)__pyx_v_number_of_boundaries);
      __Pyx_XDECREF((PyObject *)__pyx_v_surrogate_neighbours);
      __Pyx_XDECREF((PyObject *)__pyx_v_max_speed);
      __Pyx_XDECREF((PyObject *)__pyx_v_flux_update_frequency);
      __Pyx_XDECREF((PyObject *)__pyx_v_update_next_flux);
      __Pyx_XDECREF((PyObject *)__pyx_v_update_extrapolation);
      __Pyx_XDECREF((PyObject *)__pyx_v_allow_timestep_increase);
      __Pyx_XDECREF((PyObject *)__pyx_v_edge_timestep);
      __Pyx_XDECREF((PyObject *)__pyx_v_edge_flux_work);
      __Pyx_XDECREF((PyObject *)__pyx_v_pressuregrad_work);
      __Pyx_XDECREF((PyObject *)__pyx_v_x_centroid_work);
      __Pyx_XDECREF((PyObject *)__pyx_v_y_centroid_work);
      __Pyx_XDECREF((PyObject *)__pyx_v_boundary_flux_sum);
      __Pyx_XDECREF((PyObject *)__pyx_v_riverwall_elevation);
      __Pyx_XDECREF((PyObject *)__pyx_v_riverwall_rowIndex);
      __Pyx_XDECREF((PyObject *)__pyx_v_riverwall_hydraulic_properties);
      __Pyx_XDECREF((PyObject *)__pyx_v_edge_values);
      __Pyx_XDECREF((PyObject *)__pyx_v_centroid_values);
      __Pyx_XDECREF((PyObject *)__pyx_v_vertex_values);
      __Pyx_XDECREF((PyObject *)__pyx_v_boundary_values);
      __Pyx_XDECREF((PyObject *)__pyx_v_explicit_update);
      __Pyx_XDECREF(__pyx_v_quantities);
      __Pyx_XDECREF(__pyx_v_riverwallData);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     095:

     096: 	cdef np.ndarray[long, ndim=2, mode="c"] neighbours

     097: 	cdef np.ndarray[long, ndim=2, mode="c"] neighbour_edges

     098: 	cdef np.ndarray[double, ndim=2, mode="c"] normals

     099: 	cdef np.ndarray[double, ndim=2, mode="c"] edgelengths

     100: 	cdef np.ndarray[double, ndim=1, mode="c"] radii

     101: 	cdef np.ndarray[double, ndim=1, mode="c"] areas

     102: 	cdef np.ndarray[long, ndim=1, mode="c"] edge_flux_type

     103: 	cdef np.ndarray[long, ndim=1, mode="c"] tri_full_flag

     104: 	cdef np.ndarray[long, ndim=2, mode="c"] already_computed_flux

     105: 	cdef np.ndarray[double, ndim=2, mode="c"] vertex_coordinates

     106: 	cdef np.ndarray[double, ndim=2, mode="c"] edge_coordinates

     107: 	cdef np.ndarray[double, ndim=2, mode="c"] centroid_coordinates

     108: 	cdef np.ndarray[long, ndim=1, mode="c"] number_of_boundaries

     109: 	cdef np.ndarray[long, ndim=2, mode="c"] surrogate_neighbours

     110: 	cdef np.ndarray[double, ndim=1, mode="c"] max_speed

     111: 	cdef np.ndarray[long, ndim=1, mode="c"] flux_update_frequency

     112: 	cdef np.ndarray[long, ndim=1, mode="c"] update_next_flux

     113: 	cdef np.ndarray[long, ndim=1, mode="c"] update_extrapolation

     114: 	cdef np.ndarray[long, ndim=1, mode="c"] allow_timestep_increase

     115: 	cdef np.ndarray[double, ndim=1, mode="c"] edge_timestep

     116: 	cdef np.ndarray[double, ndim=1, mode="c"] edge_flux_work

     117: 	cdef np.ndarray[double, ndim=1, mode="c"] pressuregrad_work

     118: 	cdef np.ndarray[double, ndim=1, mode="c"] x_centroid_work

     119: 	cdef np.ndarray[double, ndim=1, mode="c"] y_centroid_work

     120: 	cdef np.ndarray[double, ndim=1, mode="c"] boundary_flux_sum

     121: 	cdef np.ndarray[double, ndim=1, mode="c"] riverwall_elevation

     122: 	cdef np.ndarray[long, ndim=1, mode="c"] riverwall_rowIndex

     123: 	cdef np.ndarray[double, ndim=2, mode="c"] riverwall_hydraulic_properties

     124:

     125: 	cdef np.ndarray[double, ndim=2, mode="c"] edge_values

     126: 	cdef np.ndarray[double, ndim=1, mode="c"] centroid_values

     127: 	cdef np.ndarray[double, ndim=2, mode="c"] vertex_values

     128: 	cdef np.ndarray[double, ndim=1, mode="c"] boundary_values

     129: 	cdef np.ndarray[double, ndim=1, mode="c"] explicit_update

     130:

     131: 	cdef object quantities

     132: 	cdef object riverwallData

     133:

    +134: 	D.number_of_elements = domain_object.number_of_elements

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_number_of_elements); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->number_of_elements = __pyx_t_2;

    +135: 	D.epsilon = domain_object.epsilon

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_epsilon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->epsilon = __pyx_t_3;

    +136: 	D.H0 = domain_object.H0

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_H0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->H0 = __pyx_t_3;

    +137: 	D.g = domain_object.g

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_g); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->g = __pyx_t_3;

    +138: 	D.optimise_dry_cells = domain_object.optimise_dry_cells

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_optimise_dry_cells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->optimise_dry_cells = __pyx_t_2;

    +139: 	D.evolve_max_timestep = domain_object.evolve_max_timestep

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_evolve_max_timestep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->evolve_max_timestep = __pyx_t_3;

    +140: 	D.minimum_allowed_height = domain_object.minimum_allowed_height

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_minimum_allowed_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->minimum_allowed_height = __pyx_t_3;

    +141: 	D.maximum_allowed_speed = domain_object.maximum_allowed_speed

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_maximum_allowed_speed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->maximum_allowed_speed = __pyx_t_3;

    +142: 	D.timestep_fluxcalls = domain_object.timestep_fluxcalls

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_timestep_fluxcalls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->timestep_fluxcalls = __pyx_t_2;

    +143: 	D.low_froude = domain_object.low_froude

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_low_froude); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->low_froude = __pyx_t_2;

    +144: 	D.extrapolate_velocity_second_order = domain_object.extrapolate_velocity_second_order

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_extrapolate_velocity_second_orde); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->extrapolate_velocity_second_order = __pyx_t_2;

    +145: 	D.beta_w = domain_object.beta_w

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_beta_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->beta_w = __pyx_t_3;

    +146: 	D.beta_w_dry = domain_object.beta_w_dry

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_beta_w_dry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->beta_w_dry = __pyx_t_3;

    +147: 	D.beta_uh = domain_object.beta_uh

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_beta_uh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->beta_uh = __pyx_t_3;

    +148: 	D.beta_uh_dry = domain_object.beta_uh_dry

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_beta_uh_dry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->beta_uh_dry = __pyx_t_3;

    +149: 	D.beta_vh = domain_object.beta_vh

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_beta_vh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->beta_vh = __pyx_t_3;

    +150: 	D.beta_vh_dry = domain_object.beta_vh_dry

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_beta_vh_dry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->beta_vh_dry = __pyx_t_3;

    +151: 	D.max_flux_update_frequency = domain_object.max_flux_update_frequency

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_max_flux_update_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->max_flux_update_frequency = __pyx_t_2;

     152:

    +153: 	neighbours = domain_object.neighbours

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_neighbours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 153, __pyx_L1_error)
      __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbours.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighbours, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_neighbours.diminfo[0].strides = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbours.diminfo[0].shape = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_neighbours.diminfo[1].strides = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_neighbours.diminfo[1].shape = __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 153, __pyx_L1_error)
      }
      __pyx_t_4 = 0;
      __pyx_v_neighbours = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +154: 	D.neighbours = &neighbours[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->neighbours = (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_neighbours.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_neighbours.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_neighbours.diminfo[1].strides)));

     155:

    +156: 	surrogate_neighbours = domain_object.surrogate_neighbours

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_surrogate_neighbours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 156, __pyx_L1_error)
      __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          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)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
      }
      __pyx_t_11 = 0;
      __pyx_v_surrogate_neighbours = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +157: 	D.surrogate_neighbours = &surrogate_neighbours[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->surrogate_neighbours = (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_surrogate_neighbours.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_surrogate_neighbours.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_surrogate_neighbours.diminfo[1].strides)));

     158:

    +159: 	neighbour_edges = domain_object.neighbour_edges

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_neighbour_edges); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 159, __pyx_L1_error)
      __pyx_t_12 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          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)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 159, __pyx_L1_error)
      }
      __pyx_t_12 = 0;
      __pyx_v_neighbour_edges = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +160: 	D.neighbour_edges = &neighbour_edges[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->neighbour_edges = (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_neighbour_edges.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_neighbour_edges.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_neighbour_edges.diminfo[1].strides)));

     161:

    +162: 	normals = domain_object.normals

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_normals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 162, __pyx_L1_error)
      __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normals.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normals.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          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)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 162, __pyx_L1_error)
      }
      __pyx_t_13 = 0;
      __pyx_v_normals = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +163: 	D.normals = &normals[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->normals = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_normals.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_normals.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_normals.diminfo[1].strides)));

     164:

    +165: 	edgelengths = domain_object.edgelengths

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_edgelengths); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 165, __pyx_L1_error)
      __pyx_t_14 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgelengths.rcbuffer->pybuffer, (PyObject*)__pyx_v_edgelengths, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_edgelengths.diminfo[0].strides = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edgelengths.diminfo[0].shape = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edgelengths.diminfo[1].strides = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edgelengths.diminfo[1].shape = __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 165, __pyx_L1_error)
      }
      __pyx_t_14 = 0;
      __pyx_v_edgelengths = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +166: 	D.edgelengths = &edgelengths[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->edgelengths = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edgelengths.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_edgelengths.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_edgelengths.diminfo[1].strides)));

     167:

    +168: 	radii = domain_object.radii

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_radii); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 168, __pyx_L1_error)
      __pyx_t_15 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_radii.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_radii.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          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)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
      }
      __pyx_t_15 = 0;
      __pyx_v_radii = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +169: 	D.radii = &radii[0]

      __pyx_t_10 = 0;
      __pyx_v_D->radii = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_radii.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_radii.diminfo[0].strides)));

     170:

    +171: 	areas = domain_object.areas

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_areas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 171, __pyx_L1_error)
      __pyx_t_16 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_areas.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_areas.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          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)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 171, __pyx_L1_error)
      }
      __pyx_t_16 = 0;
      __pyx_v_areas = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +172: 	D.areas = &areas[0]

      __pyx_t_10 = 0;
      __pyx_v_D->areas = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_areas.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_areas.diminfo[0].strides)));

     173:

    +174: 	edge_flux_type = domain_object.edge_flux_type

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_edge_flux_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 174, __pyx_L1_error)
      __pyx_t_17 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_flux_type, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_edge_flux_type.diminfo[0].strides = __pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_flux_type.diminfo[0].shape = __pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 174, __pyx_L1_error)
      }
      __pyx_t_17 = 0;
      __pyx_v_edge_flux_type = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +175: 	D.edge_flux_type = &edge_flux_type[0]

      __pyx_t_10 = 0;
      __pyx_v_D->edge_flux_type = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_edge_flux_type.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_flux_type.diminfo[0].strides)));

     176:

    +177: 	tri_full_flag = domain_object.tri_full_flag

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_tri_full_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 177, __pyx_L1_error)
      __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          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)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 177, __pyx_L1_error)
      }
      __pyx_t_18 = 0;
      __pyx_v_tri_full_flag = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +178: 	D.tri_full_flag = &tri_full_flag[0]

      __pyx_t_10 = 0;
      __pyx_v_D->tri_full_flag = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_tri_full_flag.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_tri_full_flag.diminfo[0].strides)));

     179:

    +180: 	already_computed_flux = domain_object.already_computed_flux

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_already_computed_flux); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 180, __pyx_L1_error)
      __pyx_t_19 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          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)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
      }
      __pyx_t_19 = 0;
      __pyx_v_already_computed_flux = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +181: 	D.already_computed_flux = &already_computed_flux[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->already_computed_flux = (&(*__Pyx_BufPtrCContig2d(long *, __pyx_pybuffernd_already_computed_flux.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_already_computed_flux.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_already_computed_flux.diminfo[1].strides)));

     182:

    +183: 	vertex_coordinates = domain_object.vertex_coordinates

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_vertex_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 183, __pyx_L1_error)
      __pyx_t_20 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_coordinates, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_vertex_coordinates.diminfo[0].strides = __pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_coordinates.diminfo[0].shape = __pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertex_coordinates.diminfo[1].strides = __pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertex_coordinates.diminfo[1].shape = __pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
      }
      __pyx_t_20 = 0;
      __pyx_v_vertex_coordinates = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +184: 	D.vertex_coordinates = &vertex_coordinates[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->vertex_coordinates = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_vertex_coordinates.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_vertex_coordinates.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_vertex_coordinates.diminfo[1].strides)));

     185:

    +186: 	edge_coordinates = domain_object.edge_coordinates

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_edge_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 186, __pyx_L1_error)
      __pyx_t_21 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          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)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
      }
      __pyx_t_21 = 0;
      __pyx_v_edge_coordinates = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +187: 	D.edge_coordinates = &edge_coordinates[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->edge_coordinates = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_coordinates.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_coordinates.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_edge_coordinates.diminfo[1].strides)));

     188:

    +189: 	centroid_coordinates = domain_object.centroid_coordinates

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_centroid_coordinates); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 189, __pyx_L1_error)
      __pyx_t_22 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_coordinates, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_centroid_coordinates.diminfo[0].strides = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_coordinates.diminfo[0].shape = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centroid_coordinates.diminfo[1].strides = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centroid_coordinates.diminfo[1].shape = __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
      }
      __pyx_t_22 = 0;
      __pyx_v_centroid_coordinates = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +190: 	D.centroid_coordinates = &centroid_coordinates[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->centroid_coordinates = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_centroid_coordinates.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_centroid_coordinates.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_centroid_coordinates.diminfo[1].strides)));

     191:

    +192: 	max_speed = domain_object.max_speed

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_max_speed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 192, __pyx_L1_error)
      __pyx_t_23 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_speed.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_speed.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_speed.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_speed, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_max_speed.diminfo[0].strides = __pyx_pybuffernd_max_speed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_speed.diminfo[0].shape = __pyx_pybuffernd_max_speed.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
      }
      __pyx_t_23 = 0;
      __pyx_v_max_speed = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +193: 	D.max_speed = &max_speed[0]

      __pyx_t_10 = 0;
      __pyx_v_D->max_speed = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_max_speed.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_max_speed.diminfo[0].strides)));

     194:

    +195: 	number_of_boundaries = domain_object.number_of_boundaries

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_number_of_boundaries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 195, __pyx_L1_error)
      __pyx_t_24 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          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)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __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];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 195, __pyx_L1_error)
      }
      __pyx_t_24 = 0;
      __pyx_v_number_of_boundaries = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +196: 	D.number_of_boundaries = &number_of_boundaries[0]

      __pyx_t_10 = 0;
      __pyx_v_D->number_of_boundaries = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_number_of_boundaries.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_number_of_boundaries.diminfo[0].strides)));

     197:

    +198: 	flux_update_frequency = domain_object.flux_update_frequency

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_flux_update_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 198, __pyx_L1_error)
      __pyx_t_25 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux_update_frequency, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_flux_update_frequency.diminfo[0].strides = __pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux_update_frequency.diminfo[0].shape = __pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 198, __pyx_L1_error)
      }
      __pyx_t_25 = 0;
      __pyx_v_flux_update_frequency = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +199: 	D.flux_update_frequency = &flux_update_frequency[0]

      __pyx_t_10 = 0;
      __pyx_v_D->flux_update_frequency = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_flux_update_frequency.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_flux_update_frequency.diminfo[0].strides)));

     200:

    +201: 	update_next_flux = domain_object.update_next_flux

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_update_next_flux); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 201, __pyx_L1_error)
      __pyx_t_26 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_update_next_flux, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_update_next_flux.diminfo[0].strides = __pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_update_next_flux.diminfo[0].shape = __pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 201, __pyx_L1_error)
      }
      __pyx_t_26 = 0;
      __pyx_v_update_next_flux = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +202: 	D.update_next_flux = &update_next_flux[0]

      __pyx_t_10 = 0;
      __pyx_v_D->update_next_flux = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_update_next_flux.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_update_next_flux.diminfo[0].strides)));

     203:

    +204: 	update_extrapolation = domain_object.update_extrapolation

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_update_extrapolation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 204, __pyx_L1_error)
      __pyx_t_27 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer, (PyObject*)__pyx_v_update_extrapolation, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_update_extrapolation.diminfo[0].strides = __pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_update_extrapolation.diminfo[0].shape = __pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
      }
      __pyx_t_27 = 0;
      __pyx_v_update_extrapolation = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +205: 	D.update_extrapolation = &update_extrapolation[0]

      __pyx_t_10 = 0;
      __pyx_v_D->update_extrapolation = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_update_extrapolation.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_update_extrapolation.diminfo[0].strides)));

     206:

    +207: 	allow_timestep_increase = domain_object.allow_timestep_increase

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_allow_timestep_increase); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 207, __pyx_L1_error)
      __pyx_t_28 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer, (PyObject*)__pyx_t_28, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer, (PyObject*)__pyx_v_allow_timestep_increase, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_allow_timestep_increase.diminfo[0].strides = __pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_allow_timestep_increase.diminfo[0].shape = __pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
      }
      __pyx_t_28 = 0;
      __pyx_v_allow_timestep_increase = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +208: 	D.allow_timestep_increase = &allow_timestep_increase[0]

      __pyx_t_10 = 0;
      __pyx_v_D->allow_timestep_increase = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_allow_timestep_increase.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_allow_timestep_increase.diminfo[0].strides)));

     209:

    +210: 	edge_timestep = domain_object.edge_timestep

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_edge_timestep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 210, __pyx_L1_error)
      __pyx_t_29 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer, (PyObject*)__pyx_t_29, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_timestep, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_edge_timestep.diminfo[0].strides = __pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_timestep.diminfo[0].shape = __pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
      }
      __pyx_t_29 = 0;
      __pyx_v_edge_timestep = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +211: 	D.edge_timestep = &edge_timestep[0]

      __pyx_t_10 = 0;
      __pyx_v_D->edge_timestep = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_edge_timestep.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_timestep.diminfo[0].strides)));

     212:

    +213: 	edge_flux_work = domain_object.edge_flux_work

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_edge_flux_work); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 213, __pyx_L1_error)
      __pyx_t_30 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer, (PyObject*)__pyx_t_30, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_flux_work, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_edge_flux_work.diminfo[0].strides = __pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_flux_work.diminfo[0].shape = __pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
      }
      __pyx_t_30 = 0;
      __pyx_v_edge_flux_work = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +214: 	D.edge_flux_work = &edge_flux_work[0]

      __pyx_t_10 = 0;
      __pyx_v_D->edge_flux_work = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_edge_flux_work.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_flux_work.diminfo[0].strides)));

     215:

    +216: 	pressuregrad_work = domain_object.pressuregrad_work

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_pressuregrad_work); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 216, __pyx_L1_error)
      __pyx_t_31 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer, (PyObject*)__pyx_t_31, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer, (PyObject*)__pyx_v_pressuregrad_work, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_pressuregrad_work.diminfo[0].strides = __pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pressuregrad_work.diminfo[0].shape = __pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 216, __pyx_L1_error)
      }
      __pyx_t_31 = 0;
      __pyx_v_pressuregrad_work = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +217: 	D.pressuregrad_work = &pressuregrad_work[0]

      __pyx_t_10 = 0;
      __pyx_v_D->pressuregrad_work = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_pressuregrad_work.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_pressuregrad_work.diminfo[0].strides)));

     218:

    +219: 	x_centroid_work = domain_object.x_centroid_work

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_x_centroid_work); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 219, __pyx_L1_error)
      __pyx_t_32 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer, (PyObject*)__pyx_t_32, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_centroid_work, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_x_centroid_work.diminfo[0].strides = __pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_centroid_work.diminfo[0].shape = __pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
      }
      __pyx_t_32 = 0;
      __pyx_v_x_centroid_work = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +220: 	D.x_centroid_work = &x_centroid_work[0]

      __pyx_t_10 = 0;
      __pyx_v_D->x_centroid_work = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_x_centroid_work.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x_centroid_work.diminfo[0].strides)));

     221:

    +222: 	y_centroid_work = domain_object.y_centroid_work

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_y_centroid_work); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 222, __pyx_L1_error)
      __pyx_t_33 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer, (PyObject*)__pyx_v_y_centroid_work, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_y_centroid_work.diminfo[0].strides = __pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y_centroid_work.diminfo[0].shape = __pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
      }
      __pyx_t_33 = 0;
      __pyx_v_y_centroid_work = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +223: 	D.y_centroid_work = &y_centroid_work[0]

      __pyx_t_10 = 0;
      __pyx_v_D->y_centroid_work = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_y_centroid_work.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_y_centroid_work.diminfo[0].strides)));

     224:

    +225: 	boundary_flux_sum = domain_object.boundary_flux_sum

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_boundary_flux_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 225, __pyx_L1_error)
      __pyx_t_34 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer, (PyObject*)__pyx_t_34, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer, (PyObject*)__pyx_v_boundary_flux_sum, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_boundary_flux_sum.diminfo[0].strides = __pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boundary_flux_sum.diminfo[0].shape = __pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 225, __pyx_L1_error)
      }
      __pyx_t_34 = 0;
      __pyx_v_boundary_flux_sum = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +226: 	D.boundary_flux_sum = &boundary_flux_sum[0]

      __pyx_t_10 = 0;
      __pyx_v_D->boundary_flux_sum = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_boundary_flux_sum.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_boundary_flux_sum.diminfo[0].strides)));

     227:

    +228: 	quantities = domain_object.quantities

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_quantities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_quantities = __pyx_t_1;
      __pyx_t_1 = 0;

     229:

    +230: 	edge_values = quantities["stage"].edge_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_stage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_edge_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 230, __pyx_L1_error)
      __pyx_t_36 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_edge_values.diminfo[0].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_values.diminfo[0].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_values.diminfo[1].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_values.diminfo[1].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
      }
      __pyx_t_36 = 0;
      __pyx_v_edge_values = ((PyArrayObject *)__pyx_t_35);
      __pyx_t_35 = 0;

    +231: 	D.stage_edge_values = &edge_values[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->stage_edge_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_values.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_edge_values.diminfo[1].strides)));

     232:

    +233: 	edge_values = quantities["xmomentum"].edge_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_xmomentum); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_edge_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 233, __pyx_L1_error)
      __pyx_t_36 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_edge_values.diminfo[0].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_values.diminfo[0].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_values.diminfo[1].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_values.diminfo[1].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
      }
      __pyx_t_36 = 0;
      __Pyx_DECREF_SET(__pyx_v_edge_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +234: 	D.xmom_edge_values = &edge_values[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->xmom_edge_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_edge_values.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_edge_values.diminfo[1].strides)));

     235:

    +236: 	edge_values = quantities["ymomentum"].edge_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_ymomentum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_edge_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 236, __pyx_L1_error)
      __pyx_t_36 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_edge_values.diminfo[0].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_values.diminfo[0].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_values.diminfo[1].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_values.diminfo[1].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 236, __pyx_L1_error)
      }
      __pyx_t_36 = 0;
      __Pyx_DECREF_SET(__pyx_v_edge_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +237: 	D.ymom_edge_values = &edge_values[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->ymom_edge_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_values.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_edge_values.diminfo[1].strides)));

     238:

    +239: 	edge_values = quantities["elevation"].edge_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_elevation); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_edge_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 239, __pyx_L1_error)
      __pyx_t_36 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_edge_values.diminfo[0].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_values.diminfo[0].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_values.diminfo[1].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_values.diminfo[1].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 239, __pyx_L1_error)
      }
      __pyx_t_36 = 0;
      __Pyx_DECREF_SET(__pyx_v_edge_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +240: 	D.bed_edge_values = &edge_values[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->bed_edge_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_edge_values.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_edge_values.diminfo[1].strides)));

     241:

    +242: 	edge_values = quantities["height"].edge_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_edge_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 242, __pyx_L1_error)
      __pyx_t_36 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edge_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_edge_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_edge_values.diminfo[0].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edge_values.diminfo[0].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_edge_values.diminfo[1].strides = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_edge_values.diminfo[1].shape = __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
      }
      __pyx_t_36 = 0;
      __Pyx_DECREF_SET(__pyx_v_edge_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +243: 	D.height_edge_values = &edge_values[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->height_edge_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_edge_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_edge_values.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_edge_values.diminfo[1].strides)));

     244:

    +245: 	centroid_values = quantities["stage"].centroid_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_stage); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_centroid_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 245, __pyx_L1_error)
      __pyx_t_37 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_centroid_values.diminfo[0].strides = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_values.diminfo[0].shape = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 245, __pyx_L1_error)
      }
      __pyx_t_37 = 0;
      __pyx_v_centroid_values = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +246: 	D.stage_centroid_values = &centroid_values[0]

      __pyx_t_9 = 0;
      __pyx_v_D->stage_centroid_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_centroid_values.diminfo[0].strides)));

     247:

    +248: 	centroid_values = quantities["xmomentum"].centroid_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_xmomentum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_centroid_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 248, __pyx_L1_error)
      __pyx_t_37 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_centroid_values.diminfo[0].strides = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_values.diminfo[0].shape = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 248, __pyx_L1_error)
      }
      __pyx_t_37 = 0;
      __Pyx_DECREF_SET(__pyx_v_centroid_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +249: 	D.xmom_centroid_values = &centroid_values[0]

      __pyx_t_9 = 0;
      __pyx_v_D->xmom_centroid_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_centroid_values.diminfo[0].strides)));

     250:

    +251: 	centroid_values = quantities["ymomentum"].centroid_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_ymomentum); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_centroid_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 251, __pyx_L1_error)
      __pyx_t_37 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_centroid_values.diminfo[0].strides = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_values.diminfo[0].shape = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
      }
      __pyx_t_37 = 0;
      __Pyx_DECREF_SET(__pyx_v_centroid_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +252: 	D.ymom_centroid_values = &centroid_values[0]

      __pyx_t_9 = 0;
      __pyx_v_D->ymom_centroid_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_centroid_values.diminfo[0].strides)));

     253:

    +254: 	centroid_values = quantities["elevation"].centroid_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_elevation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_centroid_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 254, __pyx_L1_error)
      __pyx_t_37 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_centroid_values.diminfo[0].strides = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_values.diminfo[0].shape = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
      }
      __pyx_t_37 = 0;
      __Pyx_DECREF_SET(__pyx_v_centroid_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +255: 	D.bed_centroid_values = &centroid_values[0]

      __pyx_t_9 = 0;
      __pyx_v_D->bed_centroid_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_centroid_values.diminfo[0].strides)));

     256:

    +257: 	centroid_values = quantities["height"].centroid_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_height); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_centroid_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 257, __pyx_L1_error)
      __pyx_t_37 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centroid_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_centroid_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_centroid_values.diminfo[0].strides = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centroid_values.diminfo[0].shape = __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 257, __pyx_L1_error)
      }
      __pyx_t_37 = 0;
      __Pyx_DECREF_SET(__pyx_v_centroid_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +258: 	D.height_centroid_values = &centroid_values[0]

      __pyx_t_9 = 0;
      __pyx_v_D->height_centroid_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_centroid_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_centroid_values.diminfo[0].strides)));

     259:

    +260: 	vertex_values = quantities["stage"].vertex_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_stage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vertex_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 260, __pyx_L1_error)
      __pyx_t_38 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_vertex_values.diminfo[0].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_values.diminfo[0].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertex_values.diminfo[1].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertex_values.diminfo[1].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
      }
      __pyx_t_38 = 0;
      __pyx_v_vertex_values = ((PyArrayObject *)__pyx_t_35);
      __pyx_t_35 = 0;

    +261: 	D.stage_vertex_values = &vertex_values[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->stage_vertex_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_vertex_values.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_vertex_values.diminfo[1].strides)));

     262:

    +263: 	vertex_values = quantities["xmomentum"].vertex_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_xmomentum); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_vertex_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 263, __pyx_L1_error)
      __pyx_t_38 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_vertex_values.diminfo[0].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_values.diminfo[0].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertex_values.diminfo[1].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertex_values.diminfo[1].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
      }
      __pyx_t_38 = 0;
      __Pyx_DECREF_SET(__pyx_v_vertex_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +264: 	D.xmom_vertex_values = &vertex_values[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->xmom_vertex_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_vertex_values.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_vertex_values.diminfo[1].strides)));

     265:

    +266: 	vertex_values = quantities["ymomentum"].vertex_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_ymomentum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vertex_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 266, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 266, __pyx_L1_error)
      __pyx_t_38 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_vertex_values.diminfo[0].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_values.diminfo[0].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertex_values.diminfo[1].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertex_values.diminfo[1].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
      }
      __pyx_t_38 = 0;
      __Pyx_DECREF_SET(__pyx_v_vertex_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +267: 	D.ymom_vertex_values = &vertex_values[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->ymom_vertex_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_vertex_values.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_vertex_values.diminfo[1].strides)));

     268:

    +269: 	vertex_values = quantities["elevation"].vertex_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_elevation); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_vertex_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 269, __pyx_L1_error)
      __pyx_t_38 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_vertex_values.diminfo[0].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_values.diminfo[0].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertex_values.diminfo[1].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertex_values.diminfo[1].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 269, __pyx_L1_error)
      }
      __pyx_t_38 = 0;
      __Pyx_DECREF_SET(__pyx_v_vertex_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +270: 	D.bed_vertex_values = &vertex_values[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->bed_vertex_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_vertex_values.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_vertex_values.diminfo[1].strides)));

     271:

    +272: 	vertex_values = quantities["height"].vertex_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vertex_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 272, __pyx_L1_error)
      __pyx_t_38 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vertex_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_vertex_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_vertex_values.diminfo[0].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vertex_values.diminfo[0].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_vertex_values.diminfo[1].strides = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_vertex_values.diminfo[1].shape = __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 272, __pyx_L1_error)
      }
      __pyx_t_38 = 0;
      __Pyx_DECREF_SET(__pyx_v_vertex_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +273: 	D.height_vertex_values = &vertex_values[0,0]

      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_v_D->height_vertex_values = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_vertex_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_vertex_values.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_vertex_values.diminfo[1].strides)));

     274:

    +275: 	boundary_values = quantities["stage"].boundary_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_stage); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_boundary_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 275, __pyx_L1_error)
      __pyx_t_39 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_39, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_boundary_values.diminfo[0].strides = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boundary_values.diminfo[0].shape = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 275, __pyx_L1_error)
      }
      __pyx_t_39 = 0;
      __pyx_v_boundary_values = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +276: 	D.stage_boundary_values = &boundary_values[0]

      __pyx_t_10 = 0;
      __pyx_v_D->stage_boundary_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_boundary_values.diminfo[0].strides)));

     277:

    +278: 	boundary_values = quantities["xmomentum"].boundary_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_xmomentum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boundary_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 278, __pyx_L1_error)
      __pyx_t_39 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_39, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_boundary_values.diminfo[0].strides = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boundary_values.diminfo[0].shape = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 278, __pyx_L1_error)
      }
      __pyx_t_39 = 0;
      __Pyx_DECREF_SET(__pyx_v_boundary_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +279: 	D.xmom_boundary_values = &boundary_values[0]

      __pyx_t_10 = 0;
      __pyx_v_D->xmom_boundary_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_boundary_values.diminfo[0].strides)));

     280:

    +281: 	boundary_values = quantities["ymomentum"].boundary_values

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_ymomentum); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_boundary_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 281, __pyx_L1_error)
      __pyx_t_39 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_39, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_boundary_values.diminfo[0].strides = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boundary_values.diminfo[0].shape = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 281, __pyx_L1_error)
      }
      __pyx_t_39 = 0;
      __Pyx_DECREF_SET(__pyx_v_boundary_values, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +282: 	D.ymom_boundary_values = &boundary_values[0]

      __pyx_t_10 = 0;
      __pyx_v_D->ymom_boundary_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_boundary_values.diminfo[0].strides)));

     283:

    +284: 	boundary_values = quantities["elevation"].boundary_values

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_elevation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boundary_values); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 284, __pyx_L1_error)
      __pyx_t_39 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_39, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boundary_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_boundary_values, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_boundary_values.diminfo[0].strides = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boundary_values.diminfo[0].shape = __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 284, __pyx_L1_error)
      }
      __pyx_t_39 = 0;
      __Pyx_DECREF_SET(__pyx_v_boundary_values, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +285: 	D.bed_boundary_values = &boundary_values[0]

      __pyx_t_10 = 0;
      __pyx_v_D->bed_boundary_values = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_boundary_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_boundary_values.diminfo[0].strides)));

     286:

    +287: 	explicit_update = quantities["stage"].explicit_update

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_stage); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_explicit_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 287, __pyx_L1_error)
      __pyx_t_40 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_v_explicit_update, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_explicit_update.diminfo[0].strides = __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_explicit_update.diminfo[0].shape = __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 287, __pyx_L1_error)
      }
      __pyx_t_40 = 0;
      __pyx_v_explicit_update = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +288: 	D.stage_explicit_update = &explicit_update[0]

      __pyx_t_10 = 0;
      __pyx_v_D->stage_explicit_update = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_explicit_update.diminfo[0].strides)));

     289:

    +290: 	explicit_update = quantities["xmomentum"].explicit_update

      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_xmomentum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_explicit_update); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_35) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_35, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 290, __pyx_L1_error)
      __pyx_t_40 = ((PyArrayObject *)__pyx_t_35);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_v_explicit_update, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_explicit_update.diminfo[0].strides = __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_explicit_update.diminfo[0].shape = __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 290, __pyx_L1_error)
      }
      __pyx_t_40 = 0;
      __Pyx_DECREF_SET(__pyx_v_explicit_update, ((PyArrayObject *)__pyx_t_35));
      __pyx_t_35 = 0;

    +291: 	D.xmom_explicit_update = &explicit_update[0]

      __pyx_t_10 = 0;
      __pyx_v_D->xmom_explicit_update = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_explicit_update.diminfo[0].strides)));

     292:

    +293: 	explicit_update = quantities["ymomentum"].explicit_update

      __pyx_t_35 = __Pyx_PyObject_Dict_GetItem(__pyx_v_quantities, __pyx_n_s_ymomentum); if (unlikely(!__pyx_t_35)) __PYX_ERR(0, 293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_35);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_35, __pyx_n_s_explicit_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 293, __pyx_L1_error)
      __pyx_t_40 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_explicit_update.rcbuffer->pybuffer, (PyObject*)__pyx_v_explicit_update, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_explicit_update.diminfo[0].strides = __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_explicit_update.diminfo[0].shape = __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
      }
      __pyx_t_40 = 0;
      __Pyx_DECREF_SET(__pyx_v_explicit_update, ((PyArrayObject *)__pyx_t_1));
      __pyx_t_1 = 0;

    +294: 	D.ymom_explicit_update = &explicit_update[0]

      __pyx_t_10 = 0;
      __pyx_v_D->ymom_explicit_update = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_explicit_update.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_explicit_update.diminfo[0].strides)));

     295:

    +296: 	riverwallData = domain_object.riverwallData

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_riverwallData); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_riverwallData = __pyx_t_1;
      __pyx_t_1 = 0;

     297:

    +298: 	riverwall_elevation = riverwallData.riverwall_elevation

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_riverwallData, __pyx_n_s_riverwall_elevation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 298, __pyx_L1_error)
      __pyx_t_41 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer, (PyObject*)__pyx_t_41, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer, (PyObject*)__pyx_v_riverwall_elevation, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_riverwall_elevation.diminfo[0].strides = __pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_riverwall_elevation.diminfo[0].shape = __pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 298, __pyx_L1_error)
      }
      __pyx_t_41 = 0;
      __pyx_v_riverwall_elevation = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +299: 	D.riverwall_elevation = &riverwall_elevation[0]

      __pyx_t_10 = 0;
      __pyx_v_D->riverwall_elevation = (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_riverwall_elevation.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_riverwall_elevation.diminfo[0].strides)));

     300:

    +301: 	riverwall_rowIndex = riverwallData.hydraulic_properties_rowIndex

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_riverwallData, __pyx_n_s_hydraulic_properties_rowIndex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 301, __pyx_L1_error)
      __pyx_t_42 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer, (PyObject*)__pyx_v_riverwall_rowIndex, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          }
          __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
        }
        __pyx_pybuffernd_riverwall_rowIndex.diminfo[0].strides = __pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_riverwall_rowIndex.diminfo[0].shape = __pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 301, __pyx_L1_error)
      }
      __pyx_t_42 = 0;
      __pyx_v_riverwall_rowIndex = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +302: 	D.riverwall_rowIndex = &riverwall_rowIndex[0]

      __pyx_t_10 = 0;
      __pyx_v_D->riverwall_rowIndex = (&(*__Pyx_BufPtrCContig1d(long *, __pyx_pybuffernd_riverwall_rowIndex.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_riverwall_rowIndex.diminfo[0].strides)));

     303:

    +304: 	D.ncol_riverwall_hydraulic_properties = riverwallData.ncol_hydraulic_properties

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_riverwallData, __pyx_n_s_ncol_hydraulic_properties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_D->ncol_riverwall_hydraulic_properties = __pyx_t_2;

     305:

    +306: 	riverwall_hydraulic_properties = riverwallData.hydraulic_properties

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_riverwallData, __pyx_n_s_hydraulic_properties); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 306, __pyx_L1_error)
      __pyx_t_43 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer);
        __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer, (PyObject*)__pyx_t_43, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_5 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer, (PyObject*)__pyx_v_riverwall_hydraulic_properties, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
          }
          __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
        }
        __pyx_pybuffernd_riverwall_hydraulic_properties.diminfo[0].strides = __pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_riverwall_hydraulic_properties.diminfo[0].shape = __pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_riverwall_hydraulic_properties.diminfo[1].strides = __pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_riverwall_hydraulic_properties.diminfo[1].shape = __pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 306, __pyx_L1_error)
      }
      __pyx_t_43 = 0;
      __pyx_v_riverwall_hydraulic_properties = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +307: 	D.riverwall_hydraulic_properties = &riverwall_hydraulic_properties[0,0]

      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_v_D->riverwall_hydraulic_properties = (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_riverwall_hydraulic_properties.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_riverwall_hydraulic_properties.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_riverwall_hydraulic_properties.diminfo[1].strides)));

     308:

    +309: def rotate(np.ndarray[double, ndim=1, mode="c"] q not None, np.ndarray[double, ndim=1, mode="c"] normal not None, int direction):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_1rotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_1rotate = {"rotate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_1rotate, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_1rotate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_q = 0;
      PyArrayObject *__pyx_v_normal = 0;
      int __pyx_v_direction;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rotate (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_normal,&__pyx_n_s_direction,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q)) != 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_normal)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("rotate", 1, 3, 3, 1); __PYX_ERR(0, 309, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_direction)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("rotate", 1, 3, 3, 2); __PYX_ERR(0, 309, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotate") < 0)) __PYX_ERR(0, 309, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_q = ((PyArrayObject *)values[0]);
        __pyx_v_normal = ((PyArrayObject *)values[1]);
        __pyx_v_direction = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("rotate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 309, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.rotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q), __pyx_ptype_5numpy_ndarray, 0, "q", 0))) __PYX_ERR(0, 309, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_normal), __pyx_ptype_5numpy_ndarray, 0, "normal", 0))) __PYX_ERR(0, 309, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_rotate(__pyx_self, __pyx_v_q, __pyx_v_normal, __pyx_v_direction);
      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_17shallow_water_ext_rotate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_q, PyArrayObject *__pyx_v_normal, int __pyx_v_direction) {
      PyArrayObject *__pyx_v_r = 0;
      double __pyx_v_n1;
      double __pyx_v_n2;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_normal;
      __Pyx_Buffer __pyx_pybuffer_normal;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_q;
      __Pyx_Buffer __pyx_pybuffer_q;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_r;
      __Pyx_Buffer __pyx_pybuffer_r;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rotate", 0);
      __pyx_pybuffer_r.pybuffer.buf = NULL;
      __pyx_pybuffer_r.refcount = 0;
      __pyx_pybuffernd_r.data = NULL;
      __pyx_pybuffernd_r.rcbuffer = &__pyx_pybuffer_r;
      __pyx_pybuffer_q.pybuffer.buf = NULL;
      __pyx_pybuffer_q.refcount = 0;
      __pyx_pybuffernd_q.data = NULL;
      __pyx_pybuffernd_q.rcbuffer = &__pyx_pybuffer_q;
      __pyx_pybuffer_normal.pybuffer.buf = NULL;
      __pyx_pybuffer_normal.refcount = 0;
      __pyx_pybuffernd_normal.data = NULL;
      __pyx_pybuffernd_normal.rcbuffer = &__pyx_pybuffer_normal;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 309, __pyx_L1_error)
      }
      __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 309, __pyx_L1_error)
      }
      __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_r.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.rotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_r.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_r);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__3 = PyTuple_Pack(6, __pyx_n_s_q, __pyx_n_s_normal, __pyx_n_s_direction, __pyx_n_s_r, __pyx_n_s_n1, __pyx_n_s_n2); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__3);
      __Pyx_GIVEREF(__pyx_tuple__3);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_1rotate, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotate, __pyx_t_1) < 0) __PYX_ERR(0, 309, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 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_shallow_wate, __pyx_n_s_rotate, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 309, __pyx_L1_error)

     310:

    +311: 	assert normal.shape[0] == 2, "Normal vector must have 2 components"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!(((__pyx_v_normal->dimensions[0]) == 2) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Normal_vector_must_have_2_compon);
          __PYX_ERR(0, 311, __pyx_L1_error)
        }
      }
      #endif

     312:

     313: 	cdef np.ndarray[double, ndim=1, mode="c"] r

     314: 	cdef double n1, n2

     315:

    +316: 	n1 = normal[0]

      __pyx_t_1 = 0;
      __pyx_v_n1 = (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_normal.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_normal.diminfo[0].strides));

    +317: 	n2 = normal[1]

      __pyx_t_1 = 1;
      __pyx_v_n2 = (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_normal.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_normal.diminfo[0].strides));

     318:

    +319: 	if direction == -1:

      __pyx_t_2 = ((__pyx_v_direction == -1L) != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +320: 		n2 = -n2

        __pyx_v_n2 = (-__pyx_v_n2);

     321:

    +322: 	r = np.ascontiguousarray(np.copy(q))

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_copy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, ((PyObject *)__pyx_v_q)) : __Pyx_PyObject_CallOneArg(__pyx_t_7, ((PyObject *)__pyx_v_q));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 322, __pyx_L1_error)
      __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_r.rcbuffer->pybuffer);
        __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_r.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_9 < 0)) {
          PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_r, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
          }
          __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
        }
        __pyx_pybuffernd_r.diminfo[0].strides = __pyx_pybuffernd_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_r.diminfo[0].shape = __pyx_pybuffernd_r.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 322, __pyx_L1_error)
      }
      __pyx_t_8 = 0;
      __pyx_v_r = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

     323:

    +324: 	_rotate(&r[0], n1, n2)

      __pyx_t_1 = 0;
      (void)(_rotate((&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_r.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_r.diminfo[0].strides))), __pyx_v_n1, __pyx_v_n2));

     325:

    +326: 	return r

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_r));
      __pyx_r = ((PyObject *)__pyx_v_r);
      goto __pyx_L0;

     327:

    +328: def flux_function_central(np.ndarray[double, ndim=1, mode="c"] normal not None,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_3flux_function_central(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_3flux_function_central = {"flux_function_central", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_3flux_function_central, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_3flux_function_central(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_normal = 0;
      PyArrayObject *__pyx_v_ql = 0;
      PyArrayObject *__pyx_v_qr = 0;
      double __pyx_v_zl;
      double __pyx_v_zr;
      PyArrayObject *__pyx_v_edgeflux = 0;
      double __pyx_v_epsilon;
      double __pyx_v_g;
      double __pyx_v_H0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("flux_function_central (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_normal,&__pyx_n_s_ql,&__pyx_n_s_qr,&__pyx_n_s_zl,&__pyx_n_s_zr,&__pyx_n_s_edgeflux,&__pyx_n_s_epsilon,&__pyx_n_s_g,&__pyx_n_s_H0,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_normal)) != 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_ql)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 1); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qr)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 2); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zl)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 3); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zr)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 4); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_edgeflux)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 5); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 6); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 7); __PYX_ERR(0, 328, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H0)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, 8); __PYX_ERR(0, 328, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flux_function_central") < 0)) __PYX_ERR(0, 328, __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_normal = ((PyArrayObject *)values[0]);
        __pyx_v_ql = ((PyArrayObject *)values[1]);
        __pyx_v_qr = ((PyArrayObject *)values[2]);
        __pyx_v_zl = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_zl == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 331, __pyx_L3_error)
        __pyx_v_zr = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zr == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L3_error)
        __pyx_v_edgeflux = ((PyArrayObject *)values[5]);
        __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 334, __pyx_L3_error)
        __pyx_v_g = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_g == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L3_error)
        __pyx_v_H0 = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_H0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 336, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("flux_function_central", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 328, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.flux_function_central", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_normal), __pyx_ptype_5numpy_ndarray, 0, "normal", 0))) __PYX_ERR(0, 328, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ql), __pyx_ptype_5numpy_ndarray, 0, "ql", 0))) __PYX_ERR(0, 329, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qr), __pyx_ptype_5numpy_ndarray, 0, "qr", 0))) __PYX_ERR(0, 330, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edgeflux), __pyx_ptype_5numpy_ndarray, 0, "edgeflux", 0))) __PYX_ERR(0, 333, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_2flux_function_central(__pyx_self, __pyx_v_normal, __pyx_v_ql, __pyx_v_qr, __pyx_v_zl, __pyx_v_zr, __pyx_v_edgeflux, __pyx_v_epsilon, __pyx_v_g, __pyx_v_H0);
      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_17shallow_water_ext_2flux_function_central(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_normal, PyArrayObject *__pyx_v_ql, PyArrayObject *__pyx_v_qr, double __pyx_v_zl, double __pyx_v_zr, PyArrayObject *__pyx_v_edgeflux, double __pyx_v_epsilon, double __pyx_v_g, double __pyx_v_H0) {
      double __pyx_v_h0;
      double __pyx_v_limiting_threshold;
      double __pyx_v_max_speed;
      int __pyx_v_err;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_edgeflux;
      __Pyx_Buffer __pyx_pybuffer_edgeflux;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_normal;
      __Pyx_Buffer __pyx_pybuffer_normal;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ql;
      __Pyx_Buffer __pyx_pybuffer_ql;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_qr;
      __Pyx_Buffer __pyx_pybuffer_qr;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("flux_function_central", 0);
      __pyx_pybuffer_normal.pybuffer.buf = NULL;
      __pyx_pybuffer_normal.refcount = 0;
      __pyx_pybuffernd_normal.data = NULL;
      __pyx_pybuffernd_normal.rcbuffer = &__pyx_pybuffer_normal;
      __pyx_pybuffer_ql.pybuffer.buf = NULL;
      __pyx_pybuffer_ql.refcount = 0;
      __pyx_pybuffernd_ql.data = NULL;
      __pyx_pybuffernd_ql.rcbuffer = &__pyx_pybuffer_ql;
      __pyx_pybuffer_qr.pybuffer.buf = NULL;
      __pyx_pybuffer_qr.refcount = 0;
      __pyx_pybuffernd_qr.data = NULL;
      __pyx_pybuffernd_qr.rcbuffer = &__pyx_pybuffer_qr;
      __pyx_pybuffer_edgeflux.pybuffer.buf = NULL;
      __pyx_pybuffer_edgeflux.refcount = 0;
      __pyx_pybuffernd_edgeflux.data = NULL;
      __pyx_pybuffernd_edgeflux.rcbuffer = &__pyx_pybuffer_edgeflux;
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 328, __pyx_L1_error)
      }
      __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ql.rcbuffer->pybuffer, (PyObject*)__pyx_v_ql, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 328, __pyx_L1_error)
      }
      __pyx_pybuffernd_ql.diminfo[0].strides = __pyx_pybuffernd_ql.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ql.diminfo[0].shape = __pyx_pybuffernd_ql.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_qr.rcbuffer->pybuffer, (PyObject*)__pyx_v_qr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 328, __pyx_L1_error)
      }
      __pyx_pybuffernd_qr.diminfo[0].strides = __pyx_pybuffernd_qr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_qr.diminfo[0].shape = __pyx_pybuffernd_qr.rcbuffer->pybuffer.shape[0];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_edgeflux.rcbuffer->pybuffer, (PyObject*)__pyx_v_edgeflux, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 328, __pyx_L1_error)
      }
      __pyx_pybuffernd_edgeflux.diminfo[0].strides = __pyx_pybuffernd_edgeflux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_edgeflux.diminfo[0].shape = __pyx_pybuffernd_edgeflux.rcbuffer->pybuffer.shape[0];
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_6);
      { 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_edgeflux.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ql.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_qr.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.flux_function_central", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_edgeflux.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ql.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_qr.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__5 = PyTuple_Pack(13, __pyx_n_s_normal, __pyx_n_s_ql, __pyx_n_s_qr, __pyx_n_s_zl, __pyx_n_s_zr, __pyx_n_s_edgeflux, __pyx_n_s_epsilon, __pyx_n_s_g, __pyx_n_s_H0, __pyx_n_s_h0, __pyx_n_s_limiting_threshold, __pyx_n_s_max_speed, __pyx_n_s_err); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__5);
      __Pyx_GIVEREF(__pyx_tuple__5);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_3flux_function_central, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_flux_function_central, __pyx_t_1) < 0) __PYX_ERR(0, 328, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 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_shallow_wate, __pyx_n_s_flux_function_central, 328, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 328, __pyx_L1_error)

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

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

     331: 						double zl,\

     332: 						double zr,\

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

     334: 						double epsilon,\

     335: 						double g,\

     336: 						double H0):

     337:

     338: 	cdef double h0, limiting_threshold, max_speed

     339: 	cdef int err

     340:

    +341: 	h0 = H0*H0

      __pyx_v_h0 = (__pyx_v_H0 * __pyx_v_H0);

    +342: 	limiting_threshold = 10*H0

      __pyx_v_limiting_threshold = (10.0 * __pyx_v_H0);

     343:

    +344: 	err = _flux_function_central(&ql[0], &qr[0], zl, zr, normal[0], normal[1], epsilon, h0, limiting_threshold, g, &edgeflux[0], &max_speed)

      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 1;
      __pyx_t_5 = 0;
      __pyx_v_err = _flux_function_central((&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ql.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_ql.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_qr.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_qr.diminfo[0].strides))), __pyx_v_zl, __pyx_v_zr, (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_normal.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_normal.diminfo[0].strides)), (*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_normal.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_normal.diminfo[0].strides)), __pyx_v_epsilon, __pyx_v_h0, __pyx_v_limiting_threshold, __pyx_v_g, (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_edgeflux.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_edgeflux.diminfo[0].strides))), (&__pyx_v_max_speed));

     345:

    +346: 	assert err >= 0, "Discontinuous Elevation"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_err >= 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Discontinuous_Elevation);
          __PYX_ERR(0, 346, __pyx_L1_error)
        }
      }
      #endif

     347:

    +348: 	return max_speed

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_max_speed); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

     349:

    +350: def extrapolate_second_order_sw(object domain_object):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_5extrapolate_second_order_sw(PyObject *__pyx_self, PyObject *__pyx_v_domain_object); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_5extrapolate_second_order_sw = {"extrapolate_second_order_sw", (PyCFunction)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_5extrapolate_second_order_sw, METH_O, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_5extrapolate_second_order_sw(PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("extrapolate_second_order_sw (wrapper)", 0);
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_4extrapolate_second_order_sw(__pyx_self, ((PyObject *)__pyx_v_domain_object));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_13shallow_water_17shallow_water_ext_4extrapolate_second_order_sw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      struct domain __pyx_v_D;
      int __pyx_v_err;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("extrapolate_second_order_sw", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.extrapolate_second_order_sw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__7 = PyTuple_Pack(3, __pyx_n_s_domain_object, __pyx_n_s_D, __pyx_n_s_err); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__7);
      __Pyx_GIVEREF(__pyx_tuple__7);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_5extrapolate_second_order_sw, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_extrapolate_second_order_sw, __pyx_t_1) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_extrapolate_second_order_sw, 350, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 350, __pyx_L1_error)

     351:

     352: 	cdef domain D

     353: 	cdef int err

     354:

    +355: 	get_python_domain(&D, domain_object)

      __pyx_t_1 = __pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain((&__pyx_v_D), __pyx_v_domain_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     356:

    +357: 	err = _extrapolate_second_order_sw(&D)

      __pyx_v_err = _extrapolate_second_order_sw((&__pyx_v_D));

     358:

    +359: 	assert err == 0, "Internal neighbour not found"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_err == 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Internal_neighbour_not_found);
          __PYX_ERR(0, 359, __pyx_L1_error)
        }
      }
      #endif

     360:

    +361: def compute_fluxes_ext_central_structure(object domain_object):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_7compute_fluxes_ext_central_structure(PyObject *__pyx_self, PyObject *__pyx_v_domain_object); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_7compute_fluxes_ext_central_structure = {"compute_fluxes_ext_central_structure", (PyCFunction)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_7compute_fluxes_ext_central_structure, METH_O, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_7compute_fluxes_ext_central_structure(PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_central_structure (wrapper)", 0);
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_6compute_fluxes_ext_central_structure(__pyx_self, ((PyObject *)__pyx_v_domain_object));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_13shallow_water_17shallow_water_ext_6compute_fluxes_ext_central_structure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      struct domain __pyx_v_D;
      double __pyx_v_timestep;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_central_structure", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.compute_fluxes_ext_central_structure", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__9 = PyTuple_Pack(3, __pyx_n_s_domain_object, __pyx_n_s_D, __pyx_n_s_timestep); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__9);
      __Pyx_GIVEREF(__pyx_tuple__9);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_7compute_fluxes_ext_central_structure, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_fluxes_ext_central_struc, __pyx_t_1) < 0) __PYX_ERR(0, 361, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_compute_fluxes_ext_central_struc, 361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 361, __pyx_L1_error)

     362:

     363: 	cdef domain D

     364: 	cdef double timestep

     365:

    +366: 	get_python_domain(&D, domain_object)

      __pyx_t_1 = __pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain((&__pyx_v_D), __pyx_v_domain_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     367:

    +368: 	timestep = _compute_fluxes_central_structure(&D)

      __pyx_v_timestep = _compute_fluxes_central_structure((&__pyx_v_D));

     369:

    +370: 	return timestep

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

     371:

    +372: def gravity(object domain_object):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_9gravity(PyObject *__pyx_self, PyObject *__pyx_v_domain_object); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_9gravity = {"gravity", (PyCFunction)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_9gravity, METH_O, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_9gravity(PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("gravity (wrapper)", 0);
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_8gravity(__pyx_self, ((PyObject *)__pyx_v_domain_object));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_13shallow_water_17shallow_water_ext_8gravity(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      struct domain __pyx_v_D;
      int __pyx_v_err;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("gravity", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.gravity", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__11 = PyTuple_Pack(3, __pyx_n_s_domain_object, __pyx_n_s_D, __pyx_n_s_err); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__11);
      __Pyx_GIVEREF(__pyx_tuple__11);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_9gravity, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_gravity, __pyx_t_1) < 0) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_gravity, 372, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 372, __pyx_L1_error)

     373:

     374: 	cdef domain D

     375:

    +376: 	get_python_domain(&D, domain_object)

      __pyx_t_1 = __pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain((&__pyx_v_D), __pyx_v_domain_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     377:

    +378: 	err = _gravity(&D)

      __pyx_v_err = _gravity((&__pyx_v_D));

     379:

    +380: 	if err == -1:

      __pyx_t_2 = ((__pyx_v_err == -1L) != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +381: 		return None

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

     382:

    +383: def gravity_wb(object domain_object):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_11gravity_wb(PyObject *__pyx_self, PyObject *__pyx_v_domain_object); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_11gravity_wb = {"gravity_wb", (PyCFunction)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_11gravity_wb, METH_O, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_11gravity_wb(PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("gravity_wb (wrapper)", 0);
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_10gravity_wb(__pyx_self, ((PyObject *)__pyx_v_domain_object));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_13shallow_water_17shallow_water_ext_10gravity_wb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      struct domain __pyx_v_D;
      int __pyx_v_err;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("gravity_wb", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.gravity_wb", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__13 = PyTuple_Pack(3, __pyx_n_s_domain_object, __pyx_n_s_D, __pyx_n_s_err); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__13);
      __Pyx_GIVEREF(__pyx_tuple__13);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_11gravity_wb, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_gravity_wb, __pyx_t_1) < 0) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_gravity_wb, 383, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 383, __pyx_L1_error)

     384:

     385: 	cdef domain D

     386:

    +387: 	get_python_domain(&D, domain_object)

      __pyx_t_1 = __pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain((&__pyx_v_D), __pyx_v_domain_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     388:

    +389: 	err = _gravity_wb(&D)

      __pyx_v_err = _gravity_wb((&__pyx_v_D));

     390:

    +391: 	if err == -1:

      __pyx_t_2 = ((__pyx_v_err == -1L) != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +392: 		return None

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

     393:

    +394: def compute_fluxes_ext_wb(object domain_object):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_13compute_fluxes_ext_wb(PyObject *__pyx_self, PyObject *__pyx_v_domain_object); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_13compute_fluxes_ext_wb = {"compute_fluxes_ext_wb", (PyCFunction)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_13compute_fluxes_ext_wb, METH_O, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_13compute_fluxes_ext_wb(PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_wb (wrapper)", 0);
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_12compute_fluxes_ext_wb(__pyx_self, ((PyObject *)__pyx_v_domain_object));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_13shallow_water_17shallow_water_ext_12compute_fluxes_ext_wb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      struct domain __pyx_v_D;
      double __pyx_v_timestep;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_wb", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.compute_fluxes_ext_wb", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__15 = PyTuple_Pack(3, __pyx_n_s_domain_object, __pyx_n_s_D, __pyx_n_s_timestep); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__15);
      __Pyx_GIVEREF(__pyx_tuple__15);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_13compute_fluxes_ext_wb, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_fluxes_ext_wb, __pyx_t_1) < 0) __PYX_ERR(0, 394, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_compute_fluxes_ext_wb, 394, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 394, __pyx_L1_error)

     395:

     396: 	cdef domain D

     397: 	cdef double timestep

     398:

    +399: 	get_python_domain(&D, domain_object)

      __pyx_t_1 = __pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain((&__pyx_v_D), __pyx_v_domain_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     400:

    +401: 	timestep = _compute_fluxes_central_wb(&D)

      __pyx_v_timestep = _compute_fluxes_central_wb((&__pyx_v_D));

     402:

    +403: 	assert timestep >= 0, "Discontinuous Elevation"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_timestep >= 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Discontinuous_Elevation);
          __PYX_ERR(0, 403, __pyx_L1_error)
        }
      }
      #endif

     404:

    +405: 	return timestep

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

     406:

    +407: def compute_fluxes_ext_wb_3(object domain_object):

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_15compute_fluxes_ext_wb_3(PyObject *__pyx_self, PyObject *__pyx_v_domain_object); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_15compute_fluxes_ext_wb_3 = {"compute_fluxes_ext_wb_3", (PyCFunction)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_15compute_fluxes_ext_wb_3, METH_O, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_15compute_fluxes_ext_wb_3(PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_wb_3 (wrapper)", 0);
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_14compute_fluxes_ext_wb_3(__pyx_self, ((PyObject *)__pyx_v_domain_object));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_5anuga_13shallow_water_17shallow_water_ext_14compute_fluxes_ext_wb_3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object) {
      struct domain __pyx_v_D;
      double __pyx_v_timestep;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("compute_fluxes_ext_wb_3", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.compute_fluxes_ext_wb_3", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__17 = PyTuple_Pack(3, __pyx_n_s_domain_object, __pyx_n_s_D, __pyx_n_s_timestep); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__17);
      __Pyx_GIVEREF(__pyx_tuple__17);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_15compute_fluxes_ext_wb_3, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_fluxes_ext_wb_3, __pyx_t_1) < 0) __PYX_ERR(0, 407, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_compute_fluxes_ext_wb_3, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 407, __pyx_L1_error)

     408:

     409: 	cdef domain D

     410: 	cdef double timestep

     411:

    +412: 	get_python_domain(&D, domain_object)

      __pyx_t_1 = __pyx_f_5anuga_13shallow_water_17shallow_water_ext_get_python_domain((&__pyx_v_D), __pyx_v_domain_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     413:

    +414: 	timestep = _compute_fluxes_central_wb_3(&D)

      __pyx_v_timestep = _compute_fluxes_central_wb_3((&__pyx_v_D));

     415:

    +416: 	assert timestep >= 0, "Discontinuous Elevation"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_timestep >= 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Discontinuous_Elevation);
          __PYX_ERR(0, 416, __pyx_L1_error)
        }
      }
      #endif

     417:

    +418: 	return timestep

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

     419:

    +420: def protect(double minimum_allowed_height,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_17protect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_17protect = {"protect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_17protect, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_17protect(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_zc = 0;
      PyArrayObject *__pyx_v_xmomc = 0;
      PyArrayObject *__pyx_v_ymomc = 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_zc,&__pyx_n_s_xmomc,&__pyx_n_s_ymomc,0};
        PyObject* values[7] = {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  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, 7, 7, 1); __PYX_ERR(0, 420, __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, 7, 7, 2); __PYX_ERR(0, 420, __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, 7, 7, 3); __PYX_ERR(0, 420, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 7, 7, 4); __PYX_ERR(0, 420, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmomc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 7, 7, 5); __PYX_ERR(0, 420, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymomc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("protect", 1, 7, 7, 6); __PYX_ERR(0, 420, __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, 420, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
          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);
        }
        __pyx_v_minimum_allowed_height = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_minimum_allowed_height == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 420, __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, 421, __pyx_L3_error)
        __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L3_error)
        __pyx_v_wc = ((PyArrayObject *)values[3]);
        __pyx_v_zc = ((PyArrayObject *)values[4]);
        __pyx_v_xmomc = ((PyArrayObject *)values[5]);
        __pyx_v_ymomc = ((PyArrayObject *)values[6]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("protect", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 420, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_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, 423, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zc), __pyx_ptype_5numpy_ndarray, 0, "zc", 0))) __PYX_ERR(0, 424, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmomc), __pyx_ptype_5numpy_ndarray, 0, "xmomc", 0))) __PYX_ERR(0, 425, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymomc), __pyx_ptype_5numpy_ndarray, 0, "ymomc", 0))) __PYX_ERR(0, 426, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_16protect(__pyx_self, __pyx_v_minimum_allowed_height, __pyx_v_maximum_allowed_speed, __pyx_v_epsilon, __pyx_v_wc, __pyx_v_zc, __pyx_v_xmomc, __pyx_v_ymomc);
      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_17shallow_water_ext_16protect(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_zc, PyArrayObject *__pyx_v_xmomc, PyArrayObject *__pyx_v_ymomc) {
      int __pyx_v_N;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_wc;
      __Pyx_Buffer __pyx_pybuffer_wc;
      __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;
      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_zc.pybuffer.buf = NULL;
      __pyx_pybuffer_zc.refcount = 0;
      __pyx_pybuffernd_zc.data = NULL;
      __pyx_pybuffernd_zc.rcbuffer = &__pyx_pybuffer_zc;
      __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_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, 420, __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_zc.rcbuffer->pybuffer, (PyObject*)__pyx_v_zc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 420, __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_xmomc.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmomc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 420, __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, 420, __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];
    /* … */
      /* 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_wc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmomc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zc.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.protect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_xmomc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_zc.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__19 = PyTuple_Pack(8, __pyx_n_s_minimum_allowed_height, __pyx_n_s_maximum_allowed_speed, __pyx_n_s_epsilon, __pyx_n_s_wc, __pyx_n_s_zc, __pyx_n_s_xmomc, __pyx_n_s_ymomc, __pyx_n_s_N); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__19);
      __Pyx_GIVEREF(__pyx_tuple__19);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_17protect, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_protect, __pyx_t_1) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_protect, 420, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 420, __pyx_L1_error)

     421: 			double maximum_allowed_speed,\

     422: 			double epsilon,\

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

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

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

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

     427:

     428: 	cdef int N

     429:

    +430: 	N = wc.shape[0]

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

     431:

    +432: 	_protect(N, minimum_allowed_height, maximum_allowed_speed, epsilon, &wc[0], &zc[0], &xmomc[0], &ymomc[0])

      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      (void)(_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_BufPtrCContig1d(double *, __pyx_pybuffernd_zc.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_zc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmomc.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_xmomc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymomc.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ymomc.diminfo[0].strides)))));

     433:

    +434: def balance_deep_and_shallow(object domain_object,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_19balance_deep_and_shallow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_19balance_deep_and_shallow = {"balance_deep_and_shallow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_19balance_deep_and_shallow, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_19balance_deep_and_shallow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_domain_object = 0;
      PyArrayObject *__pyx_v_wc = 0;
      PyArrayObject *__pyx_v_zc = 0;
      PyArrayObject *__pyx_v_wv = 0;
      PyArrayObject *__pyx_v_zv = 0;
      PyArrayObject *__pyx_v_hvbar = 0;
      PyArrayObject *__pyx_v_xmomc = 0;
      PyArrayObject *__pyx_v_ymomc = 0;
      PyArrayObject *__pyx_v_xmomv = 0;
      PyArrayObject *__pyx_v_ymomv = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("balance_deep_and_shallow (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_domain_object,&__pyx_n_s_wc,&__pyx_n_s_zc,&__pyx_n_s_wv,&__pyx_n_s_zv,&__pyx_n_s_hvbar,&__pyx_n_s_xmomc,&__pyx_n_s_ymomc,&__pyx_n_s_xmomv,&__pyx_n_s_ymomv,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_domain_object)) != 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_wc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 1); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 2); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wv)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 3); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zv)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 4); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hvbar)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 5); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmomc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 6); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymomc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 7); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmomv)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 8); __PYX_ERR(0, 434, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ymomv)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, 9); __PYX_ERR(0, 434, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "balance_deep_and_shallow") < 0)) __PYX_ERR(0, 434, __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_domain_object = values[0];
        __pyx_v_wc = ((PyArrayObject *)values[1]);
        __pyx_v_zc = ((PyArrayObject *)values[2]);
        __pyx_v_wv = ((PyArrayObject *)values[3]);
        __pyx_v_zv = ((PyArrayObject *)values[4]);
        __pyx_v_hvbar = ((PyArrayObject *)values[5]);
        __pyx_v_xmomc = ((PyArrayObject *)values[6]);
        __pyx_v_ymomc = ((PyArrayObject *)values[7]);
        __pyx_v_xmomv = ((PyArrayObject *)values[8]);
        __pyx_v_ymomv = ((PyArrayObject *)values[9]);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("balance_deep_and_shallow", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 434, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_ext.balance_deep_and_shallow", __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, 435, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zc), __pyx_ptype_5numpy_ndarray, 0, "zc", 0))) __PYX_ERR(0, 436, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wv), __pyx_ptype_5numpy_ndarray, 0, "wv", 0))) __PYX_ERR(0, 437, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_zv), __pyx_ptype_5numpy_ndarray, 0, "zv", 0))) __PYX_ERR(0, 438, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hvbar), __pyx_ptype_5numpy_ndarray, 0, "hvbar", 0))) __PYX_ERR(0, 439, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmomc), __pyx_ptype_5numpy_ndarray, 0, "xmomc", 0))) __PYX_ERR(0, 440, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymomc), __pyx_ptype_5numpy_ndarray, 0, "ymomc", 0))) __PYX_ERR(0, 441, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmomv), __pyx_ptype_5numpy_ndarray, 0, "xmomv", 0))) __PYX_ERR(0, 442, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymomv), __pyx_ptype_5numpy_ndarray, 0, "ymomv", 0))) __PYX_ERR(0, 443, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_18balance_deep_and_shallow(__pyx_self, __pyx_v_domain_object, __pyx_v_wc, __pyx_v_zc, __pyx_v_wv, __pyx_v_zv, __pyx_v_hvbar, __pyx_v_xmomc, __pyx_v_ymomc, __pyx_v_xmomv, __pyx_v_ymomv);
      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_17shallow_water_ext_18balance_deep_and_shallow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_domain_object, PyArrayObject *__pyx_v_wc, PyArrayObject *__pyx_v_zc, PyArrayObject *__pyx_v_wv, PyArrayObject *__pyx_v_zv, PyArrayObject *__pyx_v_hvbar, PyArrayObject *__pyx_v_xmomc, PyArrayObject *__pyx_v_ymomc, PyArrayObject *__pyx_v_xmomv, PyArrayObject *__pyx_v_ymomv) {
      double __pyx_v_alpha_balance;
      double __pyx_v_H0;
      int __pyx_v_N;
      int __pyx_v_tight_slope_limiters;
      int __pyx_v_use_centroid_velocities;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_hvbar;
      __Pyx_Buffer __pyx_pybuffer_hvbar;
      __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_xmomv;
      __Pyx_Buffer __pyx_pybuffer_xmomv;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymomc;
      __Pyx_Buffer __pyx_pybuffer_ymomc;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_ymomv;
      __Pyx_Buffer __pyx_pybuffer_ymomv;
      __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("balance_deep_and_shallow", 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_zc.pybuffer.buf = NULL;
      __pyx_pybuffer_zc.refcount = 0;
      __pyx_pybuffernd_zc.data = NULL;
      __pyx_pybuffernd_zc.rcbuffer = &__pyx_pybuffer_zc;
      __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_zv.pybuffer.buf = NULL;
      __pyx_pybuffer_zv.refcount = 0;
      __pyx_pybuffernd_zv.data = NULL;
      __pyx_pybuffernd_zv.rcbuffer = &__pyx_pybuffer_zv;
      __pyx_pybuffer_hvbar.pybuffer.buf = NULL;
      __pyx_pybuffer_hvbar.refcount = 0;
      __pyx_pybuffernd_hvbar.data = NULL;
      __pyx_pybuffernd_hvbar.rcbuffer = &__pyx_pybuffer_hvbar;
      __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_xmomv.pybuffer.buf = NULL;
      __pyx_pybuffer_xmomv.refcount = 0;
      __pyx_pybuffernd_xmomv.data = NULL;
      __pyx_pybuffernd_xmomv.rcbuffer = &__pyx_pybuffer_xmomv;
      __pyx_pybuffer_ymomv.pybuffer.buf = NULL;
      __pyx_pybuffer_ymomv.refcount = 0;
      __pyx_pybuffernd_ymomv.data = NULL;
      __pyx_pybuffernd_ymomv.rcbuffer = &__pyx_pybuffer_ymomv;
      {
        __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, 434, __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_zc.rcbuffer->pybuffer, (PyObject*)__pyx_v_zc, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 434, __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_wv.rcbuffer->pybuffer, (PyObject*)__pyx_v_wv, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 434, __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_zv.rcbuffer->pybuffer, (PyObject*)__pyx_v_zv, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 434, __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_hvbar.rcbuffer->pybuffer, (PyObject*)__pyx_v_hvbar, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 434, __pyx_L1_error)
      }
      __pyx_pybuffernd_hvbar.diminfo[0].strides = __pyx_pybuffernd_hvbar.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hvbar.diminfo[0].shape = __pyx_pybuffernd_hvbar.rcbuffer->pybuffer.shape[0];
      {
        __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, 434, __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, 434, __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_xmomv.rcbuffer->pybuffer, (PyObject*)__pyx_v_xmomv, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 434, __pyx_L1_error)
      }
      __pyx_pybuffernd_xmomv.diminfo[0].strides = __pyx_pybuffernd_xmomv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_xmomv.diminfo[0].shape = __pyx_pybuffernd_xmomv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_xmomv.diminfo[1].strides = __pyx_pybuffernd_xmomv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_xmomv.diminfo[1].shape = __pyx_pybuffernd_xmomv.rcbuffer->pybuffer.shape[1];
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ymomv.rcbuffer->pybuffer, (PyObject*)__pyx_v_ymomv, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 434, __pyx_L1_error)
      }
      __pyx_pybuffernd_ymomv.diminfo[0].strides = __pyx_pybuffernd_ymomv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ymomv.diminfo[0].shape = __pyx_pybuffernd_ymomv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ymomv.diminfo[1].strides = __pyx_pybuffernd_ymomv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ymomv.diminfo[1].shape = __pyx_pybuffernd_ymomv.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_hvbar.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_xmomv.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomv.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.shallow_water_ext.balance_deep_and_shallow", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hvbar.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_xmomv.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomc.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ymomv.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__21 = PyTuple_Pack(15, __pyx_n_s_domain_object, __pyx_n_s_wc, __pyx_n_s_zc, __pyx_n_s_wv, __pyx_n_s_zv, __pyx_n_s_hvbar, __pyx_n_s_xmomc, __pyx_n_s_ymomc, __pyx_n_s_xmomv, __pyx_n_s_ymomv, __pyx_n_s_alpha_balance, __pyx_n_s_H0, __pyx_n_s_N, __pyx_n_s_tight_slope_limiters, __pyx_n_s_use_centroid_velocities); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__21);
      __Pyx_GIVEREF(__pyx_tuple__21);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_19balance_deep_and_shallow, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_balance_deep_and_shallow, __pyx_t_1) < 0) __PYX_ERR(0, 434, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(10, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_balance_deep_and_shallow, 434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 434, __pyx_L1_error)

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

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

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

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

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

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

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

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

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

     444:

    +445: 	cdef double alpha_balance = 2.0

      __pyx_v_alpha_balance = 2.0;

     446: 	cdef double H0

     447: 	cdef int N, tight_slope_limiters, use_centroid_velocities

     448:

    +449: 	alpha_balance = domain_object.alpha_balance

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_alpha_balance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __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, 449, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_alpha_balance = __pyx_t_2;

    +450: 	H0 = domain_object.H0

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_H0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __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, 450, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_H0 = __pyx_t_2;

    +451: 	tight_slope_limiters = domain_object.tight_slope_limiters

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_tight_slope_limiters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 451, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_tight_slope_limiters = __pyx_t_3;

    +452: 	use_centroid_velocities = domain_object.use_centroid_velocities

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_domain_object, __pyx_n_s_use_centroid_velocities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_use_centroid_velocities = __pyx_t_3;

     453:

    +454: 	N = wc.shape[0]

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

     455:

    +456: 	_balance_deep_and_shallow(N,\

      (void)(_balance_deep_and_shallow(__pyx_v_N, (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_wc.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_wc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_zc.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_zc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_wv.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_wv.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_wv.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_zv.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_zv.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_zv.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_hvbar.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_hvbar.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_xmomc.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_xmomc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_ymomc.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_ymomc.diminfo[0].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_xmomv.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_xmomv.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_xmomv.diminfo[1].strides))), (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_ymomv.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_ymomv.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_ymomv.diminfo[1].strides))), __pyx_v_H0, __pyx_v_tight_slope_limiters, __pyx_v_use_centroid_velocities, __pyx_v_alpha_balance));

    +457: 							&wc[0],\

      __pyx_t_4 = 0;

    +458: 							&zc[0],\

      __pyx_t_5 = 0;

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

      __pyx_t_6 = 0;
      __pyx_t_7 = 0;

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

      __pyx_t_8 = 0;
      __pyx_t_9 = 0;

    +461: 							&hvbar[0],\

      __pyx_t_10 = 0;

    +462: 							&xmomc[0],\

      __pyx_t_11 = 0;

    +463: 							&ymomc[0],\

      __pyx_t_12 = 0;

    +464: 							&xmomv[0,0],\

      __pyx_t_13 = 0;
      __pyx_t_14 = 0;

    +465: 							&ymomv[0,0],\

      __pyx_t_15 = 0;
      __pyx_t_16 = 0;

     466: 							H0,\

     467: 							tight_slope_limiters,\

     468: 							use_centroid_velocities,\

     469: 							alpha_balance)

     470:

    +471: def manning_friction_flat(double g,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_21manning_friction_flat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_21manning_friction_flat = {"manning_friction_flat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_21manning_friction_flat, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_21manning_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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __pyx_L3_error)
        __pyx_v_eps = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 472, __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, 471, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_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, 473, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_uh), __pyx_ptype_5numpy_ndarray, 0, "uh", 0))) __PYX_ERR(0, 474, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vh), __pyx_ptype_5numpy_ndarray, 0, "vh", 0))) __PYX_ERR(0, 475, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 0, "z", 0))) __PYX_ERR(0, 476, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eta), __pyx_ptype_5numpy_ndarray, 0, "eta", 0))) __PYX_ERR(0, 477, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom), __pyx_ptype_5numpy_ndarray, 0, "xmom", 0))) __PYX_ERR(0, 478, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom), __pyx_ptype_5numpy_ndarray, 0, "ymom", 0))) __PYX_ERR(0, 479, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_20manning_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_13shallow_water_17shallow_water_ext_20manning_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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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, 471, __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.shallow_water.shallow_water_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__23 = 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__23)) __PYX_ERR(0, 471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__23);
      __Pyx_GIVEREF(__pyx_tuple__23);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_21manning_friction_flat, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __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, 471, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(9, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_anuga_shallow_water_shallow_wate, __pyx_n_s_manning_friction_flat, 471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 471, __pyx_L1_error)

     472: 						double eps,\

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

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

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

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

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

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

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

     480:

     481:

     482: 	cdef int N

     483:

    +484: 	N = w.shape[0]

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

     485:

    +486: 	_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))));

    +487: 						&w[0],\

      __pyx_t_1 = 0;

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

      __pyx_t_2 = 0;
      __pyx_t_3 = 0;

    +489: 						&uh[0],\

      __pyx_t_4 = 0;

    +490: 						&vh[0],\

      __pyx_t_5 = 0;

    +491: 						&eta[0],\

      __pyx_t_6 = 0;

    +492: 						&xmom[0],\

      __pyx_t_7 = 0;

    +493: 						&ymom[0])

      __pyx_t_8 = 0;

     494:

    +495: def manning_friction_sloped(double g,\

    /* Python wrapper */
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_23manning_friction_sloped(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_23manning_friction_sloped = {"manning_friction_sloped", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_23manning_friction_sloped, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_5anuga_13shallow_water_17shallow_water_ext_23manning_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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __pyx_L3_error)
        __pyx_v_eps = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __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, 495, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("anuga.shallow_water.shallow_water_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, 497, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 0, "w", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_uh), __pyx_ptype_5numpy_ndarray, 0, "uh", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vh), __pyx_ptype_5numpy_ndarray, 0, "vh", 0))) __PYX_ERR(0, 500, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_5numpy_ndarray, 0, "z", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eta), __pyx_ptype_5numpy_ndarray, 0, "eta", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xmom), __pyx_ptype_5numpy_ndarray, 0, "xmom", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ymom), __pyx_ptype_5numpy_ndarray, 0, "ymom", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
      __pyx_r = __pyx_pf_5anuga_13shallow_water_17shallow_water_ext_22manning_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_13shallow_water_17shallow_water_ext_22manning_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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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, 495, __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.shallow_water.shallow_water_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__25 = 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__25)) __PYX_ERR(0, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__25);
      __Pyx_GIVEREF(__pyx_tuple__25);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5anuga_13shallow_water_17shallow_water_ext_23manning_friction_sloped, NULL, __pyx_n_s_anuga_shallow_water_shallow_wate_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __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, 495, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     496: 							double eps,\

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

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

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

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

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

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

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

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

     505:

     506: 	cdef int N

     507:

    +508: 	N = w.shape[0]

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

     509:

    +510: 	_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))));

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

      __pyx_t_1 = 0;
      __pyx_t_2 = 0;

    +512: 							&w[0],\

      __pyx_t_3 = 0;

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

      __pyx_t_4 = 0;
      __pyx_t_5 = 0;

    +514: 							&uh[0],\

      __pyx_t_6 = 0;

    +515: 							&vh[0],\

      __pyx_t_7 = 0;

    +516: 							&eta[0],\

      __pyx_t_8 = 0;

    +517: 							&xmom[0],\

      __pyx_t_9 = 0;

    +518: 							&ymom[0])

      __pyx_t_10 = 0;

     519:

     520:

     521:

     522:

     523:

     524:

     525:

     526:

     527:

     528:

     529:

     530:

     531:

     532: