Generated by Cython 0.24.1

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: integrate.c

+001: # # cython: profile=True
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 002: '''
 003: Created on Nov 4, 2013
 004: 
 005: @author: thocu
 006: '''
 007: #cython: boundscheck=False
 008: #cython: wraparound=False
 009: #cython: cdivision=True
 010: 
 011: import cython
+012: import sys
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 013: from cpython.mem cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
 014: from libc.math cimport isnan, isinf, round, ceil
 015: from cython cimport parallel
+016: from collections import OrderedDict
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_OrderedDict);
  __Pyx_GIVEREF(__pyx_n_s_OrderedDict);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_OrderedDict);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 017: 
+018: cdef const gsl_odeiv2_step_type * rk2 = gsl_odeiv2_step_rk2
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rk2 = gsl_odeiv2_step_rk2;
+019: cdef const gsl_odeiv2_step_type * rk4 = gsl_odeiv2_step_rk4
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rk4 = gsl_odeiv2_step_rk4;
+020: cdef const gsl_odeiv2_step_type * rkf45 = gsl_odeiv2_step_rkf45
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rkf45 = gsl_odeiv2_step_rkf45;
+021: cdef const gsl_odeiv2_step_type * rkck = gsl_odeiv2_step_rkck
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rkck = gsl_odeiv2_step_rkck;
+022: cdef const gsl_odeiv2_step_type * rk8pd = gsl_odeiv2_step_rk8pd
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rk8pd = gsl_odeiv2_step_rk8pd;
 023: # cdef const gsl_odeiv2_step_type * rk2imp = gsl_odeiv2_step_rk2imp
 024: # cdef const gsl_odeiv2_step_type * rk4imp = gsl_odeiv2_step_rk4imp
 025: # cdef const gsl_odeiv2_step_type * bsimp = gsl_odeiv2_step_bsimp
 026: # cdef const gsl_odeiv2_step_type * rk1imp = gsl_odeiv2_step_rk1imp
+027: cdef const gsl_odeiv2_step_type * msadams = gsl_odeiv2_step_msadams
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_msadams = gsl_odeiv2_step_msadams;
+028: cdef const gsl_odeiv2_step_type * msbdf = gsl_odeiv2_step_msbdf
  /* "VirtualMicrobes/cython_gsl_interface/integrate.pyx":28
 * # cdef const gsl_odeiv2_step_type * rk1imp = gsl_odeiv2_step_rk1imp
 * cdef const gsl_odeiv2_step_type * msadams = gsl_odeiv2_step_msadams
 * cdef const gsl_odeiv2_step_type * msbdf = gsl_odeiv2_step_msbdf             # <<<<<<<<<<<<<<
 * 
 * ''' INSPIRATION for diffusion *cash2.cpp*
 */
  __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_msbdf = gsl_odeiv2_step_msbdf;
 029: 
 030: ''' INSPIRATION for diffusion *cash2.cpp*
 031: void DiffusionDB(double **a,double diff_rate,struct point**nei[])
 032: {
 033:   static double **influx=NULL;
 034:   int i, j, nc, nr;
 035: 
 036:   nr = nrow;
 037:   nc = ncol;
 038: 
 039:   /* initialize */
 040:   if(influx==NULL)
 041:     influx = NewDB();
 042: 
 043:   for (i=1; i <= nr; i++)
 044:     /*$dir force_vector*/
 045:     for (j=1; j <= nc; j++){
 046:       influx[i][j] = a[nei[1][i][j].row][nei[1][i][j].col]
 047:               +a[nei[2][i][j].row][nei[2][i][j].col]
 048:               +a[nei[3][i][j].row][nei[3][i][j].col]
 049:               +a[nei[4][i][j].row][nei[4][i][j].col];
 050:     }
 051: 
 052:   for (i=1; i <= nr; i++)
 053:     /*$dir force_vector*/
 054:     for (j=1; j <= nc; j++){
 055:       a[i][j] = a[i][j] + diff_rate*influx[i][j] - 4*diff_rate*a[i][j];
 056:     }
 057: }
 058: '''
 059: 
+060: cdef void calc_grid_diffusion_force(integrator_str * int_s) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_calc_grid_diffusion_force(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_int_s) {
  int __pyx_v_i;
  int __pyx_v_j;
  struct mol_str *__pyx_v_small_mol;
  struct mol_str *__pyx_v_small_mol_nei;
  struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_env;
  struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_nei_env;
  struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_nei_int;
  CYTHON_UNUSED double __pyx_v_nei_conc;
/* … */
  /* function exit code */
}
 061:     cdef int i, j
 062:     cdef mol_str * small_mol
 063:     cdef mol_str * small_mol_nei
 064:     cdef env_str * env
 065:     cdef env_str * nei_env
 066:     cdef integrator_str * nei_int
+067:     env = int_s.sys_s.environment
  __pyx_t_1 = __pyx_v_int_s->sys_s->environment;
  __pyx_v_env = __pyx_t_1;
+068:     for i in range(env.nr_small_mols):
  __pyx_t_2 = __pyx_v_env->nr_small_mols;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
+069:         small_mol = env.small_mols[i]
    __pyx_v_small_mol = (__pyx_v_env->small_mols[__pyx_v_i]);
+070:         small_mol.grid_diffusion_force = 0
    __pyx_v_small_mol->grid_diffusion_force = 0.0;
+071:         for j in range(int_s.nr_neighbors):
    __pyx_t_4 = __pyx_v_int_s->nr_neighbors;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_j = __pyx_t_5;
+072:             nei_int = int_s.neighboring_ints_s[j]
      __pyx_v_nei_int = (__pyx_v_int_s->neighboring_ints_s[__pyx_v_j]);
+073:             nei_env = nei_int.sys_s.environment
      __pyx_t_1 = __pyx_v_nei_int->sys_s->environment;
      __pyx_v_nei_env = __pyx_t_1;
+074:             small_mol_nei = nei_env.small_mols[i]
      __pyx_v_small_mol_nei = (__pyx_v_nei_env->small_mols[__pyx_v_i]);
+075:             nei_conc = nei_int.sys_s.vars[small_mol_nei.variable]
      __pyx_v_nei_conc = (__pyx_v_nei_int->sys_s->vars[__pyx_v_small_mol_nei->variable]);
+076:             small_mol.grid_diffusion_force += nei_int.sys_s.vars[small_mol_nei.variable]
      __pyx_v_small_mol->grid_diffusion_force = (__pyx_v_small_mol->grid_diffusion_force + (__pyx_v_nei_int->sys_s->vars[__pyx_v_small_mol_nei->variable]));
    }
  }
 077: 
+078: cdef void calc_grid_diffusion_forces_nogil(spatial_integrator_str * spat_int_s, int num_threads) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_calc_grid_diffusion_forces_nogil(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_spatial_integrator_str *__pyx_v_spat_int_s, CYTHON_UNUSED int __pyx_v_num_threads) {
  int __pyx_v_i;
/* … */
  /* function exit code */
}
 079:     cdef int i
+080:     for i in parallel.prange(spat_int_s.nr_integrators, schedule='static', num_threads=num_threads):
  __pyx_t_1 = __pyx_v_spat_int_s->nr_integrators;
  if (1 == 0) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
/* … */
  __pyx_t_1 = __pyx_v_spat_int_s->nr_integrators;
  if (1 == 0) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static) num_threads(__pyx_v_num_threads)
              #endif /* _OPENMP */
              for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                  {
                      __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
+081:         calc_grid_diffusion_force(spat_int_s.integrators_s[i])
                      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_calc_grid_diffusion_force((__pyx_v_spat_int_s->integrators_s[__pyx_v_i]));
                  }
              }
          }
      }
  }
  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
      #undef likely
      #undef unlikely
      #define likely(x)   __builtin_expect(!!(x), 1)
      #define unlikely(x) __builtin_expect(!!(x), 0)
  #endif
 082: 
+083: cdef void diffuse_mols_to_neighbors(integrator_str * int_s, double diff_const) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_diffuse_mols_to_neighbors(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_int_s, double __pyx_v_diff_const) {
  int __pyx_v_i;
  int __pyx_v_j;
  struct mol_str *__pyx_v_small_mol;
  CYTHON_UNUSED struct mol_str *__pyx_v_small_mol_nei;
  struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_env;
  struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_nei_env;
  struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_nei_int;
  double __pyx_v_prev_conc;
/* … */
  /* function exit code */
}
 084:     cdef int i, j
 085:     cdef mol_str * small_mol
 086:     cdef mol_str * small_mol_nei
 087:     cdef env_str * env
 088:     cdef env_str * nei_env
 089:     cdef integrator_str * nei_int
 090:     cdef double prev_conc
+091:     env = int_s.sys_s.environment
  __pyx_t_1 = __pyx_v_int_s->sys_s->environment;
  __pyx_v_env = __pyx_t_1;
+092:     for i in range(env.nr_small_mols):
  __pyx_t_2 = __pyx_v_env->nr_small_mols;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
+093:         small_mol = env.small_mols[i]
    __pyx_v_small_mol = (__pyx_v_env->small_mols[__pyx_v_i]);
+094:         for j in range(int_s.nr_neighbors):
    __pyx_t_4 = __pyx_v_int_s->nr_neighbors;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_j = __pyx_t_5;
+095:             nei_int = int_s.neighboring_ints_s[j]
      __pyx_v_nei_int = (__pyx_v_int_s->neighboring_ints_s[__pyx_v_j]);
+096:             nei_env = nei_int.sys_s.environment
      __pyx_t_1 = __pyx_v_nei_int->sys_s->environment;
      __pyx_v_nei_env = __pyx_t_1;
