proteus  1.8.1
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.29.30 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8  #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10  #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_30"
13 #define CYTHON_HEX_VERSION 0x001D1EF0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20  #ifndef __stdcall
21  #define __stdcall
22  #endif
23  #ifndef __cdecl
24  #define __cdecl
25  #endif
26  #ifndef __fastcall
27  #define __fastcall
28  #endif
29 #endif
30 #ifndef DL_IMPORT
31  #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34  #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38  #if PY_VERSION_HEX >= 0x02070000
39  #define HAVE_LONG_LONG
40  #endif
41 #endif
42 #ifndef PY_LONG_LONG
43  #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46  #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49  #define CYTHON_COMPILING_IN_PYPY 1
50  #define CYTHON_COMPILING_IN_PYSTON 0
51  #define CYTHON_COMPILING_IN_CPYTHON 0
52  #undef CYTHON_USE_TYPE_SLOTS
53  #define CYTHON_USE_TYPE_SLOTS 0
54  #undef CYTHON_USE_PYTYPE_LOOKUP
55  #define CYTHON_USE_PYTYPE_LOOKUP 0
56  #if PY_VERSION_HEX < 0x03050000
57  #undef CYTHON_USE_ASYNC_SLOTS
58  #define CYTHON_USE_ASYNC_SLOTS 0
59  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60  #define CYTHON_USE_ASYNC_SLOTS 1
61  #endif
62  #undef CYTHON_USE_PYLIST_INTERNALS
63  #define CYTHON_USE_PYLIST_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_INTERNALS
65  #define CYTHON_USE_UNICODE_INTERNALS 0
66  #undef CYTHON_USE_UNICODE_WRITER
67  #define CYTHON_USE_UNICODE_WRITER 0
68  #undef CYTHON_USE_PYLONG_INTERNALS
69  #define CYTHON_USE_PYLONG_INTERNALS 0
70  #undef CYTHON_AVOID_BORROWED_REFS
71  #define CYTHON_AVOID_BORROWED_REFS 1
72  #undef CYTHON_ASSUME_SAFE_MACROS
73  #define CYTHON_ASSUME_SAFE_MACROS 0
74  #undef CYTHON_UNPACK_METHODS
75  #define CYTHON_UNPACK_METHODS 0
76  #undef CYTHON_FAST_THREAD_STATE
77  #define CYTHON_FAST_THREAD_STATE 0
78  #undef CYTHON_FAST_PYCALL
79  #define CYTHON_FAST_PYCALL 0
80  #undef CYTHON_PEP489_MULTI_PHASE_INIT
81  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82  #undef CYTHON_USE_TP_FINALIZE
83  #define CYTHON_USE_TP_FINALIZE 0
84  #undef CYTHON_USE_DICT_VERSIONS
85  #define CYTHON_USE_DICT_VERSIONS 0
86  #undef CYTHON_USE_EXC_INFO_STACK
87  #define CYTHON_USE_EXC_INFO_STACK 0
88  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
89  #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
90  #endif
91 #elif defined(PYSTON_VERSION)
92  #define CYTHON_COMPILING_IN_PYPY 0
93  #define CYTHON_COMPILING_IN_PYSTON 1
94  #define CYTHON_COMPILING_IN_CPYTHON 0
95  #ifndef CYTHON_USE_TYPE_SLOTS
96  #define CYTHON_USE_TYPE_SLOTS 1
97  #endif
98  #undef CYTHON_USE_PYTYPE_LOOKUP
99  #define CYTHON_USE_PYTYPE_LOOKUP 0
100  #undef CYTHON_USE_ASYNC_SLOTS
101  #define CYTHON_USE_ASYNC_SLOTS 0
102  #undef CYTHON_USE_PYLIST_INTERNALS
103  #define CYTHON_USE_PYLIST_INTERNALS 0
104  #ifndef CYTHON_USE_UNICODE_INTERNALS
105  #define CYTHON_USE_UNICODE_INTERNALS 1
106  #endif
107  #undef CYTHON_USE_UNICODE_WRITER
108  #define CYTHON_USE_UNICODE_WRITER 0
109  #undef CYTHON_USE_PYLONG_INTERNALS
110  #define CYTHON_USE_PYLONG_INTERNALS 0
111  #ifndef CYTHON_AVOID_BORROWED_REFS
112  #define CYTHON_AVOID_BORROWED_REFS 0
113  #endif
114  #ifndef CYTHON_ASSUME_SAFE_MACROS
115  #define CYTHON_ASSUME_SAFE_MACROS 1
116  #endif
117  #ifndef CYTHON_UNPACK_METHODS
118  #define CYTHON_UNPACK_METHODS 1
119  #endif
120  #undef CYTHON_FAST_THREAD_STATE
121  #define CYTHON_FAST_THREAD_STATE 0
122  #undef CYTHON_FAST_PYCALL
123  #define CYTHON_FAST_PYCALL 0
124  #undef CYTHON_PEP489_MULTI_PHASE_INIT
125  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
126  #undef CYTHON_USE_TP_FINALIZE
127  #define CYTHON_USE_TP_FINALIZE 0
128  #undef CYTHON_USE_DICT_VERSIONS
129  #define CYTHON_USE_DICT_VERSIONS 0
130  #undef CYTHON_USE_EXC_INFO_STACK
131  #define CYTHON_USE_EXC_INFO_STACK 0
132  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
133  #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
134  #endif
135 #else
136  #define CYTHON_COMPILING_IN_PYPY 0
137  #define CYTHON_COMPILING_IN_PYSTON 0
138  #define CYTHON_COMPILING_IN_CPYTHON 1
139  #ifndef CYTHON_USE_TYPE_SLOTS
140  #define CYTHON_USE_TYPE_SLOTS 1
141  #endif
142  #if PY_VERSION_HEX < 0x02070000
143  #undef CYTHON_USE_PYTYPE_LOOKUP
144  #define CYTHON_USE_PYTYPE_LOOKUP 0
145  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
146  #define CYTHON_USE_PYTYPE_LOOKUP 1
147  #endif
148  #if PY_MAJOR_VERSION < 3
149  #undef CYTHON_USE_ASYNC_SLOTS
150  #define CYTHON_USE_ASYNC_SLOTS 0
151  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
152  #define CYTHON_USE_ASYNC_SLOTS 1
153  #endif
154  #if PY_VERSION_HEX < 0x02070000
155  #undef CYTHON_USE_PYLONG_INTERNALS
156  #define CYTHON_USE_PYLONG_INTERNALS 0
157  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
158  #define CYTHON_USE_PYLONG_INTERNALS 1
159  #endif
160  #ifndef CYTHON_USE_PYLIST_INTERNALS
161  #define CYTHON_USE_PYLIST_INTERNALS 1
162  #endif
163  #ifndef CYTHON_USE_UNICODE_INTERNALS
164  #define CYTHON_USE_UNICODE_INTERNALS 1
165  #endif
166  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
167  #undef CYTHON_USE_UNICODE_WRITER
168  #define CYTHON_USE_UNICODE_WRITER 0
169  #elif !defined(CYTHON_USE_UNICODE_WRITER)
170  #define CYTHON_USE_UNICODE_WRITER 1
171  #endif
172  #ifndef CYTHON_AVOID_BORROWED_REFS
173  #define CYTHON_AVOID_BORROWED_REFS 0
174  #endif
175  #ifndef CYTHON_ASSUME_SAFE_MACROS
176  #define CYTHON_ASSUME_SAFE_MACROS 1
177  #endif
178  #ifndef CYTHON_UNPACK_METHODS
179  #define CYTHON_UNPACK_METHODS 1
180  #endif
181  #if PY_VERSION_HEX >= 0x030B00A4
182  #undef CYTHON_FAST_THREAD_STATE
183  #define CYTHON_FAST_THREAD_STATE 0
184  #elif !defined(CYTHON_FAST_THREAD_STATE)
185  #define CYTHON_FAST_THREAD_STATE 1
186  #endif
187  #ifndef CYTHON_FAST_PYCALL
188  #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
189  #endif
190  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
191  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
192  #endif
193  #ifndef CYTHON_USE_TP_FINALIZE
194  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
195  #endif
196  #ifndef CYTHON_USE_DICT_VERSIONS
197  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
198  #endif
199  #if PY_VERSION_HEX >= 0x030B00A4
200  #undef CYTHON_USE_EXC_INFO_STACK
201  #define CYTHON_USE_EXC_INFO_STACK 0
202  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
203  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
204  #endif
205  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
206  #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
207  #endif
208 #endif
209 #if !defined(CYTHON_FAST_PYCCALL)
210 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
211 #endif
212 #if CYTHON_USE_PYLONG_INTERNALS
213  #if PY_MAJOR_VERSION < 3
214  #include "longintrepr.h"
215  #endif
216  #undef SHIFT
217  #undef BASE
218  #undef MASK
219  #ifdef SIZEOF_VOID_P
220  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
221  #endif
222 #endif
223 #ifndef __has_attribute
224  #define __has_attribute(x) 0
225 #endif
226 #ifndef __has_cpp_attribute
227  #define __has_cpp_attribute(x) 0
228 #endif
229 #ifndef CYTHON_RESTRICT
230  #if defined(__GNUC__)
231  #define CYTHON_RESTRICT __restrict__
232  #elif defined(_MSC_VER) && _MSC_VER >= 1400
233  #define CYTHON_RESTRICT __restrict
234  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
235  #define CYTHON_RESTRICT restrict
236  #else
237  #define CYTHON_RESTRICT
238  #endif
239 #endif
240 #ifndef CYTHON_UNUSED
241 # if defined(__GNUC__)
242 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
243 # define CYTHON_UNUSED __attribute__ ((__unused__))
244 # else
245 # define CYTHON_UNUSED
246 # endif
247 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
248 # define CYTHON_UNUSED __attribute__ ((__unused__))
249 # else
250 # define CYTHON_UNUSED
251 # endif
252 #endif
253 #ifndef CYTHON_MAYBE_UNUSED_VAR
254 # if defined(__cplusplus)
255  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
256 # else
257 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
258 # endif
259 #endif
260 #ifndef CYTHON_NCP_UNUSED
261 # if CYTHON_COMPILING_IN_CPYTHON
262 # define CYTHON_NCP_UNUSED
263 # else
264 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
265 # endif
266 #endif
267 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
268 #ifdef _MSC_VER
269  #ifndef _MSC_STDINT_H_
270  #if _MSC_VER < 1300
271  typedef unsigned char uint8_t;
272  typedef unsigned int uint32_t;
273  #else
274  typedef unsigned __int8 uint8_t;
275  typedef unsigned __int32 uint32_t;
276  #endif
277  #endif
278 #else
279  #include <stdint.h>
280 #endif
281 #ifndef CYTHON_FALLTHROUGH
282  #if defined(__cplusplus) && __cplusplus >= 201103L
283  #if __has_cpp_attribute(fallthrough)
284  #define CYTHON_FALLTHROUGH [[fallthrough]]
285  #elif __has_cpp_attribute(clang::fallthrough)
286  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
287  #elif __has_cpp_attribute(gnu::fallthrough)
288  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
289  #endif
290  #endif
291  #ifndef CYTHON_FALLTHROUGH
292  #if __has_attribute(fallthrough)
293  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
294  #else
295  #define CYTHON_FALLTHROUGH
296  #endif
297  #endif
298  #if defined(__clang__ ) && defined(__apple_build_version__)
299  #if __apple_build_version__ < 7000000
300  #undef CYTHON_FALLTHROUGH
301  #define CYTHON_FALLTHROUGH
302  #endif
303  #endif
304 #endif
305 
306 #ifndef CYTHON_INLINE
307  #if defined(__clang__)
308  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
309  #elif defined(__GNUC__)
310  #define CYTHON_INLINE __inline__
311  #elif defined(_MSC_VER)
312  #define CYTHON_INLINE __inline
313  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
314  #define CYTHON_INLINE inline
315  #else
316  #define CYTHON_INLINE
317  #endif
318 #endif
319 
320 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
321  #define Py_OptimizeFlag 0
322 #endif
323 #define __PYX_BUILD_PY_SSIZE_T "n"
324 #define CYTHON_FORMAT_SSIZE_T "z"
325 #if PY_MAJOR_VERSION < 3
326  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
327  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
328  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
329  #define __Pyx_DefaultClassType PyClass_Type
330 #else
331  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
332  #define __Pyx_DefaultClassType PyType_Type
333 #if PY_VERSION_HEX >= 0x030B00A1
334  static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
335  PyObject *code, PyObject *c, PyObject* n, PyObject *v,
336  PyObject *fv, PyObject *cell, PyObject* fn,
337  PyObject *name, int fline, PyObject *lnos) {
338  PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
339  PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
340  const char *fn_cstr=NULL;
341  const char *name_cstr=NULL;
342  PyCodeObject* co=NULL;
343  PyObject *type, *value, *traceback;
344  PyErr_Fetch(&type, &value, &traceback);
345  if (!(kwds=PyDict_New())) goto end;
346  if (!(argcount=PyLong_FromLong(a))) goto end;
347  if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
348  if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
349  if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
350  if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
351  if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
352  if (!(nlocals=PyLong_FromLong(l))) goto end;
353  if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
354  if (!(stacksize=PyLong_FromLong(s))) goto end;
355  if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
356  if (!(flags=PyLong_FromLong(f))) goto end;
357  if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
358  if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
359  if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
360  if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
361  if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
362  if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
363  if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
364  if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
365  if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
366  if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
367  if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
368  if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
369  if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
370  if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
371  Py_XDECREF((PyObject*)co);
372  co = (PyCodeObject*)call_result;
373  call_result = NULL;
374  if (0) {
375  cleanup_code_too:
376  Py_XDECREF((PyObject*)co);
377  co = NULL;
378  }
379  end:
380  Py_XDECREF(kwds);
381  Py_XDECREF(argcount);
382  Py_XDECREF(posonlyargcount);
383  Py_XDECREF(kwonlyargcount);
384  Py_XDECREF(nlocals);
385  Py_XDECREF(stacksize);
386  Py_XDECREF(replace);
387  Py_XDECREF(call_result);
388  Py_XDECREF(empty);
389  if (type) {
390  PyErr_Restore(type, value, traceback);
391  }
392  return co;
393  }
394 #else
395  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
396  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
397 #endif
398  #define __Pyx_DefaultClassType PyType_Type
399 #endif
400 #ifndef Py_TPFLAGS_CHECKTYPES
401  #define Py_TPFLAGS_CHECKTYPES 0
402 #endif
403 #ifndef Py_TPFLAGS_HAVE_INDEX
404  #define Py_TPFLAGS_HAVE_INDEX 0
405 #endif
406 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
407  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
408 #endif
409 #ifndef Py_TPFLAGS_HAVE_FINALIZE
410  #define Py_TPFLAGS_HAVE_FINALIZE 0
411 #endif
412 #ifndef METH_STACKLESS
413  #define METH_STACKLESS 0
414 #endif
415 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
416  #ifndef METH_FASTCALL
417  #define METH_FASTCALL 0x80
418  #endif
419  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
420  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
421  Py_ssize_t nargs, PyObject *kwnames);
422 #else
423  #define __Pyx_PyCFunctionFast _PyCFunctionFast
424  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
425 #endif
426 #if CYTHON_FAST_PYCCALL
427 #define __Pyx_PyFastCFunction_Check(func)\
428  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
429 #else
430 #define __Pyx_PyFastCFunction_Check(func) 0
431 #endif
432 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
433  #define PyObject_Malloc(s) PyMem_Malloc(s)
434  #define PyObject_Free(p) PyMem_Free(p)
435  #define PyObject_Realloc(p) PyMem_Realloc(p)
436 #endif
437 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
438  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
439  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
440  #define PyMem_RawFree(p) PyMem_Free(p)
441 #endif
442 #if CYTHON_COMPILING_IN_PYSTON
443  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
444  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
445 #else
446  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
447  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
448 #endif
449 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
450  #define __Pyx_PyThreadState_Current PyThreadState_GET()
451 #elif PY_VERSION_HEX >= 0x03060000
452  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
453 #elif PY_VERSION_HEX >= 0x03000000
454  #define __Pyx_PyThreadState_Current PyThreadState_GET()
455 #else
456  #define __Pyx_PyThreadState_Current _PyThreadState_Current
457 #endif
458 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
459 #include "pythread.h"
460 #define Py_tss_NEEDS_INIT 0
461 typedef int Py_tss_t;
462 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
463  *key = PyThread_create_key();
464  return 0;
465 }
466 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
467  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
468  *key = Py_tss_NEEDS_INIT;
469  return key;
470 }
471 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
472  PyObject_Free(key);
473 }
474 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
475  return *key != Py_tss_NEEDS_INIT;
476 }
477 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
478  PyThread_delete_key(*key);
479  *key = Py_tss_NEEDS_INIT;
480 }
481 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
482  return PyThread_set_key_value(*key, value);
483 }
484 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
485  return PyThread_get_key_value(*key);
486 }
487 #endif
488 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
489 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
490 #else
491 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
492 #endif
493 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
494  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
495  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
496 #else
497  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
498  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
499 #endif
500 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
501 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
502 #else
503 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
504 #endif
505 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
506  #define CYTHON_PEP393_ENABLED 1
507  #if defined(PyUnicode_IS_READY)
508  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
509  0 : _PyUnicode_Ready((PyObject *)(op)))
510  #else
511  #define __Pyx_PyUnicode_READY(op) (0)
512  #endif
513  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
514  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
515  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
516  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
517  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
518  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
519  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
520  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
521  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
522  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
523  #else
524  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
525  #endif
526  #else
527  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
528  #endif
529 #else
530  #define CYTHON_PEP393_ENABLED 0
531  #define PyUnicode_1BYTE_KIND 1
532  #define PyUnicode_2BYTE_KIND 2
533  #define PyUnicode_4BYTE_KIND 4
534  #define __Pyx_PyUnicode_READY(op) (0)
535  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
536  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
537  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
538  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
539  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
540  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
541  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
542  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
543 #endif
544 #if CYTHON_COMPILING_IN_PYPY
545  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
546  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
547 #else
548  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
549  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
550  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
551 #endif
552 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
553  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
554 #endif
555 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
556  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
557 #endif
558 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
559  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
560 #endif
561 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
562 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
563 #if PY_MAJOR_VERSION >= 3
564  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
565 #else
566  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
567 #endif
568 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
569  #define PyObject_ASCII(o) PyObject_Repr(o)
570 #endif
571 #if PY_MAJOR_VERSION >= 3
572  #define PyBaseString_Type PyUnicode_Type
573  #define PyStringObject PyUnicodeObject
574  #define PyString_Type PyUnicode_Type
575  #define PyString_Check PyUnicode_Check
576  #define PyString_CheckExact PyUnicode_CheckExact
577 #ifndef PyObject_Unicode
578  #define PyObject_Unicode PyObject_Str
579 #endif
580 #endif
581 #if PY_MAJOR_VERSION >= 3
582  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
583  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
584 #else
585  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
586  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
587 #endif
588 #ifndef PySet_CheckExact
589  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
590 #endif
591 #if PY_VERSION_HEX >= 0x030900A4
592  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
593  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
594 #else
595  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
596  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
597 #endif
598 #if CYTHON_ASSUME_SAFE_MACROS
599  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
600 #else
601  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
602 #endif
603 #if PY_MAJOR_VERSION >= 3
604  #define PyIntObject PyLongObject
605  #define PyInt_Type PyLong_Type
606  #define PyInt_Check(op) PyLong_Check(op)
607  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
608  #define PyInt_FromString PyLong_FromString
609  #define PyInt_FromUnicode PyLong_FromUnicode
610  #define PyInt_FromLong PyLong_FromLong
611  #define PyInt_FromSize_t PyLong_FromSize_t
612  #define PyInt_FromSsize_t PyLong_FromSsize_t
613  #define PyInt_AsLong PyLong_AsLong
614  #define PyInt_AS_LONG PyLong_AS_LONG
615  #define PyInt_AsSsize_t PyLong_AsSsize_t
616  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
617  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
618  #define PyNumber_Int PyNumber_Long
619 #endif
620 #if PY_MAJOR_VERSION >= 3
621  #define PyBoolObject PyLongObject
622 #endif
623 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
624  #ifndef PyUnicode_InternFromString
625  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
626  #endif
627 #endif
628 #if PY_VERSION_HEX < 0x030200A4
629  typedef long Py_hash_t;
630  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
631  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
632 #else
633  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
634  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
635 #endif
636 #if PY_MAJOR_VERSION >= 3
637  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
638 #else
639  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
640 #endif
641 #if CYTHON_USE_ASYNC_SLOTS
642  #if PY_VERSION_HEX >= 0x030500B1
643  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
644  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
645  #else
646  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
647  #endif
648 #else
649  #define __Pyx_PyType_AsAsync(obj) NULL
650 #endif
651 #ifndef __Pyx_PyAsyncMethodsStruct
652  typedef struct {
653  unaryfunc am_await;
654  unaryfunc am_aiter;
655  unaryfunc am_anext;
656  } __Pyx_PyAsyncMethodsStruct;
657 #endif
658 
659 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
660  #if !defined(_USE_MATH_DEFINES)
661  #define _USE_MATH_DEFINES
662  #endif
663 #endif
664 #include <math.h>
665 #ifdef NAN
666 #define __PYX_NAN() ((float) NAN)
667 #else
668 static CYTHON_INLINE float __PYX_NAN() {
669  float value;
670  memset(&value, 0xFF, sizeof(value));
671  return value;
672 }
673 #endif
674 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
675 #define __Pyx_truncl trunc
676 #else
677 #define __Pyx_truncl truncl
678 #endif
679 
680 #define __PYX_MARK_ERR_POS(f_index, lineno) \
681  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
682 #define __PYX_ERR(f_index, lineno, Ln_error) \
683  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
684 
685 #ifndef __PYX_EXTERN_C
686  #ifdef __cplusplus
687  #define __PYX_EXTERN_C extern "C"
688  #else
689  #define __PYX_EXTERN_C extern
690  #endif
691 #endif
692 
693 #define __PYX_HAVE__subsurfaceTransportFunctions
694 #define __PYX_HAVE_API__subsurfaceTransportFunctions
695 /* Early includes */
696 #include <string.h>
697 #include <stdio.h>
698 #include "numpy/arrayobject.h"
699 #include "numpy/ndarrayobject.h"
700 #include "numpy/ndarraytypes.h"
701 #include "numpy/arrayscalars.h"
702 #include "numpy/ufuncobject.h"
703 
704  /* NumPy API declarations from "numpy/__init__.pxd" */
705 
706 #include "math.h"
707 #ifdef _OPENMP
708 #include <omp.h>
709 #endif /* _OPENMP */
710 
711 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
712 #define CYTHON_WITHOUT_ASSERTIONS
713 #endif
714 
715 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
716  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
717 
718 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
719 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
720 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
721 #define __PYX_DEFAULT_STRING_ENCODING ""
722 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
723 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
724 #define __Pyx_uchar_cast(c) ((unsigned char)c)
725 #define __Pyx_long_cast(x) ((long)x)
726 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
727  (sizeof(type) < sizeof(Py_ssize_t)) ||\
728  (sizeof(type) > sizeof(Py_ssize_t) &&\
729  likely(v < (type)PY_SSIZE_T_MAX ||\
730  v == (type)PY_SSIZE_T_MAX) &&\
731  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
732  v == (type)PY_SSIZE_T_MIN))) ||\
733  (sizeof(type) == sizeof(Py_ssize_t) &&\
734  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
735  v == (type)PY_SSIZE_T_MAX))) )
736 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
737  return (size_t) i < (size_t) limit;
738 }
739 #if defined (__cplusplus) && __cplusplus >= 201103L
740  #include <cstdlib>
741  #define __Pyx_sst_abs(value) std::abs(value)
742 #elif SIZEOF_INT >= SIZEOF_SIZE_T
743  #define __Pyx_sst_abs(value) abs(value)
744 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
745  #define __Pyx_sst_abs(value) labs(value)
746 #elif defined (_MSC_VER)
747  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
748 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
749  #define __Pyx_sst_abs(value) llabs(value)
750 #elif defined (__GNUC__)
751  #define __Pyx_sst_abs(value) __builtin_llabs(value)
752 #else
753  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
754 #endif
755 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
756 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
757 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
758 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
759 #define __Pyx_PyBytes_FromString PyBytes_FromString
760 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
761 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
762 #if PY_MAJOR_VERSION < 3
763  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
764  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
765 #else
766  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
767  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
768 #endif
769 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
770 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
771 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
772 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
773 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
774 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
775 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
776 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
777 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
778 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
779 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
780 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
781 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
782 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
783 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
784 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
785 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
786  const Py_UNICODE *u_end = u;
787  while (*u_end++) ;
788  return (size_t)(u_end - u - 1);
789 }
790 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
791 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
792 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
793 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
794 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
795 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
796 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
797 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
798 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
799 #define __Pyx_PySequence_Tuple(obj)\
800  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
801 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
802 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
803 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
804 #if CYTHON_ASSUME_SAFE_MACROS
805 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
806 #else
807 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
808 #endif
809 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
810 #if PY_MAJOR_VERSION >= 3
811 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
812 #else
813 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
814 #endif
815 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
816 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
817 static int __Pyx_sys_getdefaultencoding_not_ascii;
818 static int __Pyx_init_sys_getdefaultencoding_params(void) {
819  PyObject* sys;
820  PyObject* default_encoding = NULL;
821  PyObject* ascii_chars_u = NULL;
822  PyObject* ascii_chars_b = NULL;
823  const char* default_encoding_c;
824  sys = PyImport_ImportModule("sys");
825  if (!sys) goto bad;
826  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
827  Py_DECREF(sys);
828  if (!default_encoding) goto bad;
829  default_encoding_c = PyBytes_AsString(default_encoding);
830  if (!default_encoding_c) goto bad;
831  if (strcmp(default_encoding_c, "ascii") == 0) {
832  __Pyx_sys_getdefaultencoding_not_ascii = 0;
833  } else {
834  char ascii_chars[128];
835  int c;
836  for (c = 0; c < 128; c++) {
837  ascii_chars[c] = c;
838  }
839  __Pyx_sys_getdefaultencoding_not_ascii = 1;
840  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
841  if (!ascii_chars_u) goto bad;
842  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
843  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
844  PyErr_Format(
845  PyExc_ValueError,
846  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
847  default_encoding_c);
848  goto bad;
849  }
850  Py_DECREF(ascii_chars_u);
851  Py_DECREF(ascii_chars_b);
852  }
853  Py_DECREF(default_encoding);
854  return 0;
855 bad:
856  Py_XDECREF(default_encoding);
857  Py_XDECREF(ascii_chars_u);
858  Py_XDECREF(ascii_chars_b);
859  return -1;
860 }
861 #endif
862 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
863 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
864 #else
865 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
866 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
867 static char* __PYX_DEFAULT_STRING_ENCODING;
868 static int __Pyx_init_sys_getdefaultencoding_params(void) {
869  PyObject* sys;
870  PyObject* default_encoding = NULL;
871  char* default_encoding_c;
872  sys = PyImport_ImportModule("sys");
873  if (!sys) goto bad;
874  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
875  Py_DECREF(sys);
876  if (!default_encoding) goto bad;
877  default_encoding_c = PyBytes_AsString(default_encoding);
878  if (!default_encoding_c) goto bad;
879  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
880  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
881  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
882  Py_DECREF(default_encoding);
883  return 0;
884 bad:
885  Py_XDECREF(default_encoding);
886  return -1;
887 }
888 #endif
889 #endif
890 
891 
892 /* Test for GCC > 2.95 */
893 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
894  #define likely(x) __builtin_expect(!!(x), 1)
895  #define unlikely(x) __builtin_expect(!!(x), 0)
896 #else /* !__GNUC__ or GCC < 2.95 */
897  #define likely(x) (x)
898  #define unlikely(x) (x)
899 #endif /* __GNUC__ */
900 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
901 
902 static PyObject *__pyx_m = NULL;
903 static PyObject *__pyx_d;
904 static PyObject *__pyx_b;
905 static PyObject *__pyx_cython_runtime = NULL;
906 static PyObject *__pyx_empty_tuple;
907 static PyObject *__pyx_empty_bytes;
908 static PyObject *__pyx_empty_unicode;
909 static int __pyx_lineno;
910 static int __pyx_clineno = 0;
911 static const char * __pyx_cfilenm= __FILE__;
912 static const char *__pyx_filename;
913 
914 /* Header.proto */
915 #if !defined(CYTHON_CCOMPLEX)
916  #if defined(__cplusplus)
917  #define CYTHON_CCOMPLEX 1
918  #elif defined(_Complex_I)
919  #define CYTHON_CCOMPLEX 1
920  #else
921  #define CYTHON_CCOMPLEX 0
922  #endif
923 #endif
924 #if CYTHON_CCOMPLEX
925  #ifdef __cplusplus
926  #include <complex>
927  #else
928  #include <complex.h>
929  #endif
930 #endif
931 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
932  #undef _Complex_I
933  #define _Complex_I 1.0fj
934 #endif
935 
936 
937 static const char *__pyx_f[] = {
938  "proteus/subsurfaceTransportFunctions.pyx",
939  "__init__.pxd",
940  "type.pxd",
941 };
942 /* BufferFormatStructs.proto */
943 #define IS_UNSIGNED(type) (((type) -1) > 0)
944 struct __Pyx_StructField_;
945 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
946 typedef struct {
947  const char* name;
948  struct __Pyx_StructField_* fields;
949  size_t size;
950  size_t arraysize[8];
951  int ndim;
952  char typegroup;
953  char is_unsigned;
954  int flags;
955 } __Pyx_TypeInfo;
956 typedef struct __Pyx_StructField_ {
957  __Pyx_TypeInfo* type;
958  const char* name;
959  size_t offset;
960 } __Pyx_StructField;
961 typedef struct {
962  __Pyx_StructField* field;
963  size_t parent_offset;
964 } __Pyx_BufFmt_StackElem;
965 typedef struct {
966  __Pyx_StructField root;
967  __Pyx_BufFmt_StackElem* head;
968  size_t fmt_offset;
969  size_t new_count, enc_count;
970  size_t struct_alignment;
971  int is_complex;
972  char enc_type;
973  char new_packmode;
974  char enc_packmode;
975  char is_valid_array;
976 } __Pyx_BufFmt_Context;
977 
978 
979 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":690
980  * # in Cython to enable them only on the right systems.
981  *
982  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
983  * ctypedef npy_int16 int16_t
984  * ctypedef npy_int32 int32_t
985  */
986 typedef npy_int8 __pyx_t_5numpy_int8_t;
987 
988 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":691
989  *
990  * ctypedef npy_int8 int8_t
991  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
992  * ctypedef npy_int32 int32_t
993  * ctypedef npy_int64 int64_t
994  */
995 typedef npy_int16 __pyx_t_5numpy_int16_t;
996 
997 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":692
998  * ctypedef npy_int8 int8_t
999  * ctypedef npy_int16 int16_t
1000  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
1001  * ctypedef npy_int64 int64_t
1002  * #ctypedef npy_int96 int96_t
1003  */
1004 typedef npy_int32 __pyx_t_5numpy_int32_t;
1005 
1006 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":693
1007  * ctypedef npy_int16 int16_t
1008  * ctypedef npy_int32 int32_t
1009  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
1010  * #ctypedef npy_int96 int96_t
1011  * #ctypedef npy_int128 int128_t
1012  */
1013 typedef npy_int64 __pyx_t_5numpy_int64_t;
1014 
1015 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":697
1016  * #ctypedef npy_int128 int128_t
1017  *
1018  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
1019  * ctypedef npy_uint16 uint16_t
1020  * ctypedef npy_uint32 uint32_t
1021  */
1022 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1023 
1024 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":698
1025  *
1026  * ctypedef npy_uint8 uint8_t
1027  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1028  * ctypedef npy_uint32 uint32_t
1029  * ctypedef npy_uint64 uint64_t
1030  */
1031 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1032 
1033 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":699
1034  * ctypedef npy_uint8 uint8_t
1035  * ctypedef npy_uint16 uint16_t
1036  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1037  * ctypedef npy_uint64 uint64_t
1038  * #ctypedef npy_uint96 uint96_t
1039  */
1040 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1041 
1042 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":700
1043  * ctypedef npy_uint16 uint16_t
1044  * ctypedef npy_uint32 uint32_t
1045  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1046  * #ctypedef npy_uint96 uint96_t
1047  * #ctypedef npy_uint128 uint128_t
1048  */
1049 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1050 
1051 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":704
1052  * #ctypedef npy_uint128 uint128_t
1053  *
1054  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1055  * ctypedef npy_float64 float64_t
1056  * #ctypedef npy_float80 float80_t
1057  */
1058 typedef npy_float32 __pyx_t_5numpy_float32_t;
1059 
1060 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":705
1061  *
1062  * ctypedef npy_float32 float32_t
1063  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1064  * #ctypedef npy_float80 float80_t
1065  * #ctypedef npy_float128 float128_t
1066  */
1067 typedef npy_float64 __pyx_t_5numpy_float64_t;
1068 
1069 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":714
1070  * # The int types are mapped a bit surprising --
1071  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1072  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1073  * ctypedef npy_longlong long_t
1074  * ctypedef npy_longlong longlong_t
1075  */
1076 typedef npy_long __pyx_t_5numpy_int_t;
1077 
1078 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":715
1079  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1080  * ctypedef npy_long int_t
1081  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1082  * ctypedef npy_longlong longlong_t
1083  *
1084  */
1085 typedef npy_longlong __pyx_t_5numpy_long_t;
1086 
1087 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":716
1088  * ctypedef npy_long int_t
1089  * ctypedef npy_longlong long_t
1090  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1091  *
1092  * ctypedef npy_ulong uint_t
1093  */
1094 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1095 
1096 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":718
1097  * ctypedef npy_longlong longlong_t
1098  *
1099  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1100  * ctypedef npy_ulonglong ulong_t
1101  * ctypedef npy_ulonglong ulonglong_t
1102  */
1103 typedef npy_ulong __pyx_t_5numpy_uint_t;
1104 
1105 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":719
1106  *
1107  * ctypedef npy_ulong uint_t
1108  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1109  * ctypedef npy_ulonglong ulonglong_t
1110  *
1111  */
1112 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1113 
1114 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":720
1115  * ctypedef npy_ulong uint_t
1116  * ctypedef npy_ulonglong ulong_t
1117  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1118  *
1119  * ctypedef npy_intp intp_t
1120  */
1121 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1122 
1123 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":722
1124  * ctypedef npy_ulonglong ulonglong_t
1125  *
1126  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1127  * ctypedef npy_uintp uintp_t
1128  *
1129  */
1130 typedef npy_intp __pyx_t_5numpy_intp_t;
1131 
1132 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":723
1133  *
1134  * ctypedef npy_intp intp_t
1135  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1136  *
1137  * ctypedef npy_double float_t
1138  */
1139 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1140 
1141 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":725
1142  * ctypedef npy_uintp uintp_t
1143  *
1144  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1145  * ctypedef npy_double double_t
1146  * ctypedef npy_longdouble longdouble_t
1147  */
1148 typedef npy_double __pyx_t_5numpy_float_t;
1149 
1150 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":726
1151  *
1152  * ctypedef npy_double float_t
1153  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1154  * ctypedef npy_longdouble longdouble_t
1155  *
1156  */
1157 typedef npy_double __pyx_t_5numpy_double_t;
1158 
1159 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":727
1160  * ctypedef npy_double float_t
1161  * ctypedef npy_double double_t
1162  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1163  *
1164  * ctypedef npy_cfloat cfloat_t
1165  */
1166 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1167 
1168 /* "subsurfaceTransportFunctions.pyx":14
1169  * cdef inline double double_min(double a, double b): return a if a <= b else b
1170  *
1171  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
1172  * #numpy.intc_t not in cython's numpy.pxd
1173  * ctypedef int ITYPE_t
1174  */
1175 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
1176 
1177 /* "subsurfaceTransportFunctions.pyx":16
1178  * ctypedef numpy.double_t DTYPE_t
1179  * #numpy.intc_t not in cython's numpy.pxd
1180  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
1181  *
1182  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
1183  */
1184 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
1185 /* Declarations.proto */
1186 #if CYTHON_CCOMPLEX
1187  #ifdef __cplusplus
1188  typedef ::std::complex< float > __pyx_t_float_complex;
1189  #else
1190  typedef float _Complex __pyx_t_float_complex;
1191  #endif
1192 #else
1193  typedef struct { float real, imag; } __pyx_t_float_complex;
1194 #endif
1195 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1196 
1197 /* Declarations.proto */
1198 #if CYTHON_CCOMPLEX
1199  #ifdef __cplusplus
1200  typedef ::std::complex< double > __pyx_t_double_complex;
1201  #else
1202  typedef double _Complex __pyx_t_double_complex;
1203  #endif
1204 #else
1205  typedef struct { double real, imag; } __pyx_t_double_complex;
1206 #endif
1207 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1208 
1209 
1210 /*--- Type declarations ---*/
1211 
1212 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":729
1213  * ctypedef npy_longdouble longdouble_t
1214  *
1215  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1216  * ctypedef npy_cdouble cdouble_t
1217  * ctypedef npy_clongdouble clongdouble_t
1218  */
1219 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1220 
1221 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":730
1222  *
1223  * ctypedef npy_cfloat cfloat_t
1224  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1225  * ctypedef npy_clongdouble clongdouble_t
1226  *
1227  */
1228 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1229 
1230 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":731
1231  * ctypedef npy_cfloat cfloat_t
1232  * ctypedef npy_cdouble cdouble_t
1233  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1234  *
1235  * ctypedef npy_cdouble complex_t
1236  */
1237 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1238 
1239 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":733
1240  * ctypedef npy_clongdouble clongdouble_t
1241  *
1242  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1243  *
1244  * cdef inline object PyArray_MultiIterNew1(a):
1245  */
1246 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1247 
1248 /* --- Runtime support code (head) --- */
1249 /* Refnanny.proto */
1250 #ifndef CYTHON_REFNANNY
1251  #define CYTHON_REFNANNY 0
1252 #endif
1253 #if CYTHON_REFNANNY
1254  typedef struct {
1255  void (*INCREF)(void*, PyObject*, int);
1256  void (*DECREF)(void*, PyObject*, int);
1257  void (*GOTREF)(void*, PyObject*, int);
1258  void (*GIVEREF)(void*, PyObject*, int);
1259  void* (*SetupContext)(const char*, int, const char*);
1260  void (*FinishContext)(void**);
1261  } __Pyx_RefNannyAPIStruct;
1262  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1263  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1264  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1265 #ifdef WITH_THREAD
1266  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1267  if (acquire_gil) {\
1268  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1269  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1270  PyGILState_Release(__pyx_gilstate_save);\
1271  } else {\
1272  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1273  }
1274 #else
1275  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1276  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1277 #endif
1278  #define __Pyx_RefNannyFinishContext()\
1279  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1280  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1281  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1282  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1283  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1284  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1285  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1286  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1287  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1288 #else
1289  #define __Pyx_RefNannyDeclarations
1290  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1291  #define __Pyx_RefNannyFinishContext()
1292  #define __Pyx_INCREF(r) Py_INCREF(r)
1293  #define __Pyx_DECREF(r) Py_DECREF(r)
1294  #define __Pyx_GOTREF(r)
1295  #define __Pyx_GIVEREF(r)
1296  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1297  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1298  #define __Pyx_XGOTREF(r)
1299  #define __Pyx_XGIVEREF(r)
1300 #endif
1301 #define __Pyx_XDECREF_SET(r, v) do {\
1302  PyObject *tmp = (PyObject *) r;\
1303  r = v; __Pyx_XDECREF(tmp);\
1304  } while (0)
1305 #define __Pyx_DECREF_SET(r, v) do {\
1306  PyObject *tmp = (PyObject *) r;\
1307  r = v; __Pyx_DECREF(tmp);\
1308  } while (0)
1309 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1310 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1311 
1312 /* PyObjectGetAttrStr.proto */
1313 #if CYTHON_USE_TYPE_SLOTS
1314 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1315 #else
1316 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1317 #endif
1318 
1319 /* GetBuiltinName.proto */
1320 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1321 
1322 /* RaiseArgTupleInvalid.proto */
1323 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1324  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1325 
1326 /* RaiseDoubleKeywords.proto */
1327 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1328 
1329 /* ParseKeywords.proto */
1330 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1331  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1332  const char* function_name);
1333 
1334 /* ArgTypeTest.proto */
1335 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1336  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1337  __Pyx__ArgTypeTest(obj, type, name, exact))
1338 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1339 
1340 /* IsLittleEndian.proto */
1341 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1342 
1343 /* BufferFormatCheck.proto */
1344 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1345 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1346  __Pyx_BufFmt_StackElem* stack,
1347  __Pyx_TypeInfo* type);
1348 
1349 /* BufferGetAndValidate.proto */
1350 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1351  ((obj == Py_None || obj == NULL) ?\
1352  (__Pyx_ZeroBuffer(buf), 0) :\
1353  __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1354 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1355  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1356 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1357 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1358 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1359 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1360 
1361 /* BufferIndexError.proto */
1362 static void __Pyx_RaiseBufferIndexError(int axis);
1363 
1364 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1365 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1366 /* PyThreadStateGet.proto */
1367 #if CYTHON_FAST_THREAD_STATE
1368 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1369 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1370 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1371 #else
1372 #define __Pyx_PyThreadState_declare
1373 #define __Pyx_PyThreadState_assign
1374 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1375 #endif
1376 
1377 /* PyErrFetchRestore.proto */
1378 #if CYTHON_FAST_THREAD_STATE
1379 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1380 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1381 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1382 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1383 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1384 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1385 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1386 #if CYTHON_COMPILING_IN_CPYTHON
1387 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1388 #else
1389 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1390 #endif
1391 #else
1392 #define __Pyx_PyErr_Clear() PyErr_Clear()
1393 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1394 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1395 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1396 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1397 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1398 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1399 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1400 #endif
1401 
1402 /* DictGetItem.proto */
1403 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1404 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1405 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1406  (likely(PyDict_CheckExact(obj)) ?\
1407  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1408 #else
1409 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1410 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1411 #endif
1412 
1413 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1414 /* GetItemInt.proto */
1415 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1416  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1417  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1418  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1419  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1420 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1421  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1422  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1423  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1424 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1425  int wraparound, int boundscheck);
1426 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1427  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1428  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1429  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1430 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1431  int wraparound, int boundscheck);
1432 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1433 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1434  int is_list, int wraparound, int boundscheck);
1435 
1436 /* ObjectGetItem.proto */
1437 #if CYTHON_USE_TYPE_SLOTS
1438 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1439 #else
1440 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1441 #endif
1442 
1443 /* PyFloatBinop.proto */
1444 #if !CYTHON_COMPILING_IN_PYPY
1445 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1446 #else
1447 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
1448  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1449 #endif
1450 
1451 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1452 /* PyFunctionFastCall.proto */
1453 #if CYTHON_FAST_PYCALL
1454 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1455  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1456 #if 1 || PY_VERSION_HEX < 0x030600B1
1457 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1458 #else
1459 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1460 #endif
1461 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1462  (sizeof(char [1 - 2*!(cond)]) - 1)
1463 #ifndef Py_MEMBER_SIZE
1464 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1465 #endif
1466 #if CYTHON_FAST_PYCALL
1467  static size_t __pyx_pyframe_localsplus_offset = 0;
1468  #include "frameobject.h"
1469 #if PY_VERSION_HEX >= 0x030b00a6
1470  #ifndef Py_BUILD_CORE
1471  #define Py_BUILD_CORE 1
1472  #endif
1473  #include "internal/pycore_frame.h"
1474 #endif
1475  #define __Pxy_PyFrame_Initialize_Offsets()\
1476  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1477  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1478  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1479  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1480 #endif // CYTHON_FAST_PYCALL
1481 #endif
1482 
1483 /* PyCFunctionFastCall.proto */
1484 #if CYTHON_FAST_PYCCALL
1485 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1486 #else
1487 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1488 #endif
1489 
1490 /* PyObjectCall.proto */
1491 #if CYTHON_COMPILING_IN_CPYTHON
1492 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1493 #else
1494 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1495 #endif
1496 
1497 /* PyDictVersioning.proto */
1498 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1499 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1500 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1501 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1502  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1503  (cache_var) = (value);
1504 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1505  static PY_UINT64_T __pyx_dict_version = 0;\
1506  static PyObject *__pyx_dict_cached_value = NULL;\
1507  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1508  (VAR) = __pyx_dict_cached_value;\
1509  } else {\
1510  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1511  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1512  }\
1513 }
1514 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1515 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1516 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1517 #else
1518 #define __PYX_GET_DICT_VERSION(dict) (0)
1519 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1520 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1521 #endif
1522 
1523 /* GetModuleGlobalName.proto */
1524 #if CYTHON_USE_DICT_VERSIONS
1525 #define __Pyx_GetModuleGlobalName(var, name) {\
1526  static PY_UINT64_T __pyx_dict_version = 0;\
1527  static PyObject *__pyx_dict_cached_value = NULL;\
1528  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1529  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1530  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1531 }
1532 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1533  PY_UINT64_T __pyx_dict_version;\
1534  PyObject *__pyx_dict_cached_value;\
1535  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1536 }
1537 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1538 #else
1539 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1540 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1541 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1542 #endif
1543 
1544 /* ExtTypeTest.proto */
1545 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1546 
1547 /* PyObjectCall2Args.proto */
1548 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1549 
1550 /* PyObjectCallMethO.proto */
1551 #if CYTHON_COMPILING_IN_CPYTHON
1552 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1553 #endif
1554 
1555 /* PyObjectCallOneArg.proto */
1556 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1557 
1558 /* pyobject_as_double.proto */
1559 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1560 #if CYTHON_COMPILING_IN_PYPY
1561 #define __Pyx_PyObject_AsDouble(obj)\
1562 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1563  likely(PyInt_CheckExact(obj)) ?\
1564  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1565 #else
1566 #define __Pyx_PyObject_AsDouble(obj)\
1567 ((likely(PyFloat_CheckExact(obj))) ?\
1568  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1569 #endif
1570 
1571 /* GetTopmostException.proto */
1572 #if CYTHON_USE_EXC_INFO_STACK
1573 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1574 #endif
1575 
1576 /* SaveResetException.proto */
1577 #if CYTHON_FAST_THREAD_STATE
1578 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1579 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1580 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1581 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1582 #else
1583 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1584 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1585 #endif
1586 
1587 /* PyErrExceptionMatches.proto */
1588 #if CYTHON_FAST_THREAD_STATE
1589 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1590 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1591 #else
1592 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1593 #endif
1594 
1595 /* GetException.proto */
1596 #if CYTHON_FAST_THREAD_STATE
1597 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1598 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1599 #else
1600 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1601 #endif
1602 
1603 /* RaiseException.proto */
1604 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1605 
1606 /* TypeImport.proto */
1607 #ifndef __PYX_HAVE_RT_ImportType_proto
1608 #define __PYX_HAVE_RT_ImportType_proto
1609 enum __Pyx_ImportType_CheckSize {
1610  __Pyx_ImportType_CheckSize_Error = 0,
1611  __Pyx_ImportType_CheckSize_Warn = 1,
1612  __Pyx_ImportType_CheckSize_Ignore = 2
1613 };
1614 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1615 #endif
1616 
1617 /* Import.proto */
1618 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1619 
1620 /* CLineInTraceback.proto */
1621 #ifdef CYTHON_CLINE_IN_TRACEBACK
1622 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1623 #else
1624 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1625 #endif
1626 
1627 /* CodeObjectCache.proto */
1628 typedef struct {
1629  PyCodeObject* code_object;
1630  int code_line;
1631 } __Pyx_CodeObjectCacheEntry;
1632 struct __Pyx_CodeObjectCache {
1633  int count;
1634  int max_count;
1635  __Pyx_CodeObjectCacheEntry* entries;
1636 };
1637 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1638 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1639 static PyCodeObject *__pyx_find_code_object(int code_line);
1640 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1641 
1642 /* AddTraceback.proto */
1643 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1644  int py_line, const char *filename);
1645 
1646 /* BufferStructDeclare.proto */
1647 typedef struct {
1648  Py_ssize_t shape, strides, suboffsets;
1649 } __Pyx_Buf_DimInfo;
1650 typedef struct {
1651  size_t refcount;
1652  Py_buffer pybuffer;
1653 } __Pyx_Buffer;
1654 typedef struct {
1655  __Pyx_Buffer *rcbuffer;
1656  char *data;
1657  __Pyx_Buf_DimInfo diminfo[8];
1658 } __Pyx_LocalBuf_ND;
1659 
1660 #if PY_MAJOR_VERSION < 3
1661  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1662  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1663 #else
1664  #define __Pyx_GetBuffer PyObject_GetBuffer
1665  #define __Pyx_ReleaseBuffer PyBuffer_Release
1666 #endif
1667 
1668 
1669 /* GCCDiagnostics.proto */
1670 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1671 #define __Pyx_HAS_GCC_DIAGNOSTIC
1672 #endif
1673 
1674 /* RealImag.proto */
1675 #if CYTHON_CCOMPLEX
1676  #ifdef __cplusplus
1677  #define __Pyx_CREAL(z) ((z).real())
1678  #define __Pyx_CIMAG(z) ((z).imag())
1679  #else
1680  #define __Pyx_CREAL(z) (__real__(z))
1681  #define __Pyx_CIMAG(z) (__imag__(z))
1682  #endif
1683 #else
1684  #define __Pyx_CREAL(z) ((z).real)
1685  #define __Pyx_CIMAG(z) ((z).imag)
1686 #endif
1687 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1688  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1689  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1690  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1691 #else
1692  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1693  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1694 #endif
1695 
1696 /* Arithmetic.proto */
1697 #if CYTHON_CCOMPLEX
1698  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1699  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1700  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1701  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1702  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1703  #define __Pyx_c_neg_float(a) (-(a))
1704  #ifdef __cplusplus
1705  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1706  #define __Pyx_c_conj_float(z) (::std::conj(z))
1707  #if 1
1708  #define __Pyx_c_abs_float(z) (::std::abs(z))
1709  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1710  #endif
1711  #else
1712  #define __Pyx_c_is_zero_float(z) ((z)==0)
1713  #define __Pyx_c_conj_float(z) (conjf(z))
1714  #if 1
1715  #define __Pyx_c_abs_float(z) (cabsf(z))
1716  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1717  #endif
1718  #endif
1719 #else
1720  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1721  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1722  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1723  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1724  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1725  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1726  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1727  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1728  #if 1
1729  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1730  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1731  #endif
1732 #endif
1733 
1734 /* Arithmetic.proto */
1735 #if CYTHON_CCOMPLEX
1736  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1737  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1738  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1739  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1740  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1741  #define __Pyx_c_neg_double(a) (-(a))
1742  #ifdef __cplusplus
1743  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1744  #define __Pyx_c_conj_double(z) (::std::conj(z))
1745  #if 1
1746  #define __Pyx_c_abs_double(z) (::std::abs(z))
1747  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1748  #endif
1749  #else
1750  #define __Pyx_c_is_zero_double(z) ((z)==0)
1751  #define __Pyx_c_conj_double(z) (conj(z))
1752  #if 1
1753  #define __Pyx_c_abs_double(z) (cabs(z))
1754  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1755  #endif
1756  #endif
1757 #else
1758  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1759  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1760  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1761  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1762  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1763  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1764  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1765  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1766  #if 1
1767  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1768  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1769  #endif
1770 #endif
1771 
1772 /* CIntFromPy.proto */
1773 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1774 
1775 /* CIntToPy.proto */
1776 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1777 
1778 /* CIntToPy.proto */
1779 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1780 
1781 /* CIntFromPy.proto */
1782 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1783 
1784 /* CIntToPy.proto */
1785 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1786 
1787 /* CIntFromPy.proto */
1788 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1789 
1790 /* FastTypeChecks.proto */
1791 #if CYTHON_COMPILING_IN_CPYTHON
1792 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1793 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1794 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1795 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1796 #else
1797 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1798 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1799 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1800 #endif
1801 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1802 
1803 /* CheckBinaryVersion.proto */
1804 static int __Pyx_check_binary_version(void);
1805 
1806 /* InitStrings.proto */
1807 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1808 
1809 
1810 /* Module declarations from 'cpython.buffer' */
1811 
1812 /* Module declarations from 'libc.string' */
1813 
1814 /* Module declarations from 'libc.stdio' */
1815 
1816 /* Module declarations from '__builtin__' */
1817 
1818 /* Module declarations from 'cpython.type' */
1819 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1820 
1821 /* Module declarations from 'cpython' */
1822 
1823 /* Module declarations from 'cpython.object' */
1824 
1825 /* Module declarations from 'cpython.ref' */
1826 
1827 /* Module declarations from 'cpython.mem' */
1828 
1829 /* Module declarations from 'numpy' */
1830 
1831 /* Module declarations from 'numpy' */
1832 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1833 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1834 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1835 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1836 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
1837 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
1838 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
1839 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
1840 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
1841 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
1842 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
1843 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
1844 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
1845 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
1846 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1847 
1848 /* Module declarations from 'subsurfaceTransportFunctions' */
1849 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1850 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1851 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1852 extern int __pyx_module_is_main_subsurfaceTransportFunctions;
1853 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1854 
1855 /* Implementation of 'subsurfaceTransportFunctions' */
1856 static PyObject *__pyx_builtin_range;
1857 static PyObject *__pyx_builtin_ImportError;
1858 static const char __pyx_k_I[] = "I";
1859 static const char __pyx_k_J[] = "J";
1860 static const char __pyx_k_d[] = "d";
1861 static const char __pyx_k_i[] = "i";
1862 static const char __pyx_k_j[] = "j";
1863 static const char __pyx_k_k[] = "k";
1864 static const char __pyx_k_m[] = "m";
1865 static const char __pyx_k_n[] = "n";
1866 static const char __pyx_k_q[] = "q";
1867 static const char __pyx_k_t[] = "t";
1868 static const char __pyx_k_v[] = "v";
1869 static const char __pyx_k_w[] = "w";
1870 static const char __pyx_k_x[] = "x";
1871 static const char __pyx_k_dS[] = "dS";
1872 static const char __pyx_k_dV[] = "dV";
1873 static const char __pyx_k_df[] = "df";
1874 static const char __pyx_k_dm[] = "dm";
1875 static const char __pyx_k_eN[] = "eN";
1876 static const char __pyx_k_ii[] = "ii";
1877 static const char __pyx_k_kb[] = "kb";
1878 static const char __pyx_k_mt[] = "mt";
1879 static const char __pyx_k_nd[] = "nd";
1880 static const char __pyx_k_pi[] = "pi";
1881 static const char __pyx_k_xc[] = "xc";
1882 static const char __pyx_k_yc[] = "yc";
1883 static const char __pyx_k_KWr[] = "KWr";
1884 static const char __pyx_k_KWs[] = "KWs";
1885 static const char __pyx_k_dmt[] = "dmt";
1886 static const char __pyx_k_dot[] = "dot";
1887 static const char __pyx_k_ebN[] = "ebN";
1888 static const char __pyx_k_l2g[] = "l2g";
1889 static const char __pyx_k_nnz[] = "nnz";
1890 static const char __pyx_k_q_m[] = "q_m";
1891 static const char __pyx_k_q_r[] = "q_r";
1892 static const char __pyx_k_q_u[] = "q_u";
1893 static const char __pyx_k_q_x[] = "q_x";
1894 static const char __pyx_k_rho[] = "rho";
1895 static const char __pyx_k_sum[] = "sum";
1896 static const char __pyx_k_u_j[] = "u_j";
1897 static const char __pyx_k_vol[] = "vol";
1898 static const char __pyx_k_a_eN[] = "a_eN";
1899 static const char __pyx_k_a_up[] = "a_up";
1900 static const char __pyx_k_beta[] = "beta";
1901 static const char __pyx_k_ebNE[] = "ebNE";
1902 static const char __pyx_k_f_up[] = "f_up";
1903 static const char __pyx_k_flat[] = "flat";
1904 static const char __pyx_k_flux[] = "flux";
1905 static const char __pyx_k_main[] = "__main__";
1906 static const char __pyx_k_name[] = "__name__";
1907 static const char __pyx_k_one8[] = "one8";
1908 static const char __pyx_k_psiC[] = "psiC";
1909 static const char __pyx_k_q_dm[] = "q_dm";
1910 static const char __pyx_k_q_kr[] = "q_kr";
1911 static const char __pyx_k_q_mt[] = "q_mt";
1912 static const char __pyx_k_rho2[] = "rho2";
1913 static const char __pyx_k_rhom[] = "rhom";
1914 static const char __pyx_k_sBar[] = "sBar";
1915 static const char __pyx_k_test[] = "__test__";
1916 static const char __pyx_k_u_eN[] = "u_eN";
1917 static const char __pyx_k_vBar[] = "vBar";
1918 static const char __pyx_k_a_avg[] = "a_avg";
1919 static const char __pyx_k_alpha[] = "alpha";
1920 static const char __pyx_k_clock[] = "clock";
1921 static const char __pyx_k_denom[] = "denom";
1922 static const char __pyx_k_drhom[] = "drhom";
1923 static const char __pyx_k_kr_eN[] = "kr_eN";
1924 static const char __pyx_k_matID[] = "matID";
1925 static const char __pyx_k_numer[] = "numer";
1926 static const char __pyx_k_numpy[] = "numpy";
1927 static const char __pyx_k_pcBar[] = "pcBar";
1928 static const char __pyx_k_q_dkr[] = "q_dkr";
1929 static const char __pyx_k_q_dmt[] = "q_dmt";
1930 static const char __pyx_k_range[] = "range";
1931 static const char __pyx_k_shape[] = "shape";
1932 static const char __pyx_k_u_dof[] = "u_dof";
1933 static const char __pyx_k_u_l2g[] = "u_l2g";
1934 static const char __pyx_k_vBar2[] = "vBar2";
1935 static const char __pyx_k_vol_e[] = "vol_e";
1936 static const char __pyx_k_zeros[] = "zeros";
1937 static const char __pyx_k_a_neig[] = "a_neig";
1938 static const char __pyx_k_colind[] = "colind";
1939 static const char __pyx_k_dkr_up[] = "dkr_up";
1940 static const char __pyx_k_import[] = "__import__";
1941 static const char __pyx_k_mt_avg[] = "mt_avg";
1942 static const char __pyx_k_nSpace[] = "nSpace";
1943 static const char __pyx_k_phi_eN[] = "phi_eN";
1944 static const char __pyx_k_picard[] = "picard";
1945 static const char __pyx_k_q_alin[] = "q_alin";
1946 static const char __pyx_k_q_detJ[] = "q_detJ";
1947 static const char __pyx_k_q_flin[] = "q_flin";
1948 static const char __pyx_k_q_mass[] = "q_mass";
1949 static const char __pyx_k_q_vals[] = "q_vals";
1950 static const char __pyx_k_rowptr[] = "rowptr";
1951 static const char __pyx_k_thetaR[] = "thetaR";
1952 static const char __pyx_k_thetaS[] = "thetaS";
1953 static const char __pyx_k_thetaW[] = "thetaW";
1954 static const char __pyx_k_u_neig[] = "u_neig";
1955 static const char __pyx_k_volume[] = "volume";
1956 static const char __pyx_k_weight[] = "weight";
1957 static const char __pyx_k_df_dofs[] = "df_dofs";
1958 static const char __pyx_k_eN_left[] = "eN_left";
1959 static const char __pyx_k_gravity[] = "gravity";
1960 static const char __pyx_k_kr_neig[] = "kr_neig";
1961 static const char __pyx_k_nSpace2[] = "nSpace2";
1962 static const char __pyx_k_omega_e[] = "omega_e";
1963 static const char __pyx_k_pcBar_n[] = "pcBar_n";
1964 static const char __pyx_k_q_dmass[] = "q_dmass";
1965 static const char __pyx_k_q_kr_up[] = "q_kr_up";
1966 static const char __pyx_k_thetaSR[] = "thetaSR";
1967 static const char __pyx_k_dmtj_avg[] = "dmtj_avg";
1968 static const char __pyx_k_eN_right[] = "eN_right";
1969 static const char __pyx_k_ebq_vals[] = "ebq_vals";
1970 static const char __pyx_k_integral[] = "integral";
1971 static const char __pyx_k_material[] = "material";
1972 static const char __pyx_k_phi_neig[] = "phi_neig";
1973 static const char __pyx_k_q_grad_u[] = "q_grad_u";
1974 static const char __pyx_k_q_grad_v[] = "q_grad_v";
1975 static const char __pyx_k_q_grad_w[] = "q_grad_w";
1976 static const char __pyx_k_ebN_local[] = "ebN_local";
1977 static const char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1978 static const char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1979 static const char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1980 static const char __pyx_k_transient[] = "transient";
1981 static const char __pyx_k_volFactor[] = "volFactor";
1982 static const char __pyx_k_zVelocity[] = "zVelocity";
1983 static const char __pyx_k_zvelocity[] = "zvelocity";
1984 static const char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1985 static const char __pyx_k_matID_neig[] = "matID_neig";
1986 static const char __pyx_k_nAvgWeight[] = "nAvgWeight";
1987 static const char __pyx_k_upwindFlag[] = "upwindFlag";
1988 static const char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1989 static const char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1990 static const char __pyx_k_ImportError[] = "ImportError";
1991 static const char __pyx_k_eN_neighbor[] = "eN_neighbor";
1992 static const char __pyx_k_tForReversal[] = "tForReversal";
1993 static const char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1994 static const char __pyx_k_material_left[] = "material_left";
1995 static const char __pyx_k_weak_residual[] = "weak_residual";
1996 static const char __pyx_k_material_right[] = "material_right";
1997 static const char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1998 static const char __pyx_k_elementJacobian[] = "elementJacobian";
1999 static const char __pyx_k_elementResidual[] = "elementResidual";
2000 static const char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
2001 static const char __pyx_k_nElements_global[] = "nElements_global";
2002 static const char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
2003 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2004 static const char __pyx_k_material_functions[] = "material_functions";
2005 static const char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
2006 static const char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
2007 static const char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
2008 static const char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
2009 static const char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
2010 static const char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
2011 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
2012 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
2013 static const char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
2014 static const char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
2015 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
2016 static const char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
2017 static const char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
2018 static const char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
2019 static const char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
2020 static const char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
2021 static const char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
2022 static const char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
2023 static const char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
2024 static const char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
2025 static const char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
2026 static const char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
2027 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
2028 static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
2029 static const char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
2030 static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
2031 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2032 static const char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
2033 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
2034 static const char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
2035 static const char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
2036 static const char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
2037 static const char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
2038 static const char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
2039 static const char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
2040 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2041 static const char __pyx_k_proteus_subsurfaceTransportFunct[] = "proteus/subsurfaceTransportFunctions.pyx";
2042 static const char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
2043 static const char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
2044 static const char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
2045 static const char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
2046 static const char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
2047 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
2048 static const char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
2049 static const char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
2050 static const char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
2051 static const char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
2052 static const char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
2053 static const char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
2054 static const char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
2055 static PyObject *__pyx_n_s_DKWr_DpsiC;
2056 static PyObject *__pyx_n_s_DsBar_DpsiC;
2057 static PyObject *__pyx_n_s_DthetaW_DpsiC;
2058 static PyObject *__pyx_n_s_DvBar_DpsiC;
2059 static PyObject *__pyx_n_s_I;
2060 static PyObject *__pyx_n_s_ImportError;
2061 static PyObject *__pyx_n_s_J;
2062 static PyObject *__pyx_n_s_KWr;
2063 static PyObject *__pyx_n_s_KWs;
2064 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
2065 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
2066 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
2067 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
2068 static PyObject *__pyx_n_s_a_avg;
2069 static PyObject *__pyx_n_s_a_eN;
2070 static PyObject *__pyx_n_s_a_neig;
2071 static PyObject *__pyx_n_s_a_up;
2072 static PyObject *__pyx_n_s_alpha;
2073 static PyObject *__pyx_n_s_beta;
2074 static PyObject *__pyx_n_s_calculateNormalFlux;
2075 static PyObject *__pyx_n_s_characteristic_velocity;
2076 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
2077 static PyObject *__pyx_n_s_cline_in_traceback;
2078 static PyObject *__pyx_n_s_clock;
2079 static PyObject *__pyx_n_s_colind;
2080 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
2081 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
2082 static PyObject *__pyx_n_s_d;
2083 static PyObject *__pyx_n_s_dS;
2084 static PyObject *__pyx_n_s_dV;
2085 static PyObject *__pyx_n_s_denom;
2086 static PyObject *__pyx_n_s_df;
2087 static PyObject *__pyx_n_s_df_dofs;
2088 static PyObject *__pyx_n_s_dkr_up;
2089 static PyObject *__pyx_n_s_dm;
2090 static PyObject *__pyx_n_s_dmt;
2091 static PyObject *__pyx_n_s_dmtj_avg;
2092 static PyObject *__pyx_n_s_dot;
2093 static PyObject *__pyx_n_s_drhom;
2094 static PyObject *__pyx_n_s_eN;
2095 static PyObject *__pyx_n_s_eN_left;
2096 static PyObject *__pyx_n_s_eN_neighbor;
2097 static PyObject *__pyx_n_s_eN_right;
2098 static PyObject *__pyx_n_s_ebN;
2099 static PyObject *__pyx_n_s_ebNE;
2100 static PyObject *__pyx_n_s_ebN_local;
2101 static PyObject *__pyx_n_s_ebq_global_vals;
2102 static PyObject *__pyx_n_s_ebq_vals;
2103 static PyObject *__pyx_n_s_elementBarycentersArray;
2104 static PyObject *__pyx_n_s_elementBoundariesArray;
2105 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
2106 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
2107 static PyObject *__pyx_n_s_elementBoundaryTypes;
2108 static PyObject *__pyx_n_s_elementJacobian;
2109 static PyObject *__pyx_n_s_elementMaterialTypes;
2110 static PyObject *__pyx_n_s_elementNeighborsArray;
2111 static PyObject *__pyx_n_s_elementResidual;
2112 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
2113 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
2114 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
2115 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
2116 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
2117 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
2118 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
2119 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
2120 static PyObject *__pyx_n_s_f_up;
2121 static PyObject *__pyx_n_s_flat;
2122 static PyObject *__pyx_n_s_flux;
2123 static PyObject *__pyx_n_s_gravity;
2124 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
2125 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
2126 static PyObject *__pyx_n_s_i;
2127 static PyObject *__pyx_n_s_ii;
2128 static PyObject *__pyx_n_s_import;
2129 static PyObject *__pyx_n_s_integral;
2130 static PyObject *__pyx_n_s_j;
2131 static PyObject *__pyx_n_s_jacobian_weak_residual;
2132 static PyObject *__pyx_n_s_k;
2133 static PyObject *__pyx_n_s_kb;
2134 static PyObject *__pyx_n_s_kr_eN;
2135 static PyObject *__pyx_n_s_kr_neig;
2136 static PyObject *__pyx_n_s_l2g;
2137 static PyObject *__pyx_n_s_m;
2138 static PyObject *__pyx_n_s_main;
2139 static PyObject *__pyx_n_s_matID;
2140 static PyObject *__pyx_n_s_matID_neig;
2141 static PyObject *__pyx_n_s_material;
2142 static PyObject *__pyx_n_s_material_functions;
2143 static PyObject *__pyx_n_s_material_left;
2144 static PyObject *__pyx_n_s_material_right;
2145 static PyObject *__pyx_n_s_mt;
2146 static PyObject *__pyx_n_s_mt_avg;
2147 static PyObject *__pyx_n_s_n;
2148 static PyObject *__pyx_n_s_nAvgWeight;
2149 static PyObject *__pyx_n_s_nDOF_test_element;
2150 static PyObject *__pyx_n_s_nDOF_trial_element;
2151 static PyObject *__pyx_n_s_nElementBoundaries_element;
2152 static PyObject *__pyx_n_s_nElementBoundaries_global;
2153 static PyObject *__pyx_n_s_nElements_global;
2154 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
2155 static PyObject *__pyx_n_s_nSpace;
2156 static PyObject *__pyx_n_s_nSpace2;
2157 static PyObject *__pyx_n_s_name;
2158 static PyObject *__pyx_n_s_nd;
2159 static PyObject *__pyx_n_s_nnz;
2160 static PyObject *__pyx_n_s_numer;
2161 static PyObject *__pyx_n_s_numpy;
2162 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2163 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2164 static PyObject *__pyx_n_s_omega_e;
2165 static PyObject *__pyx_n_s_one8;
2166 static PyObject *__pyx_n_s_onePlus_pcBar_n;
2167 static PyObject *__pyx_n_s_pcBar;
2168 static PyObject *__pyx_n_s_pcBar_n;
2169 static PyObject *__pyx_n_s_pcBar_nM1;
2170 static PyObject *__pyx_n_s_pcBar_nM2;
2171 static PyObject *__pyx_n_s_phi_eN;
2172 static PyObject *__pyx_n_s_phi_neig;
2173 static PyObject *__pyx_n_s_pi;
2174 static PyObject *__pyx_n_s_picard;
2175 static PyObject *__pyx_kp_s_proteus_subsurfaceTransportFunct;
2176 static PyObject *__pyx_n_s_psiC;
2177 static PyObject *__pyx_n_s_q;
2178 static PyObject *__pyx_n_s_q_alin;
2179 static PyObject *__pyx_n_s_q_detJ;
2180 static PyObject *__pyx_n_s_q_dkr;
2181 static PyObject *__pyx_n_s_q_dm;
2182 static PyObject *__pyx_n_s_q_dmass;
2183 static PyObject *__pyx_n_s_q_dmt;
2184 static PyObject *__pyx_n_s_q_flin;
2185 static PyObject *__pyx_n_s_q_grad_u;
2186 static PyObject *__pyx_n_s_q_grad_v;
2187 static PyObject *__pyx_n_s_q_grad_w;
2188 static PyObject *__pyx_n_s_q_kr;
2189 static PyObject *__pyx_n_s_q_kr_up;
2190 static PyObject *__pyx_n_s_q_m;
2191 static PyObject *__pyx_n_s_q_mass;
2192 static PyObject *__pyx_n_s_q_mt;
2193 static PyObject *__pyx_n_s_q_r;
2194 static PyObject *__pyx_n_s_q_u;
2195 static PyObject *__pyx_n_s_q_vals;
2196 static PyObject *__pyx_n_s_q_x;
2197 static PyObject *__pyx_n_s_range;
2198 static PyObject *__pyx_n_s_rho;
2199 static PyObject *__pyx_n_s_rho2;
2200 static PyObject *__pyx_n_s_rhom;
2201 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
2202 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
2203 static PyObject *__pyx_n_s_rowptr;
2204 static PyObject *__pyx_n_s_sBar;
2205 static PyObject *__pyx_n_s_setElementBoundariesArray;
2206 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
2207 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
2208 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
2209 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
2210 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
2211 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
2212 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
2213 static PyObject *__pyx_n_s_shape;
2214 static PyObject *__pyx_n_s_sqrt_sBar;
2215 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
2216 static PyObject *__pyx_n_s_sum;
2217 static PyObject *__pyx_n_s_t;
2218 static PyObject *__pyx_n_s_tForReversal;
2219 static PyObject *__pyx_n_s_test;
2220 static PyObject *__pyx_n_s_thetaR;
2221 static PyObject *__pyx_n_s_thetaS;
2222 static PyObject *__pyx_n_s_thetaSR;
2223 static PyObject *__pyx_n_s_thetaW;
2224 static PyObject *__pyx_n_s_thisElementIsUpwind;
2225 static PyObject *__pyx_n_s_transient;
2226 static PyObject *__pyx_n_s_u_dof;
2227 static PyObject *__pyx_n_s_u_eN;
2228 static PyObject *__pyx_n_s_u_j;
2229 static PyObject *__pyx_n_s_u_l2g;
2230 static PyObject *__pyx_n_s_u_neig;
2231 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
2232 static PyObject *__pyx_n_s_updateMass_weakAvg;
2233 static PyObject *__pyx_n_s_upwindFlag;
2234 static PyObject *__pyx_n_s_v;
2235 static PyObject *__pyx_n_s_vBar;
2236 static PyObject *__pyx_n_s_vBar2;
2237 static PyObject *__pyx_n_s_vol;
2238 static PyObject *__pyx_n_s_volFactor;
2239 static PyObject *__pyx_n_s_vol_e;
2240 static PyObject *__pyx_n_s_volume;
2241 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
2242 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
2243 static PyObject *__pyx_n_s_w;
2244 static PyObject *__pyx_n_s_weak_residual;
2245 static PyObject *__pyx_n_s_weight;
2246 static PyObject *__pyx_n_s_x;
2247 static PyObject *__pyx_n_s_xc;
2248 static PyObject *__pyx_n_s_yc;
2249 static PyObject *__pyx_n_s_zVelocity;
2250 static PyObject *__pyx_n_s_zeros;
2251 static PyObject *__pyx_n_s_zvelocity;
2252 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
2253 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
2254 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2255 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2256 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2257 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2258 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2259 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2260 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2261 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2262 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2263 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2264 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2265 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2266 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
2267 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
2268 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
2269 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
2270 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
2271 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
2272 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
2273 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2274 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2275 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2276 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2277 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2278 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2279 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2280 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2281 static PyObject *__pyx_float_0_0;
2282 static PyObject *__pyx_float_0_5;
2283 static PyObject *__pyx_float_2_0;
2284 static PyObject *__pyx_float_1_0eneg_20;
2285 static PyObject *__pyx_slice_;
2286 static PyObject *__pyx_tuple__2;
2287 static PyObject *__pyx_tuple__3;
2288 static PyObject *__pyx_tuple__4;
2289 static PyObject *__pyx_tuple__6;
2290 static PyObject *__pyx_tuple__8;
2291 static PyObject *__pyx_tuple__10;
2292 static PyObject *__pyx_tuple__12;
2293 static PyObject *__pyx_tuple__14;
2294 static PyObject *__pyx_tuple__16;
2295 static PyObject *__pyx_tuple__18;
2296 static PyObject *__pyx_tuple__20;
2297 static PyObject *__pyx_tuple__22;
2298 static PyObject *__pyx_tuple__24;
2299 static PyObject *__pyx_tuple__26;
2300 static PyObject *__pyx_tuple__28;
2301 static PyObject *__pyx_tuple__30;
2302 static PyObject *__pyx_tuple__32;
2303 static PyObject *__pyx_tuple__34;
2304 static PyObject *__pyx_tuple__36;
2305 static PyObject *__pyx_tuple__38;
2306 static PyObject *__pyx_tuple__40;
2307 static PyObject *__pyx_tuple__42;
2308 static PyObject *__pyx_tuple__44;
2309 static PyObject *__pyx_tuple__46;
2310 static PyObject *__pyx_tuple__48;
2311 static PyObject *__pyx_tuple__50;
2312 static PyObject *__pyx_tuple__52;
2313 static PyObject *__pyx_tuple__54;
2314 static PyObject *__pyx_tuple__56;
2315 static PyObject *__pyx_tuple__58;
2316 static PyObject *__pyx_tuple__60;
2317 static PyObject *__pyx_codeobj__5;
2318 static PyObject *__pyx_codeobj__7;
2319 static PyObject *__pyx_codeobj__9;
2320 static PyObject *__pyx_codeobj__11;
2321 static PyObject *__pyx_codeobj__13;
2322 static PyObject *__pyx_codeobj__15;
2323 static PyObject *__pyx_codeobj__17;
2324 static PyObject *__pyx_codeobj__19;
2325 static PyObject *__pyx_codeobj__21;
2326 static PyObject *__pyx_codeobj__23;
2327 static PyObject *__pyx_codeobj__25;
2328 static PyObject *__pyx_codeobj__27;
2329 static PyObject *__pyx_codeobj__29;
2330 static PyObject *__pyx_codeobj__31;
2331 static PyObject *__pyx_codeobj__33;
2332 static PyObject *__pyx_codeobj__35;
2333 static PyObject *__pyx_codeobj__37;
2334 static PyObject *__pyx_codeobj__39;
2335 static PyObject *__pyx_codeobj__41;
2336 static PyObject *__pyx_codeobj__43;
2337 static PyObject *__pyx_codeobj__45;
2338 static PyObject *__pyx_codeobj__47;
2339 static PyObject *__pyx_codeobj__49;
2340 static PyObject *__pyx_codeobj__51;
2341 static PyObject *__pyx_codeobj__53;
2342 static PyObject *__pyx_codeobj__55;
2343 static PyObject *__pyx_codeobj__57;
2344 static PyObject *__pyx_codeobj__59;
2345 static PyObject *__pyx_codeobj__61;
2346 /* Late includes */
2347 
2348 /* "subsurfaceTransportFunctions.pyx":11
2349  * double sin(double x)
2350  * double M_PI
2351  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
2352  * cdef inline double double_min(double a, double b): return a if a <= b else b
2353  *
2354  */
2355 
2356 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
2357  double __pyx_r;
2358  __Pyx_RefNannyDeclarations
2359  double __pyx_t_1;
2360  __Pyx_RefNannySetupContext("double_max", 0);
2361  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
2362  __pyx_t_1 = __pyx_v_a;
2363  } else {
2364  __pyx_t_1 = __pyx_v_b;
2365  }
2366  __pyx_r = __pyx_t_1;
2367  goto __pyx_L0;
2368 
2369  /* function exit code */
2370  __pyx_L0:;
2371  __Pyx_RefNannyFinishContext();
2372  return __pyx_r;
2373 }
2374 
2375 /* "subsurfaceTransportFunctions.pyx":12
2376  * double M_PI
2377  * cdef inline double double_max(double a, double b): return a if a >= b else b
2378  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
2379  *
2380  * ctypedef numpy.double_t DTYPE_t
2381  */
2382 
2383 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
2384  double __pyx_r;
2385  __Pyx_RefNannyDeclarations
2386  double __pyx_t_1;
2387  __Pyx_RefNannySetupContext("double_min", 0);
2388  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
2389  __pyx_t_1 = __pyx_v_a;
2390  } else {
2391  __pyx_t_1 = __pyx_v_b;
2392  }
2393  __pyx_r = __pyx_t_1;
2394  goto __pyx_L0;
2395 
2396  /* function exit code */
2397  __pyx_L0:;
2398  __Pyx_RefNannyFinishContext();
2399  return __pyx_r;
2400 }
2401 
2402 /* "subsurfaceTransportFunctions.pyx":18
2403  * ctypedef int ITYPE_t
2404  *
2405  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2406  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2407  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2408  */
2409 
2410 /* Python wrapper */
2411 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2412 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
2413 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2414  int __pyx_v_nExteriorElementBoundaries_global;
2415  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2416  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2417  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2418  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
2419  int __pyx_lineno = 0;
2420  const char *__pyx_filename = NULL;
2421  int __pyx_clineno = 0;
2422  PyObject *__pyx_r = 0;
2423  __Pyx_RefNannyDeclarations
2424  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
2425  {
2426  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
2427  PyObject* values[5] = {0,0,0,0,0};
2428  if (unlikely(__pyx_kwds)) {
2429  Py_ssize_t kw_args;
2430  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2431  switch (pos_args) {
2432  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2433  CYTHON_FALLTHROUGH;
2434  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2435  CYTHON_FALLTHROUGH;
2436  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2437  CYTHON_FALLTHROUGH;
2438  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2439  CYTHON_FALLTHROUGH;
2440  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2441  CYTHON_FALLTHROUGH;
2442  case 0: break;
2443  default: goto __pyx_L5_argtuple_error;
2444  }
2445  kw_args = PyDict_Size(__pyx_kwds);
2446  switch (pos_args) {
2447  case 0:
2448  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2449  else goto __pyx_L5_argtuple_error;
2450  CYTHON_FALLTHROUGH;
2451  case 1:
2452  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2453  else {
2454  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); __PYX_ERR(0, 18, __pyx_L3_error)
2455  }
2456  CYTHON_FALLTHROUGH;
2457  case 2:
2458  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2459  else {
2460  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); __PYX_ERR(0, 18, __pyx_L3_error)
2461  }
2462  CYTHON_FALLTHROUGH;
2463  case 3:
2464  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2465  else {
2466  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); __PYX_ERR(0, 18, __pyx_L3_error)
2467  }
2468  CYTHON_FALLTHROUGH;
2469  case 4:
2470  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
2471  else {
2472  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); __PYX_ERR(0, 18, __pyx_L3_error)
2473  }
2474  }
2475  if (unlikely(kw_args > 0)) {
2476  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
2477  }
2478  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2479  goto __pyx_L5_argtuple_error;
2480  } else {
2481  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2482  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2483  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2484  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2485  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2486  }
2487  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
2488  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
2489  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
2490  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
2491  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
2492  }
2493  goto __pyx_L4_argument_unpacking_done;
2494  __pyx_L5_argtuple_error:;
2495  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
2496  __pyx_L3_error:;
2497  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2498  __Pyx_RefNannyFinishContext();
2499  return NULL;
2500  __pyx_L4_argument_unpacking_done:;
2501  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
2502  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
2503  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
2504  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
2505  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
2506 
2507  /* function exit code */
2508  goto __pyx_L0;
2509  __pyx_L1_error:;
2510  __pyx_r = NULL;
2511  __pyx_L0:;
2512  __Pyx_RefNannyFinishContext();
2513  return __pyx_r;
2514 }
2515 
2516 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
2517  int __pyx_v_ebNE;
2518  int __pyx_v_ebN;
2519  int __pyx_v_eN;
2520  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2521  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2522  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2523  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2524  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
2525  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
2526  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
2527  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2528  PyObject *__pyx_r = NULL;
2529  __Pyx_RefNannyDeclarations
2530  int __pyx_t_1;
2531  int __pyx_t_2;
2532  int __pyx_t_3;
2533  Py_ssize_t __pyx_t_4;
2534  int __pyx_t_5;
2535  Py_ssize_t __pyx_t_6;
2536  int __pyx_lineno = 0;
2537  const char *__pyx_filename = NULL;
2538  int __pyx_clineno = 0;
2539  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
2540  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
2541  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
2542  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
2543  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
2544  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2545  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2546  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2547  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2548  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2549  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2550  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2551  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2552  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
2553  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
2554  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
2555  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2556  {
2557  __Pyx_BufFmt_StackElem __pyx_stack[1];
2558  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2559  }
2560  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
2561  {
2562  __Pyx_BufFmt_StackElem __pyx_stack[1];
2563  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2564  }
2565  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2566  {
2567  __Pyx_BufFmt_StackElem __pyx_stack[1];
2568  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2569  }
2570  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2571  {
2572  __Pyx_BufFmt_StackElem __pyx_stack[1];
2573  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2574  }
2575  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
2576 
2577  /* "subsurfaceTransportFunctions.pyx":24
2578  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
2579  * cdef int ebNE,ebN,eN
2580  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
2581  * ebN = exteriorElementBoundariesArray[ebNE]
2582  * eN = elementBoundaryElementsArray[ebN,0]
2583  */
2584  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
2585  __pyx_t_2 = __pyx_t_1;
2586  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2587  __pyx_v_ebNE = __pyx_t_3;
2588 
2589  /* "subsurfaceTransportFunctions.pyx":25
2590  * cdef int ebNE,ebN,eN
2591  * for ebNE in range(nExteriorElementBoundaries_global):
2592  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
2593  * eN = elementBoundaryElementsArray[ebN,0]
2594  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2595  */
2596  __pyx_t_4 = __pyx_v_ebNE;
2597  __pyx_t_5 = -1;
2598  if (__pyx_t_4 < 0) {
2599  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
2600  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2601  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_5 = 0;
2602  if (unlikely(__pyx_t_5 != -1)) {
2603  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2604  __PYX_ERR(0, 25, __pyx_L1_error)
2605  }
2606  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
2607 
2608  /* "subsurfaceTransportFunctions.pyx":26
2609  * for ebNE in range(nExteriorElementBoundaries_global):
2610  * ebN = exteriorElementBoundariesArray[ebNE]
2611  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2612  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2613  *
2614  */
2615  __pyx_t_4 = __pyx_v_ebN;
2616  __pyx_t_6 = 0;
2617  __pyx_t_5 = -1;
2618  if (__pyx_t_4 < 0) {
2619  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2620  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2621  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2622  if (__pyx_t_6 < 0) {
2623  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2624  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 1;
2625  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2626  if (unlikely(__pyx_t_5 != -1)) {
2627  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2628  __PYX_ERR(0, 26, __pyx_L1_error)
2629  }
2630  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2631 
2632  /* "subsurfaceTransportFunctions.pyx":27
2633  * ebN = exteriorElementBoundariesArray[ebNE]
2634  * eN = elementBoundaryElementsArray[ebN,0]
2635  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2636  *
2637  * def setElementBoundariesArray(int nElementBoundaries_global,
2638  */
2639  __pyx_t_6 = __pyx_v_eN;
2640  __pyx_t_5 = -1;
2641  if (__pyx_t_6 < 0) {
2642  __pyx_t_6 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2643  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2644  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2645  if (unlikely(__pyx_t_5 != -1)) {
2646  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2647  __PYX_ERR(0, 27, __pyx_L1_error)
2648  }
2649  __pyx_t_4 = __pyx_v_ebNE;
2650  __pyx_t_5 = -1;
2651  if (__pyx_t_4 < 0) {
2652  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
2653  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2654  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2655  if (unlikely(__pyx_t_5 != -1)) {
2656  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2657  __PYX_ERR(0, 27, __pyx_L1_error)
2658  }
2659  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2660  }
2661 
2662  /* "subsurfaceTransportFunctions.pyx":18
2663  * ctypedef int ITYPE_t
2664  *
2665  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2666  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2667  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2668  */
2669 
2670  /* function exit code */
2671  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2672  goto __pyx_L0;
2673  __pyx_L1_error:;
2674  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2675  __Pyx_PyThreadState_declare
2676  __Pyx_PyThreadState_assign
2677  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2678  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2679  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2680  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2681  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2682  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2683  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2684  __pyx_r = NULL;
2685  goto __pyx_L2;
2686  __pyx_L0:;
2687  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2688  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2689  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2690  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2691  __pyx_L2:;
2692  __Pyx_XGIVEREF(__pyx_r);
2693  __Pyx_RefNannyFinishContext();
2694  return __pyx_r;
2695 }
2696 
2697 /* "subsurfaceTransportFunctions.pyx":29
2698  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2699  *
2700  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2701  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2702  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2703  */
2704 
2705 /* Python wrapper */
2706 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2707 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2708 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2709  int __pyx_v_nElementBoundaries_global;
2710  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2711  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2712  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2713  int __pyx_lineno = 0;
2714  const char *__pyx_filename = NULL;
2715  int __pyx_clineno = 0;
2716  PyObject *__pyx_r = 0;
2717  __Pyx_RefNannyDeclarations
2718  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2719  {
2720  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2721  PyObject* values[4] = {0,0,0,0};
2722  if (unlikely(__pyx_kwds)) {
2723  Py_ssize_t kw_args;
2724  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2725  switch (pos_args) {
2726  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2727  CYTHON_FALLTHROUGH;
2728  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2729  CYTHON_FALLTHROUGH;
2730  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2731  CYTHON_FALLTHROUGH;
2732  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2733  CYTHON_FALLTHROUGH;
2734  case 0: break;
2735  default: goto __pyx_L5_argtuple_error;
2736  }
2737  kw_args = PyDict_Size(__pyx_kwds);
2738  switch (pos_args) {
2739  case 0:
2740  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2741  else goto __pyx_L5_argtuple_error;
2742  CYTHON_FALLTHROUGH;
2743  case 1:
2744  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2745  else {
2746  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
2747  }
2748  CYTHON_FALLTHROUGH;
2749  case 2:
2750  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2751  else {
2752  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error)
2753  }
2754  CYTHON_FALLTHROUGH;
2755  case 3:
2756  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2757  else {
2758  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error)
2759  }
2760  }
2761  if (unlikely(kw_args > 0)) {
2762  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
2763  }
2764  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2765  goto __pyx_L5_argtuple_error;
2766  } else {
2767  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2768  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2769  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2770  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2771  }
2772  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2773  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2774  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2775  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2776  }
2777  goto __pyx_L4_argument_unpacking_done;
2778  __pyx_L5_argtuple_error:;
2779  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
2780  __pyx_L3_error:;
2781  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2782  __Pyx_RefNannyFinishContext();
2783  return NULL;
2784  __pyx_L4_argument_unpacking_done:;
2785  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
2786  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
2787  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
2788  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2789 
2790  /* function exit code */
2791  goto __pyx_L0;
2792  __pyx_L1_error:;
2793  __pyx_r = NULL;
2794  __pyx_L0:;
2795  __Pyx_RefNannyFinishContext();
2796  return __pyx_r;
2797 }
2798 
2799 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2800  int __pyx_v_ebN;
2801  int __pyx_v_eN_left;
2802  int __pyx_v_eN_right;
2803  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2804  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2805  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2806  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2807  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2808  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2809  PyObject *__pyx_r = NULL;
2810  __Pyx_RefNannyDeclarations
2811  int __pyx_t_1;
2812  int __pyx_t_2;
2813  int __pyx_t_3;
2814  Py_ssize_t __pyx_t_4;
2815  Py_ssize_t __pyx_t_5;
2816  int __pyx_t_6;
2817  Py_ssize_t __pyx_t_7;
2818  int __pyx_t_8;
2819  int __pyx_lineno = 0;
2820  const char *__pyx_filename = NULL;
2821  int __pyx_clineno = 0;
2822  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2823  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2824  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2825  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2826  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2827  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2828  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2829  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2830  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2831  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2832  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2833  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2834  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2835  {
2836  __Pyx_BufFmt_StackElem __pyx_stack[1];
2837  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2838  }
2839  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2840  {
2841  __Pyx_BufFmt_StackElem __pyx_stack[1];
2842  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2843  }
2844  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2845  {
2846  __Pyx_BufFmt_StackElem __pyx_stack[1];
2847  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2848  }
2849  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2850 
2851  /* "subsurfaceTransportFunctions.pyx":34
2852  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2853  * cdef int ebN,eN_left,eN_right
2854  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2855  * eN_left = elementBoundaryElementsArray[ebN,0]
2856  * eN_right= elementBoundaryElementsArray[ebN,1]
2857  */
2858  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2859  __pyx_t_2 = __pyx_t_1;
2860  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2861  __pyx_v_ebN = __pyx_t_3;
2862 
2863  /* "subsurfaceTransportFunctions.pyx":35
2864  * cdef int ebN,eN_left,eN_right
2865  * for ebN in range(nElementBoundaries_global):
2866  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2867  * eN_right= elementBoundaryElementsArray[ebN,1]
2868  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2869  */
2870  __pyx_t_4 = __pyx_v_ebN;
2871  __pyx_t_5 = 0;
2872  __pyx_t_6 = -1;
2873  if (__pyx_t_4 < 0) {
2874  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2875  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2876  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2877  if (__pyx_t_5 < 0) {
2878  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2879  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2880  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2881  if (unlikely(__pyx_t_6 != -1)) {
2882  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2883  __PYX_ERR(0, 35, __pyx_L1_error)
2884  }
2885  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2886 
2887  /* "subsurfaceTransportFunctions.pyx":36
2888  * for ebN in range(nElementBoundaries_global):
2889  * eN_left = elementBoundaryElementsArray[ebN,0]
2890  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2891  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2892  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2893  */
2894  __pyx_t_5 = __pyx_v_ebN;
2895  __pyx_t_4 = 1;
2896  __pyx_t_6 = -1;
2897  if (__pyx_t_5 < 0) {
2898  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2899  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2900  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2901  if (__pyx_t_4 < 0) {
2902  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2903  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
2904  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2905  if (unlikely(__pyx_t_6 != -1)) {
2906  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2907  __PYX_ERR(0, 36, __pyx_L1_error)
2908  }
2909  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2910 
2911  /* "subsurfaceTransportFunctions.pyx":37
2912  * eN_left = elementBoundaryElementsArray[ebN,0]
2913  * eN_right= elementBoundaryElementsArray[ebN,1]
2914  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2915  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2916  * if eN_right >= 0:
2917  */
2918  __pyx_t_4 = __pyx_v_eN_left;
2919  __pyx_t_6 = -1;
2920  if (__pyx_t_4 < 0) {
2921  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2922  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2923  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2924  if (unlikely(__pyx_t_6 != -1)) {
2925  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2926  __PYX_ERR(0, 37, __pyx_L1_error)
2927  }
2928  __pyx_t_5 = __pyx_v_ebN;
2929  __pyx_t_7 = 0;
2930  __pyx_t_6 = -1;
2931  if (__pyx_t_5 < 0) {
2932  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2933  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2934  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2935  if (__pyx_t_7 < 0) {
2936  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2937  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 1;
2938  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2939  if (unlikely(__pyx_t_6 != -1)) {
2940  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2941  __PYX_ERR(0, 37, __pyx_L1_error)
2942  }
2943  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2944 
2945  /* "subsurfaceTransportFunctions.pyx":38
2946  * eN_right= elementBoundaryElementsArray[ebN,1]
2947  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2948  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2949  * if eN_right >= 0:
2950  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2951  */
2952  __pyx_t_4 = __pyx_v_eN_left;
2953  __pyx_t_6 = -1;
2954  if (__pyx_t_4 < 0) {
2955  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2956  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2957  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2958  if (unlikely(__pyx_t_6 != -1)) {
2959  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2960  __PYX_ERR(0, 38, __pyx_L1_error)
2961  }
2962  __pyx_t_7 = __pyx_v_ebN;
2963  __pyx_t_5 = 1;
2964  __pyx_t_6 = -1;
2965  if (__pyx_t_7 < 0) {
2966  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2967  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
2968  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2969  if (__pyx_t_5 < 0) {
2970  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2971  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2972  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2973  if (unlikely(__pyx_t_6 != -1)) {
2974  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2975  __PYX_ERR(0, 38, __pyx_L1_error)
2976  }
2977  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2978 
2979  /* "subsurfaceTransportFunctions.pyx":39
2980  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2981  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2982  * if eN_right >= 0: # <<<<<<<<<<<<<<
2983  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2984  *
2985  */
2986  __pyx_t_8 = ((__pyx_v_eN_right >= 0) != 0);
2987  if (__pyx_t_8) {
2988 
2989  /* "subsurfaceTransportFunctions.pyx":40
2990  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2991  * if eN_right >= 0:
2992  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2993  *
2994  * ###
2995  */
2996  __pyx_t_4 = __pyx_v_eN_right;
2997  __pyx_t_6 = -1;
2998  if (__pyx_t_4 < 0) {
2999  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3000  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
3001  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
3002  if (unlikely(__pyx_t_6 != -1)) {
3003  __Pyx_RaiseBufferIndexError(__pyx_t_6);
3004  __PYX_ERR(0, 40, __pyx_L1_error)
3005  }
3006  __pyx_t_5 = __pyx_v_ebN;
3007  __pyx_t_7 = 1;
3008  __pyx_t_6 = -1;
3009  if (__pyx_t_5 < 0) {
3010  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
3011  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
3012  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
3013  if (__pyx_t_7 < 0) {
3014  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
3015  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 1;
3016  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
3017  if (unlikely(__pyx_t_6 != -1)) {
3018  __Pyx_RaiseBufferIndexError(__pyx_t_6);
3019  __PYX_ERR(0, 40, __pyx_L1_error)
3020  }
3021  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3022 
3023  /* "subsurfaceTransportFunctions.pyx":39
3024  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
3025  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
3026  * if eN_right >= 0: # <<<<<<<<<<<<<<
3027  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
3028  *
3029  */
3030  }
3031  }
3032 
3033  /* "subsurfaceTransportFunctions.pyx":29
3034  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
3035  *
3036  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
3037  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
3038  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
3039  */
3040 
3041  /* function exit code */
3042  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3043  goto __pyx_L0;
3044  __pyx_L1_error:;
3045  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3046  __Pyx_PyThreadState_declare
3047  __Pyx_PyThreadState_assign
3048  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3049  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
3050  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
3051  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3052  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3053  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
3054  __pyx_r = NULL;
3055  goto __pyx_L2;
3056  __pyx_L0:;
3057  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
3058  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
3059  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3060  __pyx_L2:;
3061  __Pyx_XGIVEREF(__pyx_r);
3062  __Pyx_RefNannyFinishContext();
3063  return __pyx_r;
3064 }
3065 
3066 /* "subsurfaceTransportFunctions.pyx":43
3067  *
3068  * ###
3069  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3070  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
3071  * dict material_functions):
3072  */
3073 
3074 /* Python wrapper */
3075 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3076 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
3077 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
3078 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3079  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
3080  PyArrayObject *__pyx_v_q_vals = 0;
3081  PyObject *__pyx_v_material_functions = 0;
3082  int __pyx_lineno = 0;
3083  const char *__pyx_filename = NULL;
3084  int __pyx_clineno = 0;
3085  PyObject *__pyx_r = 0;
3086  __Pyx_RefNannyDeclarations
3087  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
3088  {
3089  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3090  PyObject* values[3] = {0,0,0};
3091  if (unlikely(__pyx_kwds)) {
3092  Py_ssize_t kw_args;
3093  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3094  switch (pos_args) {
3095  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3096  CYTHON_FALLTHROUGH;
3097  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3098  CYTHON_FALLTHROUGH;
3099  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3100  CYTHON_FALLTHROUGH;
3101  case 0: break;
3102  default: goto __pyx_L5_argtuple_error;
3103  }
3104  kw_args = PyDict_Size(__pyx_kwds);
3105  switch (pos_args) {
3106  case 0:
3107  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3108  else goto __pyx_L5_argtuple_error;
3109  CYTHON_FALLTHROUGH;
3110  case 1:
3111  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3112  else {
3113  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 43, __pyx_L3_error)
3114  }
3115  CYTHON_FALLTHROUGH;
3116  case 2:
3117  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3118  else {
3119  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 43, __pyx_L3_error)
3120  }
3121  }
3122  if (unlikely(kw_args > 0)) {
3123  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
3124  }
3125  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3126  goto __pyx_L5_argtuple_error;
3127  } else {
3128  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3129  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3130  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3131  }
3132  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3133  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3134  __pyx_v_material_functions = ((PyObject*)values[2]);
3135  }
3136  goto __pyx_L4_argument_unpacking_done;
3137  __pyx_L5_argtuple_error:;
3138  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
3139  __pyx_L3_error:;
3140  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3141  __Pyx_RefNannyFinishContext();
3142  return NULL;
3143  __pyx_L4_argument_unpacking_done:;
3144  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
3145  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
3146  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
3147  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3148 
3149  /* function exit code */
3150  goto __pyx_L0;
3151  __pyx_L1_error:;
3152  __pyx_r = NULL;
3153  __pyx_L0:;
3154  __Pyx_RefNannyFinishContext();
3155  return __pyx_r;
3156 }
3157 
3158 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3159  int __pyx_v_eN;
3160  int __pyx_v_k;
3161  int __pyx_v_material;
3162  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3163  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3164  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3165  __Pyx_Buffer __pyx_pybuffer_q_vals;
3166  PyObject *__pyx_r = NULL;
3167  __Pyx_RefNannyDeclarations
3168  npy_intp __pyx_t_1;
3169  npy_intp __pyx_t_2;
3170  int __pyx_t_3;
3171  Py_ssize_t __pyx_t_4;
3172  int __pyx_t_5;
3173  npy_intp __pyx_t_6;
3174  npy_intp __pyx_t_7;
3175  PyObject *__pyx_t_8 = NULL;
3176  PyObject *__pyx_t_9 = NULL;
3177  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_10;
3178  Py_ssize_t __pyx_t_11;
3179  int __pyx_t_12;
3180  int __pyx_lineno = 0;
3181  const char *__pyx_filename = NULL;
3182  int __pyx_clineno = 0;
3183  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
3184  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3185  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3186  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3187  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3188  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3189  __pyx_pybuffer_q_vals.refcount = 0;
3190  __pyx_pybuffernd_q_vals.data = NULL;
3191  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3192  {
3193  __Pyx_BufFmt_StackElem __pyx_stack[1];
3194  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3195  }
3196  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3197  {
3198  __Pyx_BufFmt_StackElem __pyx_stack[1];
3199  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3200  }
3201  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
3202 
3203  /* "subsurfaceTransportFunctions.pyx":51
3204  * """
3205  * cdef int eN,k,material
3206  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3207  * material = elementMaterialTypes[eN]
3208  * for k in range(q_vals.shape[1]):
3209  */
3210  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3211  __pyx_t_2 = __pyx_t_1;
3212  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3213  __pyx_v_eN = __pyx_t_3;
3214 
3215  /* "subsurfaceTransportFunctions.pyx":52
3216  * cdef int eN,k,material
3217  * for eN in range(q_vals.shape[0]):
3218  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3219  * for k in range(q_vals.shape[1]):
3220  * q_vals[eN,k] = material_functions[material]
3221  */
3222  __pyx_t_4 = __pyx_v_eN;
3223  __pyx_t_5 = -1;
3224  if (__pyx_t_4 < 0) {
3225  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3226  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3227  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3228  if (unlikely(__pyx_t_5 != -1)) {
3229  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3230  __PYX_ERR(0, 52, __pyx_L1_error)
3231  }
3232  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3233 
3234  /* "subsurfaceTransportFunctions.pyx":53
3235  * for eN in range(q_vals.shape[0]):
3236  * material = elementMaterialTypes[eN]
3237  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3238  * q_vals[eN,k] = material_functions[material]
3239  *
3240  */
3241  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3242  __pyx_t_7 = __pyx_t_6;
3243  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3244  __pyx_v_k = __pyx_t_5;
3245 
3246  /* "subsurfaceTransportFunctions.pyx":54
3247  * material = elementMaterialTypes[eN]
3248  * for k in range(q_vals.shape[1]):
3249  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
3250  *
3251  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
3252  */
3253  if (unlikely(__pyx_v_material_functions == Py_None)) {
3254  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3255  __PYX_ERR(0, 54, __pyx_L1_error)
3256  }
3257  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error)
3258  __Pyx_GOTREF(__pyx_t_8);
3259  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error)
3260  __Pyx_GOTREF(__pyx_t_9);
3261  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3262  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_10 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
3263  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3264  __pyx_t_4 = __pyx_v_eN;
3265  __pyx_t_11 = __pyx_v_k;
3266  __pyx_t_12 = -1;
3267  if (__pyx_t_4 < 0) {
3268  __pyx_t_4 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
3269  if (unlikely(__pyx_t_4 < 0)) __pyx_t_12 = 0;
3270  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_12 = 0;
3271  if (__pyx_t_11 < 0) {
3272  __pyx_t_11 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
3273  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
3274  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_12 = 1;
3275  if (unlikely(__pyx_t_12 != -1)) {
3276  __Pyx_RaiseBufferIndexError(__pyx_t_12);
3277  __PYX_ERR(0, 54, __pyx_L1_error)
3278  }
3279  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_10;
3280  }
3281  }
3282 
3283  /* "subsurfaceTransportFunctions.pyx":43
3284  *
3285  * ###
3286  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3287  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
3288  * dict material_functions):
3289  */
3290 
3291  /* function exit code */
3292  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3293  goto __pyx_L0;
3294  __pyx_L1_error:;
3295  __Pyx_XDECREF(__pyx_t_8);
3296  __Pyx_XDECREF(__pyx_t_9);
3297  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3298  __Pyx_PyThreadState_declare
3299  __Pyx_PyThreadState_assign
3300  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3301  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3302  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3303  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3304  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3305  __pyx_r = NULL;
3306  goto __pyx_L2;
3307  __pyx_L0:;
3308  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3309  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3310  __pyx_L2:;
3311  __Pyx_XGIVEREF(__pyx_r);
3312  __Pyx_RefNannyFinishContext();
3313  return __pyx_r;
3314 }
3315 
3316 /* "subsurfaceTransportFunctions.pyx":56
3317  * q_vals[eN,k] = material_functions[material]
3318  *
3319  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3320  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3321  * dict material_functions):
3322  */
3323 
3324 /* Python wrapper */
3325 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3326 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
3327 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
3328 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3329  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
3330  PyArrayObject *__pyx_v_q_vals = 0;
3331  PyObject *__pyx_v_material_functions = 0;
3332  int __pyx_lineno = 0;
3333  const char *__pyx_filename = NULL;
3334  int __pyx_clineno = 0;
3335  PyObject *__pyx_r = 0;
3336  __Pyx_RefNannyDeclarations
3337  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
3338  {
3339  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3340  PyObject* values[3] = {0,0,0};
3341  if (unlikely(__pyx_kwds)) {
3342  Py_ssize_t kw_args;
3343  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3344  switch (pos_args) {
3345  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3346  CYTHON_FALLTHROUGH;
3347  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3348  CYTHON_FALLTHROUGH;
3349  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3350  CYTHON_FALLTHROUGH;
3351  case 0: break;
3352  default: goto __pyx_L5_argtuple_error;
3353  }
3354  kw_args = PyDict_Size(__pyx_kwds);
3355  switch (pos_args) {
3356  case 0:
3357  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3358  else goto __pyx_L5_argtuple_error;
3359  CYTHON_FALLTHROUGH;
3360  case 1:
3361  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3362  else {
3363  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 56, __pyx_L3_error)
3364  }
3365  CYTHON_FALLTHROUGH;
3366  case 2:
3367  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3368  else {
3369  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 56, __pyx_L3_error)
3370  }
3371  }
3372  if (unlikely(kw_args > 0)) {
3373  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
3374  }
3375  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3376  goto __pyx_L5_argtuple_error;
3377  } else {
3378  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3379  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3380  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3381  }
3382  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3383  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3384  __pyx_v_material_functions = ((PyObject*)values[2]);
3385  }
3386  goto __pyx_L4_argument_unpacking_done;
3387  __pyx_L5_argtuple_error:;
3388  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
3389  __pyx_L3_error:;
3390  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3391  __Pyx_RefNannyFinishContext();
3392  return NULL;
3393  __pyx_L4_argument_unpacking_done:;
3394  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
3395  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 57, __pyx_L1_error)
3396  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 58, __pyx_L1_error)
3397  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3398 
3399  /* function exit code */
3400  goto __pyx_L0;
3401  __pyx_L1_error:;
3402  __pyx_r = NULL;
3403  __pyx_L0:;
3404  __Pyx_RefNannyFinishContext();
3405  return __pyx_r;
3406 }
3407 
3408 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3409  int __pyx_v_eN;
3410  int __pyx_v_k;
3411  int __pyx_v_material;
3412  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3413  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3414  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3415  __Pyx_Buffer __pyx_pybuffer_q_vals;
3416  PyObject *__pyx_r = NULL;
3417  __Pyx_RefNannyDeclarations
3418  npy_intp __pyx_t_1;
3419  npy_intp __pyx_t_2;
3420  int __pyx_t_3;
3421  Py_ssize_t __pyx_t_4;
3422  int __pyx_t_5;
3423  npy_intp __pyx_t_6;
3424  npy_intp __pyx_t_7;
3425  PyObject *__pyx_t_8 = NULL;
3426  PyObject *__pyx_t_9 = NULL;
3427  PyObject *__pyx_t_10 = NULL;
3428  PyObject *__pyx_t_11 = NULL;
3429  int __pyx_lineno = 0;
3430  const char *__pyx_filename = NULL;
3431  int __pyx_clineno = 0;
3432  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
3433  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3434  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3435  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3436  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3437  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3438  __pyx_pybuffer_q_vals.refcount = 0;
3439  __pyx_pybuffernd_q_vals.data = NULL;
3440  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3441  {
3442  __Pyx_BufFmt_StackElem __pyx_stack[1];
3443  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3444  }
3445  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3446  {
3447  __Pyx_BufFmt_StackElem __pyx_stack[1];
3448  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3449  }
3450  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
3451 
3452  /* "subsurfaceTransportFunctions.pyx":63
3453  * """
3454  * cdef int eN,k,material
3455  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3456  * material = elementMaterialTypes[eN]
3457  * for k in range(q_vals.shape[1]):
3458  */
3459  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3460  __pyx_t_2 = __pyx_t_1;
3461  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3462  __pyx_v_eN = __pyx_t_3;
3463 
3464  /* "subsurfaceTransportFunctions.pyx":64
3465  * cdef int eN,k,material
3466  * for eN in range(q_vals.shape[0]):
3467  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3468  * for k in range(q_vals.shape[1]):
3469  * q_vals[eN,k,:] = material_functions[material].flat
3470  */
3471  __pyx_t_4 = __pyx_v_eN;
3472  __pyx_t_5 = -1;
3473  if (__pyx_t_4 < 0) {
3474  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3475  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3476  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3477  if (unlikely(__pyx_t_5 != -1)) {
3478  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3479  __PYX_ERR(0, 64, __pyx_L1_error)
3480  }
3481  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3482 
3483  /* "subsurfaceTransportFunctions.pyx":65
3484  * for eN in range(q_vals.shape[0]):
3485  * material = elementMaterialTypes[eN]
3486  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3487  * q_vals[eN,k,:] = material_functions[material].flat
3488  *
3489  */
3490  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3491  __pyx_t_7 = __pyx_t_6;
3492  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3493  __pyx_v_k = __pyx_t_5;
3494 
3495  /* "subsurfaceTransportFunctions.pyx":66
3496  * material = elementMaterialTypes[eN]
3497  * for k in range(q_vals.shape[1]):
3498  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
3499  *
3500  *
3501  */
3502  if (unlikely(__pyx_v_material_functions == Py_None)) {
3503  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3504  __PYX_ERR(0, 66, __pyx_L1_error)
3505  }
3506  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3507  __Pyx_GOTREF(__pyx_t_8);
3508  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3509  __Pyx_GOTREF(__pyx_t_9);
3510  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3511  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3512  __Pyx_GOTREF(__pyx_t_8);
3513  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3514  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3515  __Pyx_GOTREF(__pyx_t_9);
3516  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 66, __pyx_L1_error)
3517  __Pyx_GOTREF(__pyx_t_10);
3518  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 66, __pyx_L1_error)
3519  __Pyx_GOTREF(__pyx_t_11);
3520  __Pyx_GIVEREF(__pyx_t_9);
3521  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
3522  __Pyx_GIVEREF(__pyx_t_10);
3523  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
3524  __Pyx_INCREF(__pyx_slice_);
3525  __Pyx_GIVEREF(__pyx_slice_);
3526  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_slice_);
3527  __pyx_t_9 = 0;
3528  __pyx_t_10 = 0;
3529  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_11, __pyx_t_8) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
3530  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3531  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3532  }
3533  }
3534 
3535  /* "subsurfaceTransportFunctions.pyx":56
3536  * q_vals[eN,k] = material_functions[material]
3537  *
3538  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3539  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3540  * dict material_functions):
3541  */
3542 
3543  /* function exit code */
3544  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3545  goto __pyx_L0;
3546  __pyx_L1_error:;
3547  __Pyx_XDECREF(__pyx_t_8);
3548  __Pyx_XDECREF(__pyx_t_9);
3549  __Pyx_XDECREF(__pyx_t_10);
3550  __Pyx_XDECREF(__pyx_t_11);
3551  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3552  __Pyx_PyThreadState_declare
3553  __Pyx_PyThreadState_assign
3554  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3555  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3556  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3557  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3558  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3559  __pyx_r = NULL;
3560  goto __pyx_L2;
3561  __pyx_L0:;
3562  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3563  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3564  __pyx_L2:;
3565  __Pyx_XGIVEREF(__pyx_r);
3566  __Pyx_RefNannyFinishContext();
3567  return __pyx_r;
3568 }
3569 
3570 /* "subsurfaceTransportFunctions.pyx":69
3571  *
3572  *
3573  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3574  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3575  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3576  */
3577 
3578 /* Python wrapper */
3579 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3580 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3581 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
3582 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3583  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3584  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3585  PyArrayObject *__pyx_v_ebq_vals = 0;
3586  PyObject *__pyx_v_material_functions = 0;
3587  int __pyx_lineno = 0;
3588  const char *__pyx_filename = NULL;
3589  int __pyx_clineno = 0;
3590  PyObject *__pyx_r = 0;
3591  __Pyx_RefNannyDeclarations
3592  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
3593  {
3594  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3595  PyObject* values[4] = {0,0,0,0};
3596  if (unlikely(__pyx_kwds)) {
3597  Py_ssize_t kw_args;
3598  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3599  switch (pos_args) {
3600  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3601  CYTHON_FALLTHROUGH;
3602  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3603  CYTHON_FALLTHROUGH;
3604  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3605  CYTHON_FALLTHROUGH;
3606  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3607  CYTHON_FALLTHROUGH;
3608  case 0: break;
3609  default: goto __pyx_L5_argtuple_error;
3610  }
3611  kw_args = PyDict_Size(__pyx_kwds);
3612  switch (pos_args) {
3613  case 0:
3614  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3615  else goto __pyx_L5_argtuple_error;
3616  CYTHON_FALLTHROUGH;
3617  case 1:
3618  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3619  else {
3620  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
3621  }
3622  CYTHON_FALLTHROUGH;
3623  case 2:
3624  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3625  else {
3626  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
3627  }
3628  CYTHON_FALLTHROUGH;
3629  case 3:
3630  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3631  else {
3632  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error)
3633  }
3634  }
3635  if (unlikely(kw_args > 0)) {
3636  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
3637  }
3638  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3639  goto __pyx_L5_argtuple_error;
3640  } else {
3641  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3642  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3643  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3644  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3645  }
3646  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3647  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3648  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
3649  __pyx_v_material_functions = ((PyObject*)values[3]);
3650  }
3651  goto __pyx_L4_argument_unpacking_done;
3652  __pyx_L5_argtuple_error:;
3653  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
3654  __pyx_L3_error:;
3655  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3656  __Pyx_RefNannyFinishContext();
3657  return NULL;
3658  __pyx_L4_argument_unpacking_done:;
3659  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
3660  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
3661  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
3662  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
3663  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3664 
3665  /* function exit code */
3666  goto __pyx_L0;
3667  __pyx_L1_error:;
3668  __pyx_r = NULL;
3669  __pyx_L0:;
3670  __Pyx_RefNannyFinishContext();
3671  return __pyx_r;
3672 }
3673 
3674 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3675  int __pyx_v_eN;
3676  int __pyx_v_ebN;
3677  int __pyx_v_ebN_local;
3678  int __pyx_v_k;
3679  int __pyx_v_material_left;
3680  int __pyx_v_material_right;
3681  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3682  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3683  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3684  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3685  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3686  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3687  PyObject *__pyx_r = NULL;
3688  __Pyx_RefNannyDeclarations
3689  npy_intp __pyx_t_1;
3690  npy_intp __pyx_t_2;
3691  int __pyx_t_3;
3692  npy_intp __pyx_t_4;
3693  npy_intp __pyx_t_5;
3694  int __pyx_t_6;
3695  Py_ssize_t __pyx_t_7;
3696  Py_ssize_t __pyx_t_8;
3697  int __pyx_t_9;
3698  npy_intp __pyx_t_10;
3699  npy_intp __pyx_t_11;
3700  PyObject *__pyx_t_12 = NULL;
3701  PyObject *__pyx_t_13 = NULL;
3702  PyObject *__pyx_t_14 = NULL;
3703  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
3704  Py_ssize_t __pyx_t_16;
3705  int __pyx_t_17;
3706  int __pyx_lineno = 0;
3707  const char *__pyx_filename = NULL;
3708  int __pyx_clineno = 0;
3709  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3710  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3711  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3712  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3713  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3714  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3715  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3716  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3717  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3718  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3719  __pyx_pybuffer_ebq_vals.refcount = 0;
3720  __pyx_pybuffernd_ebq_vals.data = NULL;
3721  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3722  {
3723  __Pyx_BufFmt_StackElem __pyx_stack[1];
3724  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3725  }
3726  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3727  {
3728  __Pyx_BufFmt_StackElem __pyx_stack[1];
3729  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3730  }
3731  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3732  {
3733  __Pyx_BufFmt_StackElem __pyx_stack[1];
3734  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3735  }
3736  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3737 
3738  /* "subsurfaceTransportFunctions.pyx":82
3739  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3740  *
3741  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3742  * for ebN_local in range(ebq_vals.shape[1]):
3743  * ebN = elementBoundariesArray[eN,ebN_local]
3744  */
3745  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3746  __pyx_t_2 = __pyx_t_1;
3747  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3748  __pyx_v_eN = __pyx_t_3;
3749 
3750  /* "subsurfaceTransportFunctions.pyx":83
3751  *
3752  * for eN in range(ebq_vals.shape[0]):
3753  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3754  * ebN = elementBoundariesArray[eN,ebN_local]
3755  * material_left = elementBoundaryTypes[ebN,0]
3756  */
3757  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
3758  __pyx_t_5 = __pyx_t_4;
3759  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3760  __pyx_v_ebN_local = __pyx_t_6;
3761 
3762  /* "subsurfaceTransportFunctions.pyx":84
3763  * for eN in range(ebq_vals.shape[0]):
3764  * for ebN_local in range(ebq_vals.shape[1]):
3765  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3766  * material_left = elementBoundaryTypes[ebN,0]
3767  * material_right= elementBoundaryTypes[ebN,1]
3768  */
3769  __pyx_t_7 = __pyx_v_eN;
3770  __pyx_t_8 = __pyx_v_ebN_local;
3771  __pyx_t_9 = -1;
3772  if (__pyx_t_7 < 0) {
3773  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3774  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3775  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
3776  if (__pyx_t_8 < 0) {
3777  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3778  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3779  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
3780  if (unlikely(__pyx_t_9 != -1)) {
3781  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3782  __PYX_ERR(0, 84, __pyx_L1_error)
3783  }
3784  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3785 
3786  /* "subsurfaceTransportFunctions.pyx":85
3787  * for ebN_local in range(ebq_vals.shape[1]):
3788  * ebN = elementBoundariesArray[eN,ebN_local]
3789  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3790  * material_right= elementBoundaryTypes[ebN,1]
3791  * for k in range(ebq_vals.shape[2]):
3792  */
3793  __pyx_t_8 = __pyx_v_ebN;
3794  __pyx_t_7 = 0;
3795  __pyx_t_9 = -1;
3796  if (__pyx_t_8 < 0) {
3797  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3798  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
3799  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3800  if (__pyx_t_7 < 0) {
3801  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3802  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
3803  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3804  if (unlikely(__pyx_t_9 != -1)) {
3805  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3806  __PYX_ERR(0, 85, __pyx_L1_error)
3807  }
3808  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3809 
3810  /* "subsurfaceTransportFunctions.pyx":86
3811  * ebN = elementBoundariesArray[eN,ebN_local]
3812  * material_left = elementBoundaryTypes[ebN,0]
3813  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3814  * for k in range(ebq_vals.shape[2]):
3815  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3816  */
3817  __pyx_t_7 = __pyx_v_ebN;
3818  __pyx_t_8 = 1;
3819  __pyx_t_9 = -1;
3820  if (__pyx_t_7 < 0) {
3821  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3822  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3823  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3824  if (__pyx_t_8 < 0) {
3825  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3826  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3827  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3828  if (unlikely(__pyx_t_9 != -1)) {
3829  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3830  __PYX_ERR(0, 86, __pyx_L1_error)
3831  }
3832  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3833 
3834  /* "subsurfaceTransportFunctions.pyx":87
3835  * material_left = elementBoundaryTypes[ebN,0]
3836  * material_right= elementBoundaryTypes[ebN,1]
3837  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3838  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3839  * material_functions[material_right])
3840  */
3841  __pyx_t_10 = (__pyx_v_ebq_vals->dimensions[2]);
3842  __pyx_t_11 = __pyx_t_10;
3843  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
3844  __pyx_v_k = __pyx_t_9;
3845 
3846  /* "subsurfaceTransportFunctions.pyx":88
3847  * material_right= elementBoundaryTypes[ebN,1]
3848  * for k in range(ebq_vals.shape[2]):
3849  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3850  * material_functions[material_right])
3851  *
3852  */
3853  if (unlikely(__pyx_v_material_functions == Py_None)) {
3854  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3855  __PYX_ERR(0, 88, __pyx_L1_error)
3856  }
3857  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
3858  __Pyx_GOTREF(__pyx_t_12);
3859  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error)
3860  __Pyx_GOTREF(__pyx_t_13);
3861  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3862 
3863  /* "subsurfaceTransportFunctions.pyx":89
3864  * for k in range(ebq_vals.shape[2]):
3865  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3866  * material_functions[material_right]) # <<<<<<<<<<<<<<
3867  *
3868  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3869  */
3870  if (unlikely(__pyx_v_material_functions == Py_None)) {
3871  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3872  __PYX_ERR(0, 89, __pyx_L1_error)
3873  }
3874  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L1_error)
3875  __Pyx_GOTREF(__pyx_t_12);
3876  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 89, __pyx_L1_error)
3877  __Pyx_GOTREF(__pyx_t_14);
3878  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3879 
3880  /* "subsurfaceTransportFunctions.pyx":88
3881  * material_right= elementBoundaryTypes[ebN,1]
3882  * for k in range(ebq_vals.shape[2]):
3883  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3884  * material_functions[material_right])
3885  *
3886  */
3887  __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
3888  __Pyx_GOTREF(__pyx_t_12);
3889  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3890  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3891  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L1_error)
3892  __Pyx_GOTREF(__pyx_t_14);
3893  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3894  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3895  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3896  __pyx_t_8 = __pyx_v_eN;
3897  __pyx_t_7 = __pyx_v_ebN_local;
3898  __pyx_t_16 = __pyx_v_k;
3899  __pyx_t_17 = -1;
3900  if (__pyx_t_8 < 0) {
3901  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3902  if (unlikely(__pyx_t_8 < 0)) __pyx_t_17 = 0;
3903  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_17 = 0;
3904  if (__pyx_t_7 < 0) {
3905  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3906  if (unlikely(__pyx_t_7 < 0)) __pyx_t_17 = 1;
3907  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_17 = 1;
3908  if (__pyx_t_16 < 0) {
3909  __pyx_t_16 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3910  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 2;
3911  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_17 = 2;
3912  if (unlikely(__pyx_t_17 != -1)) {
3913  __Pyx_RaiseBufferIndexError(__pyx_t_17);
3914  __PYX_ERR(0, 88, __pyx_L1_error)
3915  }
3916  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_15;
3917  }
3918  }
3919  }
3920 
3921  /* "subsurfaceTransportFunctions.pyx":69
3922  *
3923  *
3924  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3925  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3926  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3927  */
3928 
3929  /* function exit code */
3930  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3931  goto __pyx_L0;
3932  __pyx_L1_error:;
3933  __Pyx_XDECREF(__pyx_t_12);
3934  __Pyx_XDECREF(__pyx_t_13);
3935  __Pyx_XDECREF(__pyx_t_14);
3936  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3937  __Pyx_PyThreadState_declare
3938  __Pyx_PyThreadState_assign
3939  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3940  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3941  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3942  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3943  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3944  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3945  __pyx_r = NULL;
3946  goto __pyx_L2;
3947  __pyx_L0:;
3948  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3949  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3950  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3951  __pyx_L2:;
3952  __Pyx_XGIVEREF(__pyx_r);
3953  __Pyx_RefNannyFinishContext();
3954  return __pyx_r;
3955 }
3956 
3957 /* "subsurfaceTransportFunctions.pyx":91
3958  * material_functions[material_right])
3959  *
3960  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3961  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3962  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3963  */
3964 
3965 /* Python wrapper */
3966 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3967 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3968 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3969 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3970  int __pyx_v_nd;
3971  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3972  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3973  PyArrayObject *__pyx_v_ebq_vals = 0;
3974  PyObject *__pyx_v_material_functions = 0;
3975  int __pyx_lineno = 0;
3976  const char *__pyx_filename = NULL;
3977  int __pyx_clineno = 0;
3978  PyObject *__pyx_r = 0;
3979  __Pyx_RefNannyDeclarations
3980  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3981  {
3982  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3983  PyObject* values[5] = {0,0,0,0,0};
3984  if (unlikely(__pyx_kwds)) {
3985  Py_ssize_t kw_args;
3986  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3987  switch (pos_args) {
3988  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3989  CYTHON_FALLTHROUGH;
3990  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3991  CYTHON_FALLTHROUGH;
3992  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3993  CYTHON_FALLTHROUGH;
3994  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3995  CYTHON_FALLTHROUGH;
3996  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3997  CYTHON_FALLTHROUGH;
3998  case 0: break;
3999  default: goto __pyx_L5_argtuple_error;
4000  }
4001  kw_args = PyDict_Size(__pyx_kwds);
4002  switch (pos_args) {
4003  case 0:
4004  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4005  else goto __pyx_L5_argtuple_error;
4006  CYTHON_FALLTHROUGH;
4007  case 1:
4008  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4009  else {
4010  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 91, __pyx_L3_error)
4011  }
4012  CYTHON_FALLTHROUGH;
4013  case 2:
4014  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4015  else {
4016  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 91, __pyx_L3_error)
4017  }
4018  CYTHON_FALLTHROUGH;
4019  case 3:
4020  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
4021  else {
4022  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 91, __pyx_L3_error)
4023  }
4024  CYTHON_FALLTHROUGH;
4025  case 4:
4026  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4027  else {
4028  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 91, __pyx_L3_error)
4029  }
4030  }
4031  if (unlikely(kw_args > 0)) {
4032  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
4033  }
4034  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4035  goto __pyx_L5_argtuple_error;
4036  } else {
4037  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4038  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4039  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4040  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4041  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4042  }
4043  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
4044  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4045  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4046  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
4047  __pyx_v_material_functions = ((PyObject*)values[4]);
4048  }
4049  goto __pyx_L4_argument_unpacking_done;
4050  __pyx_L5_argtuple_error:;
4051  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
4052  __pyx_L3_error:;
4053  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4054  __Pyx_RefNannyFinishContext();
4055  return NULL;
4056  __pyx_L4_argument_unpacking_done:;
4057  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 92, __pyx_L1_error)
4058  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 93, __pyx_L1_error)
4059  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 94, __pyx_L1_error)
4060  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 95, __pyx_L1_error)
4061  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
4062 
4063  /* function exit code */
4064  goto __pyx_L0;
4065  __pyx_L1_error:;
4066  __pyx_r = NULL;
4067  __pyx_L0:;
4068  __Pyx_RefNannyFinishContext();
4069  return __pyx_r;
4070 }
4071 
4072 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
4073  int __pyx_v_eN;
4074  int __pyx_v_ebN;
4075  int __pyx_v_ebN_local;
4076  int __pyx_v_k;
4077  int __pyx_v_material_left;
4078  int __pyx_v_material_right;
4079  int __pyx_v_I;
4080  int __pyx_v_J;
4081  double __pyx_v_numer;
4082  double __pyx_v_denom;
4083  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
4084  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
4085  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4086  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4087  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4088  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4089  PyObject *__pyx_r = NULL;
4090  __Pyx_RefNannyDeclarations
4091  npy_intp __pyx_t_1;
4092  npy_intp __pyx_t_2;
4093  int __pyx_t_3;
4094  npy_intp __pyx_t_4;
4095  npy_intp __pyx_t_5;
4096  int __pyx_t_6;
4097  Py_ssize_t __pyx_t_7;
4098  Py_ssize_t __pyx_t_8;
4099  int __pyx_t_9;
4100  npy_intp __pyx_t_10;
4101  npy_intp __pyx_t_11;
4102  int __pyx_t_12;
4103  int __pyx_t_13;
4104  int __pyx_t_14;
4105  int __pyx_t_15;
4106  int __pyx_t_16;
4107  int __pyx_t_17;
4108  PyObject *__pyx_t_18 = NULL;
4109  PyObject *__pyx_t_19 = NULL;
4110  PyObject *__pyx_t_20 = NULL;
4111  PyObject *__pyx_t_21 = NULL;
4112  PyObject *__pyx_t_22 = NULL;
4113  double __pyx_t_23;
4114  Py_ssize_t __pyx_t_24;
4115  Py_ssize_t __pyx_t_25;
4116  int __pyx_t_26;
4117  int __pyx_lineno = 0;
4118  const char *__pyx_filename = NULL;
4119  int __pyx_clineno = 0;
4120  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
4121  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4122  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4123  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4124  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4125  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4126  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4127  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4128  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4129  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
4130  __pyx_pybuffer_ebq_vals.refcount = 0;
4131  __pyx_pybuffernd_ebq_vals.data = NULL;
4132  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
4133  {
4134  __Pyx_BufFmt_StackElem __pyx_stack[1];
4135  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4136  }
4137  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4138  {
4139  __Pyx_BufFmt_StackElem __pyx_stack[1];
4140  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4141  }
4142  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4143  {
4144  __Pyx_BufFmt_StackElem __pyx_stack[1];
4145  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4146  }
4147  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
4148 
4149  /* "subsurfaceTransportFunctions.pyx":106
4150  * cdef double numer,denom
4151  *
4152  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
4153  * for ebN_local in range(ebq_vals.shape[1]):
4154  * ebN = elementBoundariesArray[eN,ebN_local]
4155  */
4156  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
4157  __pyx_t_2 = __pyx_t_1;
4158  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4159  __pyx_v_eN = __pyx_t_3;
4160 
4161  /* "subsurfaceTransportFunctions.pyx":107
4162  *
4163  * for eN in range(ebq_vals.shape[0]):
4164  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
4165  * ebN = elementBoundariesArray[eN,ebN_local]
4166  * material_left = elementBoundaryTypes[ebN,0]
4167  */
4168  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
4169  __pyx_t_5 = __pyx_t_4;
4170  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4171  __pyx_v_ebN_local = __pyx_t_6;
4172 
4173  /* "subsurfaceTransportFunctions.pyx":108
4174  * for eN in range(ebq_vals.shape[0]):
4175  * for ebN_local in range(ebq_vals.shape[1]):
4176  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
4177  * material_left = elementBoundaryTypes[ebN,0]
4178  * material_right= elementBoundaryTypes[ebN,1]
4179  */
4180  __pyx_t_7 = __pyx_v_eN;
4181  __pyx_t_8 = __pyx_v_ebN_local;
4182  __pyx_t_9 = -1;
4183  if (__pyx_t_7 < 0) {
4184  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
4185  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4186  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
4187  if (__pyx_t_8 < 0) {
4188  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
4189  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4190  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
4191  if (unlikely(__pyx_t_9 != -1)) {
4192  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4193  __PYX_ERR(0, 108, __pyx_L1_error)
4194  }
4195  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
4196 
4197  /* "subsurfaceTransportFunctions.pyx":109
4198  * for ebN_local in range(ebq_vals.shape[1]):
4199  * ebN = elementBoundariesArray[eN,ebN_local]
4200  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4201  * material_right= elementBoundaryTypes[ebN,1]
4202  * for k in range(ebq_vals.shape[2]):
4203  */
4204  __pyx_t_8 = __pyx_v_ebN;
4205  __pyx_t_7 = 0;
4206  __pyx_t_9 = -1;
4207  if (__pyx_t_8 < 0) {
4208  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4209  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
4210  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4211  if (__pyx_t_7 < 0) {
4212  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4213  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
4214  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4215  if (unlikely(__pyx_t_9 != -1)) {
4216  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4217  __PYX_ERR(0, 109, __pyx_L1_error)
4218  }
4219  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4220 
4221  /* "subsurfaceTransportFunctions.pyx":110
4222  * ebN = elementBoundariesArray[eN,ebN_local]
4223  * material_left = elementBoundaryTypes[ebN,0]
4224  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4225  * for k in range(ebq_vals.shape[2]):
4226  * for I in range(nd):
4227  */
4228  __pyx_t_7 = __pyx_v_ebN;
4229  __pyx_t_8 = 1;
4230  __pyx_t_9 = -1;
4231  if (__pyx_t_7 < 0) {
4232  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4233  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4234  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4235  if (__pyx_t_8 < 0) {
4236  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4237  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4238  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4239  if (unlikely(__pyx_t_9 != -1)) {
4240  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4241  __PYX_ERR(0, 110, __pyx_L1_error)
4242  }
4243  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4244 
4245  /* "subsurfaceTransportFunctions.pyx":111
4246  * material_left = elementBoundaryTypes[ebN,0]
4247  * material_right= elementBoundaryTypes[ebN,1]
4248  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
4249  * for I in range(nd):
4250  * for J in range(nd):
4251  */
4252  __pyx_t_10 = (__pyx_v_ebq_vals->dimensions[2]);
4253  __pyx_t_11 = __pyx_t_10;
4254  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
4255  __pyx_v_k = __pyx_t_9;
4256 
4257  /* "subsurfaceTransportFunctions.pyx":112
4258  * material_right= elementBoundaryTypes[ebN,1]
4259  * for k in range(ebq_vals.shape[2]):
4260  * for I in range(nd): # <<<<<<<<<<<<<<
4261  * for J in range(nd):
4262  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4263  */
4264  __pyx_t_12 = __pyx_v_nd;
4265  __pyx_t_13 = __pyx_t_12;
4266  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
4267  __pyx_v_I = __pyx_t_14;
4268 
4269  /* "subsurfaceTransportFunctions.pyx":113
4270  * for k in range(ebq_vals.shape[2]):
4271  * for I in range(nd):
4272  * for J in range(nd): # <<<<<<<<<<<<<<
4273  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4274  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4275  */
4276  __pyx_t_15 = __pyx_v_nd;
4277  __pyx_t_16 = __pyx_t_15;
4278  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
4279  __pyx_v_J = __pyx_t_17;
4280 
4281  /* "subsurfaceTransportFunctions.pyx":114
4282  * for I in range(nd):
4283  * for J in range(nd):
4284  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4285  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4286  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4287  */
4288  if (unlikely(__pyx_v_material_functions == Py_None)) {
4289  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4290  __PYX_ERR(0, 114, __pyx_L1_error)
4291  }
4292  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4293  __Pyx_GOTREF(__pyx_t_18);
4294  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
4295  __Pyx_GOTREF(__pyx_t_19);
4296  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4297  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4298  __Pyx_GOTREF(__pyx_t_18);
4299  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4300  __Pyx_GOTREF(__pyx_t_20);
4301  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
4302  __Pyx_GOTREF(__pyx_t_21);
4303  __Pyx_GIVEREF(__pyx_t_18);
4304  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
4305  __Pyx_GIVEREF(__pyx_t_20);
4306  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_20);
4307  __pyx_t_18 = 0;
4308  __pyx_t_20 = 0;
4309  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4310  __Pyx_GOTREF(__pyx_t_20);
4311  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4312  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4313  __pyx_t_21 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
4314  __Pyx_GOTREF(__pyx_t_21);
4315  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4316  if (unlikely(__pyx_v_material_functions == Py_None)) {
4317  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4318  __PYX_ERR(0, 114, __pyx_L1_error)
4319  }
4320  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4321  __Pyx_GOTREF(__pyx_t_20);
4322  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
4323  __Pyx_GOTREF(__pyx_t_19);
4324  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4325  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4326  __Pyx_GOTREF(__pyx_t_20);
4327  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4328  __Pyx_GOTREF(__pyx_t_18);
4329  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4330  __Pyx_GOTREF(__pyx_t_22);
4331  __Pyx_GIVEREF(__pyx_t_20);
4332  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_20);
4333  __Pyx_GIVEREF(__pyx_t_18);
4334  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_18);
4335  __pyx_t_20 = 0;
4336  __pyx_t_18 = 0;
4337  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4338  __Pyx_GOTREF(__pyx_t_18);
4339  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4340  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4341  __pyx_t_22 = PyNumber_Multiply(__pyx_t_21, __pyx_t_18); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4342  __Pyx_GOTREF(__pyx_t_22);
4343  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4344  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4345  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_22); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
4346  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4347  __pyx_v_numer = __pyx_t_23;
4348 
4349  /* "subsurfaceTransportFunctions.pyx":115
4350  * for J in range(nd):
4351  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4352  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4353  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4354  *
4355  */
4356  if (unlikely(__pyx_v_material_functions == Py_None)) {
4357  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4358  __PYX_ERR(0, 115, __pyx_L1_error)
4359  }
4360  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4361  __Pyx_GOTREF(__pyx_t_22);
4362  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
4363  __Pyx_GOTREF(__pyx_t_18);
4364  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4365  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4366  __Pyx_GOTREF(__pyx_t_22);
4367  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
4368  __Pyx_GOTREF(__pyx_t_21);
4369  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4370  __Pyx_GOTREF(__pyx_t_19);
4371  __Pyx_GIVEREF(__pyx_t_22);
4372  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_22);
4373  __Pyx_GIVEREF(__pyx_t_21);
4374  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
4375  __pyx_t_22 = 0;
4376  __pyx_t_21 = 0;
4377  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
4378  __Pyx_GOTREF(__pyx_t_21);
4379  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4380  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4381  if (unlikely(__pyx_v_material_functions == Py_None)) {
4382  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4383  __PYX_ERR(0, 115, __pyx_L1_error)
4384  }
4385  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4386  __Pyx_GOTREF(__pyx_t_19);
4387  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
4388  __Pyx_GOTREF(__pyx_t_18);
4389  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4390  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4391  __Pyx_GOTREF(__pyx_t_19);
4392  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4393  __Pyx_GOTREF(__pyx_t_22);
4394  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
4395  __Pyx_GOTREF(__pyx_t_20);
4396  __Pyx_GIVEREF(__pyx_t_19);
4397  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
4398  __Pyx_GIVEREF(__pyx_t_22);
4399  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_22);
4400  __pyx_t_19 = 0;
4401  __pyx_t_22 = 0;
4402  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4403  __Pyx_GOTREF(__pyx_t_22);
4404  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4405  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4406  __pyx_t_20 = PyNumber_Add(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
4407  __Pyx_GOTREF(__pyx_t_20);
4408  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4409  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4410  __pyx_t_22 = __Pyx_PyFloat_AddObjC(__pyx_t_20, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4411  __Pyx_GOTREF(__pyx_t_22);
4412  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4413  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_22); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
4414  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4415  __pyx_v_denom = __pyx_t_23;
4416 
4417  /* "subsurfaceTransportFunctions.pyx":116
4418  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4419  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4420  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4421  *
4422  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4423  */
4424  if (unlikely(__pyx_v_denom == 0)) {
4425  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4426  __PYX_ERR(0, 116, __pyx_L1_error)
4427  }
4428  __pyx_t_8 = __pyx_v_eN;
4429  __pyx_t_7 = __pyx_v_ebN_local;
4430  __pyx_t_24 = __pyx_v_k;
4431  __pyx_t_25 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4432  __pyx_t_26 = -1;
4433  if (__pyx_t_8 < 0) {
4434  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
4435  if (unlikely(__pyx_t_8 < 0)) __pyx_t_26 = 0;
4436  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_26 = 0;
4437  if (__pyx_t_7 < 0) {
4438  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
4439  if (unlikely(__pyx_t_7 < 0)) __pyx_t_26 = 1;
4440  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_26 = 1;
4441  if (__pyx_t_24 < 0) {
4442  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
4443  if (unlikely(__pyx_t_24 < 0)) __pyx_t_26 = 2;
4444  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_26 = 2;
4445  if (__pyx_t_25 < 0) {
4446  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
4447  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 3;
4448  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_26 = 3;
4449  if (unlikely(__pyx_t_26 != -1)) {
4450  __Pyx_RaiseBufferIndexError(__pyx_t_26);
4451  __PYX_ERR(0, 116, __pyx_L1_error)
4452  }
4453  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
4454  }
4455  }
4456  }
4457  }
4458  }
4459 
4460  /* "subsurfaceTransportFunctions.pyx":91
4461  * material_functions[material_right])
4462  *
4463  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4464  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4465  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4466  */
4467 
4468  /* function exit code */
4469  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4470  goto __pyx_L0;
4471  __pyx_L1_error:;
4472  __Pyx_XDECREF(__pyx_t_18);
4473  __Pyx_XDECREF(__pyx_t_19);
4474  __Pyx_XDECREF(__pyx_t_20);
4475  __Pyx_XDECREF(__pyx_t_21);
4476  __Pyx_XDECREF(__pyx_t_22);
4477  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4478  __Pyx_PyThreadState_declare
4479  __Pyx_PyThreadState_assign
4480  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4481  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4482  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4483  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4484  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4485  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4486  __pyx_r = NULL;
4487  goto __pyx_L2;
4488  __pyx_L0:;
4489  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4490  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4491  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4492  __pyx_L2:;
4493  __Pyx_XGIVEREF(__pyx_r);
4494  __Pyx_RefNannyFinishContext();
4495  return __pyx_r;
4496 }
4497 
4498 /* "subsurfaceTransportFunctions.pyx":118
4499  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4500  *
4501  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4502  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4503  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4504  */
4505 
4506 /* Python wrapper */
4507 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4508 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4509 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
4510 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4511  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4512  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4513  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4514  PyObject *__pyx_v_material_functions = 0;
4515  int __pyx_lineno = 0;
4516  const char *__pyx_filename = NULL;
4517  int __pyx_clineno = 0;
4518  PyObject *__pyx_r = 0;
4519  __Pyx_RefNannyDeclarations
4520  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
4521  {
4522  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4523  PyObject* values[4] = {0,0,0,0};
4524  if (unlikely(__pyx_kwds)) {
4525  Py_ssize_t kw_args;
4526  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4527  switch (pos_args) {
4528  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4529  CYTHON_FALLTHROUGH;
4530  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4531  CYTHON_FALLTHROUGH;
4532  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4533  CYTHON_FALLTHROUGH;
4534  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4535  CYTHON_FALLTHROUGH;
4536  case 0: break;
4537  default: goto __pyx_L5_argtuple_error;
4538  }
4539  kw_args = PyDict_Size(__pyx_kwds);
4540  switch (pos_args) {
4541  case 0:
4542  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4543  else goto __pyx_L5_argtuple_error;
4544  CYTHON_FALLTHROUGH;
4545  case 1:
4546  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4547  else {
4548  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 118, __pyx_L3_error)
4549  }
4550  CYTHON_FALLTHROUGH;
4551  case 2:
4552  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4553  else {
4554  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 118, __pyx_L3_error)
4555  }
4556  CYTHON_FALLTHROUGH;
4557  case 3:
4558  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4559  else {
4560  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 118, __pyx_L3_error)
4561  }
4562  }
4563  if (unlikely(kw_args > 0)) {
4564  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 118, __pyx_L3_error)
4565  }
4566  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4567  goto __pyx_L5_argtuple_error;
4568  } else {
4569  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4570  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4571  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4572  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4573  }
4574  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
4575  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
4576  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
4577  __pyx_v_material_functions = ((PyObject*)values[3]);
4578  }
4579  goto __pyx_L4_argument_unpacking_done;
4580  __pyx_L5_argtuple_error:;
4581  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 118, __pyx_L3_error)
4582  __pyx_L3_error:;
4583  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4584  __Pyx_RefNannyFinishContext();
4585  return NULL;
4586  __pyx_L4_argument_unpacking_done:;
4587  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
4588  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
4589  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
4590  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
4591  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4592 
4593  /* function exit code */
4594  goto __pyx_L0;
4595  __pyx_L1_error:;
4596  __pyx_r = NULL;
4597  __pyx_L0:;
4598  __Pyx_RefNannyFinishContext();
4599  return __pyx_r;
4600 }
4601 
4602 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4603  int __pyx_v_ebN;
4604  int __pyx_v_material_left;
4605  int __pyx_v_material_right;
4606  npy_intp __pyx_v_k;
4607  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4608  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4609  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4610  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4611  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4612  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4613  PyObject *__pyx_r = NULL;
4614  __Pyx_RefNannyDeclarations
4615  npy_intp __pyx_t_1;
4616  npy_intp __pyx_t_2;
4617  int __pyx_t_3;
4618  Py_ssize_t __pyx_t_4;
4619  Py_ssize_t __pyx_t_5;
4620  int __pyx_t_6;
4621  npy_intp __pyx_t_7;
4622  npy_intp __pyx_t_8;
4623  npy_intp __pyx_t_9;
4624  PyObject *__pyx_t_10 = NULL;
4625  PyObject *__pyx_t_11 = NULL;
4626  PyObject *__pyx_t_12 = NULL;
4627  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
4628  int __pyx_lineno = 0;
4629  const char *__pyx_filename = NULL;
4630  int __pyx_clineno = 0;
4631  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
4632  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4633  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4634  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4635  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4636  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4637  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4638  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4639  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4640  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4641  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4642  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4643  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4644  {
4645  __Pyx_BufFmt_StackElem __pyx_stack[1];
4646  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4647  }
4648  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4649  {
4650  __Pyx_BufFmt_StackElem __pyx_stack[1];
4651  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4652  }
4653  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4654  {
4655  __Pyx_BufFmt_StackElem __pyx_stack[1];
4656  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4657  }
4658  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
4659 
4660  /* "subsurfaceTransportFunctions.pyx":131
4661  * cdef int ebN,material_left,material_right
4662  *
4663  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4664  * material_left = elementBoundaryTypes[ebN,0]
4665  * material_right= elementBoundaryTypes[ebN,1]
4666  */
4667  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4668  __pyx_t_2 = __pyx_t_1;
4669  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4670  __pyx_v_ebN = __pyx_t_3;
4671 
4672  /* "subsurfaceTransportFunctions.pyx":132
4673  *
4674  * for ebN in range(ebq_global_vals.shape[0]):
4675  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4676  * material_right= elementBoundaryTypes[ebN,1]
4677  * for k in range(ebq_global_vals.shape[1]):
4678  */
4679  __pyx_t_4 = __pyx_v_ebN;
4680  __pyx_t_5 = 0;
4681  __pyx_t_6 = -1;
4682  if (__pyx_t_4 < 0) {
4683  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4684  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4685  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4686  if (__pyx_t_5 < 0) {
4687  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4688  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4689  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4690  if (unlikely(__pyx_t_6 != -1)) {
4691  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4692  __PYX_ERR(0, 132, __pyx_L1_error)
4693  }
4694  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4695 
4696  /* "subsurfaceTransportFunctions.pyx":133
4697  * for ebN in range(ebq_global_vals.shape[0]):
4698  * material_left = elementBoundaryTypes[ebN,0]
4699  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4700  * for k in range(ebq_global_vals.shape[1]):
4701  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4702  */
4703  __pyx_t_5 = __pyx_v_ebN;
4704  __pyx_t_4 = 1;
4705  __pyx_t_6 = -1;
4706  if (__pyx_t_5 < 0) {
4707  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4708  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4709  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4710  if (__pyx_t_4 < 0) {
4711  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4712  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
4713  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4714  if (unlikely(__pyx_t_6 != -1)) {
4715  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4716  __PYX_ERR(0, 133, __pyx_L1_error)
4717  }
4718  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4719 
4720  /* "subsurfaceTransportFunctions.pyx":134
4721  * material_left = elementBoundaryTypes[ebN,0]
4722  * material_right= elementBoundaryTypes[ebN,1]
4723  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4724  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4725  * material_functions[material_right])
4726  */
4727  __pyx_t_7 = (__pyx_v_ebq_global_vals->dimensions[1]);
4728  __pyx_t_8 = __pyx_t_7;
4729  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4730  __pyx_v_k = __pyx_t_9;
4731 
4732  /* "subsurfaceTransportFunctions.pyx":135
4733  * material_right= elementBoundaryTypes[ebN,1]
4734  * for k in range(ebq_global_vals.shape[1]):
4735  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4736  * material_functions[material_right])
4737  *
4738  */
4739  if (unlikely(__pyx_v_material_functions == Py_None)) {
4740  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4741  __PYX_ERR(0, 135, __pyx_L1_error)
4742  }
4743  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4744  __Pyx_GOTREF(__pyx_t_10);
4745  __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
4746  __Pyx_GOTREF(__pyx_t_11);
4747  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4748 
4749  /* "subsurfaceTransportFunctions.pyx":136
4750  * for k in range(ebq_global_vals.shape[1]):
4751  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4752  * material_functions[material_right]) # <<<<<<<<<<<<<<
4753  *
4754  *
4755  */
4756  if (unlikely(__pyx_v_material_functions == Py_None)) {
4757  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4758  __PYX_ERR(0, 136, __pyx_L1_error)
4759  }
4760  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
4761  __Pyx_GOTREF(__pyx_t_10);
4762  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 136, __pyx_L1_error)
4763  __Pyx_GOTREF(__pyx_t_12);
4764  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4765 
4766  /* "subsurfaceTransportFunctions.pyx":135
4767  * material_right= elementBoundaryTypes[ebN,1]
4768  * for k in range(ebq_global_vals.shape[1]):
4769  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4770  * material_functions[material_right])
4771  *
4772  */
4773  __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4774  __Pyx_GOTREF(__pyx_t_10);
4775  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4776  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4777  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4778  __Pyx_GOTREF(__pyx_t_12);
4779  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4780  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_13 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4781  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4782  __pyx_t_4 = __pyx_v_ebN;
4783  __pyx_t_5 = __pyx_v_k;
4784  __pyx_t_6 = -1;
4785  if (__pyx_t_4 < 0) {
4786  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4787  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4788  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
4789  if (__pyx_t_5 < 0) {
4790  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4791  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4792  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
4793  if (unlikely(__pyx_t_6 != -1)) {
4794  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4795  __PYX_ERR(0, 135, __pyx_L1_error)
4796  }
4797  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_13;
4798  }
4799  }
4800 
4801  /* "subsurfaceTransportFunctions.pyx":118
4802  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4803  *
4804  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4805  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4806  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4807  */
4808 
4809  /* function exit code */
4810  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4811  goto __pyx_L0;
4812  __pyx_L1_error:;
4813  __Pyx_XDECREF(__pyx_t_10);
4814  __Pyx_XDECREF(__pyx_t_11);
4815  __Pyx_XDECREF(__pyx_t_12);
4816  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4817  __Pyx_PyThreadState_declare
4818  __Pyx_PyThreadState_assign
4819  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4820  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4821  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4822  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4823  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4824  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4825  __pyx_r = NULL;
4826  goto __pyx_L2;
4827  __pyx_L0:;
4828  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4829  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4830  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4831  __pyx_L2:;
4832  __Pyx_XGIVEREF(__pyx_r);
4833  __Pyx_RefNannyFinishContext();
4834  return __pyx_r;
4835 }
4836 
4837 /* "subsurfaceTransportFunctions.pyx":139
4838  *
4839  *
4840  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4841  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4842  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4843  */
4844 
4845 /* Python wrapper */
4846 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4847 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4848 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4849 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4850  int __pyx_v_nd;
4851  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4852  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4853  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4854  PyObject *__pyx_v_material_functions = 0;
4855  int __pyx_lineno = 0;
4856  const char *__pyx_filename = NULL;
4857  int __pyx_clineno = 0;
4858  PyObject *__pyx_r = 0;
4859  __Pyx_RefNannyDeclarations
4860  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4861  {
4862  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4863  PyObject* values[5] = {0,0,0,0,0};
4864  if (unlikely(__pyx_kwds)) {
4865  Py_ssize_t kw_args;
4866  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4867  switch (pos_args) {
4868  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4869  CYTHON_FALLTHROUGH;
4870  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4871  CYTHON_FALLTHROUGH;
4872  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4873  CYTHON_FALLTHROUGH;
4874  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4875  CYTHON_FALLTHROUGH;
4876  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4877  CYTHON_FALLTHROUGH;
4878  case 0: break;
4879  default: goto __pyx_L5_argtuple_error;
4880  }
4881  kw_args = PyDict_Size(__pyx_kwds);
4882  switch (pos_args) {
4883  case 0:
4884  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4885  else goto __pyx_L5_argtuple_error;
4886  CYTHON_FALLTHROUGH;
4887  case 1:
4888  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4889  else {
4890  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 139, __pyx_L3_error)
4891  }
4892  CYTHON_FALLTHROUGH;
4893  case 2:
4894  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4895  else {
4896  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 139, __pyx_L3_error)
4897  }
4898  CYTHON_FALLTHROUGH;
4899  case 3:
4900  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4901  else {
4902  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 139, __pyx_L3_error)
4903  }
4904  CYTHON_FALLTHROUGH;
4905  case 4:
4906  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4907  else {
4908  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 139, __pyx_L3_error)
4909  }
4910  }
4911  if (unlikely(kw_args > 0)) {
4912  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
4913  }
4914  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4915  goto __pyx_L5_argtuple_error;
4916  } else {
4917  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4918  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4919  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4920  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4921  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4922  }
4923  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
4924  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4925  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4926  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4927  __pyx_v_material_functions = ((PyObject*)values[4]);
4928  }
4929  goto __pyx_L4_argument_unpacking_done;
4930  __pyx_L5_argtuple_error:;
4931  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
4932  __pyx_L3_error:;
4933  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4934  __Pyx_RefNannyFinishContext();
4935  return NULL;
4936  __pyx_L4_argument_unpacking_done:;
4937  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 140, __pyx_L1_error)
4938  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 141, __pyx_L1_error)
4939  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
4940  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 143, __pyx_L1_error)
4941  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4942 
4943  /* function exit code */
4944  goto __pyx_L0;
4945  __pyx_L1_error:;
4946  __pyx_r = NULL;
4947  __pyx_L0:;
4948  __Pyx_RefNannyFinishContext();
4949  return __pyx_r;
4950 }
4951 
4952 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4953  int __pyx_v_ebN;
4954  int __pyx_v_k;
4955  int __pyx_v_material_left;
4956  int __pyx_v_material_right;
4957  int __pyx_v_I;
4958  int __pyx_v_J;
4959  double __pyx_v_numer;
4960  double __pyx_v_denom;
4961  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4962  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4963  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4964  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4965  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4966  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4967  PyObject *__pyx_r = NULL;
4968  __Pyx_RefNannyDeclarations
4969  npy_intp __pyx_t_1;
4970  npy_intp __pyx_t_2;
4971  int __pyx_t_3;
4972  Py_ssize_t __pyx_t_4;
4973  Py_ssize_t __pyx_t_5;
4974  int __pyx_t_6;
4975  npy_intp __pyx_t_7;
4976  npy_intp __pyx_t_8;
4977  int __pyx_t_9;
4978  int __pyx_t_10;
4979  int __pyx_t_11;
4980  int __pyx_t_12;
4981  int __pyx_t_13;
4982  int __pyx_t_14;
4983  PyObject *__pyx_t_15 = NULL;
4984  PyObject *__pyx_t_16 = NULL;
4985  PyObject *__pyx_t_17 = NULL;
4986  PyObject *__pyx_t_18 = NULL;
4987  PyObject *__pyx_t_19 = NULL;
4988  double __pyx_t_20;
4989  Py_ssize_t __pyx_t_21;
4990  int __pyx_t_22;
4991  int __pyx_lineno = 0;
4992  const char *__pyx_filename = NULL;
4993  int __pyx_clineno = 0;
4994  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4995  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4996  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4997  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4998  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4999  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
5000  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
5001  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
5002  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
5003  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
5004  __pyx_pybuffer_ebq_global_vals.refcount = 0;
5005  __pyx_pybuffernd_ebq_global_vals.data = NULL;
5006  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
5007  {
5008  __Pyx_BufFmt_StackElem __pyx_stack[1];
5009  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
5010  }
5011  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
5012  {
5013  __Pyx_BufFmt_StackElem __pyx_stack[1];
5014  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
5015  }
5016  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
5017  {
5018  __Pyx_BufFmt_StackElem __pyx_stack[1];
5019  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
5020  }
5021  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
5022 
5023  /* "subsurfaceTransportFunctions.pyx":154
5024  * cdef double numer,denom
5025  *
5026  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
5027  * material_left = elementBoundaryTypes[ebN,0]
5028  * material_right= elementBoundaryTypes[ebN,1]
5029  */
5030  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
5031  __pyx_t_2 = __pyx_t_1;
5032  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5033  __pyx_v_ebN = __pyx_t_3;
5034 
5035  /* "subsurfaceTransportFunctions.pyx":155
5036  *
5037  * for ebN in range(ebq_global_vals.shape[0]):
5038  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
5039  * material_right= elementBoundaryTypes[ebN,1]
5040  * for k in range(ebq_global_vals.shape[1]):
5041  */
5042  __pyx_t_4 = __pyx_v_ebN;
5043  __pyx_t_5 = 0;
5044  __pyx_t_6 = -1;
5045  if (__pyx_t_4 < 0) {
5046  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
5047  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
5048  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
5049  if (__pyx_t_5 < 0) {
5050  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
5051  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
5052  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
5053  if (unlikely(__pyx_t_6 != -1)) {
5054  __Pyx_RaiseBufferIndexError(__pyx_t_6);
5055  __PYX_ERR(0, 155, __pyx_L1_error)
5056  }
5057  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
5058 
5059  /* "subsurfaceTransportFunctions.pyx":156
5060  * for ebN in range(ebq_global_vals.shape[0]):
5061  * material_left = elementBoundaryTypes[ebN,0]
5062  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
5063  * for k in range(ebq_global_vals.shape[1]):
5064  * for I in range(nd):
5065  */
5066  __pyx_t_5 = __pyx_v_ebN;
5067  __pyx_t_4 = 1;
5068  __pyx_t_6 = -1;
5069  if (__pyx_t_5 < 0) {
5070  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
5071  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
5072  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
5073  if (__pyx_t_4 < 0) {
5074  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
5075  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
5076  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
5077  if (unlikely(__pyx_t_6 != -1)) {
5078  __Pyx_RaiseBufferIndexError(__pyx_t_6);
5079  __PYX_ERR(0, 156, __pyx_L1_error)
5080  }
5081  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
5082 
5083  /* "subsurfaceTransportFunctions.pyx":157
5084  * material_left = elementBoundaryTypes[ebN,0]
5085  * material_right= elementBoundaryTypes[ebN,1]
5086  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
5087  * for I in range(nd):
5088  * for J in range(nd):
5089  */
5090  __pyx_t_7 = (__pyx_v_ebq_global_vals->dimensions[1]);
5091  __pyx_t_8 = __pyx_t_7;
5092  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
5093  __pyx_v_k = __pyx_t_6;
5094 
5095  /* "subsurfaceTransportFunctions.pyx":158
5096  * material_right= elementBoundaryTypes[ebN,1]
5097  * for k in range(ebq_global_vals.shape[1]):
5098  * for I in range(nd): # <<<<<<<<<<<<<<
5099  * for J in range(nd):
5100  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5101  */
5102  __pyx_t_9 = __pyx_v_nd;
5103  __pyx_t_10 = __pyx_t_9;
5104  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5105  __pyx_v_I = __pyx_t_11;
5106 
5107  /* "subsurfaceTransportFunctions.pyx":159
5108  * for k in range(ebq_global_vals.shape[1]):
5109  * for I in range(nd):
5110  * for J in range(nd): # <<<<<<<<<<<<<<
5111  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5112  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5113  */
5114  __pyx_t_12 = __pyx_v_nd;
5115  __pyx_t_13 = __pyx_t_12;
5116  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5117  __pyx_v_J = __pyx_t_14;
5118 
5119  /* "subsurfaceTransportFunctions.pyx":160
5120  * for I in range(nd):
5121  * for J in range(nd):
5122  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
5123  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5124  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5125  */
5126  if (unlikely(__pyx_v_material_functions == Py_None)) {
5127  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5128  __PYX_ERR(0, 160, __pyx_L1_error)
5129  }
5130  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5131  __Pyx_GOTREF(__pyx_t_15);
5132  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
5133  __Pyx_GOTREF(__pyx_t_16);
5134  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5135  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5136  __Pyx_GOTREF(__pyx_t_15);
5137  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5138  __Pyx_GOTREF(__pyx_t_17);
5139  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5140  __Pyx_GOTREF(__pyx_t_18);
5141  __Pyx_GIVEREF(__pyx_t_15);
5142  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_15);
5143  __Pyx_GIVEREF(__pyx_t_17);
5144  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17);
5145  __pyx_t_15 = 0;
5146  __pyx_t_17 = 0;
5147  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5148  __Pyx_GOTREF(__pyx_t_17);
5149  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5150  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5151  __pyx_t_18 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5152  __Pyx_GOTREF(__pyx_t_18);
5153  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5154  if (unlikely(__pyx_v_material_functions == Py_None)) {
5155  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5156  __PYX_ERR(0, 160, __pyx_L1_error)
5157  }
5158  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5159  __Pyx_GOTREF(__pyx_t_17);
5160  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
5161  __Pyx_GOTREF(__pyx_t_16);
5162  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5163  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5164  __Pyx_GOTREF(__pyx_t_17);
5165  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5166  __Pyx_GOTREF(__pyx_t_15);
5167  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5168  __Pyx_GOTREF(__pyx_t_19);
5169  __Pyx_GIVEREF(__pyx_t_17);
5170  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17);
5171  __Pyx_GIVEREF(__pyx_t_15);
5172  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_15);
5173  __pyx_t_17 = 0;
5174  __pyx_t_15 = 0;
5175  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5176  __Pyx_GOTREF(__pyx_t_15);
5177  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5178  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5179  __pyx_t_19 = PyNumber_Multiply(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5180  __Pyx_GOTREF(__pyx_t_19);
5181  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5182  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5183  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
5184  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5185  __pyx_v_numer = __pyx_t_20;
5186 
5187  /* "subsurfaceTransportFunctions.pyx":161
5188  * for J in range(nd):
5189  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5190  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
5191  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5192  *
5193  */
5194  if (unlikely(__pyx_v_material_functions == Py_None)) {
5195  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5196  __PYX_ERR(0, 161, __pyx_L1_error)
5197  }
5198  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5199  __Pyx_GOTREF(__pyx_t_19);
5200  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
5201  __Pyx_GOTREF(__pyx_t_15);
5202  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5203  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5204  __Pyx_GOTREF(__pyx_t_19);
5205  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5206  __Pyx_GOTREF(__pyx_t_18);
5207  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5208  __Pyx_GOTREF(__pyx_t_16);
5209  __Pyx_GIVEREF(__pyx_t_19);
5210  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_19);
5211  __Pyx_GIVEREF(__pyx_t_18);
5212  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
5213  __pyx_t_19 = 0;
5214  __pyx_t_18 = 0;
5215  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5216  __Pyx_GOTREF(__pyx_t_18);
5217  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5218  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5219  if (unlikely(__pyx_v_material_functions == Py_None)) {
5220  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5221  __PYX_ERR(0, 161, __pyx_L1_error)
5222  }
5223  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5224  __Pyx_GOTREF(__pyx_t_16);
5225  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
5226  __Pyx_GOTREF(__pyx_t_15);
5227  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5228  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5229  __Pyx_GOTREF(__pyx_t_16);
5230  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5231  __Pyx_GOTREF(__pyx_t_19);
5232  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5233  __Pyx_GOTREF(__pyx_t_17);
5234  __Pyx_GIVEREF(__pyx_t_16);
5235  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16);
5236  __Pyx_GIVEREF(__pyx_t_19);
5237  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_19);
5238  __pyx_t_16 = 0;
5239  __pyx_t_19 = 0;
5240  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5241  __Pyx_GOTREF(__pyx_t_19);
5242  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5243  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5244  __pyx_t_17 = PyNumber_Add(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5245  __Pyx_GOTREF(__pyx_t_17);
5246  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5247  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5248  __pyx_t_19 = __Pyx_PyFloat_AddObjC(__pyx_t_17, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5249  __Pyx_GOTREF(__pyx_t_19);
5250  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5251  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
5252  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5253  __pyx_v_denom = __pyx_t_20;
5254 
5255  /* "subsurfaceTransportFunctions.pyx":162
5256  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5257  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5258  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
5259  *
5260  * ###
5261  */
5262  if (unlikely(__pyx_v_denom == 0)) {
5263  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5264  __PYX_ERR(0, 162, __pyx_L1_error)
5265  }
5266  __pyx_t_4 = __pyx_v_ebN;
5267  __pyx_t_5 = __pyx_v_k;
5268  __pyx_t_21 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
5269  __pyx_t_22 = -1;
5270  if (__pyx_t_4 < 0) {
5271  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
5272  if (unlikely(__pyx_t_4 < 0)) __pyx_t_22 = 0;
5273  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
5274  if (__pyx_t_5 < 0) {
5275  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
5276  if (unlikely(__pyx_t_5 < 0)) __pyx_t_22 = 1;
5277  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
5278  if (__pyx_t_21 < 0) {
5279  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
5280  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 2;
5281  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
5282  if (unlikely(__pyx_t_22 != -1)) {
5283  __Pyx_RaiseBufferIndexError(__pyx_t_22);
5284  __PYX_ERR(0, 162, __pyx_L1_error)
5285  }
5286  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
5287  }
5288  }
5289  }
5290  }
5291 
5292  /* "subsurfaceTransportFunctions.pyx":139
5293  *
5294  *
5295  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
5296  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5297  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5298  */
5299 
5300  /* function exit code */
5301  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5302  goto __pyx_L0;
5303  __pyx_L1_error:;
5304  __Pyx_XDECREF(__pyx_t_15);
5305  __Pyx_XDECREF(__pyx_t_16);
5306  __Pyx_XDECREF(__pyx_t_17);
5307  __Pyx_XDECREF(__pyx_t_18);
5308  __Pyx_XDECREF(__pyx_t_19);
5309  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5310  __Pyx_PyThreadState_declare
5311  __Pyx_PyThreadState_assign
5312  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5313  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5314  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5315  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5316  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5317  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5318  __pyx_r = NULL;
5319  goto __pyx_L2;
5320  __pyx_L0:;
5321  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5322  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5323  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5324  __pyx_L2:;
5325  __Pyx_XGIVEREF(__pyx_r);
5326  __Pyx_RefNannyFinishContext();
5327  return __pyx_r;
5328 }
5329 
5330 /* "subsurfaceTransportFunctions.pyx":165
5331  *
5332  * ###
5333  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5334  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5335  * numpy.ndarray[DTYPE_t,ndim=3] x,
5336  */
5337 
5338 /* Python wrapper */
5339 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5340 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
5341 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
5342 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5343  double __pyx_v_t;
5344  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5345  PyArrayObject *__pyx_v_x = 0;
5346  PyArrayObject *__pyx_v_q_vals = 0;
5347  PyObject *__pyx_v_material_functions = 0;
5348  int __pyx_lineno = 0;
5349  const char *__pyx_filename = NULL;
5350  int __pyx_clineno = 0;
5351  PyObject *__pyx_r = 0;
5352  __Pyx_RefNannyDeclarations
5353  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
5354  {
5355  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5356  PyObject* values[5] = {0,0,0,0,0};
5357  if (unlikely(__pyx_kwds)) {
5358  Py_ssize_t kw_args;
5359  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5360  switch (pos_args) {
5361  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5362  CYTHON_FALLTHROUGH;
5363  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5364  CYTHON_FALLTHROUGH;
5365  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5366  CYTHON_FALLTHROUGH;
5367  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5368  CYTHON_FALLTHROUGH;
5369  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5370  CYTHON_FALLTHROUGH;
5371  case 0: break;
5372  default: goto __pyx_L5_argtuple_error;
5373  }
5374  kw_args = PyDict_Size(__pyx_kwds);
5375  switch (pos_args) {
5376  case 0:
5377  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5378  else goto __pyx_L5_argtuple_error;
5379  CYTHON_FALLTHROUGH;
5380  case 1:
5381  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5382  else {
5383  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 165, __pyx_L3_error)
5384  }
5385  CYTHON_FALLTHROUGH;
5386  case 2:
5387  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5388  else {
5389  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 165, __pyx_L3_error)
5390  }
5391  CYTHON_FALLTHROUGH;
5392  case 3:
5393  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5394  else {
5395  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 165, __pyx_L3_error)
5396  }
5397  CYTHON_FALLTHROUGH;
5398  case 4:
5399  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5400  else {
5401  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 165, __pyx_L3_error)
5402  }
5403  }
5404  if (unlikely(kw_args > 0)) {
5405  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
5406  }
5407  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5408  goto __pyx_L5_argtuple_error;
5409  } else {
5410  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5411  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5412  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5413  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5414  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5415  }
5416  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
5417  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5418  __pyx_v_x = ((PyArrayObject *)values[2]);
5419  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5420  __pyx_v_material_functions = ((PyObject*)values[4]);
5421  }
5422  goto __pyx_L4_argument_unpacking_done;
5423  __pyx_L5_argtuple_error:;
5424  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
5425  __pyx_L3_error:;
5426  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5427  __Pyx_RefNannyFinishContext();
5428  return NULL;
5429  __pyx_L4_argument_unpacking_done:;
5430  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
5431  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
5432  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
5433  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
5434  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5435 
5436  /* function exit code */
5437  goto __pyx_L0;
5438  __pyx_L1_error:;
5439  __pyx_r = NULL;
5440  __pyx_L0:;
5441  __Pyx_RefNannyFinishContext();
5442  return __pyx_r;
5443 }
5444 
5445 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5446  int __pyx_v_eN;
5447  int __pyx_v_k;
5448  int __pyx_v_material;
5449  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5450  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5451  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5452  __Pyx_Buffer __pyx_pybuffer_q_vals;
5453  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5454  __Pyx_Buffer __pyx_pybuffer_x;
5455  PyObject *__pyx_r = NULL;
5456  __Pyx_RefNannyDeclarations
5457  npy_intp __pyx_t_1;
5458  npy_intp __pyx_t_2;
5459  int __pyx_t_3;
5460  Py_ssize_t __pyx_t_4;
5461  int __pyx_t_5;
5462  npy_intp __pyx_t_6;
5463  npy_intp __pyx_t_7;
5464  PyObject *__pyx_t_8 = NULL;
5465  PyObject *__pyx_t_9 = NULL;
5466  PyObject *__pyx_t_10 = NULL;
5467  PyObject *__pyx_t_11 = NULL;
5468  PyObject *__pyx_t_12 = NULL;
5469  int __pyx_t_13;
5470  PyObject *__pyx_t_14 = NULL;
5471  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
5472  Py_ssize_t __pyx_t_16;
5473  int __pyx_lineno = 0;
5474  const char *__pyx_filename = NULL;
5475  int __pyx_clineno = 0;
5476  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
5477  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5478  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5479  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5480  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5481  __pyx_pybuffer_x.pybuffer.buf = NULL;
5482  __pyx_pybuffer_x.refcount = 0;
5483  __pyx_pybuffernd_x.data = NULL;
5484  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5485  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5486  __pyx_pybuffer_q_vals.refcount = 0;
5487  __pyx_pybuffernd_q_vals.data = NULL;
5488  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5489  {
5490  __Pyx_BufFmt_StackElem __pyx_stack[1];
5491  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5492  }
5493  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5494  {
5495  __Pyx_BufFmt_StackElem __pyx_stack[1];
5496  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5497  }
5498  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5499  {
5500  __Pyx_BufFmt_StackElem __pyx_stack[1];
5501  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5502  }
5503  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
5504 
5505  /* "subsurfaceTransportFunctions.pyx":175
5506  * """
5507  * cdef int eN,k,material
5508  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5509  * material = elementMaterialTypes[eN]
5510  * for k in range(x.shape[1]):
5511  */
5512  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5513  __pyx_t_2 = __pyx_t_1;
5514  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5515  __pyx_v_eN = __pyx_t_3;
5516 
5517  /* "subsurfaceTransportFunctions.pyx":176
5518  * cdef int eN,k,material
5519  * for eN in range(x.shape[0]):
5520  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5521  * for k in range(x.shape[1]):
5522  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5523  */
5524  __pyx_t_4 = __pyx_v_eN;
5525  __pyx_t_5 = -1;
5526  if (__pyx_t_4 < 0) {
5527  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5528  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5529  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5530  if (unlikely(__pyx_t_5 != -1)) {
5531  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5532  __PYX_ERR(0, 176, __pyx_L1_error)
5533  }
5534  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5535 
5536  /* "subsurfaceTransportFunctions.pyx":177
5537  * for eN in range(x.shape[0]):
5538  * material = elementMaterialTypes[eN]
5539  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5540  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5541  *
5542  */
5543  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5544  __pyx_t_7 = __pyx_t_6;
5545  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5546  __pyx_v_k = __pyx_t_5;
5547 
5548  /* "subsurfaceTransportFunctions.pyx":178
5549  * material = elementMaterialTypes[eN]
5550  * for k in range(x.shape[1]):
5551  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
5552  *
5553  * def evaluateVectorMaterialFunctionOverElements(double t,
5554  */
5555  if (unlikely(__pyx_v_material_functions == Py_None)) {
5556  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5557  __PYX_ERR(0, 178, __pyx_L1_error)
5558  }
5559  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5560  __Pyx_GOTREF(__pyx_t_9);
5561  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5562  __Pyx_GOTREF(__pyx_t_10);
5563  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5564  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5565  __Pyx_GOTREF(__pyx_t_9);
5566  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5567  __Pyx_GOTREF(__pyx_t_11);
5568  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5569  __Pyx_GOTREF(__pyx_t_12);
5570  __Pyx_GIVEREF(__pyx_t_9);
5571  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5572  __Pyx_GIVEREF(__pyx_t_11);
5573  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5574  __pyx_t_9 = 0;
5575  __pyx_t_11 = 0;
5576  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5577  __Pyx_GOTREF(__pyx_t_11);
5578  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5579  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5580  __Pyx_GOTREF(__pyx_t_12);
5581  __pyx_t_9 = NULL;
5582  __pyx_t_13 = 0;
5583  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5584  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5585  if (likely(__pyx_t_9)) {
5586  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5587  __Pyx_INCREF(__pyx_t_9);
5588  __Pyx_INCREF(function);
5589  __Pyx_DECREF_SET(__pyx_t_10, function);
5590  __pyx_t_13 = 1;
5591  }
5592  }
5593  #if CYTHON_FAST_PYCALL
5594  if (PyFunction_Check(__pyx_t_10)) {
5595  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5596  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5597  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5598  __Pyx_GOTREF(__pyx_t_8);
5599  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5600  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5601  } else
5602  #endif
5603  #if CYTHON_FAST_PYCCALL
5604  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5605  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5606  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5607  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5608  __Pyx_GOTREF(__pyx_t_8);
5609  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5610  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5611  } else
5612  #endif
5613  {
5614  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 178, __pyx_L1_error)
5615  __Pyx_GOTREF(__pyx_t_14);
5616  if (__pyx_t_9) {
5617  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5618  }
5619  __Pyx_GIVEREF(__pyx_t_11);
5620  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5621  __Pyx_GIVEREF(__pyx_t_12);
5622  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5623  __pyx_t_11 = 0;
5624  __pyx_t_12 = 0;
5625  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5626  __Pyx_GOTREF(__pyx_t_8);
5627  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5628  }
5629  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5630  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5631  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5632  __pyx_t_4 = __pyx_v_eN;
5633  __pyx_t_16 = __pyx_v_k;
5634  __pyx_t_13 = -1;
5635  if (__pyx_t_4 < 0) {
5636  __pyx_t_4 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
5637  if (unlikely(__pyx_t_4 < 0)) __pyx_t_13 = 0;
5638  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
5639  if (__pyx_t_16 < 0) {
5640  __pyx_t_16 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
5641  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 1;
5642  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
5643  if (unlikely(__pyx_t_13 != -1)) {
5644  __Pyx_RaiseBufferIndexError(__pyx_t_13);
5645  __PYX_ERR(0, 178, __pyx_L1_error)
5646  }
5647  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_15;
5648  }
5649  }
5650 
5651  /* "subsurfaceTransportFunctions.pyx":165
5652  *
5653  * ###
5654  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5655  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5656  * numpy.ndarray[DTYPE_t,ndim=3] x,
5657  */
5658 
5659  /* function exit code */
5660  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5661  goto __pyx_L0;
5662  __pyx_L1_error:;
5663  __Pyx_XDECREF(__pyx_t_8);
5664  __Pyx_XDECREF(__pyx_t_9);
5665  __Pyx_XDECREF(__pyx_t_10);
5666  __Pyx_XDECREF(__pyx_t_11);
5667  __Pyx_XDECREF(__pyx_t_12);
5668  __Pyx_XDECREF(__pyx_t_14);
5669  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5670  __Pyx_PyThreadState_declare
5671  __Pyx_PyThreadState_assign
5672  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5673  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5674  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5675  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5676  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5677  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5678  __pyx_r = NULL;
5679  goto __pyx_L2;
5680  __pyx_L0:;
5681  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5682  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5683  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5684  __pyx_L2:;
5685  __Pyx_XGIVEREF(__pyx_r);
5686  __Pyx_RefNannyFinishContext();
5687  return __pyx_r;
5688 }
5689 
5690 /* "subsurfaceTransportFunctions.pyx":180
5691  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5692  *
5693  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5694  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5695  * numpy.ndarray[DTYPE_t,ndim=3] x,
5696  */
5697 
5698 /* Python wrapper */
5699 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5700 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
5701 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
5702 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5703  double __pyx_v_t;
5704  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5705  PyArrayObject *__pyx_v_x = 0;
5706  PyArrayObject *__pyx_v_q_vals = 0;
5707  PyObject *__pyx_v_material_functions = 0;
5708  int __pyx_lineno = 0;
5709  const char *__pyx_filename = NULL;
5710  int __pyx_clineno = 0;
5711  PyObject *__pyx_r = 0;
5712  __Pyx_RefNannyDeclarations
5713  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
5714  {
5715  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5716  PyObject* values[5] = {0,0,0,0,0};
5717  if (unlikely(__pyx_kwds)) {
5718  Py_ssize_t kw_args;
5719  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5720  switch (pos_args) {
5721  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5722  CYTHON_FALLTHROUGH;
5723  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5724  CYTHON_FALLTHROUGH;
5725  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5726  CYTHON_FALLTHROUGH;
5727  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5728  CYTHON_FALLTHROUGH;
5729  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5730  CYTHON_FALLTHROUGH;
5731  case 0: break;
5732  default: goto __pyx_L5_argtuple_error;
5733  }
5734  kw_args = PyDict_Size(__pyx_kwds);
5735  switch (pos_args) {
5736  case 0:
5737  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5738  else goto __pyx_L5_argtuple_error;
5739  CYTHON_FALLTHROUGH;
5740  case 1:
5741  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5742  else {
5743  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 180, __pyx_L3_error)
5744  }
5745  CYTHON_FALLTHROUGH;
5746  case 2:
5747  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5748  else {
5749  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 180, __pyx_L3_error)
5750  }
5751  CYTHON_FALLTHROUGH;
5752  case 3:
5753  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5754  else {
5755  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 180, __pyx_L3_error)
5756  }
5757  CYTHON_FALLTHROUGH;
5758  case 4:
5759  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5760  else {
5761  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 180, __pyx_L3_error)
5762  }
5763  }
5764  if (unlikely(kw_args > 0)) {
5765  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
5766  }
5767  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5768  goto __pyx_L5_argtuple_error;
5769  } else {
5770  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5771  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5772  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5773  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5774  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5775  }
5776  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
5777  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5778  __pyx_v_x = ((PyArrayObject *)values[2]);
5779  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5780  __pyx_v_material_functions = ((PyObject*)values[4]);
5781  }
5782  goto __pyx_L4_argument_unpacking_done;
5783  __pyx_L5_argtuple_error:;
5784  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
5785  __pyx_L3_error:;
5786  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5787  __Pyx_RefNannyFinishContext();
5788  return NULL;
5789  __pyx_L4_argument_unpacking_done:;
5790  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 181, __pyx_L1_error)
5791  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
5792  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
5793  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 184, __pyx_L1_error)
5794  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5795 
5796  /* function exit code */
5797  goto __pyx_L0;
5798  __pyx_L1_error:;
5799  __pyx_r = NULL;
5800  __pyx_L0:;
5801  __Pyx_RefNannyFinishContext();
5802  return __pyx_r;
5803 }
5804 
5805 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5806  int __pyx_v_eN;
5807  int __pyx_v_k;
5808  int __pyx_v_material;
5809  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5810  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5811  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5812  __Pyx_Buffer __pyx_pybuffer_q_vals;
5813  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5814  __Pyx_Buffer __pyx_pybuffer_x;
5815  PyObject *__pyx_r = NULL;
5816  __Pyx_RefNannyDeclarations
5817  npy_intp __pyx_t_1;
5818  npy_intp __pyx_t_2;
5819  int __pyx_t_3;
5820  Py_ssize_t __pyx_t_4;
5821  int __pyx_t_5;
5822  npy_intp __pyx_t_6;
5823  npy_intp __pyx_t_7;
5824  PyObject *__pyx_t_8 = NULL;
5825  PyObject *__pyx_t_9 = NULL;
5826  PyObject *__pyx_t_10 = NULL;
5827  PyObject *__pyx_t_11 = NULL;
5828  PyObject *__pyx_t_12 = NULL;
5829  int __pyx_t_13;
5830  PyObject *__pyx_t_14 = NULL;
5831  int __pyx_lineno = 0;
5832  const char *__pyx_filename = NULL;
5833  int __pyx_clineno = 0;
5834  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5835  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5836  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5837  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5838  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5839  __pyx_pybuffer_x.pybuffer.buf = NULL;
5840  __pyx_pybuffer_x.refcount = 0;
5841  __pyx_pybuffernd_x.data = NULL;
5842  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5843  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5844  __pyx_pybuffer_q_vals.refcount = 0;
5845  __pyx_pybuffernd_q_vals.data = NULL;
5846  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5847  {
5848  __Pyx_BufFmt_StackElem __pyx_stack[1];
5849  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5850  }
5851  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5852  {
5853  __Pyx_BufFmt_StackElem __pyx_stack[1];
5854  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5855  }
5856  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5857  {
5858  __Pyx_BufFmt_StackElem __pyx_stack[1];
5859  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5860  }
5861  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5862 
5863  /* "subsurfaceTransportFunctions.pyx":189
5864  * """
5865  * cdef int eN,k,material
5866  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5867  * material = elementMaterialTypes[eN]
5868  * for k in range(x.shape[1]):
5869  */
5870  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5871  __pyx_t_2 = __pyx_t_1;
5872  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5873  __pyx_v_eN = __pyx_t_3;
5874 
5875  /* "subsurfaceTransportFunctions.pyx":190
5876  * cdef int eN,k,material
5877  * for eN in range(x.shape[0]):
5878  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5879  * for k in range(x.shape[1]):
5880  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5881  */
5882  __pyx_t_4 = __pyx_v_eN;
5883  __pyx_t_5 = -1;
5884  if (__pyx_t_4 < 0) {
5885  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5886  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5887  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5888  if (unlikely(__pyx_t_5 != -1)) {
5889  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5890  __PYX_ERR(0, 190, __pyx_L1_error)
5891  }
5892  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5893 
5894  /* "subsurfaceTransportFunctions.pyx":191
5895  * for eN in range(x.shape[0]):
5896  * material = elementMaterialTypes[eN]
5897  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5898  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5899  *
5900  */
5901  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5902  __pyx_t_7 = __pyx_t_6;
5903  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5904  __pyx_v_k = __pyx_t_5;
5905 
5906  /* "subsurfaceTransportFunctions.pyx":192
5907  * material = elementMaterialTypes[eN]
5908  * for k in range(x.shape[1]):
5909  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5910  *
5911  *
5912  */
5913  if (unlikely(__pyx_v_material_functions == Py_None)) {
5914  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5915  __PYX_ERR(0, 192, __pyx_L1_error)
5916  }
5917  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5918  __Pyx_GOTREF(__pyx_t_9);
5919  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5920  __Pyx_GOTREF(__pyx_t_10);
5921  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5922  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5923  __Pyx_GOTREF(__pyx_t_9);
5924  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5925  __Pyx_GOTREF(__pyx_t_11);
5926  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5927  __Pyx_GOTREF(__pyx_t_12);
5928  __Pyx_GIVEREF(__pyx_t_9);
5929  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5930  __Pyx_GIVEREF(__pyx_t_11);
5931  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5932  __pyx_t_9 = 0;
5933  __pyx_t_11 = 0;
5934  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5935  __Pyx_GOTREF(__pyx_t_11);
5936  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5937  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5938  __Pyx_GOTREF(__pyx_t_12);
5939  __pyx_t_9 = NULL;
5940  __pyx_t_13 = 0;
5941  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5942  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5943  if (likely(__pyx_t_9)) {
5944  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5945  __Pyx_INCREF(__pyx_t_9);
5946  __Pyx_INCREF(function);
5947  __Pyx_DECREF_SET(__pyx_t_10, function);
5948  __pyx_t_13 = 1;
5949  }
5950  }
5951  #if CYTHON_FAST_PYCALL
5952  if (PyFunction_Check(__pyx_t_10)) {
5953  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5954  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5955  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5956  __Pyx_GOTREF(__pyx_t_8);
5957  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5958  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5959  } else
5960  #endif
5961  #if CYTHON_FAST_PYCCALL
5962  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5963  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5964  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5965  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5966  __Pyx_GOTREF(__pyx_t_8);
5967  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5968  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5969  } else
5970  #endif
5971  {
5972  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5973  __Pyx_GOTREF(__pyx_t_14);
5974  if (__pyx_t_9) {
5975  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5976  }
5977  __Pyx_GIVEREF(__pyx_t_11);
5978  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5979  __Pyx_GIVEREF(__pyx_t_12);
5980  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5981  __pyx_t_11 = 0;
5982  __pyx_t_12 = 0;
5983  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5984  __Pyx_GOTREF(__pyx_t_8);
5985  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5986  }
5987  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5988  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5989  __Pyx_GOTREF(__pyx_t_10);
5990  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5991  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5992  __Pyx_GOTREF(__pyx_t_8);
5993  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5994  __Pyx_GOTREF(__pyx_t_14);
5995  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5996  __Pyx_GOTREF(__pyx_t_12);
5997  __Pyx_GIVEREF(__pyx_t_8);
5998  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
5999  __Pyx_GIVEREF(__pyx_t_14);
6000  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14);
6001  __Pyx_INCREF(__pyx_slice_);
6002  __Pyx_GIVEREF(__pyx_slice_);
6003  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_slice_);
6004  __pyx_t_8 = 0;
6005  __pyx_t_14 = 0;
6006  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_12, __pyx_t_10) < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
6007  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6008  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6009  }
6010  }
6011 
6012  /* "subsurfaceTransportFunctions.pyx":180
6013  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
6014  *
6015  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
6016  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
6017  * numpy.ndarray[DTYPE_t,ndim=3] x,
6018  */
6019 
6020  /* function exit code */
6021  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6022  goto __pyx_L0;
6023  __pyx_L1_error:;
6024  __Pyx_XDECREF(__pyx_t_8);
6025  __Pyx_XDECREF(__pyx_t_9);
6026  __Pyx_XDECREF(__pyx_t_10);
6027  __Pyx_XDECREF(__pyx_t_11);
6028  __Pyx_XDECREF(__pyx_t_12);
6029  __Pyx_XDECREF(__pyx_t_14);
6030  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6031  __Pyx_PyThreadState_declare
6032  __Pyx_PyThreadState_assign
6033  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6034  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
6035  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
6036  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6037  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6038  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
6039  __pyx_r = NULL;
6040  goto __pyx_L2;
6041  __pyx_L0:;
6042  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
6043  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
6044  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6045  __pyx_L2:;
6046  __Pyx_XGIVEREF(__pyx_r);
6047  __Pyx_RefNannyFinishContext();
6048  return __pyx_r;
6049 }
6050 
6051 /* "subsurfaceTransportFunctions.pyx":195
6052  *
6053  *
6054  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6055  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6056  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6057  */
6058 
6059 /* Python wrapper */
6060 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6061 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6062 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
6063 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6064  double __pyx_v_t;
6065  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6066  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6067  PyArrayObject *__pyx_v_x = 0;
6068  PyArrayObject *__pyx_v_ebq_vals = 0;
6069  PyObject *__pyx_v_material_functions = 0;
6070  int __pyx_lineno = 0;
6071  const char *__pyx_filename = NULL;
6072  int __pyx_clineno = 0;
6073  PyObject *__pyx_r = 0;
6074  __Pyx_RefNannyDeclarations
6075  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
6076  {
6077  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
6078  PyObject* values[6] = {0,0,0,0,0,0};
6079  if (unlikely(__pyx_kwds)) {
6080  Py_ssize_t kw_args;
6081  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6082  switch (pos_args) {
6083  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6084  CYTHON_FALLTHROUGH;
6085  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6086  CYTHON_FALLTHROUGH;
6087  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6088  CYTHON_FALLTHROUGH;
6089  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6090  CYTHON_FALLTHROUGH;
6091  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6092  CYTHON_FALLTHROUGH;
6093  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6094  CYTHON_FALLTHROUGH;
6095  case 0: break;
6096  default: goto __pyx_L5_argtuple_error;
6097  }
6098  kw_args = PyDict_Size(__pyx_kwds);
6099  switch (pos_args) {
6100  case 0:
6101  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6102  else goto __pyx_L5_argtuple_error;
6103  CYTHON_FALLTHROUGH;
6104  case 1:
6105  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6106  else {
6107  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 195, __pyx_L3_error)
6108  }
6109  CYTHON_FALLTHROUGH;
6110  case 2:
6111  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6112  else {
6113  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 195, __pyx_L3_error)
6114  }
6115  CYTHON_FALLTHROUGH;
6116  case 3:
6117  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6118  else {
6119  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 195, __pyx_L3_error)
6120  }
6121  CYTHON_FALLTHROUGH;
6122  case 4:
6123  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6124  else {
6125  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 195, __pyx_L3_error)
6126  }
6127  CYTHON_FALLTHROUGH;
6128  case 5:
6129  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6130  else {
6131  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 195, __pyx_L3_error)
6132  }
6133  }
6134  if (unlikely(kw_args > 0)) {
6135  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 195, __pyx_L3_error)
6136  }
6137  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6138  goto __pyx_L5_argtuple_error;
6139  } else {
6140  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6141  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6142  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6143  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6144  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6145  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6146  }
6147  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
6148  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
6149  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
6150  __pyx_v_x = ((PyArrayObject *)values[3]);
6151  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
6152  __pyx_v_material_functions = ((PyObject*)values[5]);
6153  }
6154  goto __pyx_L4_argument_unpacking_done;
6155  __pyx_L5_argtuple_error:;
6156  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error)
6157  __pyx_L3_error:;
6158  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6159  __Pyx_RefNannyFinishContext();
6160  return NULL;
6161  __pyx_L4_argument_unpacking_done:;
6162  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
6163  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
6164  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
6165  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
6166  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 200, __pyx_L1_error)
6167  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6168 
6169  /* function exit code */
6170  goto __pyx_L0;
6171  __pyx_L1_error:;
6172  __pyx_r = NULL;
6173  __pyx_L0:;
6174  __Pyx_RefNannyFinishContext();
6175  return __pyx_r;
6176 }
6177 
6178 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6179  int __pyx_v_eN;
6180  int __pyx_v_ebN;
6181  int __pyx_v_ebN_local;
6182  int __pyx_v_k;
6183  int __pyx_v_material_left;
6184  int __pyx_v_material_right;
6185  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6186  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6187  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6188  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6189  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6190  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6191  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6192  __Pyx_Buffer __pyx_pybuffer_x;
6193  PyObject *__pyx_r = NULL;
6194  __Pyx_RefNannyDeclarations
6195  npy_intp __pyx_t_1;
6196  npy_intp __pyx_t_2;
6197  int __pyx_t_3;
6198  npy_intp __pyx_t_4;
6199  npy_intp __pyx_t_5;
6200  int __pyx_t_6;
6201  Py_ssize_t __pyx_t_7;
6202  Py_ssize_t __pyx_t_8;
6203  int __pyx_t_9;
6204  npy_intp __pyx_t_10;
6205  npy_intp __pyx_t_11;
6206  PyObject *__pyx_t_12 = NULL;
6207  PyObject *__pyx_t_13 = NULL;
6208  PyObject *__pyx_t_14 = NULL;
6209  PyObject *__pyx_t_15 = NULL;
6210  PyObject *__pyx_t_16 = NULL;
6211  PyObject *__pyx_t_17 = NULL;
6212  int __pyx_t_18;
6213  PyObject *__pyx_t_19 = NULL;
6214  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
6215  Py_ssize_t __pyx_t_21;
6216  int __pyx_lineno = 0;
6217  const char *__pyx_filename = NULL;
6218  int __pyx_clineno = 0;
6219  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
6220  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6221  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6222  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6223  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6224  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6225  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6226  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6227  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6228  __pyx_pybuffer_x.pybuffer.buf = NULL;
6229  __pyx_pybuffer_x.refcount = 0;
6230  __pyx_pybuffernd_x.data = NULL;
6231  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6232  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6233  __pyx_pybuffer_ebq_vals.refcount = 0;
6234  __pyx_pybuffernd_ebq_vals.data = NULL;
6235  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6236  {
6237  __Pyx_BufFmt_StackElem __pyx_stack[1];
6238  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6239  }
6240  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6241  {
6242  __Pyx_BufFmt_StackElem __pyx_stack[1];
6243  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6244  }
6245  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6246  {
6247  __Pyx_BufFmt_StackElem __pyx_stack[1];
6248  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6249  }
6250  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6251  {
6252  __Pyx_BufFmt_StackElem __pyx_stack[1];
6253  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6254  }
6255  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
6256 
6257  /* "subsurfaceTransportFunctions.pyx":210
6258  * cdef int eN,ebN,ebN_local,k,material_left,material_right
6259  *
6260  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6261  * for ebN_local in range(x.shape[1]):
6262  * ebN = elementBoundariesArray[eN,ebN_local]
6263  */
6264  __pyx_t_1 = (__pyx_v_x->dimensions[0]);