+097:             small_mol_nei = nei_env.small_mols[i]
      __pyx_v_small_mol_nei = (__pyx_v_nei_env->small_mols[__pyx_v_i]);
+098:             prev_conc = int_s.sys_s.vars[small_mol.variable]
      __pyx_v_prev_conc = (__pyx_v_int_s->sys_s->vars[__pyx_v_small_mol->variable]);
+099:             int_s.sys_s.vars[small_mol.variable] = (prev_conc + diff_const * small_mol.grid_diffusion_force -
      (__pyx_v_int_s->sys_s->vars[__pyx_v_small_mol->variable]) = ((__pyx_v_prev_conc + (__pyx_v_diff_const * __pyx_v_small_mol->grid_diffusion_force)) - ((__pyx_v_int_s->nr_neighbors * __pyx_v_diff_const) * __pyx_v_prev_conc));
    }
  }
 100:                                             int_s.nr_neighbors * diff_const * prev_conc)
 101: 
+102: cdef void diffuse_mols_on_grid_nogil(spatial_integrator_str * spat_int_s,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_diffuse_mols_on_grid_nogil(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_spatial_integrator_str *__pyx_v_spat_int_s, double __pyx_v_diff_const, CYTHON_UNUSED int __pyx_v_num_threads) {
  int __pyx_v_i;
/* … */
  /* function exit code */
}
 103:                                      double diff_const, int num_threads) nogil:
 104:     cdef int i
+105:     for i in parallel.prange(spat_int_s.nr_integrators, schedule='static', num_threads=num_threads):
  __pyx_t_1 = __pyx_v_spat_int_s->nr_integrators;
  if (1 == 0) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
/* … */
  __pyx_t_1 = __pyx_v_spat_int_s->nr_integrators;
  if (1 == 0) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static) num_threads(__pyx_v_num_threads)
              #endif /* _OPENMP */
              for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                  {
                      __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
+106:         diffuse_mols_to_neighbors(spat_int_s.integrators_s[i], diff_const)
                      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_diffuse_mols_to_neighbors((__pyx_v_spat_int_s->integrators_s[__pyx_v_i]), __pyx_v_diff_const);
                  }
              }
          }
      }
  }
  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
      #undef likely
      #undef unlikely
      #define likely(x)   __builtin_expect(!!(x), 1)
      #define unlikely(x) __builtin_expect(!!(x), 0)
  #endif
 107: 
+108: cdef void round_vars_spatial(spatial_integrator_str * spat_int_s, int num_threads) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_round_vars_spatial(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_spatial_integrator_str *__pyx_v_spat_int_s, CYTHON_UNUSED int __pyx_v_num_threads) {
  int __pyx_v_i;
/* … */
  /* function exit code */
}
 109:     cdef int i
+110:     for i in parallel.prange(spat_int_s.nr_integrators, schedule='static', num_threads=num_threads):
  __pyx_t_1 = __pyx_v_spat_int_s->nr_integrators;
  if (1 == 0) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static)
/* … */
  __pyx_t_1 = __pyx_v_spat_int_s->nr_integrators;
  if (1 == 0) abort();
  {
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   (x)
          #define unlikely(x) (x)
      #endif
      __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
      if (__pyx_t_3 > 0)
      {
          #ifdef _OPENMP
          #pragma omp parallel
          #endif /* _OPENMP */
          {
              #ifdef _OPENMP
              #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) schedule(static) num_threads(__pyx_v_num_threads)
              #endif /* _OPENMP */
              for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                  {
                      __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
+111:         round_vars(spat_int_s.integrators_s[i])
                      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_round_vars((__pyx_v_spat_int_s->integrators_s[__pyx_v_i]), NULL);
                  }
              }
          }
      }
  }
  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
      #undef likely
      #undef unlikely
      #define likely(x)   __builtin_expect(!!(x), 1)
      #define unlikely(x) __builtin_expect(!!(x), 0)
  #endif
 112: 
+113: cdef void round_vars(integrator_str * int_s, double prec=1e10) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_round_vars(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_int_s, struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_9integrate_round_vars *__pyx_optional_args) {
  double __pyx_v_prec = ((double)1e10);
  int __pyx_v_i;
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_prec = __pyx_optional_args->prec;
    }
  }
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.round_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}
/* … */
struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_9integrate_round_vars {
  int __pyx_n;
  double prec;
};
 114:     cdef int i
+115:     for i in range(int_s.sys_s.dimension):
  __pyx_t_1 = __pyx_v_int_s->sys_s->dimension;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
 116:         #printf('%1.30f', int_s.sys_s.vars[i])
+117:         int_s.sys_s.vars[i] = round(int_s.sys_s.vars[i] * prec) / prec
    __pyx_t_3 = round(((__pyx_v_int_s->sys_s->vars[__pyx_v_i]) * __pyx_v_prec));
    if (unlikely(__pyx_v_prec == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 117, __pyx_L1_error)
    }
    (__pyx_v_int_s->sys_s->vars[__pyx_v_i]) = (__pyx_t_3 / __pyx_v_prec);
+118:         int_s.sys_s.derivs[i] = round(int_s.sys_s.derivs[i] * prec) / prec
    __pyx_t_3 = round(((__pyx_v_int_s->sys_s->derivs[__pyx_v_i]) * __pyx_v_prec));
    if (unlikely(__pyx_v_prec == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 118, __pyx_L1_error)
    }
    (__pyx_v_int_s->sys_s->derivs[__pyx_v_i]) = (__pyx_t_3 / __pyx_v_prec);
  }
 119:         #printf(' -> %1.30f, ', int_s.sys_s.vars[i])
 120: 
+121: cdef void print_sys_vars(integrator_str * int_s) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_print_sys_vars(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_int_s) {
  int __pyx_v_i;
/* … */
  /* function exit code */
}
 122:     cdef int i
+123:     for i in range(int_s.sys_s.dimension):
  __pyx_t_1 = __pyx_v_int_s->sys_s->dimension;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
+124:         printf(">var%d: %1.30f, ",i, int_s.sys_s.vars[i])
    printf(((char const *)">var%d: %1.30f, "), __pyx_v_i, (__pyx_v_int_s->sys_s->vars[__pyx_v_i]));
  }
+125:     printf('\n')
  printf(((char const *)"\n"));
 126: 
+127: cdef int run_spatial_system_nogil(spatial_integrator_str * spat_int_s, double delta_t_between_diff,
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_run_spatial_system_nogil(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_spatial_integrator_str *__pyx_v_spat_int_s, double __pyx_v_delta_t_between_diff, int __pyx_v_nr_diffusion_steps, double __pyx_v_diff_const, int __pyx_v_report_freq, int __pyx_v_num_threads) {
  CYTHON_UNUSED int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_error;
  double __pyx_v_report_step;
  double __pyx_v_t_tot;
  int __pyx_r;
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.run_spatial_system_nogil", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}
 128:                                   int nr_diffusion_steps, double diff_const, int report_freq,
 129:                                   int num_threads) nogil:
 130:     cdef:
 131:         int i, j
+132:         bint error = False
  __pyx_v_error = 0;
 133:         double report_step
 134:         double t_tot
+135:     t_tot = nr_diffusion_steps * delta_t_between_diff
  __pyx_v_t_tot = (__pyx_v_nr_diffusion_steps * __pyx_v_delta_t_between_diff);
+136:     if report_freq > 0:
  __pyx_t_1 = ((__pyx_v_report_freq > 0) != 0);
  if (__pyx_t_1) {
/* … */
    goto __pyx_L3;
  }
+137:         report_step = t_tot  / <double>report_freq
    if (unlikely(((double)__pyx_v_report_freq) == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      __PYX_ERR(0, 137, __pyx_L1_error)
    }
    __pyx_v_report_step = (__pyx_v_t_tot / ((double)__pyx_v_report_freq));
 138:     else:
+139:         report_step = t_tot
  /*else*/ {
    __pyx_v_report_step = __pyx_v_t_tot;
  }
  __pyx_L3:;
+140:     for i in range(nr_diffusion_steps):
  __pyx_t_2 = __pyx_v_nr_diffusion_steps;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;
+141:         calc_grid_diffusion_forces_nogil(spat_int_s, num_threads)
    __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_calc_grid_diffusion_forces_nogil(__pyx_v_spat_int_s, __pyx_v_num_threads);
+142:         diffuse_mols_on_grid_nogil(spat_int_s, diff_const*delta_t_between_diff, num_threads)
    __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_diffuse_mols_on_grid_nogil(__pyx_v_spat_int_s, (__pyx_v_diff_const * __pyx_v_delta_t_between_diff), __pyx_v_num_threads);
+143:         for j in parallel.prange(spat_int_s.nr_integrators, schedule='guided', num_threads=num_threads):
    __pyx_t_4 = __pyx_v_spat_int_s->nr_integrators;
    if (1 == 0) abort();
    {
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   (x)
            #define unlikely(x) (x)
        #endif
        __pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
        if (__pyx_t_6 > 0)
        {
            #ifdef _OPENMP
            #pragma omp parallel
            #endif /* _OPENMP */
            {
                #ifdef _OPENMP
                #pragma omp for lastprivate(__pyx_v_error) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(guided)
/* … */
    __pyx_t_4 = __pyx_v_spat_int_s->nr_integrators;
    if (1 == 0) abort();
    {
        #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
            #undef likely
            #undef unlikely
            #define likely(x)   (x)
            #define unlikely(x) (x)
        #endif
        __pyx_t_6 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
        if (__pyx_t_6 > 0)
        {
            #ifdef _OPENMP
            #pragma omp parallel
            #endif /* _OPENMP */
            {
                #ifdef _OPENMP
                #pragma omp for lastprivate(__pyx_v_error) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(guided) num_threads(__pyx_v_num_threads)
                #endif /* _OPENMP */
                for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
                    {
                        __pyx_v_j = (int)(0 + 1 * __pyx_t_5);
                        /* Initialize private variables to invalid values */
                        __pyx_v_error = ((int)0xbad0bad0);
+144:             error = run_system_nogil(spat_int_s.integrators_s[j], delta_t_between_diff, report_step )
                        __pyx_v_error = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_run_system_nogil((__pyx_v_spat_int_s->integrators_s[__pyx_v_j]), __pyx_v_delta_t_between_diff, __pyx_v_report_step);
+145:             if error:
                        __pyx_t_1 = (__pyx_v_error != 0);
                        if (__pyx_t_1) {
/* … */
                        }
                        goto __pyx_L12;
                        __pyx_L7_break:;
                        __pyx_parallel_why = 2;
                        goto __pyx_L11;
                        __pyx_L11:;
                        #ifdef _OPENMP
                        #pragma omp critical(__pyx_parallel_lastprivates0)
                        #endif /* _OPENMP */
                        {
                            __pyx_parallel_temp0 = __pyx_v_error;
                            __pyx_parallel_temp1 = __pyx_v_j;
                        }
                        __pyx_L12:;
                        #ifdef _OPENMP
                        #pragma omp flush(__pyx_parallel_why)
                        #endif /* _OPENMP */
                    }
                }
            }
        }
        if (__pyx_parallel_why) {
          __pyx_v_error = __pyx_parallel_temp0;
          __pyx_v_j = __pyx_parallel_temp1;
          switch (__pyx_parallel_why) {
          }
        }
    }
    #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
        #undef likely
        #undef unlikely
        #define likely(x)   __builtin_expect(!!(x), 1)
        #define unlikely(x) __builtin_expect(!!(x), 0)
    #endif
+146:                 break
                          goto __pyx_L7_break;
+147:         if error:
    __pyx_t_1 = (__pyx_v_error != 0);
    if (__pyx_t_1) {
/* … */
    }
  }
  __pyx_L5_break:;
+148:             break
      goto __pyx_L5_break;
+149:     return error
  __pyx_r = __pyx_v_error;
  goto __pyx_L0;
 150: 
+151: cdef int run_system_nogil(integrator_str * int_s, double delta_t, double report_step) nogil:
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_run_system_nogil(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_int_s, double __pyx_v_delta_t, double __pyx_v_report_step) {
  int __pyx_v_status;
  double __pyx_v_ti;
  double __pyx_v_t_next_report;
  double __pyx_v_t_next;
  double __pyx_v_t_end;
  int __pyx_v_error;
  int __pyx_v_report;
  double __pyx_v_EPSILON;
  CYTHON_UNUSED double __pyx_v_t_last_report;
  int __pyx_r;
/* … */
  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
 152:     cdef:
 153:         int i, steps, status
 154:         double ti, t_next_report, t_next, t_end
+155:         bint error = False
  __pyx_v_error = 0;
 156:         bint report
+157:         double EPSILON = 1e-10 # used for comparing diffusion and report step lengths
  __pyx_v_EPSILON = 1e-10;
+158:     t_end = int_s.time + delta_t
  __pyx_v_t_end = (__pyx_v_int_s->time + __pyx_v_delta_t);
+159:     ti = int_s.time
  __pyx_t_1 = __pyx_v_int_s->time;
  __pyx_v_ti = __pyx_t_1;
+160:     t_last_report = int_s.t_last_report
  __pyx_t_1 = __pyx_v_int_s->t_last_report;
  __pyx_v_t_last_report = __pyx_t_1;
+161:     gsl_odeiv2_driver_reset(int_s.driver)
  gsl_odeiv2_driver_reset(__pyx_v_int_s->driver);
+162:     while ti < t_end:
  while (1) {
    __pyx_t_2 = ((__pyx_v_ti < __pyx_v_t_end) != 0);
    if (!__pyx_t_2) break;
+163:         report = False
    __pyx_v_report = 0;
+164:         t_next = t_end
    __pyx_v_t_next = __pyx_v_t_end;
+165:         if report_step > 0:
    __pyx_t_2 = ((__pyx_v_report_step > 0.0) != 0);
    if (__pyx_t_2) {
/* … */
    }
+166:             t_next_report = int_s.t_last_report + report_step
      __pyx_v_t_next_report = (__pyx_v_int_s->t_last_report + __pyx_v_report_step);
+167:             if t_next_report < (t_next - EPSILON):
      __pyx_t_2 = ((__pyx_v_t_next_report < (__pyx_v_t_next - __pyx_v_EPSILON)) != 0);
      if (__pyx_t_2) {
/* … */
        goto __pyx_L6;
      }
+168:                 report = True
        __pyx_v_report = 1;
+169:                 t_next = t_next_report
        __pyx_v_t_next = __pyx_v_t_next_report;
+170:                 int_s.t_last_report = t_next
        __pyx_v_int_s->t_last_report = __pyx_v_t_next;
+171:             elif t_next_report < t_next + EPSILON:
      __pyx_t_2 = ((__pyx_v_t_next_report < (__pyx_v_t_next + __pyx_v_EPSILON)) != 0);
      if (__pyx_t_2) {
/* … */
      }
      __pyx_L6:;
+172:                 report = True
        __pyx_v_report = 1;
+173:                 int_s.t_last_report = t_next
        __pyx_v_int_s->t_last_report = __pyx_v_t_next;
+174:         ti = t_next
    __pyx_v_ti = __pyx_v_t_next;
 175:         #printf('time  %f\n', ti)
+176:         status = gsl_odeiv2_driver_apply (int_s.driver, & int_s.time, ti, int_s.sys_s.vars)
    __pyx_v_status = gsl_odeiv2_driver_apply(__pyx_v_int_s->driver, (&__pyx_v_int_s->time), __pyx_v_ti, __pyx_v_int_s->sys_s->vars);
+177:         if (status != GSL_SUCCESS):
    __pyx_t_2 = ((__pyx_v_status != __pyx_e_10cython_gsl_GSL_SUCCESS) != 0);
    if (__pyx_t_2) {
/* … */
      goto __pyx_L7;
    }
+178:             printf("error (%d) in integration. Step should be recomputed\n" , status)
      printf(((char const *)"error (%d) in integration. Step should be recomputed\n"), __pyx_v_status);
+179:             print_sys_vars(int_s)
      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_print_sys_vars(__pyx_v_int_s);
+180:             printf('\n')
      printf(((char const *)"\n"));
+181:             error = True
      __pyx_v_error = 1;
 182:             #break
 183:         #else:
+184:         elif check_inf_nan_negative(int_s.sys_s):
    __pyx_t_2 = (__pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_check_inf_nan_negative(__pyx_v_int_s->sys_s) != 0);
    if (__pyx_t_2) {
/* … */
    }
    __pyx_L7:;
+185:             printf("found nan or inf or negative val after integration. Step should be recomputed\n")
      printf(((char const *)"found nan or inf or negative val after integration. Step should be recomputed\n"));
+186:             print_sys_vars(int_s)
      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_print_sys_vars(__pyx_v_int_s);
+187:             printf('\n')
      printf(((char const *)"\n"));
+188:             error = True
      __pyx_v_error = 1;
 189:         #zero_negatives_nogil(int_s.sys_s)
 190:         #print_sys_vars(int_s) 
+191:         if error:
    __pyx_t_2 = (__pyx_v_error != 0);
    if (__pyx_t_2) {
/* … */
    }
+192:             break
      goto __pyx_L4_break;
+193:         if report:
    __pyx_t_2 = (__pyx_v_report != 0);
    if (__pyx_t_2) {
/* … */
    }
  }
  __pyx_L4_break:;
 194:             #printf('storing at t=%f\n', ti)
+195:             store_state_nogil(int_s.sys_s, int_s.time)
      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_state_nogil(__pyx_v_int_s->sys_s, __pyx_v_int_s->time);
+196:     return error
  __pyx_r = __pyx_v_error;
  goto __pyx_L0;
 197: 
+198: cdef bint check_inf_nan_negative(system_str * sys) nogil:
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_check_inf_nan_negative(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_system_str *__pyx_v_sys) {
  int __pyx_v_i;
  int __pyx_v_error;
  double __pyx_v_val;
  int __pyx_r;
/* … */
  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
 199:     cdef int i
+200:     cdef bint error = False
  __pyx_v_error = 0;
 201:     cdef double val
+202:     for i in range(sys.dimension):
  __pyx_t_1 = __pyx_v_sys->dimension;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
+203:         val = sys.vars[i]
    __pyx_v_val = (__pyx_v_sys->vars[__pyx_v_i]);
+204:         if isnan(val) or isinf(val) or (val < 0.):
    __pyx_t_4 = (isnan(__pyx_v_val) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = (isinf(__pyx_v_val) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = ((__pyx_v_val < 0.) != 0);
    __pyx_t_3 = __pyx_t_4;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_3) {
/* … */
    }
  }
  __pyx_L4_break:;
 205:             #sys.vars[i] = 0
+206:             error = True
      __pyx_v_error = 1;
+207:             break
      goto __pyx_L4_break;
+208:     return error
  __pyx_r = __pyx_v_error;
  goto __pyx_L0;
 209: 
+210: cdef void zero_negatives_nogil(system_str * sys) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_zero_negatives_nogil(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_system_str *__pyx_v_sys) {
  int __pyx_v_i;
/* … */
  /* function exit code */
}
 211:     cdef int i
+212:     for i in range(sys.dimension):
  __pyx_t_1 = __pyx_v_sys->dimension;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
+213:         if sys.vars[i] < 0.:
    __pyx_t_3 = (((__pyx_v_sys->vars[__pyx_v_i]) < 0.) != 0);
    if (__pyx_t_3) {
/* … */
    }
  }
+214:             printf('var %d @%f of %d to zero \n', i, sys.vars[i], sys.dimension)
      printf(((char const *)"var %d @%f of %d to zero \n"), __pyx_v_i, (__pyx_v_sys->vars[__pyx_v_i]), __pyx_v_sys->dimension);
+215:             sys.vars[i] = 0.
      (__pyx_v_sys->vars[__pyx_v_i]) = 0.;
 216: 
+217: cdef class SpatialIntegrator:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator {
  void (*init_spatial_integrators)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *, PyObject *, int, char *, double, double, double, double, double);
  void (*add_neighbors)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *);
  void (*add_integrator_structs)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *);
};
static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator;

 218: 
+219:     def __cinit__(self, grid,
/* Python wrapper */
static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_grid = 0;
  PyObject *__pyx_v_step_function = 0;
  double __pyx_v_hstart;
  double __pyx_v_epsabs;
  double __pyx_v_epsrel;
  double __pyx_v_time;
  double __pyx_v_product_scaling;
  int __pyx_v_per_integrator_threads;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_grid,&__pyx_n_s_step_function,&__pyx_n_s_hstart,&__pyx_n_s_epsabs,&__pyx_n_s_epsrel,&__pyx_n_s_time,&__pyx_n_s_product_scaling,&__pyx_n_s_per_integrator_threads,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_s_rkf45);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step_function);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hstart);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_epsabs);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_epsrel);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_time);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_product_scaling);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_per_integrator_threads);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_grid = values[0];
    __pyx_v_step_function = values[1];
    if (values[2]) {
      __pyx_v_hstart = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_hstart == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L3_error)
    } else {
      __pyx_v_hstart = ((double)1e-6);
    }
    if (values[3]) {
      __pyx_v_epsabs = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_epsabs == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L3_error)
    } else {
      __pyx_v_epsabs = ((double)1e-6);
    }
    if (values[4]) {
      __pyx_v_epsrel = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_epsrel == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L3_error)
    } else {
      __pyx_v_epsrel = ((double)0.0);
    }
    if (values[5]) {
      __pyx_v_time = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_time == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L3_error)
    } else {
      __pyx_v_time = ((double)0.0);
    }
    if (values[6]) {
      __pyx_v_product_scaling = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_product_scaling == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L3_error)
    } else {
      __pyx_v_product_scaling = ((double)1.);
    }
    if (values[7]) {
      __pyx_v_per_integrator_threads = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_per_integrator_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L3_error)
    } else {
      __pyx_v_per_integrator_threads = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self), __pyx_v_grid, __pyx_v_step_function, __pyx_v_hstart, __pyx_v_epsabs, __pyx_v_epsrel, __pyx_v_time, __pyx_v_product_scaling, __pyx_v_per_integrator_threads);

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

static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self, PyObject *__pyx_v_grid, PyObject *__pyx_v_step_function, double __pyx_v_hstart, double __pyx_v_epsabs, double __pyx_v_epsrel, double __pyx_v_time, double __pyx_v_product_scaling, int __pyx_v_per_integrator_threads) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 220:                   step_function="rkf45",
 221:                   double hstart=1e-6, double epsabs=1e-6, double epsrel=0.0,
 222:                   double time=0, double product_scaling=1., int per_integrator_threads=1):
+223:         self.grid = grid
  __Pyx_INCREF(__pyx_v_grid);
  __Pyx_GIVEREF(__pyx_v_grid);
  __Pyx_GOTREF(__pyx_v_self->grid);
  __Pyx_DECREF(__pyx_v_self->grid);
  __pyx_v_self->grid = __pyx_v_grid;
+224:         self.step_function = step_function
  __Pyx_INCREF(__pyx_v_step_function);
  __Pyx_GIVEREF(__pyx_v_step_function);
  __Pyx_GOTREF(__pyx_v_self->step_function);
  __Pyx_DECREF(__pyx_v_self->step_function);
  __pyx_v_self->step_function = __pyx_v_step_function;
+225:         self.hstart = hstart
  __pyx_v_self->hstart = __pyx_v_hstart;
+226:         self.epsabs = epsabs
  __pyx_v_self->epsabs = __pyx_v_epsabs;
+227:         self.epsrel = epsrel
  __pyx_v_self->epsrel = __pyx_v_epsrel;
+228:         self.per_integrator_threads = per_integrator_threads
  __pyx_v_self->per_integrator_threads = __pyx_v_per_integrator_threads;
+229:         self.product_scaling = product_scaling
  __pyx_v_self->product_scaling = __pyx_v_product_scaling;
+230:         self.init_spatial_integrators(self.grid, self.per_integrator_threads,
  __pyx_t_1 = __pyx_v_self->grid;
  __Pyx_INCREF(__pyx_t_1);
/* … */
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self->__pyx_vtab)->init_spatial_integrators(__pyx_v_self, __pyx_t_1, __pyx_v_self->per_integrator_threads, __pyx_t_2, __pyx_v_self->hstart, __pyx_v_self->epsabs, __pyx_v_self->epsrel, __pyx_v_time, __pyx_v_self->product_scaling);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+231:                               self.step_function, self.hstart, self.epsabs, self.epsrel,
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_self->step_function); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error)
 232:                               time, self.product_scaling)
 233: 
+234:     def update_diffusion_stepping(self, double delta_t_between_diff):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_3update_diffusion_stepping(PyObject *__pyx_v_self, PyObject *__pyx_arg_delta_t_between_diff); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_3update_diffusion_stepping(PyObject *__pyx_v_self, PyObject *__pyx_arg_delta_t_between_diff) {
  double __pyx_v_delta_t_between_diff;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_diffusion_stepping (wrapper)", 0);
  assert(__pyx_arg_delta_t_between_diff); {
    __pyx_v_delta_t_between_diff = __pyx_PyFloat_AsDouble(__pyx_arg_delta_t_between_diff); if (unlikely((__pyx_v_delta_t_between_diff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.update_diffusion_stepping", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_2update_diffusion_stepping(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self), ((double)__pyx_v_delta_t_between_diff));

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_2update_diffusion_stepping(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self, double __pyx_v_delta_t_between_diff) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_diffusion_stepping", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+235:         self.delta_t_between_diff = delta_t_between_diff
  __pyx_v_self->delta_t_between_diff = __pyx_v_delta_t_between_diff;
 236: 
+237:     cdef void init_spatial_integrators(self, grid,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_init_spatial_integrators(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self, PyObject *__pyx_v_grid, int __pyx_v_per_integrator_threads, char *__pyx_v_step_function, double __pyx_v_hstart, double __pyx_v_epsabs, double __pyx_v_epsrel, double __pyx_v_time, double __pyx_v_product_scaling) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  int __pyx_v_nr_neighbors;
  CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_gp = NULL;
  PyObject *__pyx_v_locality = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_spatial_integrators", 0);
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.init_spatial_integrators", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_gp);
  __Pyx_XDECREF(__pyx_v_locality);
  __Pyx_RefNannyFinishContext();
}
 238:                          int per_integrator_threads,
 239:                          char* step_function, double hstart,
 240:                          double epsabs, double epsrel, double time, double product_scaling):
+241:         if per_integrator_threads is None:
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_per_integrator_threads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
/* … */
  }
+242:             per_integrator_threads = self.per_integrator_threads
    __pyx_t_4 = __pyx_v_self->per_integrator_threads;
    __pyx_v_per_integrator_threads = __pyx_t_4;
+243:         if step_function is None:
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_step_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (((PyObject*)__pyx_t_1) == ((PyObject*)Py_None));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
/* … */
  }
+244:             step_function = self.step_function
    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_self->step_function); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
    __pyx_v_step_function = __pyx_t_5;
+245:         if hstart is None:
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_hstart); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
/* … */
  }
+246:             hstart = self.hstart
    __pyx_t_6 = __pyx_v_self->hstart;
    __pyx_v_hstart = __pyx_t_6;
+247:         if epsabs is None:
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_epsabs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {
/* … */
  }
+248:             epsabs = self.epsabs
    __pyx_t_6 = __pyx_v_self->epsabs;
    __pyx_v_epsabs = __pyx_t_6;
+249:         if epsrel is None:
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_epsrel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
/* … */
  }
+250:             epsrel = self.epsrel
    __pyx_t_6 = __pyx_v_self->epsrel;
    __pyx_v_epsrel = __pyx_t_6;
+251:         self.gp_to_integrators_c_dict = OrderedDict()
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_8) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gp_to_integrators_c_dict);
  __Pyx_DECREF(__pyx_v_self->gp_to_integrators_c_dict);
  __pyx_v_self->gp_to_integrators_c_dict = __pyx_t_1;
  __pyx_t_1 = 0;
 252:         cdef Integrator int_c
 253:         cdef int nr_neighbors
+254:         for i,gp in enumerate(list(grid.gp_iter)):
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_grid, __pyx_n_s_gp_iter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PySequence_List(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 254, __pyx_L1_error)
    #else
    __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_gp, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_8;
    __pyx_t_8 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+255:             nr_neighbors = len(gp.neighborhoods['diffusion'])
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_neighborhoods); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = PyObject_GetItem(__pyx_t_8, __pyx_n_s_diffusion); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_11 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_nr_neighbors = __pyx_t_11;
+256:             locality = gp.content
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_content); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF_SET(__pyx_v_locality, __pyx_t_10);
    __pyx_t_10 = 0;
+257:             int_c = Integrator.__new__(Integrator, locality,
    __pyx_t_18 = PyTuple_New(9); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __Pyx_INCREF(__pyx_v_locality);
    __Pyx_GIVEREF(__pyx_v_locality);
    PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_locality);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_18, 5, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_18, 6, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_18, 7, __pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_17);
    PyTuple_SET_ITEM(__pyx_t_18, 8, __pyx_t_17);
    __pyx_t_10 = 0;
    __pyx_t_8 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;
    __pyx_t_14 = 0;
    __pyx_t_15 = 0;
    __pyx_t_16 = 0;
    __pyx_t_17 = 0;
    __pyx_t_17 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator), __pyx_t_18, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    if (!(likely(__Pyx_TypeTest(__pyx_t_17, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator)))) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_17));
    __pyx_t_17 = 0;
+258:                                        nr_neighbors, per_integrator_threads,
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nr_neighbors); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_per_integrator_threads); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
+259:                                        step_function, hstart, epsabs, epsrel,
    __pyx_t_12 = __Pyx_PyBytes_FromString(__pyx_v_step_function); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyFloat_FromDouble(__pyx_v_hstart); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = PyFloat_FromDouble(__pyx_v_epsabs); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_epsrel); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
+260:                                        product_scaling, time)
    __pyx_t_16 = PyFloat_FromDouble(__pyx_v_product_scaling); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_17 = PyFloat_FromDouble(__pyx_v_time); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
+261:             if not int_c.sys_c.check_sane_vals():
    __pyx_t_3 = ((!(((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_int_c->sys_c->__pyx_vtab)->check_sane_vals(__pyx_v_int_c->sys_c) != 0)) != 0);
    if (__pyx_t_3) {
/* … */
    }
+262:                 print_sys_vars(&int_c.int_s)
      __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_print_sys_vars((&__pyx_v_int_c->int_s));
+263:                 printf('\n')
      printf(((char const *)"\n"));
 264:                 #raise Exception('values not sane')
 265: 
+266:             self.gp_to_integrators_c_dict[gp] = int_c
    if (unlikely(PyObject_SetItem(__pyx_v_self->gp_to_integrators_c_dict, __pyx_v_gp, ((PyObject *)__pyx_v_int_c)) < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
+267:         self.add_neighbors()
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self->__pyx_vtab)->add_neighbors(__pyx_v_self);
+268:         self.spat_int_s.nr_integrators = len(self.gp_to_integrators_c_dict)
  __pyx_t_1 = __pyx_v_self->gp_to_integrators_c_dict;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->spat_int_s.nr_integrators = __pyx_t_9;
+269:         self.add_integrator_structs()
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self->__pyx_vtab)->add_integrator_structs(__pyx_v_self);
 270: 
+271:     def update_drivers(self, step_function=None, hstart=None, epsabs=None, epsrel=None):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_5update_drivers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_5update_drivers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_step_function = 0;
  PyObject *__pyx_v_hstart = 0;
  PyObject *__pyx_v_epsabs = 0;
  PyObject *__pyx_v_epsrel = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_drivers (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_step_function,&__pyx_n_s_hstart,&__pyx_n_s_epsabs,&__pyx_n_s_epsrel,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step_function);
          if (value) { values[0] = value; kw_args--; }
        }
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hstart);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_epsabs);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_epsrel);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_drivers") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_step_function = values[0];
    __pyx_v_hstart = values[1];
    __pyx_v_epsabs = values[2];
    __pyx_v_epsrel = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_drivers", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.update_drivers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_4update_drivers(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self), __pyx_v_step_function, __pyx_v_hstart, __pyx_v_epsabs, __pyx_v_epsrel);

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_4update_drivers(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self, PyObject *__pyx_v_step_function, PyObject *__pyx_v_hstart, PyObject *__pyx_v_epsabs, PyObject *__pyx_v_epsrel) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  CYTHON_UNUSED PyObject *__pyx_v__gp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_drivers", 0);
  __Pyx_INCREF(__pyx_v_step_function);
  __Pyx_INCREF(__pyx_v_hstart);
  __Pyx_INCREF(__pyx_v_epsabs);
  __Pyx_INCREF(__pyx_v_epsrel);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.update_drivers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XDECREF(__pyx_v__gp);
  __Pyx_XDECREF(__pyx_v_step_function);
  __Pyx_XDECREF(__pyx_v_hstart);
  __Pyx_XDECREF(__pyx_v_epsabs);
  __Pyx_XDECREF(__pyx_v_epsrel);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+272:         if step_function is None:
  __pyx_t_1 = (__pyx_v_step_function == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
/* … */
  }
+273:             step_function = self.step_function
    __pyx_t_3 = __pyx_v_self->step_function;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_step_function, __pyx_t_3);
    __pyx_t_3 = 0;
+274:         if hstart is None:
  __pyx_t_2 = (__pyx_v_hstart == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
/* … */
  }
+275:             hstart = self.hstart
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->hstart); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_hstart, __pyx_t_3);
    __pyx_t_3 = 0;
+276:         if epsabs is None:
  __pyx_t_1 = (__pyx_v_epsabs == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
/* … */
  }
+277:             epsabs = self.epsabs
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->epsabs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_epsabs, __pyx_t_3);
    __pyx_t_3 = 0;
+278:         if epsrel is None:
  __pyx_t_2 = (__pyx_v_epsrel == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
/* … */
  }
+279:             epsrel = self.epsrel
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->epsrel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_epsrel, __pyx_t_3);
    __pyx_t_3 = 0;
 280:         cdef Integrator int_c
+281:         for _gp, int_c in self.gp_to_integrators_c_dict.items():
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->gp_to_integrators_c_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 281, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 281, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 281, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 281, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 281, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 281, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 281, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 281, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v__gp, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_8));
    __pyx_t_8 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+282:             int_c.set_params(step_function, hstart, epsabs, epsrel)
    __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_step_function); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_hstart); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_epsabs); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_epsrel); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L1_error)
    ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->set_params(__pyx_v_int_c, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14);
+283:             int_c.init_driver()
    ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->init_driver(__pyx_v_int_c);
+284:         print 'drivers updated with params step_function:{} hstart:{} epsabs:{} epsrel:{}'.format(step_function, hstart, epsabs, epsrel)
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_drivers_updated_with_params_step, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_8) {
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_INCREF(__pyx_v_step_function);
  __Pyx_GIVEREF(__pyx_v_step_function);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_step_function);
  __Pyx_INCREF(__pyx_v_hstart);
  __Pyx_GIVEREF(__pyx_v_hstart);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_hstart);
  __Pyx_INCREF(__pyx_v_epsabs);
  __Pyx_GIVEREF(__pyx_v_epsabs);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_epsabs);
  __Pyx_INCREF(__pyx_v_epsrel);
  __Pyx_GIVEREF(__pyx_v_epsrel);
  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_6, __pyx_v_epsrel);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PrintOne(0, __pyx_t_4) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 285: 
+286:     def update_integrators(self, product_scaling, double time, bint reset):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_7update_integrators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_7update_integrators(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_product_scaling = 0;
  double __pyx_v_time;
  int __pyx_v_reset;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_integrators (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_product_scaling,&__pyx_n_s_time,&__pyx_n_s_reset,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);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_product_scaling)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_time)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_integrators", 1, 3, 3, 1); __PYX_ERR(0, 286, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reset)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update_integrators", 1, 3, 3, 2); __PYX_ERR(0, 286, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_integrators") < 0)) __PYX_ERR(0, 286, __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_product_scaling = values[0];
    __pyx_v_time = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_time == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
    __pyx_v_reset = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_reset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update_integrators", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.update_integrators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_6update_integrators(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self), __pyx_v_product_scaling, __pyx_v_time, __pyx_v_reset);

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_6update_integrators(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self, PyObject *__pyx_v_product_scaling, double __pyx_v_time, int __pyx_v_reset) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  PyObject *__pyx_v_gp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_integrators", 0);
/* … */
  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.update_integrators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XDECREF(__pyx_v_gp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 287:         cdef Integrator int_c
+288:         for gp, int_c in self.gp_to_integrators_c_dict.items():
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->gp_to_integrators_c_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 288, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 288, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 288, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 288, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 288, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_gp, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_6));
    __pyx_t_6 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+289:             if gp.updated:
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_updated); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_9) {
/* … */
      goto __pyx_L7;
    }
+290:                 int_c.init_sys(gp.content, time, product_scaling,
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_content); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_product_scaling); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
/* … */
      ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->init_sys(__pyx_v_int_c, __pyx_t_1, __pyx_v_time, __pyx_t_10, __pyx_v_self->per_integrator_threads);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 291:                                self.per_integrator_threads
 292:                                )
+293:                 int_c.init_driver()
      ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->init_driver(__pyx_v_int_c);
 294:             else:
 295:                 # update the states of variables 
+296:                 int_c.update_sys(time, product_scaling, reset)
    /*else*/ {
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_product_scaling); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error)
      ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->update_sys(__pyx_v_int_c, __pyx_v_time, __pyx_t_10, __pyx_v_reset);
    }
    __pyx_L7:;
 297: 
+298:     cdef void add_neighbors(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_add_neighbors(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  PyObject *__pyx_v_gp = NULL;
  PyObject *__pyx_v_neighbor_gps = NULL;
  PyObject *__pyx_v_neighboring_int_c = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_neighbors", 0);
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.add_neighbors", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XDECREF(__pyx_v_gp);
  __Pyx_XDECREF(__pyx_v_neighbor_gps);
  __Pyx_XDECREF(__pyx_v_neighboring_int_c);
  __Pyx_RefNannyFinishContext();
}
 299:         cdef Integrator int_c
+300:         for gp, int_c in self.gp_to_integrators_c_dict.items():
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->gp_to_integrators_c_dict, __pyx_n_s_items); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 300, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 300, __pyx_L1_error)
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 300, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 300, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 300, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_gp, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_6));
    __pyx_t_6 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+301:             neighbor_gps = gp.neighbor_gps('diffusion')
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gp, __pyx_n_s_neighbor_gps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_neighbor_gps, __pyx_t_6);
    __pyx_t_6 = 0;
/* … */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_diffusion); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);
+302:             neighboring_int_c = [ self.gp_to_integrators_c_dict[gp] for gp in neighbor_gps ]
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (likely(PyList_CheckExact(__pyx_v_neighbor_gps)) || PyTuple_CheckExact(__pyx_v_neighbor_gps)) {
      __pyx_t_1 = __pyx_v_neighbor_gps; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_neighbor_gps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 302, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 302, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 302, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_10(__pyx_t_1);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 302, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF_SET(__pyx_v_gp, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(__pyx_v_self->gp_to_integrators_c_dict, __pyx_v_gp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_neighboring_int_c, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;
+303:             int_c.add_neighboring_integrators(neighboring_int_c)
    ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->add_neighboring_integrators(__pyx_v_int_c, __pyx_v_neighboring_int_c);
 304: 
+305:     cdef void add_integrator_structs(self):
/* "VirtualMicrobes/cython_gsl_interface/integrate.pyx":305
 *             int_c.add_neighboring_integrators(neighboring_int_c)
 * 
 *     cdef void add_integrator_structs(self):             # <<<<<<<<<<<<<<
 *         cdef int nr_integrators = len(self.gp_to_integrators_c_dict)
 *         self.spat_int_s.integrators_s = < integrator_str **> PyMem_Malloc(nr_integrators *
 */

static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_add_integrator_structs(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self) {
  int __pyx_v_nr_integrators;
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  int __pyx_v_i;
  PyObject *__pyx_v_integrator = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_integrator_structs", 0);

  /* "VirtualMicrobes/cython_gsl_interface/integrate.pyx":305
 *             int_c.add_neighboring_integrators(neighboring_int_c)
 * 
 *     cdef void add_integrator_structs(self):             # <<<<<<<<<<<<<<
 *         cdef int nr_integrators = len(self.gp_to_integrators_c_dict)
 *         self.spat_int_s.integrators_s = < integrator_str **> PyMem_Malloc(nr_integrators *
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.add_integrator_structs", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XDECREF(__pyx_v_integrator);
  __Pyx_RefNannyFinishContext();
}
+306:         cdef int nr_integrators = len(self.gp_to_integrators_c_dict)
  __pyx_t_1 = __pyx_v_self->gp_to_integrators_c_dict;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nr_integrators = __pyx_t_2;
+307:         self.spat_int_s.integrators_s = < integrator_str **> PyMem_Malloc(nr_integrators *
  __pyx_v_self->spat_int_s.integrators_s = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str **)PyMem_Malloc((__pyx_v_nr_integrators * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *)))));
 308:                                                                     sizeof(integrator_str *))
 309:         cdef Integrator int_c
 310:         cdef int i
+311:         for i, integrator in enumerate(self.gp_to_integrators_c_dict.values()):
  __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->gp_to_integrators_c_dict, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 311, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 311, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 311, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 311, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_integrator, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = (__pyx_t_3 + 1);
/* … */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+312:             int_c = integrator
    if (!(likely(((__pyx_v_integrator) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_integrator, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 312, __pyx_L1_error)
    __pyx_t_1 = __pyx_v_integrator;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_1));
    __pyx_t_1 = 0;
+313:             self.spat_int_s.integrators_s[i] = & int_c.int_s
    (__pyx_v_self->spat_int_s.integrators_s[__pyx_v_i]) = (&__pyx_v_int_c->int_s);
 314: 
+315:     def store_nr_time_points_py(self):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_9store_nr_time_points_py(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_9store_nr_time_points_py(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("store_nr_time_points_py (wrapper)", 0);
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_8store_nr_time_points_py(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self));

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_8store_nr_time_points_py(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("store_nr_time_points_py", 0);
/* … */
  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.store_nr_time_points_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 316:         cdef Integrator int_c
+317:         for int_c in self.gp_to_integrators_c_dict.values():
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->gp_to_integrators_c_dict, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 317, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 317, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 317, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 317, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 317, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_1));
    __pyx_t_1 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+318:             int_c.store_nr_time_points_py()
    __pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->store_nr_time_points_py(__pyx_v_int_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 319: 
+320:     def run_spatial_system(self, int diffusion_steps, double delta_t_between_diff,
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_11run_spatial_system(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_11run_spatial_system(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_diffusion_steps;
  double __pyx_v_delta_t_between_diff;
  double __pyx_v_diffusion_constant;
  int __pyx_v_report_freq;
  int __pyx_v_num_threads;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_spatial_system (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_diffusion_steps,&__pyx_n_s_delta_t_between_diff,&__pyx_n_s_diffusion_constant,&__pyx_n_s_report_freq,&__pyx_n_s_num_threads,0};
    PyObject* values[5] = {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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diffusion_steps)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delta_t_between_diff)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run_spatial_system", 1, 5, 5, 1); __PYX_ERR(0, 320, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diffusion_constant)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run_spatial_system", 1, 5, 5, 2); __PYX_ERR(0, 320, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_report_freq)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run_spatial_system", 1, 5, 5, 3); __PYX_ERR(0, 320, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run_spatial_system", 1, 5, 5, 4); __PYX_ERR(0, 320, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run_spatial_system") < 0)) __PYX_ERR(0, 320, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
    }
    __pyx_v_diffusion_steps = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_diffusion_steps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error)
    __pyx_v_delta_t_between_diff = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_delta_t_between_diff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L3_error)
    __pyx_v_diffusion_constant = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_diffusion_constant == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L3_error)
    __pyx_v_report_freq = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_report_freq == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L3_error)
    __pyx_v_num_threads = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 323, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("run_spatial_system", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 320, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.run_spatial_system", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_10run_spatial_system(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self), __pyx_v_diffusion_steps, __pyx_v_delta_t_between_diff, __pyx_v_diffusion_constant, __pyx_v_report_freq, __pyx_v_num_threads);

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_10run_spatial_system(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self, int __pyx_v_diffusion_steps, double __pyx_v_delta_t_between_diff, double __pyx_v_diffusion_constant, int __pyx_v_report_freq, int __pyx_v_num_threads) {
  int __pyx_v_errors;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_spatial_system", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.run_spatial_system", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 321:                            double diffusion_constant,
 322:                            int report_freq,
 323:                            int num_threads):
+324:         print 'running system with', num_threads, 'threads',
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_s_running_system_with);
  __Pyx_GIVEREF(__pyx_kp_s_running_system_with);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_running_system_with);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_threads);
  __Pyx_GIVEREF(__pyx_n_s_threads);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_threads);
  __pyx_t_1 = 0;
  if (__Pyx_Print(0, __pyx_t_2, 0) < 0) __PYX_ERR(0, 324, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+325:         print 'for', diffusion_steps, 'steps of length', delta_t_between_diff,
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_diffusion_steps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_delta_t_between_diff); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_for);
  __Pyx_GIVEREF(__pyx_n_s_for);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_for);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_kp_s_steps_of_length);
  __Pyx_GIVEREF(__pyx_kp_s_steps_of_length);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s_steps_of_length);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  if (__Pyx_Print(0, __pyx_t_3, 0) < 0) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+326:         print 'at diffusion constant', diffusion_constant,
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_diffusion_constant); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_s_at_diffusion_constant);
  __Pyx_GIVEREF(__pyx_kp_s_at_diffusion_constant);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_at_diffusion_constant);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  if (__Pyx_Print(0, __pyx_t_1, 0) < 0) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+327:         print 'and saving', report_freq, 'time points per step'
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_report_freq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_kp_s_and_saving);
  __Pyx_GIVEREF(__pyx_kp_s_and_saving);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_and_saving);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_kp_s_time_points_per_step);
  __Pyx_GIVEREF(__pyx_kp_s_time_points_per_step);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s_time_points_per_step);
  __pyx_t_1 = 0;
  if (__Pyx_Print(0, __pyx_t_3, 1) < 0) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+328:         with nogil:
  {
      #ifdef WITH_THREAD
      PyThreadState *_save;
      Py_UNBLOCK_THREADS
      #endif
      /*try:*/ {
/* … */
      /*finally:*/ {
        /*normal exit:*/{
          #ifdef WITH_THREAD
          Py_BLOCK_THREADS
          #endif
          goto __pyx_L5;
        }
        __pyx_L5:;
      }
  }
+329:             errors = run_spatial_system_nogil(&self.spat_int_s, delta_t_between_diff,
        __pyx_v_errors = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_run_spatial_system_nogil((&__pyx_v_self->spat_int_s), __pyx_v_delta_t_between_diff, __pyx_v_diffusion_steps, __pyx_v_diffusion_constant, __pyx_v_report_freq, __pyx_v_num_threads);
      }
 330:                                       diffusion_steps, diffusion_constant,
 331:                                       report_freq,
 332:                                       num_threads)
 333:         #if not errors:
 334:         #round_vars_spatial(&self.spat_int_s, num_threads)
 335:         #self.store_nr_time_points_py()
+336:         return errors
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_errors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 337: 
+338:     def print_spatial_sys_vars(self):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_13print_spatial_sys_vars(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_12print_spatial_sys_vars[] = "print out all variable values \n        \n        ";
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_13print_spatial_sys_vars(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_spatial_sys_vars (wrapper)", 0);
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_12print_spatial_sys_vars(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self));

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_12print_spatial_sys_vars(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_int_c = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_spatial_sys_vars", 0);
/* … */
  /* 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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.SpatialIntegrator.print_spatial_sys_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_int_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 339:         '''print out all variable values 
 340:         
 341:         '''
 342:         cdef Integrator int_c
+343:         for int_c in self.gp_to_integrators_c_dict.values():
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->gp_to_integrators_c_dict, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 343, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_1));
    __pyx_t_1 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+344:             int_c.print_sys_vars()
    ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_int_c->__pyx_vtab)->print_sys_vars(__pyx_v_int_c);
+345:             print
    if (__Pyx_Print(0, __pyx_empty_tuple, 1) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
 346: 
+347:     def __dealloc__(self):
/* Python wrapper */
static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_15__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_15__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_14__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self));

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

static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_14__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+348:         PyMem_Free(self.spat_int_s.integrators_s)
  PyMem_Free(__pyx_v_self->spat_int_s.integrators_s);
 349: 
+350:     def diffusion_step(self):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_17diffusion_step(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_17diffusion_step(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diffusion_step (wrapper)", 0);
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_16diffusion_step(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *)__pyx_v_self));

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_17SpatialIntegrator_16diffusion_step(CYTHON_UNUSED struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_SpatialIntegrator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diffusion_step", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 351:         pass
 352: 
+353: cdef class Integrator:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator {
  gsl_odeiv2_step_type const *(*select_step_function)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_select_step_function *__pyx_optional_args);
  void (*init_sys)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, PyObject *, double, double, int);
  void (*init_driver)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *);
  void (*update_sys)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, double, double, int);
  void (*set_params)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, char *, double, double, double);
  void (*add_neighboring_int)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *, int);
  void (*add_neighboring_integrators)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, PyObject *);
  void (*print_sys_vars)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *);
  PyObject *(*store_nr_time_points_py)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *);
  void (*add_jacobian)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *, __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_JAC);
};
static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator;

 354:     '''
 355:     This will wrap the integrator from (cython)gsl, by initializing a stepper
 356:     with the 'master'-equation
 357:     '''
 358: 
+359:     def __cinit__(self, locality, int nr_neighbors=0, int num_threads=1,
/* Python wrapper */
static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_locality = 0;
  int __pyx_v_nr_neighbors;
  int __pyx_v_num_threads;
  PyObject *__pyx_v_step_function = 0;
  double __pyx_v_hstart;
  double __pyx_v_epsabs;
  double __pyx_v_epsrel;
  double __pyx_v_init_time;
  PyObject *__pyx_v_product_scaling = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_locality,&__pyx_n_s_nr_neighbors,&__pyx_n_s_num_threads,&__pyx_n_s_step_function,&__pyx_n_s_hstart,&__pyx_n_s_epsabs,&__pyx_n_s_epsrel,&__pyx_n_s_init_time,&__pyx_n_s_product_scaling,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s_rkf45);
    values[8] = ((PyObject *)__pyx_float_1_);
    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);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locality)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nr_neighbors);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_threads);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_step_function);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hstart);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_epsabs);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_epsrel);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_init_time);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_product_scaling);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_locality = values[0];
    if (values[1]) {
      __pyx_v_nr_neighbors = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nr_neighbors == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
    } else {
      __pyx_v_nr_neighbors = ((int)0);
    }
    if (values[2]) {
      __pyx_v_num_threads = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
    } else {
      __pyx_v_num_threads = ((int)1);
    }
    __pyx_v_step_function = values[3];
    if (values[4]) {
      __pyx_v_hstart = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_hstart == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
    } else {
      __pyx_v_hstart = ((double)1e-6);
    }
    if (values[5]) {
      __pyx_v_epsabs = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_epsabs == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
    } else {
      __pyx_v_epsabs = ((double)1e-6);
    }
    if (values[6]) {
      __pyx_v_epsrel = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_epsrel == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
    } else {
      __pyx_v_epsrel = ((double)0.0);
    }
    if (values[7]) {
      __pyx_v_init_time = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_init_time == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 361, __pyx_L3_error)
    } else {
      __pyx_v_init_time = ((double)0.);
    }
    __pyx_v_product_scaling = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self), __pyx_v_locality, __pyx_v_nr_neighbors, __pyx_v_num_threads, __pyx_v_step_function, __pyx_v_hstart, __pyx_v_epsabs, __pyx_v_epsrel, __pyx_v_init_time, __pyx_v_product_scaling);

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

static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, PyObject *__pyx_v_locality, int __pyx_v_nr_neighbors, int __pyx_v_num_threads, PyObject *__pyx_v_step_function, double __pyx_v_hstart, double __pyx_v_epsabs, double __pyx_v_epsrel, double __pyx_v_init_time, PyObject *__pyx_v_product_scaling) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 360:                   step_function="rkf45", double hstart=1e-6, double epsabs=1e-6, double epsrel=0.0,
 361:                   double init_time=0., product_scaling=1.):
 362:         '''
 363:         Constructor 
 364:         '''
+365:         self.int_s.nr_neighbors = nr_neighbors
  __pyx_v_self->int_s.nr_neighbors = __pyx_v_nr_neighbors;
+366:         self.int_s.driver = NULL
  __pyx_v_self->int_s.driver = NULL;
+367:         self.int_s.neighboring_ints_s = <integrator_str**>PyMem_Malloc(nr_neighbors * sizeof(integrator_str*))
  __pyx_v_self->int_s.neighboring_ints_s = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str **)PyMem_Malloc((__pyx_v_nr_neighbors * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *)))));
+368:         self.init_sys(locality, init_time, product_scaling, num_threads)
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_product_scaling); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L1_error)
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self->__pyx_vtab)->init_sys(__pyx_v_self, __pyx_v_locality, __pyx_v_init_time, __pyx_t_1, __pyx_v_num_threads);
+369:         self.set_params(step_function, hstart, epsabs, epsrel)
  __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_step_function); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L1_error)
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self->__pyx_vtab)->set_params(__pyx_v_self, __pyx_t_2, __pyx_v_hstart, __pyx_v_epsabs, __pyx_v_epsrel);
+370:         self.init_driver()
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self->__pyx_vtab)->init_driver(__pyx_v_self);
 371: 
+372:     cdef const gsl_odeiv2_step_type * select_step_function(self, char * name="rkf45"):
static gsl_odeiv2_step_type const *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_select_step_function(CYTHON_UNUSED struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_select_step_function *__pyx_optional_args) {
  char *__pyx_v_name = ((char *)((char *)"rkf45"));
  gsl_odeiv2_step_type const *__pyx_v_stepper;
  gsl_odeiv2_step_type const *__pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select_step_function", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_name = __pyx_optional_args->name;
    }
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.select_step_function", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+373:         cdef const gsl_odeiv2_step_type * stepper = rkf45
  __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rkf45;
+374:         if name == b"rk8pd":
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_rk8pd, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 374, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+375:             stepper = rk8pd
    __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rk8pd;
+376:         elif name == b"rk2":
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_rk2, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+377:             stepper = rk2
    __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rk2;
+378:         elif name == b"rk4":
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_rk4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 378, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+379:             stepper = rk4
    __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rk4;
+380:         elif name == b"rkf45":
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_rkf45, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+381:             stepper = rkf45
    __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rkf45;
+382:         elif name == b"rkck":
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_rkck, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+383:             stepper = rkck
    __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_rkck;
+384:         elif name == b"msadams":
  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_1, __pyx_n_b_msadams, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+385:             stepper = msadams
    __pyx_v_stepper = __pyx_v_15VirtualMicrobes_20cython_gsl_interface_9integrate_msadams;
 386:         else:
+387:             print "unknown driver type:", name
  /*else*/ {
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_s_unknown_driver_type);
    __Pyx_GIVEREF(__pyx_kp_s_unknown_driver_type);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_unknown_driver_type);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __pyx_t_1 = 0;
    if (__Pyx_Print(0, __pyx_t_3, 1) < 0) __PYX_ERR(0, 387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+388:             print "using rkf45"
    if (__Pyx_PrintOne(0, __pyx_kp_s_using_rkf45) < 0) __PYX_ERR(0, 388, __pyx_L1_error)
  }
  __pyx_L3:;
+389:         return stepper
  __pyx_r = __pyx_v_stepper;
  goto __pyx_L0;
 390: 
+391:     cdef void set_params(self, char * step_function, double hstart, double epsabs, double epsrel):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_set_params(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, char *__pyx_v_step_function, double __pyx_v_hstart, double __pyx_v_epsabs, double __pyx_v_epsrel) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_params", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+392:         self.stepper = self.select_step_function(step_function)
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.name = __pyx_v_step_function;
  __pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self->__pyx_vtab)->select_step_function(__pyx_v_self, &__pyx_t_2); 
  __pyx_v_self->stepper = __pyx_t_1;
+393:         self.hstart = hstart
  __pyx_v_self->hstart = __pyx_v_hstart;
+394:         self.epsabs = epsabs
  __pyx_v_self->epsabs = __pyx_v_epsabs;
+395:         self.epsrel = epsrel
  __pyx_v_self->epsrel = __pyx_v_epsrel;
 396: 
+397:     cdef void init_sys(self, locality, double time, double product_scaling, int num_threads):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_init_sys(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, PyObject *__pyx_v_locality, double __pyx_v_time, double __pyx_v_product_scaling, int __pyx_v_num_threads) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_sys = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_sys", 0);
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.init_sys", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sys);
  __Pyx_RefNannyFinishContext();
}
+398:         cdef SYSTEM sys = SYSTEM.__new__(SYSTEM, locality, product_scaling, num_threads)
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_product_scaling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_locality);
  __Pyx_GIVEREF(__pyx_v_locality);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_locality);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_tp_new(((PyObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM), ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM)))) __PYX_ERR(0, 398, __pyx_L1_error)
  __pyx_v_sys = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_t_2);
  __pyx_t_2 = 0;
+399:         self.sys_c = sys
  __Pyx_INCREF(((PyObject *)__pyx_v_sys));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_sys));
  __Pyx_GOTREF(__pyx_v_self->sys_c);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->sys_c));
  __pyx_v_self->sys_c = __pyx_v_sys;
+400:         self.int_s.sys_s = & self.sys_c.sys_s
  __pyx_v_self->int_s.sys_s = (&__pyx_v_self->sys_c->sys_s);
+401:         self.int_s.vars = & self.sys_c.sys_s.vars
  __pyx_v_self->int_s.vars = (&__pyx_v_self->sys_c->sys_s.vars);
+402:         self.int_s.gsl_sys.function = self.sys_c.sys_s.master_eq
  __pyx_t_4 = __pyx_v_self->sys_c->sys_s.master_eq;
  __pyx_v_self->int_s.gsl_sys.function = __pyx_t_4;
+403:         self.int_s.gsl_sys.dimension = self.sys_c.sys_s.dimension
  __pyx_t_5 = __pyx_v_self->sys_c->sys_s.dimension;
  __pyx_v_self->int_s.gsl_sys.dimension = __pyx_t_5;
+404:         self.int_s.gsl_sys.params = self.int_s.sys_s
  __pyx_t_6 = __pyx_v_self->int_s.sys_s;
  __pyx_v_self->int_s.gsl_sys.params = __pyx_t_6;
+405:         self.int_s.time = time
  __pyx_v_self->int_s.time = __pyx_v_time;
+406:         self.int_s.t_last_report = time
  __pyx_v_self->int_s.t_last_report = __pyx_v_time;
 407: 
+408:     cdef void init_driver(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_init_driver(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_driver", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+409:         if self.int_s.driver is not NULL:
  __pyx_t_1 = ((__pyx_v_self->int_s.driver != NULL) != 0);
  if (__pyx_t_1) {
/* … */
  }
+410:             gsl_odeiv2_driver_free(self.int_s.driver)
    gsl_odeiv2_driver_free(__pyx_v_self->int_s.driver);
+411:         self.int_s.driver = gsl_odeiv2_driver_alloc_y_new(
  __pyx_v_self->int_s.driver = gsl_odeiv2_driver_alloc_y_new((&__pyx_v_self->int_s.gsl_sys), __pyx_v_self->stepper, __pyx_v_self->hstart, __pyx_v_self->epsabs, __pyx_v_self->epsrel);
 412:             & self.int_s.gsl_sys, self.stepper, self.hstart, self.epsabs, self.epsrel)
 413: 
+414:     cdef void update_sys(self, double time, double product_scaling, bint reset):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_update_sys(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, double __pyx_v_time, double __pyx_v_product_scaling, int __pyx_v_reset) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_sys", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+415:         self.int_s.time = time
  __pyx_v_self->int_s.time = __pyx_v_time;
+416:         self.int_s.t_last_report = time
  __pyx_v_self->int_s.t_last_report = __pyx_v_time;
+417:         self.sys_c.update_sys(product_scaling, reset)
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->sys_c->__pyx_vtab)->update_sys(__pyx_v_self->sys_c, __pyx_v_product_scaling, __pyx_v_reset);
+418:         self.int_s.vars = & self.sys_c.sys_s.vars
  __pyx_v_self->int_s.vars = (&__pyx_v_self->sys_c->sys_s.vars);
 419: 
+420:     cdef void add_neighboring_int(self, integrator_str * nei_int_s, int index):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_add_neighboring_int(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_integrator_str *__pyx_v_nei_int_s, int __pyx_v_index) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_neighboring_int", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+421:         self.int_s.neighboring_ints_s[index] = nei_int_s
  (__pyx_v_self->int_s.neighboring_ints_s[__pyx_v_index]) = __pyx_v_nei_int_s;
 422: 
+423:     cdef void add_neighboring_integrators(self, integrators_c):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_add_neighboring_integrators(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, PyObject *__pyx_v_integrators_c) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_nei_int_c = 0;
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_neighboring_integrators", 0);
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.add_neighboring_integrators", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nei_int_c);
  __Pyx_RefNannyFinishContext();
}
 424:         cdef Integrator nei_int_c
 425:         cdef int i
+426:         for i, nei_int_c in enumerate(integrators_c):
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_integrators_c)) || PyTuple_CheckExact(__pyx_v_integrators_c)) {
    __pyx_t_2 = __pyx_v_integrators_c; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_integrators_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 426, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator))))) __PYX_ERR(0, 426, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_nei_int_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+427:             self.add_neighboring_int(&nei_int_c.int_s, i)
    ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self->__pyx_vtab)->add_neighboring_int(__pyx_v_self, (&__pyx_v_nei_int_c->int_s), __pyx_v_i);
 428: 
+429:     def run_system(self, double delta_t, int nr_reports):
/* Python wrapper */
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_3run_system(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_3run_system(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_delta_t;
  int __pyx_v_nr_reports;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_system (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_delta_t,&__pyx_n_s_nr_reports,0};
    PyObject* values[2] = {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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delta_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nr_reports)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("run_system", 1, 2, 2, 1); __PYX_ERR(0, 429, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run_system") < 0)) __PYX_ERR(0, 429, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_delta_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_delta_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 429, __pyx_L3_error)
    __pyx_v_nr_reports = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nr_reports == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 429, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("run_system", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 429, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.run_system", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_2run_system(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self), __pyx_v_delta_t, __pyx_v_nr_reports);

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

static PyObject *__pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_2run_system(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, double __pyx_v_delta_t, int __pyx_v_nr_reports) {
  int __pyx_v_errors;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run_system", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.run_system", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+430:         errors = run_system_nogil(&self.int_s, delta_t, nr_reports)
  __pyx_v_errors = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_run_system_nogil((&__pyx_v_self->int_s), __pyx_v_delta_t, __pyx_v_nr_reports);
+431:         return errors
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_errors); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 432: 
+433:     cdef void print_sys_vars(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_print_sys_vars(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_sys_vars", 0);
/* … */
  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.integrate.Integrator.print_sys_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}
 434:         cdef int i
+435:         for i in range(self.int_s.sys_s.dimension):
  __pyx_t_1 = __pyx_v_self->int_s.sys_s->dimension;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
+436:             print "&var%d: %.30f, " % (i, self.int_s.sys_s.vars[i]),
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_self->int_s.sys_s->vars[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_var_d_30f, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (__Pyx_Print(0, __pyx_t_5, 0) < 0) __PYX_ERR(0, 436, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
 437: 
+438:     cdef store_nr_time_points_py(self):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_store_nr_time_points_py(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self) {
  struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_sys_c = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("store_nr_time_points_py", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XDECREF((PyObject *)__pyx_v_sys_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+439:         cdef SYSTEM sys_c = self.sys_c
  __pyx_t_1 = ((PyObject *)__pyx_v_self->sys_c);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_sys_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_t_1);
  __pyx_t_1 = 0;
+440:         sys_c.store_nr_time_points_py()
  ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_sys_c->__pyx_vtab)->store_nr_time_points_py(__pyx_v_sys_c);
 441: 
+442:     cdef void add_jacobian(self, JAC jac):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_add_jacobian(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self, __pyx_t_15VirtualMicrobes_20cython_gsl_interface_9integrate_JAC __pyx_v_jac) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_jacobian", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+443:         self.int_s.gsl_sys.jacobian = jac
  __pyx_v_self->int_s.gsl_sys.jacobian = __pyx_v_jac;
 444: 
+445:     def __dealloc__(self):
/* Python wrapper */
static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_5__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_4__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *)__pyx_v_self));

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

static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_9integrate_10Integrator_4__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_9integrate_Integrator *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+446:         if self.int_s.driver is not NULL:
  __pyx_t_1 = ((__pyx_v_self->int_s.driver != NULL) != 0);
  if (__pyx_t_1) {
/* … */
  }
+447:             gsl_odeiv2_driver_free(self.int_s.driver)
    gsl_odeiv2_driver_free(__pyx_v_self->int_s.driver);
+448:         PyMem_Free(self.int_s.neighboring_ints_s)
  PyMem_Free(__pyx_v_self->int_s.neighboring_ints_s);
 449: 
+450: if cython.compiled:
  __pyx_t_4 = (1 != 0);
  if (__pyx_t_4) {
/* … */
    goto __pyx_L2;
  }
+451:     print "Yep, integrate.pyx is compiled and has test_integrator."
    if (__Pyx_PrintOne(0, __pyx_kp_s_Yep_integrate_pyx_is_compiled_an) < 0) __PYX_ERR(0, 451, __pyx_L1_error)
 452: else:
+453:     print "Just a lowly interpreted script."
  /*else*/ {
    if (__Pyx_PrintOne(0, __pyx_kp_s_Just_a_lowly_interpreted_script) < 0) __PYX_ERR(0, 453, __pyx_L1_error)
  }
  __pyx_L2:;