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]);
6265  __pyx_t_2 = __pyx_t_1;
6266  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6267  __pyx_v_eN = __pyx_t_3;
6268 
6269  /* "subsurfaceTransportFunctions.pyx":211
6270  *
6271  * for eN in range(x.shape[0]):
6272  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6273  * ebN = elementBoundariesArray[eN,ebN_local]
6274  * material_left = elementBoundaryTypes[ebN,0]
6275  */
6276  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6277  __pyx_t_5 = __pyx_t_4;
6278  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6279  __pyx_v_ebN_local = __pyx_t_6;
6280 
6281  /* "subsurfaceTransportFunctions.pyx":212
6282  * for eN in range(x.shape[0]):
6283  * for ebN_local in range(x.shape[1]):
6284  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6285  * material_left = elementBoundaryTypes[ebN,0]
6286  * material_right= elementBoundaryTypes[ebN,1]
6287  */
6288  __pyx_t_7 = __pyx_v_eN;
6289  __pyx_t_8 = __pyx_v_ebN_local;
6290  __pyx_t_9 = -1;
6291  if (__pyx_t_7 < 0) {
6292  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6293  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6294  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6295  if (__pyx_t_8 < 0) {
6296  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6297  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6298  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6299  if (unlikely(__pyx_t_9 != -1)) {
6300  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6301  __PYX_ERR(0, 212, __pyx_L1_error)
6302  }
6303  __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));
6304 
6305  /* "subsurfaceTransportFunctions.pyx":213
6306  * for ebN_local in range(x.shape[1]):
6307  * ebN = elementBoundariesArray[eN,ebN_local]
6308  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6309  * material_right= elementBoundaryTypes[ebN,1]
6310  * for k in range(x.shape[2]):
6311  */
6312  __pyx_t_8 = __pyx_v_ebN;
6313  __pyx_t_7 = 0;
6314  __pyx_t_9 = -1;
6315  if (__pyx_t_8 < 0) {
6316  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6317  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
6318  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6319  if (__pyx_t_7 < 0) {
6320  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6321  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
6322  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6323  if (unlikely(__pyx_t_9 != -1)) {
6324  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6325  __PYX_ERR(0, 213, __pyx_L1_error)
6326  }
6327  __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));
6328 
6329  /* "subsurfaceTransportFunctions.pyx":214
6330  * ebN = elementBoundariesArray[eN,ebN_local]
6331  * material_left = elementBoundaryTypes[ebN,0]
6332  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6333  * for k in range(x.shape[2]):
6334  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6335  */
6336  __pyx_t_7 = __pyx_v_ebN;
6337  __pyx_t_8 = 1;
6338  __pyx_t_9 = -1;
6339  if (__pyx_t_7 < 0) {
6340  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6341  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6342  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6343  if (__pyx_t_8 < 0) {
6344  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6345  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6346  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6347  if (unlikely(__pyx_t_9 != -1)) {
6348  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6349  __PYX_ERR(0, 214, __pyx_L1_error)
6350  }
6351  __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));
6352 
6353  /* "subsurfaceTransportFunctions.pyx":215
6354  * material_left = elementBoundaryTypes[ebN,0]
6355  * material_right= elementBoundaryTypes[ebN,1]
6356  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6357  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6358  * material_functions[material_right](x[eN,ebN_local,k],t))
6359  */
6360  __pyx_t_10 = (__pyx_v_x->dimensions[2]);
6361  __pyx_t_11 = __pyx_t_10;
6362  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
6363  __pyx_v_k = __pyx_t_9;
6364 
6365  /* "subsurfaceTransportFunctions.pyx":216
6366  * material_right= elementBoundaryTypes[ebN,1]
6367  * for k in range(x.shape[2]):
6368  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6369  * material_functions[material_right](x[eN,ebN_local,k],t))
6370  *
6371  */
6372  if (unlikely(__pyx_v_material_functions == Py_None)) {
6373  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6374  __PYX_ERR(0, 216, __pyx_L1_error)
6375  }
6376  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6377  __Pyx_GOTREF(__pyx_t_13);
6378  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
6379  __Pyx_GOTREF(__pyx_t_14);
6380  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6381  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6382  __Pyx_GOTREF(__pyx_t_13);
6383  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 216, __pyx_L1_error)
6384  __Pyx_GOTREF(__pyx_t_15);
6385  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6386  __Pyx_GOTREF(__pyx_t_16);
6387  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6388  __Pyx_GOTREF(__pyx_t_17);
6389  __Pyx_GIVEREF(__pyx_t_13);
6390  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_13);
6391  __Pyx_GIVEREF(__pyx_t_15);
6392  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_15);
6393  __Pyx_GIVEREF(__pyx_t_16);
6394  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_16);
6395  __pyx_t_13 = 0;
6396  __pyx_t_15 = 0;
6397  __pyx_t_16 = 0;
6398  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6399  __Pyx_GOTREF(__pyx_t_16);
6400  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6401  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6402  __Pyx_GOTREF(__pyx_t_17);
6403  __pyx_t_15 = NULL;
6404  __pyx_t_18 = 0;
6405  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
6406  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
6407  if (likely(__pyx_t_15)) {
6408  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
6409  __Pyx_INCREF(__pyx_t_15);
6410  __Pyx_INCREF(function);
6411  __Pyx_DECREF_SET(__pyx_t_14, function);
6412  __pyx_t_18 = 1;
6413  }
6414  }
6415  #if CYTHON_FAST_PYCALL
6416  if (PyFunction_Check(__pyx_t_14)) {
6417  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_17};
6418  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6419  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
6420  __Pyx_GOTREF(__pyx_t_12);
6421  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6422  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6423  } else
6424  #endif
6425  #if CYTHON_FAST_PYCCALL
6426  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
6427  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_17};
6428  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6429  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
6430  __Pyx_GOTREF(__pyx_t_12);
6431  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6432  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6433  } else
6434  #endif
6435  {
6436  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6437  __Pyx_GOTREF(__pyx_t_13);
6438  if (__pyx_t_15) {
6439  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
6440  }
6441  __Pyx_GIVEREF(__pyx_t_16);
6442  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_16);
6443  __Pyx_GIVEREF(__pyx_t_17);
6444  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_17);
6445  __pyx_t_16 = 0;
6446  __pyx_t_17 = 0;
6447  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6448  __Pyx_GOTREF(__pyx_t_12);
6449  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6450  }
6451  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6452 
6453  /* "subsurfaceTransportFunctions.pyx":217
6454  * for k in range(x.shape[2]):
6455  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6456  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
6457  *
6458  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
6459  */
6460  if (unlikely(__pyx_v_material_functions == Py_None)) {
6461  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6462  __PYX_ERR(0, 217, __pyx_L1_error)
6463  }
6464  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6465  __Pyx_GOTREF(__pyx_t_13);
6466  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6467  __Pyx_GOTREF(__pyx_t_17);
6468  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6469  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6470  __Pyx_GOTREF(__pyx_t_13);
6471  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 217, __pyx_L1_error)
6472  __Pyx_GOTREF(__pyx_t_16);
6473  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6474  __Pyx_GOTREF(__pyx_t_15);
6475  __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6476  __Pyx_GOTREF(__pyx_t_19);
6477  __Pyx_GIVEREF(__pyx_t_13);
6478  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_13);
6479  __Pyx_GIVEREF(__pyx_t_16);
6480  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_16);
6481  __Pyx_GIVEREF(__pyx_t_15);
6482  PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_15);
6483  __pyx_t_13 = 0;
6484  __pyx_t_16 = 0;
6485  __pyx_t_15 = 0;
6486  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6487  __Pyx_GOTREF(__pyx_t_15);
6488  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6489  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6490  __Pyx_GOTREF(__pyx_t_19);
6491  __pyx_t_16 = NULL;
6492  __pyx_t_18 = 0;
6493  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
6494  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
6495  if (likely(__pyx_t_16)) {
6496  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
6497  __Pyx_INCREF(__pyx_t_16);
6498  __Pyx_INCREF(function);
6499  __Pyx_DECREF_SET(__pyx_t_17, function);
6500  __pyx_t_18 = 1;
6501  }
6502  }
6503  #if CYTHON_FAST_PYCALL
6504  if (PyFunction_Check(__pyx_t_17)) {
6505  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_19};
6506  __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6507  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
6508  __Pyx_GOTREF(__pyx_t_14);
6509  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6510  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6511  } else
6512  #endif
6513  #if CYTHON_FAST_PYCCALL
6514  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
6515  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_19};
6516  __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6517  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
6518  __Pyx_GOTREF(__pyx_t_14);
6519  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6520  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6521  } else
6522  #endif
6523  {
6524  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6525  __Pyx_GOTREF(__pyx_t_13);
6526  if (__pyx_t_16) {
6527  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_16); __pyx_t_16 = NULL;
6528  }
6529  __Pyx_GIVEREF(__pyx_t_15);
6530  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_15);
6531  __Pyx_GIVEREF(__pyx_t_19);
6532  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_19);
6533  __pyx_t_15 = 0;
6534  __pyx_t_19 = 0;
6535  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6536  __Pyx_GOTREF(__pyx_t_14);
6537  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6538  }
6539  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6540 
6541  /* "subsurfaceTransportFunctions.pyx":216
6542  * material_right= elementBoundaryTypes[ebN,1]
6543  * for k in range(x.shape[2]):
6544  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6545  * material_functions[material_right](x[eN,ebN_local,k],t))
6546  *
6547  */
6548  __pyx_t_17 = PyNumber_Add(__pyx_t_12, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6549  __Pyx_GOTREF(__pyx_t_17);
6550  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6551  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6552  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
6553  __Pyx_GOTREF(__pyx_t_14);
6554  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6555  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
6556  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6557  __pyx_t_8 = __pyx_v_eN;
6558  __pyx_t_7 = __pyx_v_ebN_local;
6559  __pyx_t_21 = __pyx_v_k;
6560  __pyx_t_18 = -1;
6561  if (__pyx_t_8 < 0) {
6562  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6563  if (unlikely(__pyx_t_8 < 0)) __pyx_t_18 = 0;
6564  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_18 = 0;
6565  if (__pyx_t_7 < 0) {
6566  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6567  if (unlikely(__pyx_t_7 < 0)) __pyx_t_18 = 1;
6568  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_18 = 1;
6569  if (__pyx_t_21 < 0) {
6570  __pyx_t_21 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6571  if (unlikely(__pyx_t_21 < 0)) __pyx_t_18 = 2;
6572  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_18 = 2;
6573  if (unlikely(__pyx_t_18 != -1)) {
6574  __Pyx_RaiseBufferIndexError(__pyx_t_18);
6575  __PYX_ERR(0, 216, __pyx_L1_error)
6576  }
6577  *__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_21, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_20;
6578  }
6579  }
6580  }
6581 
6582  /* "subsurfaceTransportFunctions.pyx":195
6583  *
6584  *
6585  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6586  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6587  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6588  */
6589 
6590  /* function exit code */
6591  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6592  goto __pyx_L0;
6593  __pyx_L1_error:;
6594  __Pyx_XDECREF(__pyx_t_12);
6595  __Pyx_XDECREF(__pyx_t_13);
6596  __Pyx_XDECREF(__pyx_t_14);
6597  __Pyx_XDECREF(__pyx_t_15);
6598  __Pyx_XDECREF(__pyx_t_16);
6599  __Pyx_XDECREF(__pyx_t_17);
6600  __Pyx_XDECREF(__pyx_t_19);
6601  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6602  __Pyx_PyThreadState_declare
6603  __Pyx_PyThreadState_assign
6604  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6605  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6606  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6607  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6608  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6609  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6610  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6611  __pyx_r = NULL;
6612  goto __pyx_L2;
6613  __pyx_L0:;
6614  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6615  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6616  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6617  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6618  __pyx_L2:;
6619  __Pyx_XGIVEREF(__pyx_r);
6620  __Pyx_RefNannyFinishContext();
6621  return __pyx_r;
6622 }
6623 
6624 /* "subsurfaceTransportFunctions.pyx":219
6625  * material_functions[material_right](x[eN,ebN_local,k],t))
6626  *
6627  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6628  * double t,
6629  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6630  */
6631 
6632 /* Python wrapper */
6633 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6634 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+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 ";
6635 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
6636 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6637  int __pyx_v_nd;
6638  double __pyx_v_t;
6639  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6640  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6641  PyArrayObject *__pyx_v_x = 0;
6642  PyArrayObject *__pyx_v_ebq_vals = 0;
6643  PyObject *__pyx_v_material_functions = 0;
6644  int __pyx_lineno = 0;
6645  const char *__pyx_filename = NULL;
6646  int __pyx_clineno = 0;
6647  PyObject *__pyx_r = 0;
6648  __Pyx_RefNannyDeclarations
6649  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
6650  {
6651  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__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};
6652  PyObject* values[7] = {0,0,0,0,0,0,0};
6653  if (unlikely(__pyx_kwds)) {
6654  Py_ssize_t kw_args;
6655  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6656  switch (pos_args) {
6657  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6658  CYTHON_FALLTHROUGH;
6659  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6660  CYTHON_FALLTHROUGH;
6661  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6662  CYTHON_FALLTHROUGH;
6663  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6664  CYTHON_FALLTHROUGH;
6665  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6666  CYTHON_FALLTHROUGH;
6667  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6668  CYTHON_FALLTHROUGH;
6669  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6670  CYTHON_FALLTHROUGH;
6671  case 0: break;
6672  default: goto __pyx_L5_argtuple_error;
6673  }
6674  kw_args = PyDict_Size(__pyx_kwds);
6675  switch (pos_args) {
6676  case 0:
6677  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
6678  else goto __pyx_L5_argtuple_error;
6679  CYTHON_FALLTHROUGH;
6680  case 1:
6681  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6682  else {
6683  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 219, __pyx_L3_error)
6684  }
6685  CYTHON_FALLTHROUGH;
6686  case 2:
6687  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6688  else {
6689  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 219, __pyx_L3_error)
6690  }
6691  CYTHON_FALLTHROUGH;
6692  case 3:
6693  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6694  else {
6695  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 219, __pyx_L3_error)
6696  }
6697  CYTHON_FALLTHROUGH;
6698  case 4:
6699  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6700  else {
6701  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 219, __pyx_L3_error)
6702  }
6703  CYTHON_FALLTHROUGH;
6704  case 5:
6705  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6706  else {
6707  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 219, __pyx_L3_error)
6708  }
6709  CYTHON_FALLTHROUGH;
6710  case 6:
6711  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6712  else {
6713  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 219, __pyx_L3_error)
6714  }
6715  }
6716  if (unlikely(kw_args > 0)) {
6717  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6718  }
6719  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
6720  goto __pyx_L5_argtuple_error;
6721  } else {
6722  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6723  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6724  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6725  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6726  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6727  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6728  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6729  }
6730  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
6731  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
6732  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
6733  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
6734  __pyx_v_x = ((PyArrayObject *)values[4]);
6735  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
6736  __pyx_v_material_functions = ((PyObject*)values[6]);
6737  }
6738  goto __pyx_L4_argument_unpacking_done;
6739  __pyx_L5_argtuple_error:;
6740  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6741  __pyx_L3_error:;
6742  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6743  __Pyx_RefNannyFinishContext();
6744  return NULL;
6745  __pyx_L4_argument_unpacking_done:;
6746  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
6747  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
6748  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
6749  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 224, __pyx_L1_error)
6750  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 225, __pyx_L1_error)
6751  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6752 
6753  /* function exit code */
6754  goto __pyx_L0;
6755  __pyx_L1_error:;
6756  __pyx_r = NULL;
6757  __pyx_L0:;
6758  __Pyx_RefNannyFinishContext();
6759  return __pyx_r;
6760 }
6761 
6762 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) {
6763  int __pyx_v_eN;
6764  int __pyx_v_ebN;
6765  int __pyx_v_ebN_local;
6766  int __pyx_v_k;
6767  int __pyx_v_material_left;
6768  int __pyx_v_material_right;
6769  int __pyx_v_I;
6770  int __pyx_v_J;
6771  double __pyx_v_numer;
6772  double __pyx_v_denom;
6773  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6774  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6775  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6776  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6777  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6778  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6779  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6780  __Pyx_Buffer __pyx_pybuffer_x;
6781  PyObject *__pyx_r = NULL;
6782  __Pyx_RefNannyDeclarations
6783  npy_intp __pyx_t_1;
6784  npy_intp __pyx_t_2;
6785  int __pyx_t_3;
6786  npy_intp __pyx_t_4;
6787  npy_intp __pyx_t_5;
6788  int __pyx_t_6;
6789  Py_ssize_t __pyx_t_7;
6790  Py_ssize_t __pyx_t_8;
6791  int __pyx_t_9;
6792  npy_intp __pyx_t_10;
6793  npy_intp __pyx_t_11;
6794  int __pyx_t_12;
6795  int __pyx_t_13;
6796  int __pyx_t_14;
6797  int __pyx_t_15;
6798  int __pyx_t_16;
6799  int __pyx_t_17;
6800  PyObject *__pyx_t_18 = NULL;
6801  PyObject *__pyx_t_19 = NULL;
6802  PyObject *__pyx_t_20 = NULL;
6803  PyObject *__pyx_t_21 = NULL;
6804  PyObject *__pyx_t_22 = NULL;
6805  PyObject *__pyx_t_23 = NULL;
6806  int __pyx_t_24;
6807  PyObject *__pyx_t_25 = NULL;
6808  double __pyx_t_26;
6809  Py_ssize_t __pyx_t_27;
6810  Py_ssize_t __pyx_t_28;
6811  int __pyx_lineno = 0;
6812  const char *__pyx_filename = NULL;
6813  int __pyx_clineno = 0;
6814  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
6815  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6816  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6817  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6818  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6819  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6820  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6821  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6822  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6823  __pyx_pybuffer_x.pybuffer.buf = NULL;
6824  __pyx_pybuffer_x.refcount = 0;
6825  __pyx_pybuffernd_x.data = NULL;
6826  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6827  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6828  __pyx_pybuffer_ebq_vals.refcount = 0;
6829  __pyx_pybuffernd_ebq_vals.data = NULL;
6830  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6831  {
6832  __Pyx_BufFmt_StackElem __pyx_stack[1];
6833  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, 219, __pyx_L1_error)
6834  }
6835  __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];
6836  {
6837  __Pyx_BufFmt_StackElem __pyx_stack[1];
6838  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, 219, __pyx_L1_error)
6839  }
6840  __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];
6841  {
6842  __Pyx_BufFmt_StackElem __pyx_stack[1];
6843  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, 219, __pyx_L1_error)
6844  }
6845  __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];
6846  {
6847  __Pyx_BufFmt_StackElem __pyx_stack[1];
6848  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, 219, __pyx_L1_error)
6849  }
6850  __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];
6851 
6852  /* "subsurfaceTransportFunctions.pyx":236
6853  * cdef double numer,denom
6854  *
6855  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6856  * for ebN_local in range(x.shape[1]):
6857  * ebN = elementBoundariesArray[eN,ebN_local]
6858  */
6859  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6860  __pyx_t_2 = __pyx_t_1;
6861  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6862  __pyx_v_eN = __pyx_t_3;
6863 
6864  /* "subsurfaceTransportFunctions.pyx":237
6865  *
6866  * for eN in range(x.shape[0]):
6867  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6868  * ebN = elementBoundariesArray[eN,ebN_local]
6869  * material_left = elementBoundaryTypes[ebN,0]
6870  */
6871  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6872  __pyx_t_5 = __pyx_t_4;
6873  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6874  __pyx_v_ebN_local = __pyx_t_6;
6875 
6876  /* "subsurfaceTransportFunctions.pyx":238
6877  * for eN in range(x.shape[0]):
6878  * for ebN_local in range(x.shape[1]):
6879  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6880  * material_left = elementBoundaryTypes[ebN,0]
6881  * material_right= elementBoundaryTypes[ebN,1]
6882  */
6883  __pyx_t_7 = __pyx_v_eN;
6884  __pyx_t_8 = __pyx_v_ebN_local;
6885  __pyx_t_9 = -1;
6886  if (__pyx_t_7 < 0) {
6887  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6888  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6889  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6890  if (__pyx_t_8 < 0) {
6891  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6892  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6893  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6894  if (unlikely(__pyx_t_9 != -1)) {
6895  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6896  __PYX_ERR(0, 238, __pyx_L1_error)
6897  }
6898  __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));
6899 
6900  /* "subsurfaceTransportFunctions.pyx":239
6901  * for ebN_local in range(x.shape[1]):
6902  * ebN = elementBoundariesArray[eN,ebN_local]
6903  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6904  * material_right= elementBoundaryTypes[ebN,1]
6905  * for k in range(x.shape[2]):
6906  */
6907  __pyx_t_8 = __pyx_v_ebN;
6908  __pyx_t_7 = 0;
6909  __pyx_t_9 = -1;
6910  if (__pyx_t_8 < 0) {
6911  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6912  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
6913  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6914  if (__pyx_t_7 < 0) {
6915  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6916  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
6917  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6918  if (unlikely(__pyx_t_9 != -1)) {
6919  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6920  __PYX_ERR(0, 239, __pyx_L1_error)
6921  }
6922  __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));
6923 
6924  /* "subsurfaceTransportFunctions.pyx":240
6925  * ebN = elementBoundariesArray[eN,ebN_local]
6926  * material_left = elementBoundaryTypes[ebN,0]
6927  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6928  * for k in range(x.shape[2]):
6929  * for I in range(nd):
6930  */
6931  __pyx_t_7 = __pyx_v_ebN;
6932  __pyx_t_8 = 1;
6933  __pyx_t_9 = -1;
6934  if (__pyx_t_7 < 0) {
6935  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6936  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6937  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6938  if (__pyx_t_8 < 0) {
6939  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6940  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6941  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6942  if (unlikely(__pyx_t_9 != -1)) {
6943  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6944  __PYX_ERR(0, 240, __pyx_L1_error)
6945  }
6946  __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));
6947 
6948  /* "subsurfaceTransportFunctions.pyx":241
6949  * material_left = elementBoundaryTypes[ebN,0]
6950  * material_right= elementBoundaryTypes[ebN,1]
6951  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6952  * for I in range(nd):
6953  * for J in range(nd):
6954  */
6955  __pyx_t_10 = (__pyx_v_x->dimensions[2]);
6956  __pyx_t_11 = __pyx_t_10;
6957  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
6958  __pyx_v_k = __pyx_t_9;
6959 
6960  /* "subsurfaceTransportFunctions.pyx":242
6961  * material_right= elementBoundaryTypes[ebN,1]
6962  * for k in range(x.shape[2]):
6963  * for I in range(nd): # <<<<<<<<<<<<<<
6964  * for J in range(nd):
6965  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6966  */
6967  __pyx_t_12 = __pyx_v_nd;
6968  __pyx_t_13 = __pyx_t_12;
6969  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6970  __pyx_v_I = __pyx_t_14;
6971 
6972  /* "subsurfaceTransportFunctions.pyx":243
6973  * for k in range(x.shape[2]):
6974  * for I in range(nd):
6975  * for J in range(nd): # <<<<<<<<<<<<<<
6976  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6977  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6978  */
6979  __pyx_t_15 = __pyx_v_nd;
6980  __pyx_t_16 = __pyx_t_15;
6981  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
6982  __pyx_v_J = __pyx_t_17;
6983 
6984  /* "subsurfaceTransportFunctions.pyx":244
6985  * for I in range(nd):
6986  * for J in range(nd):
6987  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6988  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6989  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6990  */
6991  if (unlikely(__pyx_v_material_functions == Py_None)) {
6992  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6993  __PYX_ERR(0, 244, __pyx_L1_error)
6994  }
6995  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6996  __Pyx_GOTREF(__pyx_t_19);
6997  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6998  __Pyx_GOTREF(__pyx_t_20);
6999  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7000  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7001  __Pyx_GOTREF(__pyx_t_19);
7002  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7003  __Pyx_GOTREF(__pyx_t_21);
7004  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7005  __Pyx_GOTREF(__pyx_t_22);
7006  __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7007  __Pyx_GOTREF(__pyx_t_23);
7008  __Pyx_GIVEREF(__pyx_t_19);
7009  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_19);
7010  __Pyx_GIVEREF(__pyx_t_21);
7011  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
7012  __Pyx_GIVEREF(__pyx_t_22);
7013  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
7014  __pyx_t_19 = 0;
7015  __pyx_t_21 = 0;
7016  __pyx_t_22 = 0;
7017  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7018  __Pyx_GOTREF(__pyx_t_22);
7019  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7020  __pyx_t_23 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7021  __Pyx_GOTREF(__pyx_t_23);
7022  __pyx_t_21 = NULL;
7023  __pyx_t_24 = 0;
7024  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
7025  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20);
7026  if (likely(__pyx_t_21)) {
7027  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
7028  __Pyx_INCREF(__pyx_t_21);
7029  __Pyx_INCREF(function);
7030  __Pyx_DECREF_SET(__pyx_t_20, function);
7031  __pyx_t_24 = 1;
7032  }
7033  }
7034  #if CYTHON_FAST_PYCALL
7035  if (PyFunction_Check(__pyx_t_20)) {
7036  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_22, __pyx_t_23};
7037  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7038  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
7039  __Pyx_GOTREF(__pyx_t_18);
7040  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7041  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7042  } else
7043  #endif
7044  #if CYTHON_FAST_PYCCALL
7045  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
7046  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_22, __pyx_t_23};
7047  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7048  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
7049  __Pyx_GOTREF(__pyx_t_18);
7050  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7051  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7052  } else
7053  #endif
7054  {
7055  __pyx_t_19 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7056  __Pyx_GOTREF(__pyx_t_19);
7057  if (__pyx_t_21) {
7058  __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21); __pyx_t_21 = NULL;
7059  }
7060  __Pyx_GIVEREF(__pyx_t_22);
7061  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_24, __pyx_t_22);
7062  __Pyx_GIVEREF(__pyx_t_23);
7063  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_24, __pyx_t_23);
7064  __pyx_t_22 = 0;
7065  __pyx_t_23 = 0;
7066  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_19, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7067  __Pyx_GOTREF(__pyx_t_18);
7068  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7069  }
7070  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7071  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7072  __Pyx_GOTREF(__pyx_t_20);
7073  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7074  __Pyx_GOTREF(__pyx_t_19);
7075  __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7076  __Pyx_GOTREF(__pyx_t_23);
7077  __Pyx_GIVEREF(__pyx_t_20);
7078  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
7079  __Pyx_GIVEREF(__pyx_t_19);
7080  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_19);
7081  __pyx_t_20 = 0;
7082  __pyx_t_19 = 0;
7083  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_23); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7084  __Pyx_GOTREF(__pyx_t_19);
7085  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7086  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7087  __pyx_t_23 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7088  __Pyx_GOTREF(__pyx_t_23);
7089  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7090  if (unlikely(__pyx_v_material_functions == Py_None)) {
7091  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7092  __PYX_ERR(0, 244, __pyx_L1_error)
7093  }
7094  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7095  __Pyx_GOTREF(__pyx_t_18);
7096  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7097  __Pyx_GOTREF(__pyx_t_20);
7098  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7099  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7100  __Pyx_GOTREF(__pyx_t_18);
7101  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7102  __Pyx_GOTREF(__pyx_t_22);
7103  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7104  __Pyx_GOTREF(__pyx_t_21);
7105  __pyx_t_25 = PyTuple_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7106  __Pyx_GOTREF(__pyx_t_25);
7107  __Pyx_GIVEREF(__pyx_t_18);
7108  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_18);
7109  __Pyx_GIVEREF(__pyx_t_22);
7110  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_22);
7111  __Pyx_GIVEREF(__pyx_t_21);
7112  PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_t_21);
7113  __pyx_t_18 = 0;
7114  __pyx_t_22 = 0;
7115  __pyx_t_21 = 0;
7116  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7117  __Pyx_GOTREF(__pyx_t_21);
7118  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7119  __pyx_t_25 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7120  __Pyx_GOTREF(__pyx_t_25);
7121  __pyx_t_22 = NULL;
7122  __pyx_t_24 = 0;
7123  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
7124  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
7125  if (likely(__pyx_t_22)) {
7126  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
7127  __Pyx_INCREF(__pyx_t_22);
7128  __Pyx_INCREF(function);
7129  __Pyx_DECREF_SET(__pyx_t_20, function);
7130  __pyx_t_24 = 1;
7131  }
7132  }
7133  #if CYTHON_FAST_PYCALL
7134  if (PyFunction_Check(__pyx_t_20)) {
7135  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_25};
7136  __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7137  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
7138  __Pyx_GOTREF(__pyx_t_19);
7139  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7140  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7141  } else
7142  #endif
7143  #if CYTHON_FAST_PYCCALL
7144  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
7145  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_25};
7146  __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7147  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
7148  __Pyx_GOTREF(__pyx_t_19);
7149  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7150  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7151  } else
7152  #endif
7153  {
7154  __pyx_t_18 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7155  __Pyx_GOTREF(__pyx_t_18);
7156  if (__pyx_t_22) {
7157  __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_22); __pyx_t_22 = NULL;
7158  }
7159  __Pyx_GIVEREF(__pyx_t_21);
7160  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_24, __pyx_t_21);
7161  __Pyx_GIVEREF(__pyx_t_25);
7162  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_24, __pyx_t_25);
7163  __pyx_t_21 = 0;
7164  __pyx_t_25 = 0;
7165  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_18, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7166  __Pyx_GOTREF(__pyx_t_19);
7167  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7168  }
7169  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7170  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7171  __Pyx_GOTREF(__pyx_t_20);
7172  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7173  __Pyx_GOTREF(__pyx_t_18);
7174  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7175  __Pyx_GOTREF(__pyx_t_25);
7176  __Pyx_GIVEREF(__pyx_t_20);
7177  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_20);
7178  __Pyx_GIVEREF(__pyx_t_18);
7179  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_18);
7180  __pyx_t_20 = 0;
7181  __pyx_t_18 = 0;
7182  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_25); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7183  __Pyx_GOTREF(__pyx_t_18);
7184  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7185  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7186  __pyx_t_25 = PyNumber_Multiply(__pyx_t_23, __pyx_t_18); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7187  __Pyx_GOTREF(__pyx_t_25);
7188  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7189  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7190  __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_25); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
7191  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7192  __pyx_v_numer = __pyx_t_26;
7193 
7194  /* "subsurfaceTransportFunctions.pyx":245
7195  * for J in range(nd):
7196  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7197  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
7198  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7199  *
7200  */
7201  if (unlikely(__pyx_v_material_functions == Py_None)) {
7202  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7203  __PYX_ERR(0, 245, __pyx_L1_error)
7204  }
7205  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7206  __Pyx_GOTREF(__pyx_t_18);
7207  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7208  __Pyx_GOTREF(__pyx_t_23);
7209  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7210  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7211  __Pyx_GOTREF(__pyx_t_18);
7212  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7213  __Pyx_GOTREF(__pyx_t_19);
7214  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7215  __Pyx_GOTREF(__pyx_t_20);
7216  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7217  __Pyx_GOTREF(__pyx_t_21);
7218  __Pyx_GIVEREF(__pyx_t_18);
7219  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
7220  __Pyx_GIVEREF(__pyx_t_19);
7221  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
7222  __Pyx_GIVEREF(__pyx_t_20);
7223  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_20);
7224  __pyx_t_18 = 0;
7225  __pyx_t_19 = 0;
7226  __pyx_t_20 = 0;
7227  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7228  __Pyx_GOTREF(__pyx_t_20);
7229  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7230  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7231  __Pyx_GOTREF(__pyx_t_21);
7232  __pyx_t_19 = NULL;
7233  __pyx_t_24 = 0;
7234  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
7235  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_23);
7236  if (likely(__pyx_t_19)) {
7237  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
7238  __Pyx_INCREF(__pyx_t_19);
7239  __Pyx_INCREF(function);
7240  __Pyx_DECREF_SET(__pyx_t_23, function);
7241  __pyx_t_24 = 1;
7242  }
7243  }
7244  #if CYTHON_FAST_PYCALL
7245  if (PyFunction_Check(__pyx_t_23)) {
7246  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
7247  __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7248  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7249  __Pyx_GOTREF(__pyx_t_25);
7250  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7251  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7252  } else
7253  #endif
7254  #if CYTHON_FAST_PYCCALL
7255  if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
7256  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
7257  __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7258  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7259  __Pyx_GOTREF(__pyx_t_25);
7260  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7261  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7262  } else
7263  #endif
7264  {
7265  __pyx_t_18 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7266  __Pyx_GOTREF(__pyx_t_18);
7267  if (__pyx_t_19) {
7268  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19); __pyx_t_19 = NULL;
7269  }
7270  __Pyx_GIVEREF(__pyx_t_20);
7271  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_24, __pyx_t_20);
7272  __Pyx_GIVEREF(__pyx_t_21);
7273  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_24, __pyx_t_21);
7274  __pyx_t_20 = 0;
7275  __pyx_t_21 = 0;
7276  __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_18, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7277  __Pyx_GOTREF(__pyx_t_25);
7278  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7279  }
7280  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7281  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7282  __Pyx_GOTREF(__pyx_t_23);
7283  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7284  __Pyx_GOTREF(__pyx_t_18);
7285  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7286  __Pyx_GOTREF(__pyx_t_21);
7287  __Pyx_GIVEREF(__pyx_t_23);
7288  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_23);
7289  __Pyx_GIVEREF(__pyx_t_18);
7290  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_18);
7291  __pyx_t_23 = 0;
7292  __pyx_t_18 = 0;
7293  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_t_21); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7294  __Pyx_GOTREF(__pyx_t_18);
7295  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7296  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7297  if (unlikely(__pyx_v_material_functions == Py_None)) {
7298  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7299  __PYX_ERR(0, 245, __pyx_L1_error)
7300  }
7301  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7302  __Pyx_GOTREF(__pyx_t_25);
7303  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_25); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7304  __Pyx_GOTREF(__pyx_t_23);
7305  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7306  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7307  __Pyx_GOTREF(__pyx_t_25);
7308  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7309  __Pyx_GOTREF(__pyx_t_20);
7310  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7311  __Pyx_GOTREF(__pyx_t_19);
7312  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7313  __Pyx_GOTREF(__pyx_t_22);
7314  __Pyx_GIVEREF(__pyx_t_25);
7315  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_25);
7316  __Pyx_GIVEREF(__pyx_t_20);
7317  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
7318  __Pyx_GIVEREF(__pyx_t_19);
7319  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_19);
7320  __pyx_t_25 = 0;
7321  __pyx_t_20 = 0;
7322  __pyx_t_19 = 0;
7323  __pyx_t_19 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7324  __Pyx_GOTREF(__pyx_t_19);
7325  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7326  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7327  __Pyx_GOTREF(__pyx_t_22);
7328  __pyx_t_20 = NULL;
7329  __pyx_t_24 = 0;
7330  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
7331  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_23);
7332  if (likely(__pyx_t_20)) {
7333  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
7334  __Pyx_INCREF(__pyx_t_20);
7335  __Pyx_INCREF(function);
7336  __Pyx_DECREF_SET(__pyx_t_23, function);
7337  __pyx_t_24 = 1;
7338  }
7339  }
7340  #if CYTHON_FAST_PYCALL
7341  if (PyFunction_Check(__pyx_t_23)) {
7342  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_22};
7343  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7344  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7345  __Pyx_GOTREF(__pyx_t_21);
7346  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7347  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7348  } else
7349  #endif
7350  #if CYTHON_FAST_PYCCALL
7351  if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
7352  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_22};
7353  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7354  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7355  __Pyx_GOTREF(__pyx_t_21);
7356  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7357  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7358  } else
7359  #endif
7360  {
7361  __pyx_t_25 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7362  __Pyx_GOTREF(__pyx_t_25);
7363  if (__pyx_t_20) {
7364  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_20); __pyx_t_20 = NULL;
7365  }
7366  __Pyx_GIVEREF(__pyx_t_19);
7367  PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_24, __pyx_t_19);
7368  __Pyx_GIVEREF(__pyx_t_22);
7369  PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_24, __pyx_t_22);
7370  __pyx_t_19 = 0;
7371  __pyx_t_22 = 0;
7372  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_25, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7373  __Pyx_GOTREF(__pyx_t_21);
7374  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7375  }
7376  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7377  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7378  __Pyx_GOTREF(__pyx_t_23);
7379  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7380  __Pyx_GOTREF(__pyx_t_25);
7381  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7382  __Pyx_GOTREF(__pyx_t_22);
7383  __Pyx_GIVEREF(__pyx_t_23);
7384  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23);
7385  __Pyx_GIVEREF(__pyx_t_25);
7386  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_25);
7387  __pyx_t_23 = 0;
7388  __pyx_t_25 = 0;
7389  __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7390  __Pyx_GOTREF(__pyx_t_25);
7391  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7392  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7393  __pyx_t_22 = PyNumber_Add(__pyx_t_18, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7394  __Pyx_GOTREF(__pyx_t_22);
7395  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7396  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7397  __pyx_t_25 = __Pyx_PyFloat_AddObjC(__pyx_t_22, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7398  __Pyx_GOTREF(__pyx_t_25);
7399  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7400  __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_25); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
7401  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7402  __pyx_v_denom = __pyx_t_26;
7403 
7404  /* "subsurfaceTransportFunctions.pyx":246
7405  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7406  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
7407  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
7408  *
7409  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
7410  */
7411  if (unlikely(__pyx_v_denom == 0)) {
7412  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
7413  __PYX_ERR(0, 246, __pyx_L1_error)
7414  }
7415  __pyx_t_8 = __pyx_v_eN;
7416  __pyx_t_7 = __pyx_v_ebN_local;
7417  __pyx_t_27 = __pyx_v_k;
7418  __pyx_t_28 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
7419  __pyx_t_24 = -1;
7420  if (__pyx_t_8 < 0) {
7421  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
7422  if (unlikely(__pyx_t_8 < 0)) __pyx_t_24 = 0;
7423  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_24 = 0;
7424  if (__pyx_t_7 < 0) {
7425  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
7426  if (unlikely(__pyx_t_7 < 0)) __pyx_t_24 = 1;
7427  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_24 = 1;
7428  if (__pyx_t_27 < 0) {
7429  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
7430  if (unlikely(__pyx_t_27 < 0)) __pyx_t_24 = 2;
7431  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_24 = 2;
7432  if (__pyx_t_28 < 0) {
7433  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
7434  if (unlikely(__pyx_t_28 < 0)) __pyx_t_24 = 3;
7435  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_24 = 3;
7436  if (unlikely(__pyx_t_24 != -1)) {
7437  __Pyx_RaiseBufferIndexError(__pyx_t_24);
7438  __PYX_ERR(0, 246, __pyx_L1_error)
7439  }
7440  *__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_27, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
7441  }
7442  }
7443  }
7444  }
7445  }
7446 
7447  /* "subsurfaceTransportFunctions.pyx":219
7448  * material_functions[material_right](x[eN,ebN_local,k],t))
7449  *
7450  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7451  * double t,
7452  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7453  */
7454 
7455  /* function exit code */
7456  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7457  goto __pyx_L0;
7458  __pyx_L1_error:;
7459  __Pyx_XDECREF(__pyx_t_18);
7460  __Pyx_XDECREF(__pyx_t_19);
7461  __Pyx_XDECREF(__pyx_t_20);
7462  __Pyx_XDECREF(__pyx_t_21);
7463  __Pyx_XDECREF(__pyx_t_22);
7464  __Pyx_XDECREF(__pyx_t_23);
7465  __Pyx_XDECREF(__pyx_t_25);
7466  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7467  __Pyx_PyThreadState_declare
7468  __Pyx_PyThreadState_assign
7469  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7470  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7471  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7472  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7473  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7474  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7475  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7476  __pyx_r = NULL;
7477  goto __pyx_L2;
7478  __pyx_L0:;
7479  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7480  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7481  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7482  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7483  __pyx_L2:;
7484  __Pyx_XGIVEREF(__pyx_r);
7485  __Pyx_RefNannyFinishContext();
7486  return __pyx_r;
7487 }
7488 
7489 /* "subsurfaceTransportFunctions.pyx":248
7490  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7491  *
7492  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7493  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7494  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7495  */
7496 
7497 /* Python wrapper */
7498 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7499 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_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 ";
7500 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
7501 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7502  double __pyx_v_t;
7503  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7504  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7505  PyArrayObject *__pyx_v_x = 0;
7506  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7507  PyObject *__pyx_v_material_functions = 0;
7508  int __pyx_lineno = 0;
7509  const char *__pyx_filename = NULL;
7510  int __pyx_clineno = 0;
7511  PyObject *__pyx_r = 0;
7512  __Pyx_RefNannyDeclarations
7513  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
7514  {
7515  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7516  PyObject* values[6] = {0,0,0,0,0,0};
7517  if (unlikely(__pyx_kwds)) {
7518  Py_ssize_t kw_args;
7519  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7520  switch (pos_args) {
7521  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7522  CYTHON_FALLTHROUGH;
7523  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7524  CYTHON_FALLTHROUGH;
7525  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7526  CYTHON_FALLTHROUGH;
7527  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7528  CYTHON_FALLTHROUGH;
7529  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7530  CYTHON_FALLTHROUGH;
7531  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7532  CYTHON_FALLTHROUGH;
7533  case 0: break;
7534  default: goto __pyx_L5_argtuple_error;
7535  }
7536  kw_args = PyDict_Size(__pyx_kwds);
7537  switch (pos_args) {
7538  case 0:
7539  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7540  else goto __pyx_L5_argtuple_error;
7541  CYTHON_FALLTHROUGH;
7542  case 1:
7543  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7544  else {
7545  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 248, __pyx_L3_error)
7546  }
7547  CYTHON_FALLTHROUGH;
7548  case 2:
7549  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7550  else {
7551  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 248, __pyx_L3_error)
7552  }
7553  CYTHON_FALLTHROUGH;
7554  case 3:
7555  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7556  else {
7557  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 248, __pyx_L3_error)
7558  }
7559  CYTHON_FALLTHROUGH;
7560  case 4:
7561  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7562  else {
7563  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 248, __pyx_L3_error)
7564  }
7565  CYTHON_FALLTHROUGH;
7566  case 5:
7567  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7568  else {
7569  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 248, __pyx_L3_error)
7570  }
7571  }
7572  if (unlikely(kw_args > 0)) {
7573  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
7574  }
7575  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
7576  goto __pyx_L5_argtuple_error;
7577  } else {
7578  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7579  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7580  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7581  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7582  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7583  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7584  }
7585  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
7586  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
7587  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
7588  __pyx_v_x = ((PyArrayObject *)values[3]);
7589  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
7590  __pyx_v_material_functions = ((PyObject*)values[5]);
7591  }
7592  goto __pyx_L4_argument_unpacking_done;
7593  __pyx_L5_argtuple_error:;
7594  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
7595  __pyx_L3_error:;
7596  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7597  __Pyx_RefNannyFinishContext();
7598  return NULL;
7599  __pyx_L4_argument_unpacking_done:;
7600  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 249, __pyx_L1_error)
7601  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 250, __pyx_L1_error)
7602  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 251, __pyx_L1_error)
7603  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 252, __pyx_L1_error)
7604  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 253, __pyx_L1_error)
7605  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7606 
7607  /* function exit code */
7608  goto __pyx_L0;
7609  __pyx_L1_error:;
7610  __pyx_r = NULL;
7611  __pyx_L0:;
7612  __Pyx_RefNannyFinishContext();
7613  return __pyx_r;
7614 }
7615 
7616 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) {
7617  int __pyx_v_ebN;
7618  int __pyx_v_material_left;
7619  int __pyx_v_material_right;
7620  npy_intp __pyx_v_k;
7621  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7622  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7623  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7624  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7625  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7626  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7627  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7628  __Pyx_Buffer __pyx_pybuffer_x;
7629  PyObject *__pyx_r = NULL;
7630  __Pyx_RefNannyDeclarations
7631  npy_intp __pyx_t_1;
7632  npy_intp __pyx_t_2;
7633  int __pyx_t_3;
7634  Py_ssize_t __pyx_t_4;
7635  Py_ssize_t __pyx_t_5;
7636  int __pyx_t_6;
7637  npy_intp __pyx_t_7;
7638  npy_intp __pyx_t_8;
7639  npy_intp __pyx_t_9;
7640  PyObject *__pyx_t_10 = NULL;
7641  PyObject *__pyx_t_11 = NULL;
7642  PyObject *__pyx_t_12 = NULL;
7643  PyObject *__pyx_t_13 = NULL;
7644  PyObject *__pyx_t_14 = NULL;
7645  PyObject *__pyx_t_15 = NULL;
7646  PyObject *__pyx_t_16 = NULL;
7647  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
7648  int __pyx_lineno = 0;
7649  const char *__pyx_filename = NULL;
7650  int __pyx_clineno = 0;
7651  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
7652  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7653  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7654  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7655  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7656  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7657  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7658  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7659  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7660  __pyx_pybuffer_x.pybuffer.buf = NULL;
7661  __pyx_pybuffer_x.refcount = 0;
7662  __pyx_pybuffernd_x.data = NULL;
7663  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7664  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7665  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7666  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7667  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7668  {
7669  __Pyx_BufFmt_StackElem __pyx_stack[1];
7670  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, 248, __pyx_L1_error)
7671  }
7672  __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];
7673  {
7674  __Pyx_BufFmt_StackElem __pyx_stack[1];
7675  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, 248, __pyx_L1_error)
7676  }
7677  __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];
7678  {
7679  __Pyx_BufFmt_StackElem __pyx_stack[1];
7680  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, 248, __pyx_L1_error)
7681  }
7682  __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];
7683  {
7684  __Pyx_BufFmt_StackElem __pyx_stack[1];
7685  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, 248, __pyx_L1_error)
7686  }
7687  __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];
7688 
7689  /* "subsurfaceTransportFunctions.pyx":263
7690  * cdef int ebN,material_left,material_right
7691  *
7692  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7693  * material_left = elementBoundaryTypes[ebN,0]
7694  * material_right= elementBoundaryTypes[ebN,1]
7695  */
7696  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7697  __pyx_t_2 = __pyx_t_1;
7698  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7699  __pyx_v_ebN = __pyx_t_3;
7700 
7701  /* "subsurfaceTransportFunctions.pyx":264
7702  *
7703  * for ebN in range(x.shape[0]):
7704  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7705  * material_right= elementBoundaryTypes[ebN,1]
7706  * for k in range(x.shape[1]):
7707  */
7708  __pyx_t_4 = __pyx_v_ebN;
7709  __pyx_t_5 = 0;
7710  __pyx_t_6 = -1;
7711  if (__pyx_t_4 < 0) {
7712  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7713  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7714  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7715  if (__pyx_t_5 < 0) {
7716  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7717  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7718  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7719  if (unlikely(__pyx_t_6 != -1)) {
7720  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7721  __PYX_ERR(0, 264, __pyx_L1_error)
7722  }
7723  __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));
7724 
7725  /* "subsurfaceTransportFunctions.pyx":265
7726  * for ebN in range(x.shape[0]):
7727  * material_left = elementBoundaryTypes[ebN,0]
7728  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7729  * for k in range(x.shape[1]):
7730  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7731  */
7732  __pyx_t_5 = __pyx_v_ebN;
7733  __pyx_t_4 = 1;
7734  __pyx_t_6 = -1;
7735  if (__pyx_t_5 < 0) {
7736  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7737  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
7738  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7739  if (__pyx_t_4 < 0) {
7740  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7741  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
7742  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7743  if (unlikely(__pyx_t_6 != -1)) {
7744  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7745  __PYX_ERR(0, 265, __pyx_L1_error)
7746  }
7747  __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));
7748 
7749  /* "subsurfaceTransportFunctions.pyx":266
7750  * material_left = elementBoundaryTypes[ebN,0]
7751  * material_right= elementBoundaryTypes[ebN,1]
7752  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7753  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7754  * material_functions[material_right](x[ebN,k],t))
7755  */
7756  __pyx_t_7 = (__pyx_v_x->dimensions[1]);
7757  __pyx_t_8 = __pyx_t_7;
7758  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
7759  __pyx_v_k = __pyx_t_9;
7760 
7761  /* "subsurfaceTransportFunctions.pyx":267
7762  * material_right= elementBoundaryTypes[ebN,1]
7763  * for k in range(x.shape[1]):
7764  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7765  * material_functions[material_right](x[ebN,k],t))
7766  *
7767  */
7768  if (unlikely(__pyx_v_material_functions == Py_None)) {
7769  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7770  __PYX_ERR(0, 267, __pyx_L1_error)
7771  }
7772  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7773  __Pyx_GOTREF(__pyx_t_11);
7774  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7775  __Pyx_GOTREF(__pyx_t_12);
7776  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7777  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7778  __Pyx_GOTREF(__pyx_t_11);
7779  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7780  __Pyx_GOTREF(__pyx_t_13);
7781  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7782  __Pyx_GOTREF(__pyx_t_14);
7783  __Pyx_GIVEREF(__pyx_t_11);
7784  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11);
7785  __Pyx_GIVEREF(__pyx_t_13);
7786  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
7787  __pyx_t_11 = 0;
7788  __pyx_t_13 = 0;
7789  __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7790  __Pyx_GOTREF(__pyx_t_13);
7791  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7792  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7793  __Pyx_GOTREF(__pyx_t_14);
7794  __pyx_t_11 = NULL;
7795  __pyx_t_6 = 0;
7796  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
7797  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
7798  if (likely(__pyx_t_11)) {
7799  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
7800  __Pyx_INCREF(__pyx_t_11);
7801  __Pyx_INCREF(function);
7802  __Pyx_DECREF_SET(__pyx_t_12, function);
7803  __pyx_t_6 = 1;
7804  }
7805  }
7806  #if CYTHON_FAST_PYCALL
7807  if (PyFunction_Check(__pyx_t_12)) {
7808  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7809  __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7810  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7811  __Pyx_GOTREF(__pyx_t_10);
7812  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7813  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7814  } else
7815  #endif
7816  #if CYTHON_FAST_PYCCALL
7817  if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
7818  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7819  __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7820  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7821  __Pyx_GOTREF(__pyx_t_10);
7822  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7823  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7824  } else
7825  #endif
7826  {
7827  __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7828  __Pyx_GOTREF(__pyx_t_15);
7829  if (__pyx_t_11) {
7830  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
7831  }
7832  __Pyx_GIVEREF(__pyx_t_13);
7833  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_t_13);
7834  __Pyx_GIVEREF(__pyx_t_14);
7835  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_t_14);
7836  __pyx_t_13 = 0;
7837  __pyx_t_14 = 0;
7838  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7839  __Pyx_GOTREF(__pyx_t_10);
7840  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7841  }
7842  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7843 
7844  /* "subsurfaceTransportFunctions.pyx":268
7845  * for k in range(x.shape[1]):
7846  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7847  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
7848  *
7849  *
7850  */
7851  if (unlikely(__pyx_v_material_functions == Py_None)) {
7852  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7853  __PYX_ERR(0, 268, __pyx_L1_error)
7854  }
7855  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7856  __Pyx_GOTREF(__pyx_t_15);
7857  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7858  __Pyx_GOTREF(__pyx_t_14);
7859  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7860  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7861  __Pyx_GOTREF(__pyx_t_15);
7862  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7863  __Pyx_GOTREF(__pyx_t_13);
7864  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7865  __Pyx_GOTREF(__pyx_t_11);
7866  __Pyx_GIVEREF(__pyx_t_15);
7867  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15);
7868  __Pyx_GIVEREF(__pyx_t_13);
7869  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
7870  __pyx_t_15 = 0;
7871  __pyx_t_13 = 0;
7872  __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7873  __Pyx_GOTREF(__pyx_t_13);
7874  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7875  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7876  __Pyx_GOTREF(__pyx_t_11);
7877  __pyx_t_15 = NULL;
7878  __pyx_t_6 = 0;
7879  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7880  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
7881  if (likely(__pyx_t_15)) {
7882  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7883  __Pyx_INCREF(__pyx_t_15);
7884  __Pyx_INCREF(function);
7885  __Pyx_DECREF_SET(__pyx_t_14, function);
7886  __pyx_t_6 = 1;
7887  }
7888  }
7889  #if CYTHON_FAST_PYCALL
7890  if (PyFunction_Check(__pyx_t_14)) {
7891  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7892  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7893  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7894  __Pyx_GOTREF(__pyx_t_12);
7895  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7896  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7897  } else
7898  #endif
7899  #if CYTHON_FAST_PYCCALL
7900  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7901  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7902  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7903  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7904  __Pyx_GOTREF(__pyx_t_12);
7905  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7906  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7907  } else
7908  #endif
7909  {
7910  __pyx_t_16 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 268, __pyx_L1_error)
7911  __Pyx_GOTREF(__pyx_t_16);
7912  if (__pyx_t_15) {
7913  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
7914  }
7915  __Pyx_GIVEREF(__pyx_t_13);
7916  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_t_13);
7917  __Pyx_GIVEREF(__pyx_t_11);
7918  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_11);
7919  __pyx_t_13 = 0;
7920  __pyx_t_11 = 0;
7921  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7922  __Pyx_GOTREF(__pyx_t_12);
7923  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7924  }
7925  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7926 
7927  /* "subsurfaceTransportFunctions.pyx":267
7928  * material_right= elementBoundaryTypes[ebN,1]
7929  * for k in range(x.shape[1]):
7930  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7931  * material_functions[material_right](x[ebN,k],t))
7932  *
7933  */
7934  __pyx_t_14 = PyNumber_Add(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7935  __Pyx_GOTREF(__pyx_t_14);
7936  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7937  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7938  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7939  __Pyx_GOTREF(__pyx_t_12);
7940  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7941  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
7942  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7943  __pyx_t_4 = __pyx_v_ebN;
7944  __pyx_t_5 = __pyx_v_k;
7945  __pyx_t_6 = -1;
7946  if (__pyx_t_4 < 0) {
7947  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7948  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7949  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
7950  if (__pyx_t_5 < 0) {
7951  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7952  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7953  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
7954  if (unlikely(__pyx_t_6 != -1)) {
7955  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7956  __PYX_ERR(0, 267, __pyx_L1_error)
7957  }
7958  *__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_17;
7959  }
7960  }
7961 
7962  /* "subsurfaceTransportFunctions.pyx":248
7963  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7964  *
7965  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7966  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7967  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7968  */
7969 
7970  /* function exit code */
7971  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7972  goto __pyx_L0;
7973  __pyx_L1_error:;
7974  __Pyx_XDECREF(__pyx_t_10);
7975  __Pyx_XDECREF(__pyx_t_11);
7976  __Pyx_XDECREF(__pyx_t_12);
7977  __Pyx_XDECREF(__pyx_t_13);
7978  __Pyx_XDECREF(__pyx_t_14);
7979  __Pyx_XDECREF(__pyx_t_15);
7980  __Pyx_XDECREF(__pyx_t_16);
7981  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7982  __Pyx_PyThreadState_declare
7983  __Pyx_PyThreadState_assign
7984  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7985  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7986  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7987  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7988  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7989  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7990  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7991  __pyx_r = NULL;
7992  goto __pyx_L2;
7993  __pyx_L0:;
7994  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7995  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7996  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7997  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7998  __pyx_L2:;
7999  __Pyx_XGIVEREF(__pyx_r);
8000  __Pyx_RefNannyFinishContext();
8001  return __pyx_r;
8002 }
8003 
8004 /* "subsurfaceTransportFunctions.pyx":271
8005  *
8006  *
8007  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8008  * double t,
8009  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8010  */
8011 
8012 /* Python wrapper */
8013 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8014 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+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 ";
8015 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
8016 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8017  int __pyx_v_nd;
8018  double __pyx_v_t;
8019  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
8020  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
8021  PyArrayObject *__pyx_v_x = 0;
8022  PyArrayObject *__pyx_v_ebq_global_vals = 0;
8023  PyObject *__pyx_v_material_functions = 0;
8024  int __pyx_lineno = 0;
8025  const char *__pyx_filename = NULL;
8026  int __pyx_clineno = 0;
8027  PyObject *__pyx_r = 0;
8028  __Pyx_RefNannyDeclarations
8029  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
8030  {
8031  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
8032  PyObject* values[7] = {0,0,0,0,0,0,0};
8033  if (unlikely(__pyx_kwds)) {
8034  Py_ssize_t kw_args;
8035  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8036  switch (pos_args) {
8037  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8038  CYTHON_FALLTHROUGH;
8039  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8040  CYTHON_FALLTHROUGH;
8041  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8042  CYTHON_FALLTHROUGH;
8043  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8044  CYTHON_FALLTHROUGH;
8045  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8046  CYTHON_FALLTHROUGH;
8047  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8048  CYTHON_FALLTHROUGH;
8049  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8050  CYTHON_FALLTHROUGH;
8051  case 0: break;
8052  default: goto __pyx_L5_argtuple_error;
8053  }
8054  kw_args = PyDict_Size(__pyx_kwds);
8055  switch (pos_args) {
8056  case 0:
8057  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
8058  else goto __pyx_L5_argtuple_error;
8059  CYTHON_FALLTHROUGH;
8060  case 1:
8061  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
8062  else {
8063  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 271, __pyx_L3_error)
8064  }
8065  CYTHON_FALLTHROUGH;
8066  case 2:
8067  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
8068  else {
8069  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 271, __pyx_L3_error)
8070  }
8071  CYTHON_FALLTHROUGH;
8072  case 3:
8073  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
8074  else {
8075  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 271, __pyx_L3_error)
8076  }
8077  CYTHON_FALLTHROUGH;
8078  case 4:
8079  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
8080  else {
8081  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 271, __pyx_L3_error)
8082  }
8083  CYTHON_FALLTHROUGH;
8084  case 5:
8085  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
8086  else {
8087  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 271, __pyx_L3_error)
8088  }
8089  CYTHON_FALLTHROUGH;
8090  case 6:
8091  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
8092  else {
8093  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 271, __pyx_L3_error)
8094  }
8095  }
8096  if (unlikely(kw_args > 0)) {
8097  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
8098  }
8099  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
8100  goto __pyx_L5_argtuple_error;
8101  } else {
8102  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8103  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8104  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8105  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8106  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8107  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8108  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8109  }
8110  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
8111  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error)
8112  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
8113  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
8114  __pyx_v_x = ((PyArrayObject *)values[4]);
8115  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
8116  __pyx_v_material_functions = ((PyObject*)values[6]);
8117  }
8118  goto __pyx_L4_argument_unpacking_done;
8119  __pyx_L5_argtuple_error:;
8120  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
8121  __pyx_L3_error:;
8122  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8123  __Pyx_RefNannyFinishContext();
8124  return NULL;
8125  __pyx_L4_argument_unpacking_done:;
8126  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 273, __pyx_L1_error)
8127  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 274, __pyx_L1_error)
8128  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 275, __pyx_L1_error)
8129  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 276, __pyx_L1_error)
8130  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 277, __pyx_L1_error)
8131  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
8132 
8133  /* function exit code */
8134  goto __pyx_L0;
8135  __pyx_L1_error:;
8136  __pyx_r = NULL;
8137  __pyx_L0:;
8138  __Pyx_RefNannyFinishContext();
8139  return __pyx_r;
8140 }
8141 
8142 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) {
8143  int __pyx_v_ebN;
8144  int __pyx_v_k;
8145  int __pyx_v_material_left;
8146  int __pyx_v_material_right;
8147  int __pyx_v_I;
8148  int __pyx_v_J;
8149  double __pyx_v_numer;
8150  double __pyx_v_denom;
8151  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
8152  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
8153  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
8154  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
8155  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
8156  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
8157  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
8158  __Pyx_Buffer __pyx_pybuffer_x;
8159  PyObject *__pyx_r = NULL;
8160  __Pyx_RefNannyDeclarations
8161  npy_intp __pyx_t_1;
8162  npy_intp __pyx_t_2;
8163  int __pyx_t_3;
8164  Py_ssize_t __pyx_t_4;
8165  Py_ssize_t __pyx_t_5;
8166  int __pyx_t_6;
8167  npy_intp __pyx_t_7;
8168  npy_intp __pyx_t_8;
8169  int __pyx_t_9;
8170  int __pyx_t_10;
8171  int __pyx_t_11;
8172  int __pyx_t_12;
8173  int __pyx_t_13;
8174  int __pyx_t_14;
8175  PyObject *__pyx_t_15 = NULL;
8176  PyObject *__pyx_t_16 = NULL;
8177  PyObject *__pyx_t_17 = NULL;
8178  PyObject *__pyx_t_18 = NULL;
8179  PyObject *__pyx_t_19 = NULL;
8180  int __pyx_t_20;
8181  PyObject *__pyx_t_21 = NULL;
8182  PyObject *__pyx_t_22 = NULL;
8183  double __pyx_t_23;
8184  Py_ssize_t __pyx_t_24;
8185  int __pyx_lineno = 0;
8186  const char *__pyx_filename = NULL;
8187  int __pyx_clineno = 0;
8188  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
8189  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
8190  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
8191  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
8192  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
8193  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
8194  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
8195  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
8196  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
8197  __pyx_pybuffer_x.pybuffer.buf = NULL;
8198  __pyx_pybuffer_x.refcount = 0;
8199  __pyx_pybuffernd_x.data = NULL;
8200  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
8201  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
8202  __pyx_pybuffer_ebq_global_vals.refcount = 0;
8203  __pyx_pybuffernd_ebq_global_vals.data = NULL;
8204  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
8205  {
8206  __Pyx_BufFmt_StackElem __pyx_stack[1];
8207  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, 271, __pyx_L1_error)
8208  }
8209  __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];
8210  {
8211  __Pyx_BufFmt_StackElem __pyx_stack[1];
8212  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, 271, __pyx_L1_error)
8213  }
8214  __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];
8215  {
8216  __Pyx_BufFmt_StackElem __pyx_stack[1];
8217  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, 271, __pyx_L1_error)
8218  }
8219  __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];
8220  {
8221  __Pyx_BufFmt_StackElem __pyx_stack[1];
8222  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, 271, __pyx_L1_error)
8223  }
8224  __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];
8225 
8226  /* "subsurfaceTransportFunctions.pyx":288
8227  * cdef double numer,denom
8228  *
8229  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
8230  * material_left = elementBoundaryTypes[ebN,0]
8231  * material_right= elementBoundaryTypes[ebN,1]
8232  */
8233  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
8234  __pyx_t_2 = __pyx_t_1;
8235  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8236  __pyx_v_ebN = __pyx_t_3;
8237 
8238  /* "subsurfaceTransportFunctions.pyx":289
8239  *
8240  * for ebN in range(x.shape[0]):
8241  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
8242  * material_right= elementBoundaryTypes[ebN,1]
8243  * for k in range(x.shape[1]):
8244  */
8245  __pyx_t_4 = __pyx_v_ebN;
8246  __pyx_t_5 = 0;
8247  __pyx_t_6 = -1;
8248  if (__pyx_t_4 < 0) {
8249  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8250  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
8251  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8252  if (__pyx_t_5 < 0) {
8253  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8254  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
8255  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8256  if (unlikely(__pyx_t_6 != -1)) {
8257  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8258  __PYX_ERR(0, 289, __pyx_L1_error)
8259  }
8260  __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));
8261 
8262  /* "subsurfaceTransportFunctions.pyx":290
8263  * for ebN in range(x.shape[0]):
8264  * material_left = elementBoundaryTypes[ebN,0]
8265  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
8266  * for k in range(x.shape[1]):
8267  * for I in range(nd):
8268  */
8269  __pyx_t_5 = __pyx_v_ebN;
8270  __pyx_t_4 = 1;
8271  __pyx_t_6 = -1;
8272  if (__pyx_t_5 < 0) {
8273  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8274  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
8275  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8276  if (__pyx_t_4 < 0) {
8277  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8278  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
8279  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8280  if (unlikely(__pyx_t_6 != -1)) {
8281  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8282  __PYX_ERR(0, 290, __pyx_L1_error)
8283  }
8284  __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));
8285 
8286  /* "subsurfaceTransportFunctions.pyx":291
8287  * material_left = elementBoundaryTypes[ebN,0]
8288  * material_right= elementBoundaryTypes[ebN,1]
8289  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
8290  * for I in range(nd):
8291  * for J in range(nd):
8292  */
8293  __pyx_t_7 = (__pyx_v_x->dimensions[1]);
8294  __pyx_t_8 = __pyx_t_7;
8295  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
8296  __pyx_v_k = __pyx_t_6;
8297 
8298  /* "subsurfaceTransportFunctions.pyx":292
8299  * material_right= elementBoundaryTypes[ebN,1]
8300  * for k in range(x.shape[1]):
8301  * for I in range(nd): # <<<<<<<<<<<<<<
8302  * for J in range(nd):
8303  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8304  */
8305  __pyx_t_9 = __pyx_v_nd;
8306  __pyx_t_10 = __pyx_t_9;
8307  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
8308  __pyx_v_I = __pyx_t_11;
8309 
8310  /* "subsurfaceTransportFunctions.pyx":293
8311  * for k in range(x.shape[1]):
8312  * for I in range(nd):
8313  * for J in range(nd): # <<<<<<<<<<<<<<
8314  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8315  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8316  */
8317  __pyx_t_12 = __pyx_v_nd;
8318  __pyx_t_13 = __pyx_t_12;
8319  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
8320  __pyx_v_J = __pyx_t_14;
8321 
8322  /* "subsurfaceTransportFunctions.pyx":294
8323  * for I in range(nd):
8324  * for J in range(nd):
8325  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
8326  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8327  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8328  */
8329  if (unlikely(__pyx_v_material_functions == Py_None)) {
8330  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8331  __PYX_ERR(0, 294, __pyx_L1_error)
8332  }
8333  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8334  __Pyx_GOTREF(__pyx_t_16);
8335  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8336  __Pyx_GOTREF(__pyx_t_17);
8337  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8338  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8339  __Pyx_GOTREF(__pyx_t_16);
8340  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8341  __Pyx_GOTREF(__pyx_t_18);
8342  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8343  __Pyx_GOTREF(__pyx_t_19);
8344  __Pyx_GIVEREF(__pyx_t_16);
8345  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_16);
8346  __Pyx_GIVEREF(__pyx_t_18);
8347  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_18);
8348  __pyx_t_16 = 0;
8349  __pyx_t_18 = 0;
8350  __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8351  __Pyx_GOTREF(__pyx_t_18);
8352  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8353  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8354  __Pyx_GOTREF(__pyx_t_19);
8355  __pyx_t_16 = NULL;
8356  __pyx_t_20 = 0;
8357  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8358  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
8359  if (likely(__pyx_t_16)) {
8360  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8361  __Pyx_INCREF(__pyx_t_16);
8362  __Pyx_INCREF(function);
8363  __Pyx_DECREF_SET(__pyx_t_17, function);
8364  __pyx_t_20 = 1;
8365  }
8366  }
8367  #if CYTHON_FAST_PYCALL
8368  if (PyFunction_Check(__pyx_t_17)) {
8369  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_18, __pyx_t_19};
8370  __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8371  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8372  __Pyx_GOTREF(__pyx_t_15);
8373  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8374  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8375  } else
8376  #endif
8377  #if CYTHON_FAST_PYCCALL
8378  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8379  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_18, __pyx_t_19};
8380  __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8381  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8382  __Pyx_GOTREF(__pyx_t_15);
8383  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8384  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8385  } else
8386  #endif
8387  {
8388  __pyx_t_21 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8389  __Pyx_GOTREF(__pyx_t_21);
8390  if (__pyx_t_16) {
8391  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_16); __pyx_t_16 = NULL;
8392  }
8393  __Pyx_GIVEREF(__pyx_t_18);
8394  PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_t_18);
8395  __Pyx_GIVEREF(__pyx_t_19);
8396  PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_t_19);
8397  __pyx_t_18 = 0;
8398  __pyx_t_19 = 0;
8399  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_21, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8400  __Pyx_GOTREF(__pyx_t_15);
8401  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8402  }
8403  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8404  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8405  __Pyx_GOTREF(__pyx_t_17);
8406  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8407  __Pyx_GOTREF(__pyx_t_21);
8408  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8409  __Pyx_GOTREF(__pyx_t_19);
8410  __Pyx_GIVEREF(__pyx_t_17);
8411  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17);
8412  __Pyx_GIVEREF(__pyx_t_21);
8413  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
8414  __pyx_t_17 = 0;
8415  __pyx_t_21 = 0;
8416  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8417  __Pyx_GOTREF(__pyx_t_21);
8418  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8419  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8420  __pyx_t_19 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_21); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8421  __Pyx_GOTREF(__pyx_t_19);
8422  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8423  if (unlikely(__pyx_v_material_functions == Py_None)) {
8424  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8425  __PYX_ERR(0, 294, __pyx_L1_error)
8426  }
8427  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8428  __Pyx_GOTREF(__pyx_t_15);
8429  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8430  __Pyx_GOTREF(__pyx_t_17);
8431  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8432  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8433  __Pyx_GOTREF(__pyx_t_15);
8434  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8435  __Pyx_GOTREF(__pyx_t_18);
8436  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8437  __Pyx_GOTREF(__pyx_t_16);
8438  __Pyx_GIVEREF(__pyx_t_15);
8439  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
8440  __Pyx_GIVEREF(__pyx_t_18);
8441  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
8442  __pyx_t_15 = 0;
8443  __pyx_t_18 = 0;
8444  __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8445  __Pyx_GOTREF(__pyx_t_18);
8446  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8447  __pyx_t_16 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8448  __Pyx_GOTREF(__pyx_t_16);
8449  __pyx_t_15 = NULL;
8450  __pyx_t_20 = 0;
8451  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8452  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_17);
8453  if (likely(__pyx_t_15)) {
8454  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8455  __Pyx_INCREF(__pyx_t_15);
8456  __Pyx_INCREF(function);
8457  __Pyx_DECREF_SET(__pyx_t_17, function);
8458  __pyx_t_20 = 1;
8459  }
8460  }
8461  #if CYTHON_FAST_PYCALL
8462  if (PyFunction_Check(__pyx_t_17)) {
8463  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_18, __pyx_t_16};
8464  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8465  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
8466  __Pyx_GOTREF(__pyx_t_21);
8467  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8468  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8469  } else
8470  #endif
8471  #if CYTHON_FAST_PYCCALL
8472  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8473  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_18, __pyx_t_16};
8474  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8475  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
8476  __Pyx_GOTREF(__pyx_t_21);
8477  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8478  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8479  } else
8480  #endif
8481  {
8482  __pyx_t_22 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8483  __Pyx_GOTREF(__pyx_t_22);
8484  if (__pyx_t_15) {
8485  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_15); __pyx_t_15 = NULL;
8486  }
8487  __Pyx_GIVEREF(__pyx_t_18);
8488  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_20, __pyx_t_18);
8489  __Pyx_GIVEREF(__pyx_t_16);
8490  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_20, __pyx_t_16);
8491  __pyx_t_18 = 0;
8492  __pyx_t_16 = 0;
8493  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_22, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8494  __Pyx_GOTREF(__pyx_t_21);
8495  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8496  }
8497  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8498  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8499  __Pyx_GOTREF(__pyx_t_17);
8500  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8501  __Pyx_GOTREF(__pyx_t_22);
8502  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8503  __Pyx_GOTREF(__pyx_t_16);
8504  __Pyx_GIVEREF(__pyx_t_17);
8505  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_17);
8506  __Pyx_GIVEREF(__pyx_t_22);
8507  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_22);
8508  __pyx_t_17 = 0;
8509  __pyx_t_22 = 0;
8510  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_21, __pyx_t_16); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8511  __Pyx_GOTREF(__pyx_t_22);
8512  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8513  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8514  __pyx_t_16 = PyNumber_Multiply(__pyx_t_19, __pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8515  __Pyx_GOTREF(__pyx_t_16);
8516  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8517  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8518  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
8519  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8520  __pyx_v_numer = __pyx_t_23;
8521 
8522  /* "subsurfaceTransportFunctions.pyx":295
8523  * for J in range(nd):
8524  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8525  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
8526  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8527  *
8528  */
8529  if (unlikely(__pyx_v_material_functions == Py_None)) {
8530  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8531  __PYX_ERR(0, 295, __pyx_L1_error)
8532  }
8533  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8534  __Pyx_GOTREF(__pyx_t_22);
8535  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8536  __Pyx_GOTREF(__pyx_t_19);
8537  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8538  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8539  __Pyx_GOTREF(__pyx_t_22);
8540  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8541  __Pyx_GOTREF(__pyx_t_21);
8542  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8543  __Pyx_GOTREF(__pyx_t_17);
8544  __Pyx_GIVEREF(__pyx_t_22);
8545  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_22);
8546  __Pyx_GIVEREF(__pyx_t_21);
8547  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_21);
8548  __pyx_t_22 = 0;
8549  __pyx_t_21 = 0;
8550  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8551  __Pyx_GOTREF(__pyx_t_21);
8552  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8553  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8554  __Pyx_GOTREF(__pyx_t_17);
8555  __pyx_t_22 = NULL;
8556  __pyx_t_20 = 0;
8557  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8558  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_19);
8559  if (likely(__pyx_t_22)) {
8560  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8561  __Pyx_INCREF(__pyx_t_22);
8562  __Pyx_INCREF(function);
8563  __Pyx_DECREF_SET(__pyx_t_19, function);
8564  __pyx_t_20 = 1;
8565  }
8566  }
8567  #if CYTHON_FAST_PYCALL
8568  if (PyFunction_Check(__pyx_t_19)) {
8569  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_17};
8570  __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8571  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
8572  __Pyx_GOTREF(__pyx_t_16);
8573  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8574  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8575  } else
8576  #endif
8577  #if CYTHON_FAST_PYCCALL
8578  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8579  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_17};
8580  __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8581  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
8582  __Pyx_GOTREF(__pyx_t_16);
8583  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8584  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8585  } else
8586  #endif
8587  {
8588  __pyx_t_18 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8589  __Pyx_GOTREF(__pyx_t_18);
8590  if (__pyx_t_22) {
8591  __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_22); __pyx_t_22 = NULL;
8592  }
8593  __Pyx_GIVEREF(__pyx_t_21);
8594  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_20, __pyx_t_21);
8595  __Pyx_GIVEREF(__pyx_t_17);
8596  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_20, __pyx_t_17);
8597  __pyx_t_21 = 0;
8598  __pyx_t_17 = 0;
8599  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_18, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8600  __Pyx_GOTREF(__pyx_t_16);
8601  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8602  }
8603  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8604  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8605  __Pyx_GOTREF(__pyx_t_19);
8606  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8607  __Pyx_GOTREF(__pyx_t_18);
8608  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8609  __Pyx_GOTREF(__pyx_t_17);
8610  __Pyx_GIVEREF(__pyx_t_19);
8611  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19);
8612  __Pyx_GIVEREF(__pyx_t_18);
8613  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18);
8614  __pyx_t_19 = 0;
8615  __pyx_t_18 = 0;
8616  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8617  __Pyx_GOTREF(__pyx_t_18);
8618  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8619  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8620  if (unlikely(__pyx_v_material_functions == Py_None)) {
8621  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8622  __PYX_ERR(0, 295, __pyx_L1_error)
8623  }
8624  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8625  __Pyx_GOTREF(__pyx_t_16);
8626  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8627  __Pyx_GOTREF(__pyx_t_19);
8628  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8629  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8630  __Pyx_GOTREF(__pyx_t_16);
8631  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8632  __Pyx_GOTREF(__pyx_t_21);
8633  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8634  __Pyx_GOTREF(__pyx_t_22);
8635  __Pyx_GIVEREF(__pyx_t_16);
8636  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_16);
8637  __Pyx_GIVEREF(__pyx_t_21);
8638  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_21);
8639  __pyx_t_16 = 0;
8640  __pyx_t_21 = 0;
8641  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8642  __Pyx_GOTREF(__pyx_t_21);
8643  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8644  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8645  __Pyx_GOTREF(__pyx_t_22);
8646  __pyx_t_16 = NULL;
8647  __pyx_t_20 = 0;
8648  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8649  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_19);
8650  if (likely(__pyx_t_16)) {
8651  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8652  __Pyx_INCREF(__pyx_t_16);
8653  __Pyx_INCREF(function);
8654  __Pyx_DECREF_SET(__pyx_t_19, function);
8655  __pyx_t_20 = 1;
8656  }
8657  }
8658  #if CYTHON_FAST_PYCALL
8659  if (PyFunction_Check(__pyx_t_19)) {
8660  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_21, __pyx_t_22};
8661  __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8662  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8663  __Pyx_GOTREF(__pyx_t_17);
8664  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8665  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8666  } else
8667  #endif
8668  #if CYTHON_FAST_PYCCALL
8669  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8670  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_21, __pyx_t_22};
8671  __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8672  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8673  __Pyx_GOTREF(__pyx_t_17);
8674  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8675  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8676  } else
8677  #endif
8678  {
8679  __pyx_t_15 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8680  __Pyx_GOTREF(__pyx_t_15);
8681  if (__pyx_t_16) {
8682  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16); __pyx_t_16 = NULL;
8683  }
8684  __Pyx_GIVEREF(__pyx_t_21);
8685  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_20, __pyx_t_21);
8686  __Pyx_GIVEREF(__pyx_t_22);
8687  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_20, __pyx_t_22);
8688  __pyx_t_21 = 0;
8689  __pyx_t_22 = 0;
8690  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_15, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8691  __Pyx_GOTREF(__pyx_t_17);
8692  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8693  }
8694  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8695  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8696  __Pyx_GOTREF(__pyx_t_19);
8697  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8698  __Pyx_GOTREF(__pyx_t_15);
8699  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8700  __Pyx_GOTREF(__pyx_t_22);
8701  __Pyx_GIVEREF(__pyx_t_19);
8702  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_19);
8703  __Pyx_GIVEREF(__pyx_t_15);
8704  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_15);
8705  __pyx_t_19 = 0;
8706  __pyx_t_15 = 0;
8707  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_22); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8708  __Pyx_GOTREF(__pyx_t_15);
8709  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8710  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8711  __pyx_t_22 = PyNumber_Add(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8712  __Pyx_GOTREF(__pyx_t_22);
8713  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8714  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8715  __pyx_t_15 = __Pyx_PyFloat_AddObjC(__pyx_t_22, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8716  __Pyx_GOTREF(__pyx_t_15);
8717  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8718  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error)
8719  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8720  __pyx_v_denom = __pyx_t_23;
8721 
8722  /* "subsurfaceTransportFunctions.pyx":296
8723  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8724  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8725  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
8726  *
8727  *
8728  */
8729  if (unlikely(__pyx_v_denom == 0)) {
8730  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8731  __PYX_ERR(0, 296, __pyx_L1_error)
8732  }
8733  __pyx_t_4 = __pyx_v_ebN;
8734  __pyx_t_5 = __pyx_v_k;
8735  __pyx_t_24 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
8736  __pyx_t_20 = -1;
8737  if (__pyx_t_4 < 0) {
8738  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
8739  if (unlikely(__pyx_t_4 < 0)) __pyx_t_20 = 0;
8740  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_20 = 0;
8741  if (__pyx_t_5 < 0) {
8742  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
8743  if (unlikely(__pyx_t_5 < 0)) __pyx_t_20 = 1;
8744  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_20 = 1;
8745  if (__pyx_t_24 < 0) {
8746  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
8747  if (unlikely(__pyx_t_24 < 0)) __pyx_t_20 = 2;
8748  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_20 = 2;
8749  if (unlikely(__pyx_t_20 != -1)) {
8750  __Pyx_RaiseBufferIndexError(__pyx_t_20);
8751  __PYX_ERR(0, 296, __pyx_L1_error)
8752  }
8753  *__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_24, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
8754  }
8755  }
8756  }
8757  }
8758 
8759  /* "subsurfaceTransportFunctions.pyx":271
8760  *
8761  *
8762  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8763  * double t,
8764  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8765  */
8766 
8767  /* function exit code */
8768  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8769  goto __pyx_L0;
8770  __pyx_L1_error:;
8771  __Pyx_XDECREF(__pyx_t_15);
8772  __Pyx_XDECREF(__pyx_t_16);
8773  __Pyx_XDECREF(__pyx_t_17);
8774  __Pyx_XDECREF(__pyx_t_18);
8775  __Pyx_XDECREF(__pyx_t_19);
8776  __Pyx_XDECREF(__pyx_t_21);
8777  __Pyx_XDECREF(__pyx_t_22);
8778  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8779  __Pyx_PyThreadState_declare
8780  __Pyx_PyThreadState_assign
8781  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8782  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8783  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8784  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8785  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8786  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8787  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8788  __pyx_r = NULL;
8789  goto __pyx_L2;
8790  __pyx_L0:;
8791  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8792  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8793  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8794  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8795  __pyx_L2:;
8796  __Pyx_XGIVEREF(__pyx_r);
8797  __Pyx_RefNannyFinishContext();
8798  return __pyx_r;
8799 }
8800 
8801 /* "subsurfaceTransportFunctions.pyx":301
8802  *
8803  * ##################################################
8804  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8805  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8806  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8807  */
8808 
8809 /* Python wrapper */
8810 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8811 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8812 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
8813 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8814  double __pyx_v_rho;
8815  PyArrayObject *__pyx_v_gravity = 0;
8816  PyArrayObject *__pyx_v_rowptr = 0;
8817  PyArrayObject *__pyx_v_colind = 0;
8818  PyArrayObject *__pyx_v_KWs = 0;
8819  int __pyx_v_nSpace;
8820  int __pyx_v_nElements_global;
8821  int __pyx_v_nElementBoundaries_element;
8822  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8823  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8824  PyArrayObject *__pyx_v_q_flin = 0;
8825  PyArrayObject *__pyx_v_q_alin = 0;
8826  int __pyx_lineno = 0;
8827  const char *__pyx_filename = NULL;
8828  int __pyx_clineno = 0;
8829  PyObject *__pyx_r = 0;
8830  __Pyx_RefNannyDeclarations
8831  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
8832  {
8833  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
8834  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
8835  if (unlikely(__pyx_kwds)) {
8836  Py_ssize_t kw_args;
8837  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8838  switch (pos_args) {
8839  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8840  CYTHON_FALLTHROUGH;
8841  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8842  CYTHON_FALLTHROUGH;
8843  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8844  CYTHON_FALLTHROUGH;
8845  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8846  CYTHON_FALLTHROUGH;
8847  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8848  CYTHON_FALLTHROUGH;
8849  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8850  CYTHON_FALLTHROUGH;
8851  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8852  CYTHON_FALLTHROUGH;
8853  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8854  CYTHON_FALLTHROUGH;
8855  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8856  CYTHON_FALLTHROUGH;
8857  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8858  CYTHON_FALLTHROUGH;
8859  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8860  CYTHON_FALLTHROUGH;
8861  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8862  CYTHON_FALLTHROUGH;
8863  case 0: break;
8864  default: goto __pyx_L5_argtuple_error;
8865  }
8866  kw_args = PyDict_Size(__pyx_kwds);
8867  switch (pos_args) {
8868  case 0:
8869  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8870  else goto __pyx_L5_argtuple_error;
8871  CYTHON_FALLTHROUGH;
8872  case 1:
8873  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8874  else {
8875  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); __PYX_ERR(0, 301, __pyx_L3_error)
8876  }
8877  CYTHON_FALLTHROUGH;
8878  case 2:
8879  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
8880  else {
8881  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); __PYX_ERR(0, 301, __pyx_L3_error)
8882  }
8883  CYTHON_FALLTHROUGH;
8884  case 3:
8885  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
8886  else {
8887  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); __PYX_ERR(0, 301, __pyx_L3_error)
8888  }
8889  CYTHON_FALLTHROUGH;
8890  case 4:
8891  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
8892  else {
8893  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); __PYX_ERR(0, 301, __pyx_L3_error)
8894  }
8895  CYTHON_FALLTHROUGH;
8896  case 5:
8897  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8898  else {
8899  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); __PYX_ERR(0, 301, __pyx_L3_error)
8900  }
8901  CYTHON_FALLTHROUGH;
8902  case 6:
8903  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8904  else {
8905  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); __PYX_ERR(0, 301, __pyx_L3_error)
8906  }
8907  CYTHON_FALLTHROUGH;
8908  case 7:
8909  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8910  else {
8911  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); __PYX_ERR(0, 301, __pyx_L3_error)
8912  }
8913  CYTHON_FALLTHROUGH;
8914  case 8:
8915  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8916  else {
8917  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); __PYX_ERR(0, 301, __pyx_L3_error)
8918  }
8919  CYTHON_FALLTHROUGH;
8920  case 9:
8921  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8922  else {
8923  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); __PYX_ERR(0, 301, __pyx_L3_error)
8924  }
8925  CYTHON_FALLTHROUGH;
8926  case 10:
8927  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
8928  else {
8929  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); __PYX_ERR(0, 301, __pyx_L3_error)
8930  }
8931  CYTHON_FALLTHROUGH;
8932  case 11:
8933  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
8934  else {
8935  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); __PYX_ERR(0, 301, __pyx_L3_error)
8936  }
8937  }
8938  if (unlikely(kw_args > 0)) {
8939  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
8940  }
8941  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
8942  goto __pyx_L5_argtuple_error;
8943  } else {
8944  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8945  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8946  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8947  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8948  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8949  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8950  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8951  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8952  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8953  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8954  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8955  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8956  }
8957  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error)
8958  __pyx_v_gravity = ((PyArrayObject *)values[1]);
8959  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
8960  __pyx_v_colind = ((PyArrayObject *)values[3]);
8961  __pyx_v_KWs = ((PyArrayObject *)values[4]);
8962  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
8963  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
8964  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
8965  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
8966  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
8967  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
8968  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
8969  }
8970  goto __pyx_L4_argument_unpacking_done;
8971  __pyx_L5_argtuple_error:;
8972  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
8973  __pyx_L3_error:;
8974  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8975  __Pyx_RefNannyFinishContext();
8976  return NULL;
8977  __pyx_L4_argument_unpacking_done:;
8978  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
8979  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
8980  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
8981  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) __PYX_ERR(0, 305, __pyx_L1_error)
8982  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 310, __pyx_L1_error)
8983  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 311, __pyx_L1_error)
8984  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 312, __pyx_L1_error)
8985  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 313, __pyx_L1_error)
8986  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
8987 
8988  /* function exit code */
8989  goto __pyx_L0;
8990  __pyx_L1_error:;
8991  __pyx_r = NULL;
8992  __pyx_L0:;
8993  __Pyx_RefNannyFinishContext();
8994  return __pyx_r;
8995 }
8996 
8997 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) {
8998  int __pyx_v_eN;
8999  int __pyx_v_eN_neighbor;
9000  int __pyx_v_ii;
9001  int __pyx_v_I;
9002  int __pyx_v_ebN;
9003  int __pyx_v_matID;
9004  int __pyx_v_matID_neig;
9005  CYTHON_UNUSED int __pyx_v_nSpace2;
9006  int __pyx_v_nnz;
9007  PyArrayObject *__pyx_v_a_eN = 0;
9008  PyArrayObject *__pyx_v_a_neig = 0;
9009  PyArrayObject *__pyx_v_a_avg = 0;
9010  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
9011  __Pyx_Buffer __pyx_pybuffer_KWs;
9012  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
9013  __Pyx_Buffer __pyx_pybuffer_a_avg;
9014  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
9015  __Pyx_Buffer __pyx_pybuffer_a_eN;
9016  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
9017  __Pyx_Buffer __pyx_pybuffer_a_neig;
9018  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
9019  __Pyx_Buffer __pyx_pybuffer_colind;
9020  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
9021  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
9022  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
9023  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
9024  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
9025  __Pyx_Buffer __pyx_pybuffer_gravity;
9026  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
9027  __Pyx_Buffer __pyx_pybuffer_q_alin;
9028  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
9029  __Pyx_Buffer __pyx_pybuffer_q_flin;
9030  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
9031  __Pyx_Buffer __pyx_pybuffer_rowptr;
9032  PyObject *__pyx_r = NULL;
9033  __Pyx_RefNannyDeclarations
9034  Py_ssize_t __pyx_t_1;
9035  int __pyx_t_2;
9036  PyObject *__pyx_t_3 = NULL;
9037  PyObject *__pyx_t_4 = NULL;
9038  PyObject *__pyx_t_5 = NULL;
9039  PyObject *__pyx_t_6 = NULL;
9040  PyObject *__pyx_t_7 = NULL;
9041  PyArrayObject *__pyx_t_8 = NULL;
9042  PyArrayObject *__pyx_t_9 = NULL;
9043  PyArrayObject *__pyx_t_10 = NULL;
9044  int __pyx_t_11;
9045  int __pyx_t_12;
9046  int __pyx_t_13;
9047  int __pyx_t_14;
9048  int __pyx_t_15;
9049  Py_ssize_t __pyx_t_16;
9050  int __pyx_t_17;
9051  Py_ssize_t __pyx_t_18;
9052  int __pyx_t_19;
9053  int __pyx_t_20;
9054  int __pyx_t_21;
9055  int __pyx_t_22;
9056  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_23;
9057  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_24;
9058  Py_ssize_t __pyx_t_25;
9059  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_26;
9060  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_27;
9061  int __pyx_t_28;
9062  Py_ssize_t __pyx_t_29;
9063  Py_ssize_t __pyx_t_30;
9064  Py_ssize_t __pyx_t_31;
9065  int __pyx_lineno = 0;
9066  const char *__pyx_filename = NULL;
9067  int __pyx_clineno = 0;
9068  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
9069  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
9070  __pyx_pybuffer_a_eN.refcount = 0;
9071  __pyx_pybuffernd_a_eN.data = NULL;
9072  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
9073  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
9074  __pyx_pybuffer_a_neig.refcount = 0;
9075  __pyx_pybuffernd_a_neig.data = NULL;
9076  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
9077  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
9078  __pyx_pybuffer_a_avg.refcount = 0;
9079  __pyx_pybuffernd_a_avg.data = NULL;
9080  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
9081  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
9082  __pyx_pybuffer_gravity.refcount = 0;
9083  __pyx_pybuffernd_gravity.data = NULL;
9084  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
9085  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
9086  __pyx_pybuffer_rowptr.refcount = 0;
9087  __pyx_pybuffernd_rowptr.data = NULL;
9088  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
9089  __pyx_pybuffer_colind.pybuffer.buf = NULL;
9090  __pyx_pybuffer_colind.refcount = 0;
9091  __pyx_pybuffernd_colind.data = NULL;
9092  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
9093  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
9094  __pyx_pybuffer_KWs.refcount = 0;
9095  __pyx_pybuffernd_KWs.data = NULL;
9096  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
9097  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
9098  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
9099  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
9100  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
9101  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
9102  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
9103  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
9104  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
9105  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
9106  __pyx_pybuffer_q_flin.refcount = 0;
9107  __pyx_pybuffernd_q_flin.data = NULL;
9108  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
9109  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
9110  __pyx_pybuffer_q_alin.refcount = 0;
9111  __pyx_pybuffernd_q_alin.data = NULL;
9112  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
9113  {
9114  __Pyx_BufFmt_StackElem __pyx_stack[1];
9115  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9116  }
9117  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
9118  {
9119  __Pyx_BufFmt_StackElem __pyx_stack[1];
9120  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9121  }
9122  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
9123  {
9124  __Pyx_BufFmt_StackElem __pyx_stack[1];
9125  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9126  }
9127  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
9128  {
9129  __Pyx_BufFmt_StackElem __pyx_stack[1];
9130  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9131  }
9132  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
9133  {
9134  __Pyx_BufFmt_StackElem __pyx_stack[1];
9135  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9136  }
9137  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
9138  {
9139  __Pyx_BufFmt_StackElem __pyx_stack[1];
9140  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, 301, __pyx_L1_error)
9141  }
9142  __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];
9143  {
9144  __Pyx_BufFmt_StackElem __pyx_stack[1];
9145  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9146  }
9147  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
9148  {
9149  __Pyx_BufFmt_StackElem __pyx_stack[1];
9150  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9151  }
9152  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
9153 
9154  /* "subsurfaceTransportFunctions.pyx":328
9155  * #temporaries
9156  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9157  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
9158  * cdef int nnz = rowptr[nSpace]
9159  *
9160  */
9161  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
9162 
9163  /* "subsurfaceTransportFunctions.pyx":329
9164  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9165  * cdef int nSpace2 = nSpace*nSpace
9166  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
9167  *
9168  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9169  */
9170  __pyx_t_1 = __pyx_v_nSpace;
9171  __pyx_t_2 = -1;
9172  if (__pyx_t_1 < 0) {
9173  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9174  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
9175  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
9176  if (unlikely(__pyx_t_2 != -1)) {
9177  __Pyx_RaiseBufferIndexError(__pyx_t_2);
9178  __PYX_ERR(0, 329, __pyx_L1_error)
9179  }
9180  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9181 
9182  /* "subsurfaceTransportFunctions.pyx":331
9183  * cdef int nnz = rowptr[nSpace]
9184  *
9185  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9186  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9187  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9188  */
9189  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9190  __Pyx_GOTREF(__pyx_t_4);
9191  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
9192  __Pyx_GOTREF(__pyx_t_5);
9193  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9194  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9195  __Pyx_GOTREF(__pyx_t_4);
9196  __pyx_t_6 = NULL;
9197  __pyx_t_2 = 0;
9198  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9199  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9200  if (likely(__pyx_t_6)) {
9201  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9202  __Pyx_INCREF(__pyx_t_6);
9203  __Pyx_INCREF(function);
9204  __Pyx_DECREF_SET(__pyx_t_5, function);
9205  __pyx_t_2 = 1;
9206  }
9207  }
9208  #if CYTHON_FAST_PYCALL
9209  if (PyFunction_Check(__pyx_t_5)) {
9210  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9211  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9212  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9213  __Pyx_GOTREF(__pyx_t_3);
9214  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9215  } else
9216  #endif
9217  #if CYTHON_FAST_PYCCALL
9218  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9219  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9220  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9221  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9222  __Pyx_GOTREF(__pyx_t_3);
9223  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9224  } else
9225  #endif
9226  {
9227  __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
9228  __Pyx_GOTREF(__pyx_t_7);
9229  if (__pyx_t_6) {
9230  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
9231  }
9232  __Pyx_GIVEREF(__pyx_t_4);
9233  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_4);
9234  __Pyx_INCREF(__pyx_n_s_d);
9235  __Pyx_GIVEREF(__pyx_n_s_d);
9236  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_n_s_d);
9237  __pyx_t_4 = 0;
9238  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9239  __Pyx_GOTREF(__pyx_t_3);
9240  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9241  }
9242  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9243  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
9244  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
9245  {
9246  __Pyx_BufFmt_StackElem __pyx_stack[1];
9247  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9248  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
9249  __PYX_ERR(0, 331, __pyx_L1_error)
9250  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
9251  }
9252  }
9253  __pyx_t_8 = 0;
9254  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
9255  __pyx_t_3 = 0;
9256 
9257  /* "subsurfaceTransportFunctions.pyx":332
9258  *
9259  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9260  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9261  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9262  *
9263  */
9264  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9265  __Pyx_GOTREF(__pyx_t_5);
9266  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
9267  __Pyx_GOTREF(__pyx_t_7);
9268  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9269  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9270  __Pyx_GOTREF(__pyx_t_5);
9271  __pyx_t_4 = NULL;
9272  __pyx_t_2 = 0;
9273  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9274  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
9275  if (likely(__pyx_t_4)) {
9276  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9277  __Pyx_INCREF(__pyx_t_4);
9278  __Pyx_INCREF(function);
9279  __Pyx_DECREF_SET(__pyx_t_7, function);
9280  __pyx_t_2 = 1;
9281  }
9282  }
9283  #if CYTHON_FAST_PYCALL
9284  if (PyFunction_Check(__pyx_t_7)) {
9285  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9286  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9287  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9288  __Pyx_GOTREF(__pyx_t_3);
9289  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9290  } else
9291  #endif
9292  #if CYTHON_FAST_PYCCALL
9293  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9294  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9295  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9296  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9297  __Pyx_GOTREF(__pyx_t_3);
9298  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9299  } else
9300  #endif
9301  {
9302  __pyx_t_6 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
9303  __Pyx_GOTREF(__pyx_t_6);
9304  if (__pyx_t_4) {
9305  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
9306  }
9307  __Pyx_GIVEREF(__pyx_t_5);
9308  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_5);
9309  __Pyx_INCREF(__pyx_n_s_d);
9310  __Pyx_GIVEREF(__pyx_n_s_d);
9311  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_n_s_d);
9312  __pyx_t_5 = 0;
9313  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9314  __Pyx_GOTREF(__pyx_t_3);
9315  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9316  }
9317  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9318  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
9319  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
9320  {
9321  __Pyx_BufFmt_StackElem __pyx_stack[1];
9322  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9323  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
9324  __PYX_ERR(0, 332, __pyx_L1_error)
9325  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
9326  }
9327  }
9328  __pyx_t_9 = 0;
9329  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
9330  __pyx_t_3 = 0;
9331 
9332  /* "subsurfaceTransportFunctions.pyx":333
9333  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9334  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9335  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9336  *
9337  * #loop through and evaluate
9338  */
9339  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9340  __Pyx_GOTREF(__pyx_t_7);
9341  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
9342  __Pyx_GOTREF(__pyx_t_6);
9343  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9344  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9345  __Pyx_GOTREF(__pyx_t_7);
9346  __pyx_t_5 = NULL;
9347  __pyx_t_2 = 0;
9348  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9349  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9350  if (likely(__pyx_t_5)) {
9351  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9352  __Pyx_INCREF(__pyx_t_5);
9353  __Pyx_INCREF(function);
9354  __Pyx_DECREF_SET(__pyx_t_6, function);
9355  __pyx_t_2 = 1;
9356  }
9357  }
9358  #if CYTHON_FAST_PYCALL
9359  if (PyFunction_Check(__pyx_t_6)) {
9360  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9361  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9362  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9363  __Pyx_GOTREF(__pyx_t_3);
9364  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9365  } else
9366  #endif
9367  #if CYTHON_FAST_PYCCALL
9368  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9369  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9370  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9371  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9372  __Pyx_GOTREF(__pyx_t_3);
9373  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9374  } else
9375  #endif
9376  {
9377  __pyx_t_4 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
9378  __Pyx_GOTREF(__pyx_t_4);
9379  if (__pyx_t_5) {
9380  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
9381  }
9382  __Pyx_GIVEREF(__pyx_t_7);
9383  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_2, __pyx_t_7);
9384  __Pyx_INCREF(__pyx_n_s_d);
9385  __Pyx_GIVEREF(__pyx_n_s_d);
9386  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_2, __pyx_n_s_d);
9387  __pyx_t_7 = 0;
9388  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9389  __Pyx_GOTREF(__pyx_t_3);
9390  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9391  }
9392  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9393  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
9394  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
9395  {
9396  __Pyx_BufFmt_StackElem __pyx_stack[1];
9397  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9398  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
9399  __PYX_ERR(0, 333, __pyx_L1_error)
9400  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
9401  }
9402  }
9403  __pyx_t_10 = 0;
9404  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
9405  __pyx_t_3 = 0;
9406 
9407  /* "subsurfaceTransportFunctions.pyx":336
9408  *
9409  * #loop through and evaluate
9410  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
9411  * matID = elementMaterialTypes[eN]
9412  * for ii in range(nnz):
9413  */
9414  __pyx_t_2 = __pyx_v_nElements_global;
9415  __pyx_t_11 = __pyx_t_2;
9416  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9417  __pyx_v_eN = __pyx_t_12;
9418 
9419  /* "subsurfaceTransportFunctions.pyx":337
9420  * #loop through and evaluate
9421  * for eN in range(nElements_global):
9422  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
9423  * for ii in range(nnz):
9424  * a_eN[ii] = rho*KWs[matID,ii]
9425  */
9426  __pyx_t_1 = __pyx_v_eN;
9427  __pyx_t_13 = -1;
9428  if (__pyx_t_1 < 0) {
9429  __pyx_t_1 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9430  if (unlikely(__pyx_t_1 < 0)) __pyx_t_13 = 0;
9431  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_13 = 0;
9432  if (unlikely(__pyx_t_13 != -1)) {
9433  __Pyx_RaiseBufferIndexError(__pyx_t_13);
9434  __PYX_ERR(0, 337, __pyx_L1_error)
9435  }
9436  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9437 
9438  /* "subsurfaceTransportFunctions.pyx":338
9439  * for eN in range(nElements_global):
9440  * matID = elementMaterialTypes[eN]
9441  * for ii in range(nnz): # <<<<<<<<<<<<<<
9442  * a_eN[ii] = rho*KWs[matID,ii]
9443  * for ebN in range(nElementBoundaries_element):
9444  */
9445  __pyx_t_13 = __pyx_v_nnz;
9446  __pyx_t_14 = __pyx_t_13;
9447  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
9448  __pyx_v_ii = __pyx_t_15;
9449 
9450  /* "subsurfaceTransportFunctions.pyx":339
9451  * matID = elementMaterialTypes[eN]
9452  * for ii in range(nnz):
9453  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
9454  * for ebN in range(nElementBoundaries_element):
9455  * eN_neighbor = elementNeighborsArray[eN,ebN]
9456  */
9457  __pyx_t_1 = __pyx_v_matID;
9458  __pyx_t_16 = __pyx_v_ii;
9459  __pyx_t_17 = -1;
9460  if (__pyx_t_1 < 0) {
9461  __pyx_t_1 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9462  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 0;
9463  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_17 = 0;
9464  if (__pyx_t_16 < 0) {
9465  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9466  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
9467  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_17 = 1;
9468  if (unlikely(__pyx_t_17 != -1)) {
9469  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9470  __PYX_ERR(0, 339, __pyx_L1_error)
9471  }
9472  __pyx_t_18 = __pyx_v_ii;
9473  __pyx_t_17 = -1;
9474  if (__pyx_t_18 < 0) {
9475  __pyx_t_18 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9476  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
9477  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_17 = 0;
9478  if (unlikely(__pyx_t_17 != -1)) {
9479  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9480  __PYX_ERR(0, 339, __pyx_L1_error)
9481  }
9482  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9483  }
9484 
9485  /* "subsurfaceTransportFunctions.pyx":340
9486  * for ii in range(nnz):
9487  * a_eN[ii] = rho*KWs[matID,ii]
9488  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
9489  * eN_neighbor = elementNeighborsArray[eN,ebN]
9490  * for ii in range(nnz):
9491  */
9492  __pyx_t_13 = __pyx_v_nElementBoundaries_element;
9493  __pyx_t_14 = __pyx_t_13;
9494  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
9495  __pyx_v_ebN = __pyx_t_15;
9496 
9497  /* "subsurfaceTransportFunctions.pyx":341
9498  * a_eN[ii] = rho*KWs[matID,ii]
9499  * for ebN in range(nElementBoundaries_element):
9500  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
9501  * for ii in range(nnz):
9502  * a_neig[ii] = a_eN[ii]
9503  */
9504  __pyx_t_16 = __pyx_v_eN;
9505  __pyx_t_1 = __pyx_v_ebN;
9506  __pyx_t_17 = -1;
9507  if (__pyx_t_16 < 0) {
9508  __pyx_t_16 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
9509  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
9510  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_17 = 0;
9511  if (__pyx_t_1 < 0) {
9512  __pyx_t_1 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
9513  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 1;
9514  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_17 = 1;
9515  if (unlikely(__pyx_t_17 != -1)) {
9516  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9517  __PYX_ERR(0, 341, __pyx_L1_error)
9518  }
9519  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
9520 
9521  /* "subsurfaceTransportFunctions.pyx":342
9522  * for ebN in range(nElementBoundaries_element):
9523  * eN_neighbor = elementNeighborsArray[eN,ebN]
9524  * for ii in range(nnz): # <<<<<<<<<<<<<<
9525  * a_neig[ii] = a_eN[ii]
9526  * if eN_neighbor >= 0:
9527  */
9528  __pyx_t_17 = __pyx_v_nnz;
9529  __pyx_t_19 = __pyx_t_17;
9530  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9531  __pyx_v_ii = __pyx_t_20;
9532 
9533  /* "subsurfaceTransportFunctions.pyx":343
9534  * eN_neighbor = elementNeighborsArray[eN,ebN]
9535  * for ii in range(nnz):
9536  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
9537  * if eN_neighbor >= 0:
9538  * matID_neig = elementMaterialTypes[eN_neighbor]
9539  */
9540  __pyx_t_1 = __pyx_v_ii;
9541  __pyx_t_21 = -1;
9542  if (__pyx_t_1 < 0) {
9543  __pyx_t_1 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9544  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9545  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9546  if (unlikely(__pyx_t_21 != -1)) {
9547  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9548  __PYX_ERR(0, 343, __pyx_L1_error)
9549  }
9550  __pyx_t_16 = __pyx_v_ii;
9551  __pyx_t_21 = -1;
9552  if (__pyx_t_16 < 0) {
9553  __pyx_t_16 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9554  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9555  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9556  if (unlikely(__pyx_t_21 != -1)) {
9557  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9558  __PYX_ERR(0, 343, __pyx_L1_error)
9559  }
9560  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_eN.diminfo[0].strides));
9561  }
9562 
9563  /* "subsurfaceTransportFunctions.pyx":344
9564  * for ii in range(nnz):
9565  * a_neig[ii] = a_eN[ii]
9566  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9567  * matID_neig = elementMaterialTypes[eN_neighbor]
9568  * for ii in range(nnz):
9569  */
9570  __pyx_t_22 = ((__pyx_v_eN_neighbor >= 0) != 0);
9571  if (__pyx_t_22) {
9572 
9573  /* "subsurfaceTransportFunctions.pyx":345
9574  * a_neig[ii] = a_eN[ii]
9575  * if eN_neighbor >= 0:
9576  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
9577  * for ii in range(nnz):
9578  * a_neig[ii] = rho*KWs[matID_neig,ii]
9579  */
9580  __pyx_t_1 = __pyx_v_eN_neighbor;
9581  __pyx_t_17 = -1;
9582  if (__pyx_t_1 < 0) {
9583  __pyx_t_1 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9584  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 0;
9585  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_17 = 0;
9586  if (unlikely(__pyx_t_17 != -1)) {
9587  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9588  __PYX_ERR(0, 345, __pyx_L1_error)
9589  }
9590  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9591 
9592  /* "subsurfaceTransportFunctions.pyx":346
9593  * if eN_neighbor >= 0:
9594  * matID_neig = elementMaterialTypes[eN_neighbor]
9595  * for ii in range(nnz): # <<<<<<<<<<<<<<
9596  * a_neig[ii] = rho*KWs[matID_neig,ii]
9597  * for ii in range(nnz):
9598  */
9599  __pyx_t_17 = __pyx_v_nnz;
9600  __pyx_t_19 = __pyx_t_17;
9601  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9602  __pyx_v_ii = __pyx_t_20;
9603 
9604  /* "subsurfaceTransportFunctions.pyx":347
9605  * matID_neig = elementMaterialTypes[eN_neighbor]
9606  * for ii in range(nnz):
9607  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
9608  * for ii in range(nnz):
9609  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9610  */
9611  __pyx_t_1 = __pyx_v_matID_neig;
9612  __pyx_t_16 = __pyx_v_ii;
9613  __pyx_t_21 = -1;
9614  if (__pyx_t_1 < 0) {
9615  __pyx_t_1 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9616  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9617  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_21 = 0;
9618  if (__pyx_t_16 < 0) {
9619  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9620  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 1;
9621  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_21 = 1;
9622  if (unlikely(__pyx_t_21 != -1)) {
9623  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9624  __PYX_ERR(0, 347, __pyx_L1_error)
9625  }
9626  __pyx_t_18 = __pyx_v_ii;
9627  __pyx_t_21 = -1;
9628  if (__pyx_t_18 < 0) {
9629  __pyx_t_18 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9630  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9631  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9632  if (unlikely(__pyx_t_21 != -1)) {
9633  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9634  __PYX_ERR(0, 347, __pyx_L1_error)
9635  }
9636  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9637  }
9638 
9639  /* "subsurfaceTransportFunctions.pyx":344
9640  * for ii in range(nnz):
9641  * a_neig[ii] = a_eN[ii]
9642  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9643  * matID_neig = elementMaterialTypes[eN_neighbor]
9644  * for ii in range(nnz):
9645  */
9646  }
9647 
9648  /* "subsurfaceTransportFunctions.pyx":348
9649  * for ii in range(nnz):
9650  * a_neig[ii] = rho*KWs[matID_neig,ii]
9651  * for ii in range(nnz): # <<<<<<<<<<<<<<
9652  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9653  * q_alin[eN,ebN,ii] = a_avg[ii]
9654  */
9655  __pyx_t_17 = __pyx_v_nnz;
9656  __pyx_t_19 = __pyx_t_17;
9657  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9658  __pyx_v_ii = __pyx_t_20;
9659 
9660  /* "subsurfaceTransportFunctions.pyx":349
9661  * a_neig[ii] = rho*KWs[matID_neig,ii]
9662  * for ii in range(nnz):
9663  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
9664  * q_alin[eN,ebN,ii] = a_avg[ii]
9665  * for I in range(nSpace):
9666  */
9667  __pyx_t_16 = __pyx_v_ii;
9668  __pyx_t_21 = -1;
9669  if (__pyx_t_16 < 0) {
9670  __pyx_t_16 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9671  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9672  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9673  if (unlikely(__pyx_t_21 != -1)) {
9674  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9675  __PYX_ERR(0, 349, __pyx_L1_error)
9676  }
9677  __pyx_t_1 = __pyx_v_ii;
9678  __pyx_t_21 = -1;
9679  if (__pyx_t_1 < 0) {
9680  __pyx_t_1 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9681  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9682  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9683  if (unlikely(__pyx_t_21 != -1)) {
9684  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9685  __PYX_ERR(0, 349, __pyx_L1_error)
9686  }
9687  __pyx_t_23 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
9688  __pyx_t_1 = __pyx_v_ii;
9689  __pyx_t_21 = -1;
9690  if (__pyx_t_1 < 0) {
9691  __pyx_t_1 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9692  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9693  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9694  if (unlikely(__pyx_t_21 != -1)) {
9695  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9696  __PYX_ERR(0, 349, __pyx_L1_error)
9697  }
9698  __pyx_t_16 = __pyx_v_ii;
9699  __pyx_t_21 = -1;
9700  if (__pyx_t_16 < 0) {
9701  __pyx_t_16 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9702  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9703  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9704  if (unlikely(__pyx_t_21 != -1)) {
9705  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9706  __PYX_ERR(0, 349, __pyx_L1_error)
9707  }
9708  __pyx_t_24 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
9709  if (unlikely(__pyx_t_24 == 0)) {
9710  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9711  __PYX_ERR(0, 349, __pyx_L1_error)
9712  }
9713  __pyx_t_16 = __pyx_v_ii;
9714  __pyx_t_21 = -1;
9715  if (__pyx_t_16 < 0) {
9716  __pyx_t_16 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9717  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9718  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_21 = 0;
9719  if (unlikely(__pyx_t_21 != -1)) {
9720  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9721  __PYX_ERR(0, 349, __pyx_L1_error)
9722  }
9723  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_23 / __pyx_t_24);
9724 
9725  /* "subsurfaceTransportFunctions.pyx":350
9726  * for ii in range(nnz):
9727  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9728  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
9729  * for I in range(nSpace):
9730  * q_flin[eN,ebN,I] = 0.0
9731  */
9732  __pyx_t_16 = __pyx_v_ii;
9733  __pyx_t_21 = -1;
9734  if (__pyx_t_16 < 0) {
9735  __pyx_t_16 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9736  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9737  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_21 = 0;
9738  if (unlikely(__pyx_t_21 != -1)) {
9739  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9740  __PYX_ERR(0, 350, __pyx_L1_error)
9741  }
9742  __pyx_t_1 = __pyx_v_eN;
9743  __pyx_t_18 = __pyx_v_ebN;
9744  __pyx_t_25 = __pyx_v_ii;
9745  __pyx_t_21 = -1;
9746  if (__pyx_t_1 < 0) {
9747  __pyx_t_1 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
9748  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9749  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_21 = 0;
9750  if (__pyx_t_18 < 0) {
9751  __pyx_t_18 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
9752  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 1;
9753  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_21 = 1;
9754  if (__pyx_t_25 < 0) {
9755  __pyx_t_25 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
9756  if (unlikely(__pyx_t_25 < 0)) __pyx_t_21 = 2;
9757  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_21 = 2;
9758  if (unlikely(__pyx_t_21 != -1)) {
9759  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9760  __PYX_ERR(0, 350, __pyx_L1_error)
9761  }
9762  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_avg.diminfo[0].strides));
9763  }
9764 
9765  /* "subsurfaceTransportFunctions.pyx":351
9766  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9767  * q_alin[eN,ebN,ii] = a_avg[ii]
9768  * for I in range(nSpace): # <<<<<<<<<<<<<<
9769  * q_flin[eN,ebN,I] = 0.0
9770  * for ii in range(rowptr[I],rowptr[I+1]):
9771  */
9772  __pyx_t_17 = __pyx_v_nSpace;
9773  __pyx_t_19 = __pyx_t_17;
9774  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9775  __pyx_v_I = __pyx_t_20;
9776 
9777  /* "subsurfaceTransportFunctions.pyx":352
9778  * q_alin[eN,ebN,ii] = a_avg[ii]
9779  * for I in range(nSpace):
9780  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
9781  * for ii in range(rowptr[I],rowptr[I+1]):
9782  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9783  */
9784  __pyx_t_16 = __pyx_v_eN;
9785  __pyx_t_25 = __pyx_v_ebN;
9786  __pyx_t_18 = __pyx_v_I;
9787  __pyx_t_21 = -1;
9788  if (__pyx_t_16 < 0) {
9789  __pyx_t_16 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9790  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9791  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_21 = 0;
9792  if (__pyx_t_25 < 0) {
9793  __pyx_t_25 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9794  if (unlikely(__pyx_t_25 < 0)) __pyx_t_21 = 1;
9795  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_21 = 1;
9796  if (__pyx_t_18 < 0) {
9797  __pyx_t_18 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9798  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 2;
9799  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_21 = 2;
9800  if (unlikely(__pyx_t_21 != -1)) {
9801  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9802  __PYX_ERR(0, 352, __pyx_L1_error)
9803  }
9804  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
9805 
9806  /* "subsurfaceTransportFunctions.pyx":353
9807  * for I in range(nSpace):
9808  * q_flin[eN,ebN,I] = 0.0
9809  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
9810  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9811  * #ebN
9812  */
9813  __pyx_t_18 = (__pyx_v_I + 1);
9814  __pyx_t_21 = -1;
9815  if (__pyx_t_18 < 0) {
9816  __pyx_t_18 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9817  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9818  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_21 = 0;
9819  if (unlikely(__pyx_t_21 != -1)) {
9820  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9821  __PYX_ERR(0, 353, __pyx_L1_error)
9822  }
9823  __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9824  __pyx_t_18 = __pyx_v_I;
9825  __pyx_t_21 = -1;
9826  if (__pyx_t_18 < 0) {
9827  __pyx_t_18 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9828  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9829  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_21 = 0;
9830  if (unlikely(__pyx_t_21 != -1)) {
9831  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9832  __PYX_ERR(0, 353, __pyx_L1_error)
9833  }
9834  __pyx_t_27 = __pyx_t_26;
9835  for (__pyx_t_21 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_21 < __pyx_t_27; __pyx_t_21+=1) {
9836  __pyx_v_ii = __pyx_t_21;
9837 
9838  /* "subsurfaceTransportFunctions.pyx":354
9839  * q_flin[eN,ebN,I] = 0.0
9840  * for ii in range(rowptr[I],rowptr[I+1]):
9841  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
9842  * #ebN
9843  * #eN
9844  */
9845  __pyx_t_25 = __pyx_v_ii;
9846  __pyx_t_28 = -1;
9847  if (__pyx_t_25 < 0) {
9848  __pyx_t_25 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9849  if (unlikely(__pyx_t_25 < 0)) __pyx_t_28 = 0;
9850  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_28 = 0;
9851  if (unlikely(__pyx_t_28 != -1)) {
9852  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9853  __PYX_ERR(0, 354, __pyx_L1_error)
9854  }
9855  __pyx_t_16 = __pyx_v_ii;
9856  __pyx_t_28 = -1;
9857  if (__pyx_t_16 < 0) {
9858  __pyx_t_16 += __pyx_pybuffernd_colind.diminfo[0].shape;
9859  if (unlikely(__pyx_t_16 < 0)) __pyx_t_28 = 0;
9860  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_28 = 0;
9861  if (unlikely(__pyx_t_28 != -1)) {
9862  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9863  __PYX_ERR(0, 354, __pyx_L1_error)
9864  }
9865  __pyx_t_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_colind.diminfo[0].strides));
9866  __pyx_t_28 = -1;
9867  if (__pyx_t_1 < 0) {
9868  __pyx_t_1 += __pyx_pybuffernd_gravity.diminfo[0].shape;
9869  if (unlikely(__pyx_t_1 < 0)) __pyx_t_28 = 0;
9870  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_28 = 0;
9871  if (unlikely(__pyx_t_28 != -1)) {
9872  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9873  __PYX_ERR(0, 354, __pyx_L1_error)
9874  }
9875  __pyx_t_29 = __pyx_v_eN;
9876  __pyx_t_30 = __pyx_v_ebN;
9877  __pyx_t_31 = __pyx_v_I;
9878  __pyx_t_28 = -1;
9879  if (__pyx_t_29 < 0) {
9880  __pyx_t_29 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9881  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
9882  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_28 = 0;
9883  if (__pyx_t_30 < 0) {
9884  __pyx_t_30 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9885  if (unlikely(__pyx_t_30 < 0)) __pyx_t_28 = 1;
9886  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_28 = 1;
9887  if (__pyx_t_31 < 0) {
9888  __pyx_t_31 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9889  if (unlikely(__pyx_t_31 < 0)) __pyx_t_28 = 2;
9890  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_28 = 2;
9891  if (unlikely(__pyx_t_28 != -1)) {
9892  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9893  __PYX_ERR(0, 354, __pyx_L1_error)
9894  }
9895  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_gravity.diminfo[0].strides)));
9896  }
9897  }
9898  }
9899  }
9900 
9901  /* "subsurfaceTransportFunctions.pyx":301
9902  *
9903  * ##################################################
9904  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
9905  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9906  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
9907  */
9908 
9909  /* function exit code */
9910  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9911  goto __pyx_L0;
9912  __pyx_L1_error:;
9913  __Pyx_XDECREF(__pyx_t_3);
9914  __Pyx_XDECREF(__pyx_t_4);
9915  __Pyx_XDECREF(__pyx_t_5);
9916  __Pyx_XDECREF(__pyx_t_6);
9917  __Pyx_XDECREF(__pyx_t_7);
9918  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9919  __Pyx_PyThreadState_declare
9920  __Pyx_PyThreadState_assign
9921  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9922  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9923  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9924  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9925  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9926  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9927  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9928  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9929  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9930  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9931  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9932  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9933  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9934  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
9935  __pyx_r = NULL;
9936  goto __pyx_L2;
9937  __pyx_L0:;
9938  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9939  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9940  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9941  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9942  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9943  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9944  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9945  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9946  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9947  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9948  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9949  __pyx_L2:;
9950  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
9951  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
9952  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
9953  __Pyx_XGIVEREF(__pyx_r);
9954  __Pyx_RefNannyFinishContext();
9955  return __pyx_r;
9956 }
9957 
9958 /* "subsurfaceTransportFunctions.pyx":359
9959  *
9960  *
9961  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
9962  * double beta,
9963  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9964  */
9965 
9966 /* Python wrapper */
9967 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9968 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
9969 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
9970 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9971  double __pyx_v_rho;
9972  double __pyx_v_beta;
9973  PyArrayObject *__pyx_v_gravity = 0;
9974  PyArrayObject *__pyx_v_alpha = 0;
9975  PyArrayObject *__pyx_v_n = 0;
9976  PyArrayObject *__pyx_v_thetaR = 0;
9977  PyArrayObject *__pyx_v_thetaSR = 0;
9978  int __pyx_v_nSpace;
9979  int __pyx_v_nElements_global;
9980  int __pyx_v_nElementBoundaries_element;
9981  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
9982  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
9983  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
9984  int __pyx_v_nDOF_trial_element;
9985  PyArrayObject *__pyx_v_u_l2g = 0;
9986  PyArrayObject *__pyx_v_u_dof = 0;
9987  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
9988  PyArrayObject *__pyx_v_q_u = 0;
9989  PyArrayObject *__pyx_v_q_mass = 0;
9990  PyArrayObject *__pyx_v_q_dmass = 0;
9991  PyArrayObject *__pyx_v_q_r = 0;
9992  PyArrayObject *__pyx_v_q_kr = 0;
9993  PyArrayObject *__pyx_v_q_dkr = 0;
9994  PyArrayObject *__pyx_v_q_kr_up = 0;
9995  int __pyx_lineno = 0;
9996  const char *__pyx_filename = NULL;
9997  int __pyx_clineno = 0;
9998  PyObject *__pyx_r = 0;
9999  __Pyx_RefNannyDeclarations
10000  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
10001  {
10002  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
10003  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
10004  if (unlikely(__pyx_kwds)) {
10005  Py_ssize_t kw_args;
10006  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10007  switch (pos_args) {
10008  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
10009  CYTHON_FALLTHROUGH;
10010  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
10011  CYTHON_FALLTHROUGH;
10012  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
10013  CYTHON_FALLTHROUGH;
10014  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10015  CYTHON_FALLTHROUGH;
10016  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10017  CYTHON_FALLTHROUGH;
10018  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10019  CYTHON_FALLTHROUGH;
10020  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10021  CYTHON_FALLTHROUGH;
10022  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10023  CYTHON_FALLTHROUGH;
10024  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10025  CYTHON_FALLTHROUGH;
10026  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10027  CYTHON_FALLTHROUGH;
10028  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10029  CYTHON_FALLTHROUGH;
10030  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10031  CYTHON_FALLTHROUGH;
10032  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10033  CYTHON_FALLTHROUGH;
10034  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10035  CYTHON_FALLTHROUGH;
10036  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10037  CYTHON_FALLTHROUGH;
10038  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10039  CYTHON_FALLTHROUGH;
10040  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10041  CYTHON_FALLTHROUGH;
10042  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10043  CYTHON_FALLTHROUGH;
10044  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10045  CYTHON_FALLTHROUGH;
10046  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10047  CYTHON_FALLTHROUGH;
10048  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10049  CYTHON_FALLTHROUGH;
10050  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10051  CYTHON_FALLTHROUGH;
10052  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10053  CYTHON_FALLTHROUGH;
10054  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10055  CYTHON_FALLTHROUGH;
10056  case 0: break;
10057  default: goto __pyx_L5_argtuple_error;
10058  }
10059  kw_args = PyDict_Size(__pyx_kwds);
10060  switch (pos_args) {
10061  case 0:
10062  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
10063  else goto __pyx_L5_argtuple_error;
10064  CYTHON_FALLTHROUGH;
10065  case 1:
10066  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
10067  else {
10068  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); __PYX_ERR(0, 359, __pyx_L3_error)
10069  }
10070  CYTHON_FALLTHROUGH;
10071  case 2:
10072  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
10073  else {
10074  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); __PYX_ERR(0, 359, __pyx_L3_error)
10075  }
10076  CYTHON_FALLTHROUGH;
10077  case 3:
10078  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
10079  else {
10080  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); __PYX_ERR(0, 359, __pyx_L3_error)
10081  }
10082  CYTHON_FALLTHROUGH;
10083  case 4:
10084  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
10085  else {
10086  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); __PYX_ERR(0, 359, __pyx_L3_error)
10087  }
10088  CYTHON_FALLTHROUGH;
10089  case 5:
10090  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
10091  else {
10092  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); __PYX_ERR(0, 359, __pyx_L3_error)
10093  }
10094  CYTHON_FALLTHROUGH;
10095  case 6:
10096  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
10097  else {
10098  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); __PYX_ERR(0, 359, __pyx_L3_error)
10099  }
10100  CYTHON_FALLTHROUGH;
10101  case 7:
10102  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
10103  else {
10104  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); __PYX_ERR(0, 359, __pyx_L3_error)
10105  }
10106  CYTHON_FALLTHROUGH;
10107  case 8:
10108  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
10109  else {
10110  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); __PYX_ERR(0, 359, __pyx_L3_error)
10111  }
10112  CYTHON_FALLTHROUGH;
10113  case 9:
10114  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
10115  else {
10116  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); __PYX_ERR(0, 359, __pyx_L3_error)
10117  }
10118  CYTHON_FALLTHROUGH;
10119  case 10:
10120  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
10121  else {
10122  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); __PYX_ERR(0, 359, __pyx_L3_error)
10123  }
10124  CYTHON_FALLTHROUGH;
10125  case 11:
10126  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
10127  else {
10128  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); __PYX_ERR(0, 359, __pyx_L3_error)
10129  }
10130  CYTHON_FALLTHROUGH;
10131  case 12:
10132  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
10133  else {
10134  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); __PYX_ERR(0, 359, __pyx_L3_error)
10135  }
10136  CYTHON_FALLTHROUGH;
10137  case 13:
10138  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
10139  else {
10140  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); __PYX_ERR(0, 359, __pyx_L3_error)
10141  }
10142  CYTHON_FALLTHROUGH;
10143  case 14:
10144  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
10145  else {
10146  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); __PYX_ERR(0, 359, __pyx_L3_error)
10147  }
10148  CYTHON_FALLTHROUGH;
10149  case 15:
10150  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
10151  else {
10152  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); __PYX_ERR(0, 359, __pyx_L3_error)
10153  }
10154  CYTHON_FALLTHROUGH;
10155  case 16:
10156  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
10157  else {
10158  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); __PYX_ERR(0, 359, __pyx_L3_error)
10159  }
10160  CYTHON_FALLTHROUGH;
10161  case 17:
10162  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
10163  else {
10164  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); __PYX_ERR(0, 359, __pyx_L3_error)
10165  }
10166  CYTHON_FALLTHROUGH;
10167  case 18:
10168  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
10169  else {
10170  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); __PYX_ERR(0, 359, __pyx_L3_error)
10171  }
10172  CYTHON_FALLTHROUGH;
10173  case 19:
10174  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
10175  else {
10176  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); __PYX_ERR(0, 359, __pyx_L3_error)
10177  }
10178  CYTHON_FALLTHROUGH;
10179  case 20:
10180  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
10181  else {
10182  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); __PYX_ERR(0, 359, __pyx_L3_error)
10183  }
10184  CYTHON_FALLTHROUGH;
10185  case 21:
10186  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
10187  else {
10188  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); __PYX_ERR(0, 359, __pyx_L3_error)
10189  }
10190  CYTHON_FALLTHROUGH;
10191  case 22:
10192  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
10193  else {
10194  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); __PYX_ERR(0, 359, __pyx_L3_error)
10195  }
10196  CYTHON_FALLTHROUGH;
10197  case 23:
10198  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
10199  else {
10200  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); __PYX_ERR(0, 359, __pyx_L3_error)
10201  }
10202  }
10203  if (unlikely(kw_args > 0)) {
10204  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
10205  }
10206  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
10207  goto __pyx_L5_argtuple_error;
10208  } else {
10209  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10210  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10211  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10212  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10213  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10214  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10215  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10216  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10217  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10218  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10219  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10220  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10221  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10222  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10223  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10224  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10225  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10226  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10227  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10228  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10229  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10230  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
10231  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
10232  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
10233  }
10234  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
10235  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
10236  __pyx_v_gravity = ((PyArrayObject *)values[2]);
10237  __pyx_v_alpha = ((PyArrayObject *)values[3]);
10238  __pyx_v_n = ((PyArrayObject *)values[4]);
10239  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
10240  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
10241  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error)
10242  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
10243  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error)
10244  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
10245  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
10246  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
10247  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error)
10248  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
10249  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
10250  __pyx_v_q_x = ((PyArrayObject *)values[16]);
10251  __pyx_v_q_u = ((PyArrayObject *)values[17]);
10252  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
10253  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
10254  __pyx_v_q_r = ((PyArrayObject *)values[20]);
10255  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
10256  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
10257  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
10258  }
10259  goto __pyx_L4_argument_unpacking_done;
10260  __pyx_L5_argtuple_error:;
10261  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
10262  __pyx_L3_error:;
10263  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
10264  __Pyx_RefNannyFinishContext();
10265  return NULL;
10266  __pyx_L4_argument_unpacking_done:;
10267  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 361, __pyx_L1_error)
10268  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
10269  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
10270  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) __PYX_ERR(0, 364, __pyx_L1_error)
10271  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) __PYX_ERR(0, 365, __pyx_L1_error)
10272  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 370, __pyx_L1_error)
10273  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 371, __pyx_L1_error)
10274  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 372, __pyx_L1_error)
10275  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) __PYX_ERR(0, 375, __pyx_L1_error)
10276  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) __PYX_ERR(0, 376, __pyx_L1_error)
10277  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) __PYX_ERR(0, 378, __pyx_L1_error)
10278  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 379, __pyx_L1_error)
10279  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) __PYX_ERR(0, 380, __pyx_L1_error)
10280  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
10281  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
10282  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 383, __pyx_L1_error)
10283  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
10284  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
10285  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
10286 
10287  /* function exit code */
10288  goto __pyx_L0;
10289  __pyx_L1_error:;
10290  __pyx_r = NULL;
10291  __pyx_L0:;
10292  __Pyx_RefNannyFinishContext();
10293  return __pyx_r;
10294 }
10295 
10296 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) {
10297  PyObject *__pyx_v_q = NULL;
10298  double __pyx_v_psiC;
10299  double __pyx_v_pcBar;
10300  double __pyx_v_pcBar_n;
10301  double __pyx_v_pcBar_nM1;
10302  double __pyx_v_pcBar_nM2;
10303  double __pyx_v_onePlus_pcBar_n;
10304  double __pyx_v_sBar;
10305  double __pyx_v_sqrt_sBar;
10306  double __pyx_v_DsBar_DpsiC;
10307  double __pyx_v_thetaW;
10308  double __pyx_v_DthetaW_DpsiC;
10309  double __pyx_v_vBar;
10310  double __pyx_v_vBar2;
10311  double __pyx_v_DvBar_DpsiC;
10312  double __pyx_v_KWr;
10313  double __pyx_v_DKWr_DpsiC;
10314  CYTHON_UNUSED double __pyx_v_rho2;
10315  double __pyx_v_thetaS;
10316  double __pyx_v_rhom;
10317  double __pyx_v_drhom;
10318  double __pyx_v_m;
10319  double __pyx_v_u_j;
10320  double __pyx_v_u_eN;
10321  double __pyx_v_u_neig;
10322  double __pyx_v_kr_eN;
10323  double __pyx_v_kr_neig;
10324  double __pyx_v_phi_eN;
10325  double __pyx_v_phi_neig;
10326  int __pyx_v_eN;
10327  int __pyx_v_eN_neighbor;
10328  int __pyx_v_ebN;
10329  int __pyx_v_j;
10330  int __pyx_v_matID;
10331  double __pyx_v_nAvgWeight;
10332  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
10333  __Pyx_Buffer __pyx_pybuffer_alpha;
10334  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
10335  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
10336  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
10337  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
10338  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
10339  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
10340  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
10341  __Pyx_Buffer __pyx_pybuffer_gravity;
10342  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
10343  __Pyx_Buffer __pyx_pybuffer_n;
10344  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
10345  __Pyx_Buffer __pyx_pybuffer_q_dkr;
10346  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
10347  __Pyx_Buffer __pyx_pybuffer_q_dmass;
10348  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
10349  __Pyx_Buffer __pyx_pybuffer_q_kr;
10350  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
10351  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
10352  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
10353  __Pyx_Buffer __pyx_pybuffer_q_mass;
10354  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
10355  __Pyx_Buffer __pyx_pybuffer_q_r;
10356  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
10357  __Pyx_Buffer __pyx_pybuffer_q_u;
10358  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
10359  __Pyx_Buffer __pyx_pybuffer_q_x;
10360  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
10361  __Pyx_Buffer __pyx_pybuffer_thetaR;
10362  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
10363  __Pyx_Buffer __pyx_pybuffer_thetaSR;
10364  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
10365  __Pyx_Buffer __pyx_pybuffer_u_dof;
10366  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
10367  __Pyx_Buffer __pyx_pybuffer_u_l2g;
10368  PyObject *__pyx_r = NULL;
10369  __Pyx_RefNannyDeclarations
10370  PyObject *__pyx_t_1 = NULL;
10371  PyObject *__pyx_t_2 = NULL;
10372  Py_ssize_t __pyx_t_3;
10373  PyObject *__pyx_t_4 = NULL;
10374  PyObject *__pyx_t_5 = NULL;
10375  int __pyx_t_6;
10376  double __pyx_t_7;
10377  int __pyx_t_8;
10378  int __pyx_t_9;
10379  int __pyx_t_10;
10380  Py_ssize_t __pyx_t_11;
10381  int __pyx_t_12;
10382  int __pyx_t_13;
10383  int __pyx_t_14;
10384  Py_ssize_t __pyx_t_15;
10385  int __pyx_t_16;
10386  Py_ssize_t __pyx_t_17;
10387  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_18;
10388  PyObject *__pyx_t_19 = NULL;
10389  PyObject *__pyx_t_20 = NULL;
10390  int __pyx_lineno = 0;
10391  const char *__pyx_filename = NULL;
10392  int __pyx_clineno = 0;
10393  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
10394  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
10395  __pyx_pybuffer_gravity.refcount = 0;
10396  __pyx_pybuffernd_gravity.data = NULL;
10397  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
10398  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
10399  __pyx_pybuffer_alpha.refcount = 0;
10400  __pyx_pybuffernd_alpha.data = NULL;
10401  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
10402  __pyx_pybuffer_n.pybuffer.buf = NULL;
10403  __pyx_pybuffer_n.refcount = 0;
10404  __pyx_pybuffernd_n.data = NULL;
10405  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
10406  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
10407  __pyx_pybuffer_thetaR.refcount = 0;
10408  __pyx_pybuffernd_thetaR.data = NULL;
10409  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
10410  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
10411  __pyx_pybuffer_thetaSR.refcount = 0;
10412  __pyx_pybuffernd_thetaSR.data = NULL;
10413  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
10414  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
10415  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
10416  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
10417  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
10418  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
10419  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
10420  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
10421  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
10422  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
10423  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
10424  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
10425  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
10426  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
10427  __pyx_pybuffer_u_l2g.refcount = 0;
10428  __pyx_pybuffernd_u_l2g.data = NULL;
10429  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
10430  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
10431  __pyx_pybuffer_u_dof.refcount = 0;
10432  __pyx_pybuffernd_u_dof.data = NULL;
10433  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
10434  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
10435  __pyx_pybuffer_q_x.refcount = 0;
10436  __pyx_pybuffernd_q_x.data = NULL;
10437  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
10438  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
10439  __pyx_pybuffer_q_u.refcount = 0;
10440  __pyx_pybuffernd_q_u.data = NULL;
10441  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
10442  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
10443  __pyx_pybuffer_q_mass.refcount = 0;
10444  __pyx_pybuffernd_q_mass.data = NULL;
10445  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
10446  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
10447  __pyx_pybuffer_q_dmass.refcount = 0;
10448  __pyx_pybuffernd_q_dmass.data = NULL;
10449  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
10450  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
10451  __pyx_pybuffer_q_r.refcount = 0;
10452  __pyx_pybuffernd_q_r.data = NULL;
10453  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
10454  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
10455  __pyx_pybuffer_q_kr.refcount = 0;
10456  __pyx_pybuffernd_q_kr.data = NULL;
10457  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
10458  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
10459  __pyx_pybuffer_q_dkr.refcount = 0;
10460  __pyx_pybuffernd_q_dkr.data = NULL;
10461  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
10462  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
10463  __pyx_pybuffer_q_kr_up.refcount = 0;
10464  __pyx_pybuffernd_q_kr_up.data = NULL;
10465  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
10466  {
10467  __Pyx_BufFmt_StackElem __pyx_stack[1];
10468  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10469  }
10470  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
10471  {
10472  __Pyx_BufFmt_StackElem __pyx_stack[1];
10473  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10474  }
10475  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
10476  {
10477  __Pyx_BufFmt_StackElem __pyx_stack[1];
10478  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10479  }
10480  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
10481  {
10482  __Pyx_BufFmt_StackElem __pyx_stack[1];
10483  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10484  }
10485  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
10486  {
10487  __Pyx_BufFmt_StackElem __pyx_stack[1];
10488  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10489  }
10490  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
10491  {
10492  __Pyx_BufFmt_StackElem __pyx_stack[1];
10493  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10494  }
10495  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
10496  {
10497  __Pyx_BufFmt_StackElem __pyx_stack[1];
10498  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10499  }
10500  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
10501  {
10502  __Pyx_BufFmt_StackElem __pyx_stack[1];
10503  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, 359, __pyx_L1_error)
10504  }
10505  __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];
10506  {
10507  __Pyx_BufFmt_StackElem __pyx_stack[1];
10508  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10509  }
10510  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
10511  {
10512  __Pyx_BufFmt_StackElem __pyx_stack[1];
10513  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10514  }
10515  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
10516  {
10517  __Pyx_BufFmt_StackElem __pyx_stack[1];
10518  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10519  }
10520  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
10521  {
10522  __Pyx_BufFmt_StackElem __pyx_stack[1];
10523  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10524  }
10525  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
10526  {
10527  __Pyx_BufFmt_StackElem __pyx_stack[1];
10528  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10529  }
10530  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
10531  {
10532  __Pyx_BufFmt_StackElem __pyx_stack[1];
10533  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10534  }
10535  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
10536  {
10537  __Pyx_BufFmt_StackElem __pyx_stack[1];
10538  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10539  }
10540  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
10541  {
10542  __Pyx_BufFmt_StackElem __pyx_stack[1];
10543  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10544  }
10545  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
10546  {
10547  __Pyx_BufFmt_StackElem __pyx_stack[1];
10548  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10549  }
10550  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
10551  {
10552  __Pyx_BufFmt_StackElem __pyx_stack[1];
10553  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10554  }
10555  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
10556 
10557  /* "subsurfaceTransportFunctions.pyx":399
10558  * """
10559  * #check some sizes
10560  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10561  * assert q.shape[1] == nSpace+1
10562  * assert nDOF_trial_element == nSpace + 1
10563  */
10564  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10565  __Pyx_GOTREF(__pyx_t_1);
10566  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
10567  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
10568  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
10569  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
10570  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
10571  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
10572  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
10573  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
10574  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
10575  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
10576  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
10577  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
10578  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
10579  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
10580  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
10581  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10582  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10583  for (;;) {
10584  if (__pyx_t_3 >= 5) break;
10585  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10586  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
10587  #else
10588  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10589  __Pyx_GOTREF(__pyx_t_1);
10590  #endif
10591  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
10592  __pyx_t_1 = 0;
10593 
10594  /* "subsurfaceTransportFunctions.pyx":400
10595  * #check some sizes
10596  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10597  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
10598  * assert nDOF_trial_element == nSpace + 1
10599  * #temporaries
10600  */
10601  #ifndef CYTHON_WITHOUT_ASSERTIONS
10602  if (unlikely(!Py_OptimizeFlag)) {
10603  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10604  __Pyx_GOTREF(__pyx_t_1);
10605  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
10606  __Pyx_GOTREF(__pyx_t_4);
10607  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10608  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10609  __Pyx_GOTREF(__pyx_t_1);
10610  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
10611  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10612  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10613  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
10614  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10615  if (unlikely(!__pyx_t_6)) {
10616  PyErr_SetNone(PyExc_AssertionError);
10617  __PYX_ERR(0, 400, __pyx_L1_error)
10618  }
10619  }
10620  #endif
10621 
10622  /* "subsurfaceTransportFunctions.pyx":399
10623  * """
10624  * #check some sizes
10625  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10626  * assert q.shape[1] == nSpace+1
10627  * assert nDOF_trial_element == nSpace + 1
10628  */
10629  }
10630  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10631 
10632  /* "subsurfaceTransportFunctions.pyx":401
10633  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10634  * assert q.shape[1] == nSpace+1
10635  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
10636  * #temporaries
10637  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10638  */
10639  #ifndef CYTHON_WITHOUT_ASSERTIONS
10640  if (unlikely(!Py_OptimizeFlag)) {
10641  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
10642  PyErr_SetNone(PyExc_AssertionError);
10643  __PYX_ERR(0, 401, __pyx_L1_error)
10644  }
10645  }
10646  #endif
10647 
10648  /* "subsurfaceTransportFunctions.pyx":404
10649  * #temporaries
10650  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10651  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
10652  *
10653  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
10654  */
10655  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
10656 
10657  /* "subsurfaceTransportFunctions.pyx":409
10658  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
10659  * #for averaging/integration weights
10660  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
10661  *
10662  * #loop through and evaluate
10663  */
10664  __pyx_t_7 = (__pyx_v_nSpace + 1.);
10665  if (unlikely(__pyx_t_7 == 0)) {
10666  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10667  __PYX_ERR(0, 409, __pyx_L1_error)
10668  }
10669  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
10670 
10671  /* "subsurfaceTransportFunctions.pyx":412
10672  *
10673  * #loop through and evaluate
10674  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10675  * matID = elementMaterialTypes[eN]
10676  * for j in range(nDOF_trial_element):
10677  */
10678  __pyx_t_8 = __pyx_v_nElements_global;
10679  __pyx_t_9 = __pyx_t_8;
10680  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
10681  __pyx_v_eN = __pyx_t_10;
10682 
10683  /* "subsurfaceTransportFunctions.pyx":413
10684  * #loop through and evaluate
10685  * for eN in range(nElements_global):
10686  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
10687  * for j in range(nDOF_trial_element):
10688  * u_j = u_dof[u_l2g[eN,j]]
10689  */
10690  __pyx_t_11 = __pyx_v_eN;
10691  __pyx_t_12 = -1;
10692  if (__pyx_t_11 < 0) {
10693  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
10694  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
10695  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_12 = 0;
10696  if (unlikely(__pyx_t_12 != -1)) {
10697  __Pyx_RaiseBufferIndexError(__pyx_t_12);
10698  __PYX_ERR(0, 413, __pyx_L1_error)
10699  }
10700  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
10701 
10702  /* "subsurfaceTransportFunctions.pyx":414
10703  * for eN in range(nElements_global):
10704  * matID = elementMaterialTypes[eN]
10705  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
10706  * u_j = u_dof[u_l2g[eN,j]]
10707  * q_u[eN,j] = u_j
10708  */
10709  __pyx_t_12 = __pyx_v_nDOF_trial_element;
10710  __pyx_t_13 = __pyx_t_12;
10711  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
10712  __pyx_v_j = __pyx_t_14;
10713 
10714  /* "subsurfaceTransportFunctions.pyx":415
10715  * matID = elementMaterialTypes[eN]
10716  * for j in range(nDOF_trial_element):
10717  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
10718  * q_u[eN,j] = u_j
10719  *
10720  */
10721  __pyx_t_11 = __pyx_v_eN;
10722  __pyx_t_15 = __pyx_v_j;
10723  __pyx_t_16 = -1;
10724  if (__pyx_t_11 < 0) {
10725  __pyx_t_11 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
10726  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10727  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_16 = 0;
10728  if (__pyx_t_15 < 0) {
10729  __pyx_t_15 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
10730  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
10731  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_16 = 1;
10732  if (unlikely(__pyx_t_16 != -1)) {
10733  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10734  __PYX_ERR(0, 415, __pyx_L1_error)
10735  }
10736  __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
10737  __pyx_t_16 = -1;
10738  if (__pyx_t_17 < 0) {
10739  __pyx_t_17 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
10740  if (unlikely(__pyx_t_17 < 0)) __pyx_t_16 = 0;
10741  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_16 = 0;
10742  if (unlikely(__pyx_t_16 != -1)) {
10743  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10744  __PYX_ERR(0, 415, __pyx_L1_error)
10745  }
10746  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_u_dof.diminfo[0].strides));
10747 
10748  /* "subsurfaceTransportFunctions.pyx":416
10749  * for j in range(nDOF_trial_element):
10750  * u_j = u_dof[u_l2g[eN,j]]
10751  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
10752  *
10753  * #VGM evaluation
10754  */
10755  __pyx_t_15 = __pyx_v_eN;
10756  __pyx_t_11 = __pyx_v_j;
10757  __pyx_t_16 = -1;
10758  if (__pyx_t_15 < 0) {
10759  __pyx_t_15 += __pyx_pybuffernd_q_u.diminfo[0].shape;
10760  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10761  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_16 = 0;
10762  if (__pyx_t_11 < 0) {
10763  __pyx_t_11 += __pyx_pybuffernd_q_u.diminfo[1].shape;
10764  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
10765  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_16 = 1;
10766  if (unlikely(__pyx_t_16 != -1)) {
10767  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10768  __PYX_ERR(0, 416, __pyx_L1_error)
10769  }
10770  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
10771 
10772  /* "subsurfaceTransportFunctions.pyx":419
10773  *
10774  * #VGM evaluation
10775  * psiC = -u_j # <<<<<<<<<<<<<<
10776  * m = 1.0 - 1.0/n[matID]
10777  * thetaS = thetaR[matID] + thetaSR[matID]
10778  */
10779  __pyx_v_psiC = (-__pyx_v_u_j);
10780 
10781  /* "subsurfaceTransportFunctions.pyx":420
10782  * #VGM evaluation
10783  * psiC = -u_j
10784  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
10785  * thetaS = thetaR[matID] + thetaSR[matID]
10786  * if psiC > 0.0:
10787  */
10788  __pyx_t_11 = __pyx_v_matID;
10789  __pyx_t_16 = -1;
10790  if (__pyx_t_11 < 0) {
10791  __pyx_t_11 += __pyx_pybuffernd_n.diminfo[0].shape;
10792  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10793  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10794  if (unlikely(__pyx_t_16 != -1)) {
10795  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10796  __PYX_ERR(0, 420, __pyx_L1_error)
10797  }
10798  __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_n.diminfo[0].strides));
10799  if (unlikely(__pyx_t_18 == 0)) {
10800  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10801  __PYX_ERR(0, 420, __pyx_L1_error)
10802  }
10803  __pyx_v_m = (1.0 - (1.0 / __pyx_t_18));
10804 
10805  /* "subsurfaceTransportFunctions.pyx":421
10806  * psiC = -u_j
10807  * m = 1.0 - 1.0/n[matID]
10808  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
10809  * if psiC > 0.0:
10810  * pcBar = alpha[matID]*psiC
10811  */
10812  __pyx_t_11 = __pyx_v_matID;
10813  __pyx_t_16 = -1;
10814  if (__pyx_t_11 < 0) {
10815  __pyx_t_11 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10816  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10817  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_16 = 0;
10818  if (unlikely(__pyx_t_16 != -1)) {
10819  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10820  __PYX_ERR(0, 421, __pyx_L1_error)
10821  }
10822  __pyx_t_15 = __pyx_v_matID;
10823  __pyx_t_16 = -1;
10824  if (__pyx_t_15 < 0) {
10825  __pyx_t_15 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10826  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10827  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10828  if (unlikely(__pyx_t_16 != -1)) {
10829  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10830  __PYX_ERR(0, 421, __pyx_L1_error)
10831  }
10832  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
10833 
10834  /* "subsurfaceTransportFunctions.pyx":422
10835  * m = 1.0 - 1.0/n[matID]
10836  * thetaS = thetaR[matID] + thetaSR[matID]
10837  * if psiC > 0.0: # <<<<<<<<<<<<<<
10838  * pcBar = alpha[matID]*psiC
10839  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10840  */
10841  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
10842  if (__pyx_t_6) {
10843 
10844  /* "subsurfaceTransportFunctions.pyx":423
10845  * thetaS = thetaR[matID] + thetaSR[matID]
10846  * if psiC > 0.0:
10847  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
10848  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10849  * pcBar_nM1 = pcBar_nM2*pcBar
10850  */
10851  __pyx_t_15 = __pyx_v_matID;
10852  __pyx_t_16 = -1;
10853  if (__pyx_t_15 < 0) {
10854  __pyx_t_15 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10855  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10856  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10857  if (unlikely(__pyx_t_16 != -1)) {
10858  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10859  __PYX_ERR(0, 423, __pyx_L1_error)
10860  }
10861  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
10862 
10863  /* "subsurfaceTransportFunctions.pyx":424
10864  * if psiC > 0.0:
10865  * pcBar = alpha[matID]*psiC
10866  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
10867  * pcBar_nM1 = pcBar_nM2*pcBar
10868  * pcBar_n = pcBar_nM1*pcBar
10869  */
10870  __pyx_t_15 = __pyx_v_matID;
10871  __pyx_t_16 = -1;
10872  if (__pyx_t_15 < 0) {
10873  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[0].shape;
10874  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10875  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10876  if (unlikely(__pyx_t_16 != -1)) {
10877  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10878  __PYX_ERR(0, 424, __pyx_L1_error)
10879  }
10880  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
10881 
10882  /* "subsurfaceTransportFunctions.pyx":425
10883  * pcBar = alpha[matID]*psiC
10884  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10885  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
10886  * pcBar_n = pcBar_nM1*pcBar
10887  * onePlus_pcBar_n = 1.0 + pcBar_n
10888  */
10889  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
10890 
10891  /* "subsurfaceTransportFunctions.pyx":426
10892  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10893  * pcBar_nM1 = pcBar_nM2*pcBar
10894  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
10895  * onePlus_pcBar_n = 1.0 + pcBar_n
10896  *
10897  */
10898  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
10899 
10900  /* "subsurfaceTransportFunctions.pyx":427
10901  * pcBar_nM1 = pcBar_nM2*pcBar
10902  * pcBar_n = pcBar_nM1*pcBar
10903  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
10904  *
10905  * sBar = pow(onePlus_pcBar_n,-m)
10906  */
10907  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
10908 
10909  /* "subsurfaceTransportFunctions.pyx":429
10910  * onePlus_pcBar_n = 1.0 + pcBar_n
10911  *
10912  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
10913  * # using -mn = 1-n
10914  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10915  */
10916  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
10917 
10918  /* "subsurfaceTransportFunctions.pyx":431
10919  * sBar = pow(onePlus_pcBar_n,-m)
10920  * # using -mn = 1-n
10921  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
10922  *
10923  * vBar = 1.0-pcBar_nM1*sBar
10924  */
10925  __pyx_t_15 = __pyx_v_matID;
10926  __pyx_t_16 = -1;
10927  if (__pyx_t_15 < 0) {
10928  __pyx_t_15 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10929  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10930  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10931  if (unlikely(__pyx_t_16 != -1)) {
10932  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10933  __PYX_ERR(0, 431, __pyx_L1_error)
10934  }
10935  __pyx_t_11 = __pyx_v_matID;
10936  __pyx_t_16 = -1;
10937  if (__pyx_t_11 < 0) {
10938  __pyx_t_11 += __pyx_pybuffernd_n.diminfo[0].shape;
10939  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10940  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10941  if (unlikely(__pyx_t_16 != -1)) {
10942  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10943  __PYX_ERR(0, 431, __pyx_L1_error)
10944  }
10945  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
10946  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10947  __PYX_ERR(0, 431, __pyx_L1_error)
10948  }
10949  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
10950 
10951  /* "subsurfaceTransportFunctions.pyx":433
10952  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10953  *
10954  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
10955  * vBar2 = vBar*vBar
10956  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10957  */
10958  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
10959 
10960  /* "subsurfaceTransportFunctions.pyx":434
10961  *
10962  * vBar = 1.0-pcBar_nM1*sBar
10963  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
10964  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10965  *
10966  */
10967  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
10968 
10969  /* "subsurfaceTransportFunctions.pyx":435
10970  * vBar = 1.0-pcBar_nM1*sBar
10971  * vBar2 = vBar*vBar
10972  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
10973  *
10974  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10975  */
10976  __pyx_t_11 = __pyx_v_matID;
10977  __pyx_t_16 = -1;
10978  if (__pyx_t_11 < 0) {
10979  __pyx_t_11 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10980  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10981  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10982  if (unlikely(__pyx_t_16 != -1)) {
10983  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10984  __PYX_ERR(0, 435, __pyx_L1_error)
10985  }
10986  __pyx_t_15 = __pyx_v_matID;
10987  __pyx_t_16 = -1;
10988  if (__pyx_t_15 < 0) {
10989  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[0].shape;
10990  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10991  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10992  if (unlikely(__pyx_t_16 != -1)) {
10993  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10994  __PYX_ERR(0, 435, __pyx_L1_error)
10995  }
10996  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
10997 
10998  /* "subsurfaceTransportFunctions.pyx":437
10999  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
11000  *
11001  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
11002  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
11003  *
11004  */
11005  __pyx_t_15 = __pyx_v_matID;
11006  __pyx_t_16 = -1;
11007  if (__pyx_t_15 < 0) {
11008  __pyx_t_15 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
11009  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11010  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
11011  if (unlikely(__pyx_t_16 != -1)) {
11012  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11013  __PYX_ERR(0, 437, __pyx_L1_error)
11014  }
11015  __pyx_t_11 = __pyx_v_matID;
11016  __pyx_t_16 = -1;
11017  if (__pyx_t_11 < 0) {
11018  __pyx_t_11 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
11019  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11020  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_16 = 0;
11021  if (unlikely(__pyx_t_16 != -1)) {
11022  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11023  __PYX_ERR(0, 437, __pyx_L1_error)
11024  }
11025  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
11026 
11027  /* "subsurfaceTransportFunctions.pyx":438
11028  *
11029  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
11030  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
11031  *
11032  * sqrt_sBar = sqrt(sBar)
11033  */
11034  __pyx_t_11 = __pyx_v_matID;
11035  __pyx_t_16 = -1;
11036  if (__pyx_t_11 < 0) {
11037  __pyx_t_11 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
11038  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11039  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
11040  if (unlikely(__pyx_t_16 != -1)) {
11041  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11042  __PYX_ERR(0, 438, __pyx_L1_error)
11043  }
11044  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
11045 
11046  /* "subsurfaceTransportFunctions.pyx":440
11047  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
11048  *
11049  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
11050  * KWr= sqrt_sBar*vBar2
11051  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
11052  */
11053  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
11054 
11055  /* "subsurfaceTransportFunctions.pyx":441
11056  *
11057  * sqrt_sBar = sqrt(sBar)
11058  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
11059  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
11060  * else:
11061  */
11062  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
11063 
11064  /* "subsurfaceTransportFunctions.pyx":442
11065  * sqrt_sBar = sqrt(sBar)
11066  * KWr= sqrt_sBar*vBar2
11067  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
11068  * else:
11069  * thetaW = thetaS
11070  */
11071  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
11072  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
11073  __PYX_ERR(0, 442, __pyx_L1_error)
11074  }
11075  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
11076 
11077  /* "subsurfaceTransportFunctions.pyx":422
11078  * m = 1.0 - 1.0/n[matID]
11079  * thetaS = thetaR[matID] + thetaSR[matID]
11080  * if psiC > 0.0: # <<<<<<<<<<<<<<
11081  * pcBar = alpha[matID]*psiC
11082  * pcBar_nM2 = pow(pcBar,n[matID]-2)
11083  */
11084  goto __pyx_L9;
11085  }
11086 
11087  /* "subsurfaceTransportFunctions.pyx":444
11088  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
11089  * else:
11090  * thetaW = thetaS # <<<<<<<<<<<<<<
11091  * DthetaW_DpsiC = 0.0
11092  * KWr = 1.0
11093  */
11094  /*else*/ {
11095  __pyx_v_thetaW = __pyx_v_thetaS;
11096 
11097  /* "subsurfaceTransportFunctions.pyx":445
11098  * else:
11099  * thetaW = thetaS
11100  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
11101  * KWr = 1.0
11102  * DKWr_DpsiC = 0.0
11103  */
11104  __pyx_v_DthetaW_DpsiC = 0.0;
11105 
11106  /* "subsurfaceTransportFunctions.pyx":446
11107  * thetaW = thetaS
11108  * DthetaW_DpsiC = 0.0
11109  * KWr = 1.0 # <<<<<<<<<<<<<<
11110  * DKWr_DpsiC = 0.0
11111  * #
11112  */
11113  __pyx_v_KWr = 1.0;
11114 
11115  /* "subsurfaceTransportFunctions.pyx":447
11116  * DthetaW_DpsiC = 0.0
11117  * KWr = 1.0
11118  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
11119  * #
11120  * rhom = rho*exp(beta*u_j)
11121  */
11122  __pyx_v_DKWr_DpsiC = 0.0;
11123  }
11124  __pyx_L9:;
11125 
11126  /* "subsurfaceTransportFunctions.pyx":449
11127  * DKWr_DpsiC = 0.0
11128  * #
11129  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
11130  * drhom= beta*rhom
11131  * q_mass[eN,j] = rhom*thetaW
11132  */
11133  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
11134 
11135  /* "subsurfaceTransportFunctions.pyx":450
11136  * #
11137  * rhom = rho*exp(beta*u_j)
11138  * drhom= beta*rhom # <<<<<<<<<<<<<<
11139  * q_mass[eN,j] = rhom*thetaW
11140  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11141  */
11142  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
11143 
11144  /* "subsurfaceTransportFunctions.pyx":451
11145  * rhom = rho*exp(beta*u_j)
11146  * drhom= beta*rhom
11147  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
11148  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11149  *
11150  */
11151  __pyx_t_11 = __pyx_v_eN;
11152  __pyx_t_15 = __pyx_v_j;
11153  __pyx_t_16 = -1;
11154  if (__pyx_t_11 < 0) {
11155  __pyx_t_11 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
11156  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11157  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_16 = 0;
11158  if (__pyx_t_15 < 0) {
11159  __pyx_t_15 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
11160  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11161  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_16 = 1;
11162  if (unlikely(__pyx_t_16 != -1)) {
11163  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11164  __PYX_ERR(0, 451, __pyx_L1_error)
11165  }
11166  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
11167 
11168  /* "subsurfaceTransportFunctions.pyx":452
11169  * drhom= beta*rhom
11170  * q_mass[eN,j] = rhom*thetaW
11171  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
11172  *
11173  * q_kr[eN,j] = KWr
11174  */
11175  __pyx_t_15 = __pyx_v_eN;
11176  __pyx_t_11 = __pyx_v_j;
11177  __pyx_t_16 = -1;
11178  if (__pyx_t_15 < 0) {
11179  __pyx_t_15 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
11180  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11181  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_16 = 0;
11182  if (__pyx_t_11 < 0) {
11183  __pyx_t_11 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
11184  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11185  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_16 = 1;
11186  if (unlikely(__pyx_t_16 != -1)) {
11187  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11188  __PYX_ERR(0, 452, __pyx_L1_error)
11189  }
11190  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
11191 
11192  /* "subsurfaceTransportFunctions.pyx":454
11193  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11194  *
11195  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
11196  * q_dkr[eN,j]= -DKWr_DpsiC
11197  *
11198  */
11199  __pyx_t_11 = __pyx_v_eN;
11200  __pyx_t_15 = __pyx_v_j;
11201  __pyx_t_16 = -1;
11202  if (__pyx_t_11 < 0) {
11203  __pyx_t_11 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
11204  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11205  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_16 = 0;
11206  if (__pyx_t_15 < 0) {
11207  __pyx_t_15 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
11208  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11209  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_16 = 1;
11210  if (unlikely(__pyx_t_16 != -1)) {
11211  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11212  __PYX_ERR(0, 454, __pyx_L1_error)
11213  }
11214  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
11215 
11216  /* "subsurfaceTransportFunctions.pyx":455
11217  *
11218  * q_kr[eN,j] = KWr
11219  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
11220  *
11221  * #j
11222  */
11223  __pyx_t_15 = __pyx_v_eN;
11224  __pyx_t_11 = __pyx_v_j;
11225  __pyx_t_16 = -1;
11226  if (__pyx_t_15 < 0) {
11227  __pyx_t_15 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
11228  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11229  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_16 = 0;
11230  if (__pyx_t_11 < 0) {
11231  __pyx_t_11 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
11232  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11233  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_16 = 1;
11234  if (unlikely(__pyx_t_16 != -1)) {
11235  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11236  __PYX_ERR(0, 455, __pyx_L1_error)
11237  }
11238  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
11239  }
11240  }
11241 
11242  /* "subsurfaceTransportFunctions.pyx":461
11243  *
11244  * #now upwind kr
11245  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
11246  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11247  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11248  */
11249  __pyx_t_8 = __pyx_v_nElements_global;
11250  __pyx_t_9 = __pyx_t_8;
11251  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
11252  __pyx_v_eN = __pyx_t_10;
11253 
11254  /* "subsurfaceTransportFunctions.pyx":462
11255  * #now upwind kr
11256  * for eN in range(nElements_global):
11257  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
11258  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11259  * #potential assumes slight compressibility
11260  */
11261  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11262  __Pyx_GOTREF(__pyx_t_5);
11263  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11264  __Pyx_GOTREF(__pyx_t_1);
11265  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11266  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11267  __Pyx_GOTREF(__pyx_t_5);
11268  __pyx_t_4 = NULL;
11269  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11270  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11271  if (likely(__pyx_t_4)) {
11272  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11273  __Pyx_INCREF(__pyx_t_4);
11274  __Pyx_INCREF(function);
11275  __Pyx_DECREF_SET(__pyx_t_1, function);
11276  }
11277  }
11278  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
11279  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11280  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11281  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11282  __Pyx_GOTREF(__pyx_t_2);
11283  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11284  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11285  __Pyx_GOTREF(__pyx_t_1);
11286  __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11287  __Pyx_GOTREF(__pyx_t_5);
11288  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11289  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11290  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
11291  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11292  __pyx_v_u_eN = __pyx_t_7;
11293 
11294  /* "subsurfaceTransportFunctions.pyx":463
11295  * for eN in range(nElements_global):
11296  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11297  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
11298  * #potential assumes slight compressibility
11299  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
11300  */
11301  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11302  __Pyx_GOTREF(__pyx_t_1);
11303  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11304  __Pyx_GOTREF(__pyx_t_2);
11305  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11306  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11307  __Pyx_GOTREF(__pyx_t_1);
11308  __pyx_t_4 = NULL;
11309  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11310  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
11311  if (likely(__pyx_t_4)) {
11312  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11313  __Pyx_INCREF(__pyx_t_4);
11314  __Pyx_INCREF(function);
11315  __Pyx_DECREF_SET(__pyx_t_2, function);
11316  }
11317  }
11318  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
11319  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11320  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11321  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error)
11322  __Pyx_GOTREF(__pyx_t_5);
11323  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11324  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11325  __Pyx_GOTREF(__pyx_t_2);
11326  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11327  __Pyx_GOTREF(__pyx_t_1);
11328  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11329  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11330  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
11331  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11332  __pyx_v_kr_eN = __pyx_t_7;
11333 
11334  /* "subsurfaceTransportFunctions.pyx":465
11335  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11336  * #potential assumes slight compressibility
11337  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
11338  *
11339  *
11340  */
11341  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11342  __Pyx_GOTREF(__pyx_t_1);
11343  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11344  __Pyx_GOTREF(__pyx_t_5);
11345  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11346  __Pyx_GOTREF(__pyx_t_4);
11347  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11348  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11349  __Pyx_GOTREF(__pyx_t_5);
11350  __pyx_t_19 = NULL;
11351  __pyx_t_12 = 0;
11352  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11353  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4);
11354  if (likely(__pyx_t_19)) {
11355  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11356  __Pyx_INCREF(__pyx_t_19);
11357  __Pyx_INCREF(function);
11358  __Pyx_DECREF_SET(__pyx_t_4, function);
11359  __pyx_t_12 = 1;
11360  }
11361  }
11362  #if CYTHON_FAST_PYCALL
11363  if (PyFunction_Check(__pyx_t_4)) {
11364  PyObject *__pyx_temp[3] = {__pyx_t_19, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11365  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11366  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
11367  __Pyx_GOTREF(__pyx_t_2);
11368  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11369  } else
11370  #endif
11371  #if CYTHON_FAST_PYCCALL
11372  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11373  PyObject *__pyx_temp[3] = {__pyx_t_19, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11374  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11375  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
11376  __Pyx_GOTREF(__pyx_t_2);
11377  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11378  } else
11379  #endif
11380  {
11381  __pyx_t_20 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 465, __pyx_L1_error)
11382  __Pyx_GOTREF(__pyx_t_20);
11383  if (__pyx_t_19) {
11384  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
11385  }
11386  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11387  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11388  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_12, ((PyObject *)__pyx_v_gravity));
11389  __Pyx_GIVEREF(__pyx_t_5);
11390  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_12, __pyx_t_5);
11391  __pyx_t_5 = 0;
11392  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11393  __Pyx_GOTREF(__pyx_t_2);
11394  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11395  }
11396  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11397  __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11398  __Pyx_GOTREF(__pyx_t_4);
11399  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11400  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11401  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
11402  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11403  __pyx_v_phi_eN = __pyx_t_7;
11404 
11405  /* "subsurfaceTransportFunctions.pyx":469
11406  *
11407  * #loop over faces to upwind
11408  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
11409  * #by default eN is upwind
11410  * q_kr_up[eN,ebN] = kr_eN
11411  */
11412  __pyx_t_12 = __pyx_v_nElementBoundaries_element;
11413  __pyx_t_13 = __pyx_t_12;
11414  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
11415  __pyx_v_ebN = __pyx_t_14;
11416 
11417  /* "subsurfaceTransportFunctions.pyx":471
11418  * for ebN in range(nElementBoundaries_element):
11419  * #by default eN is upwind
11420  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
11421  * eN_neighbor = elementNeighborsArray[eN,ebN]
11422  * if eN_neighbor >= 0:
11423  */
11424  __pyx_t_11 = __pyx_v_eN;
11425  __pyx_t_15 = __pyx_v_ebN;
11426  __pyx_t_16 = -1;
11427  if (__pyx_t_11 < 0) {
11428  __pyx_t_11 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11429  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11430  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_16 = 0;
11431  if (__pyx_t_15 < 0) {
11432  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11433  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11434  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_16 = 1;
11435  if (unlikely(__pyx_t_16 != -1)) {
11436  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11437  __PYX_ERR(0, 471, __pyx_L1_error)
11438  }
11439  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
11440 
11441  /* "subsurfaceTransportFunctions.pyx":472
11442  * #by default eN is upwind
11443  * q_kr_up[eN,ebN] = kr_eN
11444  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
11445  * if eN_neighbor >= 0:
11446  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11447  */
11448  __pyx_t_15 = __pyx_v_eN;
11449  __pyx_t_11 = __pyx_v_ebN;
11450  __pyx_t_16 = -1;
11451  if (__pyx_t_15 < 0) {
11452  __pyx_t_15 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
11453  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11454  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_16 = 0;
11455  if (__pyx_t_11 < 0) {
11456  __pyx_t_11 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
11457  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11458  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_16 = 1;
11459  if (unlikely(__pyx_t_16 != -1)) {
11460  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11461  __PYX_ERR(0, 472, __pyx_L1_error)
11462  }
11463  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
11464 
11465  /* "subsurfaceTransportFunctions.pyx":473
11466  * q_kr_up[eN,ebN] = kr_eN
11467  * eN_neighbor = elementNeighborsArray[eN,ebN]
11468  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11469  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11470  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11471  */
11472  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
11473  if (__pyx_t_6) {
11474 
11475  /* "subsurfaceTransportFunctions.pyx":474
11476  * eN_neighbor = elementNeighborsArray[eN,ebN]
11477  * if eN_neighbor >= 0:
11478  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11479  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11480  * #potential, assumes slight compressibility
11481  */
11482  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11483  __Pyx_GOTREF(__pyx_t_2);
11484  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11485  __Pyx_GOTREF(__pyx_t_1);
11486  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11487  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11488  __Pyx_GOTREF(__pyx_t_2);
11489  __pyx_t_20 = NULL;
11490  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11491  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
11492  if (likely(__pyx_t_20)) {
11493  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11494  __Pyx_INCREF(__pyx_t_20);
11495  __Pyx_INCREF(function);
11496  __Pyx_DECREF_SET(__pyx_t_1, function);
11497  }
11498  }
11499  __pyx_t_4 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
11500  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11501  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11502  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
11503  __Pyx_GOTREF(__pyx_t_4);
11504  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11505  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11506  __Pyx_GOTREF(__pyx_t_1);
11507  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11508  __Pyx_GOTREF(__pyx_t_2);
11509  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11510  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11511  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
11512  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11513  __pyx_v_u_neig = __pyx_t_7;
11514 
11515  /* "subsurfaceTransportFunctions.pyx":475
11516  * if eN_neighbor >= 0:
11517  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11518  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11519  * #potential, assumes slight compressibility
11520  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11521  */
11522  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11523  __Pyx_GOTREF(__pyx_t_1);
11524  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11525  __Pyx_GOTREF(__pyx_t_4);
11526  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11527  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11528  __Pyx_GOTREF(__pyx_t_1);
11529  __pyx_t_20 = NULL;
11530  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11531  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
11532  if (likely(__pyx_t_20)) {
11533  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11534  __Pyx_INCREF(__pyx_t_20);
11535  __Pyx_INCREF(function);
11536  __Pyx_DECREF_SET(__pyx_t_4, function);
11537  }
11538  }
11539  __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
11540  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11541  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11542  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
11543  __Pyx_GOTREF(__pyx_t_2);
11544  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11545  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11546  __Pyx_GOTREF(__pyx_t_4);
11547  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11548  __Pyx_GOTREF(__pyx_t_1);
11549  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11550  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11551  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error)
11552  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11553  __pyx_v_kr_neig = __pyx_t_7;
11554 
11555  /* "subsurfaceTransportFunctions.pyx":477
11556  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11557  * #potential, assumes slight compressibility
11558  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
11559  *
11560  * if phi_eN < phi_neig: #neighbor is upwind
11561  */
11562  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11563  __Pyx_GOTREF(__pyx_t_1);
11564  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11565  __Pyx_GOTREF(__pyx_t_2);
11566  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 477, __pyx_L1_error)
11567  __Pyx_GOTREF(__pyx_t_20);
11568  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11569  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11570  __Pyx_GOTREF(__pyx_t_2);
11571  __pyx_t_5 = NULL;
11572  __pyx_t_16 = 0;
11573  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
11574  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_20);
11575  if (likely(__pyx_t_5)) {
11576  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
11577  __Pyx_INCREF(__pyx_t_5);
11578  __Pyx_INCREF(function);
11579  __Pyx_DECREF_SET(__pyx_t_20, function);
11580  __pyx_t_16 = 1;
11581  }
11582  }
11583  #if CYTHON_FAST_PYCALL
11584  if (PyFunction_Check(__pyx_t_20)) {
11585  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11586  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11587  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11588  __Pyx_GOTREF(__pyx_t_4);
11589  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11590  } else
11591  #endif
11592  #if CYTHON_FAST_PYCCALL
11593  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
11594  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11595  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11596  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11597  __Pyx_GOTREF(__pyx_t_4);
11598  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11599  } else
11600  #endif
11601  {
11602  __pyx_t_19 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 477, __pyx_L1_error)
11603  __Pyx_GOTREF(__pyx_t_19);
11604  if (__pyx_t_5) {
11605  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_5); __pyx_t_5 = NULL;
11606  }
11607  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11608  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11609  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_16, ((PyObject *)__pyx_v_gravity));
11610  __Pyx_GIVEREF(__pyx_t_2);
11611  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_16, __pyx_t_2);
11612  __pyx_t_2 = 0;
11613  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11614  __Pyx_GOTREF(__pyx_t_4);
11615  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
11616  }
11617  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11618  __pyx_t_20 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 477, __pyx_L1_error)
11619  __Pyx_GOTREF(__pyx_t_20);
11620  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11621  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11622  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
11623  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11624  __pyx_v_phi_neig = __pyx_t_7;
11625 
11626  /* "subsurfaceTransportFunctions.pyx":479
11627  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11628  *
11629  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11630  * q_kr_up[eN,ebN] = kr_neig
11631  *
11632  */
11633  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
11634  if (__pyx_t_6) {
11635 
11636  /* "subsurfaceTransportFunctions.pyx":480
11637  *
11638  * if phi_eN < phi_neig: #neighbor is upwind
11639  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
11640  *
11641  * #neighbor
11642  */
11643  __pyx_t_11 = __pyx_v_eN;
11644  __pyx_t_15 = __pyx_v_ebN;
11645  __pyx_t_16 = -1;
11646  if (__pyx_t_11 < 0) {
11647  __pyx_t_11 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11648  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11649  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_16 = 0;
11650  if (__pyx_t_15 < 0) {
11651  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11652  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11653  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_16 = 1;
11654  if (unlikely(__pyx_t_16 != -1)) {
11655  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11656  __PYX_ERR(0, 480, __pyx_L1_error)
11657  }
11658  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
11659 
11660  /* "subsurfaceTransportFunctions.pyx":479
11661  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11662  *
11663  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11664  * q_kr_up[eN,ebN] = kr_neig
11665  *
11666  */
11667  }
11668 
11669  /* "subsurfaceTransportFunctions.pyx":473
11670  * q_kr_up[eN,ebN] = kr_eN
11671  * eN_neighbor = elementNeighborsArray[eN,ebN]
11672  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11673  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11674  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11675  */
11676  }
11677  }
11678  }
11679 
11680  /* "subsurfaceTransportFunctions.pyx":359
11681  *
11682  *
11683  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
11684  * double beta,
11685  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
11686  */
11687 
11688  /* function exit code */
11689  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11690  goto __pyx_L0;
11691  __pyx_L1_error:;
11692  __Pyx_XDECREF(__pyx_t_1);
11693  __Pyx_XDECREF(__pyx_t_2);
11694  __Pyx_XDECREF(__pyx_t_4);
11695  __Pyx_XDECREF(__pyx_t_5);
11696  __Pyx_XDECREF(__pyx_t_19);
11697  __Pyx_XDECREF(__pyx_t_20);
11698  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11699  __Pyx_PyThreadState_declare
11700  __Pyx_PyThreadState_assign
11701  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11702  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11703  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11704  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11705  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11706  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11707  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11708  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11709  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11710  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11711  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11712  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11713  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11714  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11715  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11716  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11717  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11718  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11719  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11720  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11721  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
11722  __pyx_r = NULL;
11723  goto __pyx_L2;
11724  __pyx_L0:;
11725  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11726  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11727  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11728  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11729  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11730  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11731  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11732  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11733  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11734  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11735  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11736  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11737  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11738  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11739  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11740  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11741  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11742  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11743  __pyx_L2:;
11744  __Pyx_XDECREF(__pyx_v_q);
11745  __Pyx_XGIVEREF(__pyx_r);
11746  __Pyx_RefNannyFinishContext();
11747  return __pyx_r;
11748 }
11749 
11750 /* "subsurfaceTransportFunctions.pyx":486
11751  * #eN for upwind
11752  *
11753  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11754  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11755  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11756  */
11757 
11758 /* Python wrapper */
11759 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11760 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11761 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
11762 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11763  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11764  PyArrayObject *__pyx_v_rowptr = 0;
11765  PyArrayObject *__pyx_v_colind = 0;
11766  int __pyx_v_nSpace;
11767  int __pyx_v_nElements_global;
11768  int __pyx_v_nElementBoundaries_element;
11769  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11770  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11771  int __pyx_v_nDOF_test_element;
11772  PyArrayObject *__pyx_v_q_u = 0;
11773  PyArrayObject *__pyx_v_q_grad_u = 0;
11774  PyArrayObject *__pyx_v_q_grad_w = 0;
11775  PyArrayObject *__pyx_v_q_detJ = 0;
11776  PyArrayObject *__pyx_v_q_m = 0;
11777  PyArrayObject *__pyx_v_q_mt = 0;
11778  PyArrayObject *__pyx_v_q_r = 0;
11779  PyArrayObject *__pyx_v_q_kr = 0;
11780  PyArrayObject *__pyx_v_q_kr_up = 0;
11781  PyArrayObject *__pyx_v_q_flin = 0;
11782  PyArrayObject *__pyx_v_q_alin = 0;
11783  PyArrayObject *__pyx_v_elementResidual = 0;
11784  int __pyx_lineno = 0;
11785  const char *__pyx_filename = NULL;
11786  int __pyx_clineno = 0;
11787  PyObject *__pyx_r = 0;
11788  __Pyx_RefNannyDeclarations
11789  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
11790  {
11791  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
11792  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11793  if (unlikely(__pyx_kwds)) {
11794  Py_ssize_t kw_args;
11795  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11796  switch (pos_args) {
11797  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11798  CYTHON_FALLTHROUGH;
11799  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11800  CYTHON_FALLTHROUGH;
11801  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11802  CYTHON_FALLTHROUGH;
11803  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11804  CYTHON_FALLTHROUGH;
11805  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11806  CYTHON_FALLTHROUGH;
11807  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11808  CYTHON_FALLTHROUGH;
11809  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11810  CYTHON_FALLTHROUGH;
11811  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11812  CYTHON_FALLTHROUGH;
11813  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11814  CYTHON_FALLTHROUGH;
11815  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11816  CYTHON_FALLTHROUGH;
11817  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11818  CYTHON_FALLTHROUGH;
11819  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11820  CYTHON_FALLTHROUGH;
11821  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11822  CYTHON_FALLTHROUGH;
11823  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11824  CYTHON_FALLTHROUGH;
11825  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11826  CYTHON_FALLTHROUGH;
11827  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11828  CYTHON_FALLTHROUGH;
11829  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11830  CYTHON_FALLTHROUGH;
11831  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11832  CYTHON_FALLTHROUGH;
11833  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11834  CYTHON_FALLTHROUGH;
11835  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11836  CYTHON_FALLTHROUGH;
11837  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11838  CYTHON_FALLTHROUGH;
11839  case 0: break;
11840  default: goto __pyx_L5_argtuple_error;
11841  }
11842  kw_args = PyDict_Size(__pyx_kwds);
11843  switch (pos_args) {
11844  case 0:
11845  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
11846  else goto __pyx_L5_argtuple_error;
11847  CYTHON_FALLTHROUGH;
11848  case 1:
11849  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
11850  else {
11851  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); __PYX_ERR(0, 486, __pyx_L3_error)
11852  }
11853  CYTHON_FALLTHROUGH;
11854  case 2:
11855  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
11856  else {
11857  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); __PYX_ERR(0, 486, __pyx_L3_error)
11858  }
11859  CYTHON_FALLTHROUGH;
11860  case 3:
11861  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
11862  else {
11863  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); __PYX_ERR(0, 486, __pyx_L3_error)
11864  }
11865  CYTHON_FALLTHROUGH;
11866  case 4:
11867  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
11868  else {
11869  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); __PYX_ERR(0, 486, __pyx_L3_error)
11870  }
11871  CYTHON_FALLTHROUGH;
11872  case 5:
11873  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
11874  else {
11875  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); __PYX_ERR(0, 486, __pyx_L3_error)
11876  }
11877  CYTHON_FALLTHROUGH;
11878  case 6:
11879  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
11880  else {
11881  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); __PYX_ERR(0, 486, __pyx_L3_error)
11882  }
11883  CYTHON_FALLTHROUGH;
11884  case 7:
11885  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
11886  else {
11887  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); __PYX_ERR(0, 486, __pyx_L3_error)
11888  }
11889  CYTHON_FALLTHROUGH;
11890  case 8:
11891  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
11892  else {
11893  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); __PYX_ERR(0, 486, __pyx_L3_error)
11894  }
11895  CYTHON_FALLTHROUGH;
11896  case 9:
11897  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
11898  else {
11899  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); __PYX_ERR(0, 486, __pyx_L3_error)
11900  }
11901  CYTHON_FALLTHROUGH;
11902  case 10:
11903  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
11904  else {
11905  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); __PYX_ERR(0, 486, __pyx_L3_error)
11906  }
11907  CYTHON_FALLTHROUGH;
11908  case 11:
11909  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
11910  else {
11911  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); __PYX_ERR(0, 486, __pyx_L3_error)
11912  }
11913  CYTHON_FALLTHROUGH;
11914  case 12:
11915  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
11916  else {
11917  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); __PYX_ERR(0, 486, __pyx_L3_error)
11918  }
11919  CYTHON_FALLTHROUGH;
11920  case 13:
11921  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
11922  else {
11923  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); __PYX_ERR(0, 486, __pyx_L3_error)
11924  }
11925  CYTHON_FALLTHROUGH;
11926  case 14:
11927  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
11928  else {
11929  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); __PYX_ERR(0, 486, __pyx_L3_error)
11930  }
11931  CYTHON_FALLTHROUGH;
11932  case 15:
11933  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
11934  else {
11935  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); __PYX_ERR(0, 486, __pyx_L3_error)
11936  }
11937  CYTHON_FALLTHROUGH;
11938  case 16:
11939  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
11940  else {
11941  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); __PYX_ERR(0, 486, __pyx_L3_error)
11942  }
11943  CYTHON_FALLTHROUGH;
11944  case 17:
11945  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
11946  else {
11947  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); __PYX_ERR(0, 486, __pyx_L3_error)
11948  }
11949  CYTHON_FALLTHROUGH;
11950  case 18:
11951  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
11952  else {
11953  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); __PYX_ERR(0, 486, __pyx_L3_error)
11954  }
11955  CYTHON_FALLTHROUGH;
11956  case 19:
11957  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
11958  else {
11959  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); __PYX_ERR(0, 486, __pyx_L3_error)
11960  }
11961  CYTHON_FALLTHROUGH;
11962  case 20:
11963  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
11964  else {
11965  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); __PYX_ERR(0, 486, __pyx_L3_error)
11966  }
11967  }
11968  if (unlikely(kw_args > 0)) {
11969  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) __PYX_ERR(0, 486, __pyx_L3_error)
11970  }
11971  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
11972  goto __pyx_L5_argtuple_error;
11973  } else {
11974  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11975  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11976  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11977  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11978  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11979  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11980  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11981  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11982  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11983  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11984  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11985  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11986  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11987  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11988  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11989  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11990  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11991  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11992  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11993  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11994  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11995  }
11996  __pyx_v_gravity = ((PyArrayObject *)values[0]);
11997  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
11998  __pyx_v_colind = ((PyArrayObject *)values[2]);
11999  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error)
12000  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error)
12001  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L3_error)
12002  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
12003  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
12004  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L3_error)
12005  __pyx_v_q_u = ((PyArrayObject *)values[9]);
12006  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
12007  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
12008  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
12009  __pyx_v_q_m = ((PyArrayObject *)values[13]);
12010  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
12011  __pyx_v_q_r = ((PyArrayObject *)values[15]);
12012  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
12013  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
12014  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
12015  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
12016  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
12017  }
12018  goto __pyx_L4_argument_unpacking_done;
12019  __pyx_L5_argtuple_error:;
12020  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error)
12021  __pyx_L3_error:;
12022  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
12023  __Pyx_RefNannyFinishContext();
12024  return NULL;
12025  __pyx_L4_argument_unpacking_done:;
12026  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 486, __pyx_L1_error)
12027  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 487, __pyx_L1_error)
12028  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 488, __pyx_L1_error)
12029  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 493, __pyx_L1_error)
12030  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 494, __pyx_L1_error)
12031  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 497, __pyx_L1_error)
12032  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
12033  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
12034  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
12035  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
12036  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
12037  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
12038  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 505, __pyx_L1_error)
12039  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
12040  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 509, __pyx_L1_error)
12041  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 510, __pyx_L1_error)
12042  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) __PYX_ERR(0, 512, __pyx_L1_error)
12043  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
12044 
12045  /* function exit code */
12046  goto __pyx_L0;
12047  __pyx_L1_error:;
12048  __pyx_r = NULL;
12049  __pyx_L0:;
12050  __Pyx_RefNannyFinishContext();
12051  return __pyx_r;
12052 }
12053 
12054 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) {
12055  CYTHON_UNUSED int __pyx_v_upwindFlag;
12056  PyObject *__pyx_v_q = NULL;
12057  int __pyx_v_nnz;
12058  int __pyx_v_eN;
12059  int __pyx_v_ii;
12060  int __pyx_v_I;
12061  int __pyx_v_i;
12062  int __pyx_v_ebN;
12063  PyArrayObject *__pyx_v_a_up = 0;
12064  PyArrayObject *__pyx_v_f_up = 0;
12065  double __pyx_v_nAvgWeight;
12066  double __pyx_v_weight;
12067  double __pyx_v_volFactor;
12068  double __pyx_v_volume;
12069  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
12070  __Pyx_Buffer __pyx_pybuffer_a_up;
12071  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
12072  __Pyx_Buffer __pyx_pybuffer_colind;
12073  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
12074  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
12075  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
12076  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
12077  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
12078  __Pyx_Buffer __pyx_pybuffer_elementResidual;
12079  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
12080  __Pyx_Buffer __pyx_pybuffer_f_up;
12081  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
12082  __Pyx_Buffer __pyx_pybuffer_gravity;
12083  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
12084  __Pyx_Buffer __pyx_pybuffer_q_alin;
12085  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
12086  __Pyx_Buffer __pyx_pybuffer_q_detJ;
12087  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
12088  __Pyx_Buffer __pyx_pybuffer_q_flin;
12089  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
12090  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
12091  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
12092  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
12093  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
12094  __Pyx_Buffer __pyx_pybuffer_q_kr;
12095  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
12096  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
12097  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
12098  __Pyx_Buffer __pyx_pybuffer_q_m;
12099  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
12100  __Pyx_Buffer __pyx_pybuffer_q_mt;
12101  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
12102  __Pyx_Buffer __pyx_pybuffer_q_r;
12103  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
12104  __Pyx_Buffer __pyx_pybuffer_q_u;
12105  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
12106  __Pyx_Buffer __pyx_pybuffer_rowptr;
12107  PyObject *__pyx_r = NULL;
12108  __Pyx_RefNannyDeclarations
12109  PyObject *__pyx_t_1 = NULL;
12110  PyObject *__pyx_t_2 = NULL;
12111  Py_ssize_t __pyx_t_3;
12112  PyObject *__pyx_t_4 = NULL;
12113  PyObject *__pyx_t_5 = NULL;
12114  int __pyx_t_6;
12115  Py_ssize_t __pyx_t_7;
12116  int __pyx_t_8;
12117  PyObject *__pyx_t_9 = NULL;
12118  PyArrayObject *__pyx_t_10 = NULL;
12119  PyArrayObject *__pyx_t_11 = NULL;
12120  double __pyx_t_12;
12121  int __pyx_t_13;
12122  int __pyx_t_14;
12123  Py_ssize_t __pyx_t_15;
12124  int __pyx_t_16;
12125  int __pyx_t_17;
12126  int __pyx_t_18;
12127  int __pyx_t_19;
12128  Py_ssize_t __pyx_t_20;
12129  Py_ssize_t __pyx_t_21;
12130  int __pyx_t_22;
12131  int __pyx_t_23;
12132  int __pyx_t_24;
12133  int __pyx_t_25;
12134  int __pyx_t_26;
12135  int __pyx_t_27;
12136  Py_ssize_t __pyx_t_28;
12137  Py_ssize_t __pyx_t_29;
12138  Py_ssize_t __pyx_t_30;
12139  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_31;
12140  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_32;
12141  int __pyx_t_33;
12142  Py_ssize_t __pyx_t_34;
12143  Py_ssize_t __pyx_t_35;
12144  Py_ssize_t __pyx_t_36;
12145  Py_ssize_t __pyx_t_37;
12146  Py_ssize_t __pyx_t_38;
12147  int __pyx_lineno = 0;
12148  const char *__pyx_filename = NULL;
12149  int __pyx_clineno = 0;
12150  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
12151  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
12152  __pyx_pybuffer_a_up.refcount = 0;
12153  __pyx_pybuffernd_a_up.data = NULL;
12154  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
12155  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
12156  __pyx_pybuffer_f_up.refcount = 0;
12157  __pyx_pybuffernd_f_up.data = NULL;
12158  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
12159  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
12160  __pyx_pybuffer_gravity.refcount = 0;
12161  __pyx_pybuffernd_gravity.data = NULL;
12162  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
12163  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
12164  __pyx_pybuffer_rowptr.refcount = 0;
12165  __pyx_pybuffernd_rowptr.data = NULL;
12166  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
12167  __pyx_pybuffer_colind.pybuffer.buf = NULL;
12168  __pyx_pybuffer_colind.refcount = 0;
12169  __pyx_pybuffernd_colind.data = NULL;
12170  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
12171  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
12172  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
12173  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
12174  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
12175  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
12176  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
12177  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
12178  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
12179  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
12180  __pyx_pybuffer_q_u.refcount = 0;
12181  __pyx_pybuffernd_q_u.data = NULL;
12182  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
12183  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
12184  __pyx_pybuffer_q_grad_u.refcount = 0;
12185  __pyx_pybuffernd_q_grad_u.data = NULL;
12186  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
12187  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
12188  __pyx_pybuffer_q_grad_w.refcount = 0;
12189  __pyx_pybuffernd_q_grad_w.data = NULL;
12190  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
12191  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
12192  __pyx_pybuffer_q_detJ.refcount = 0;
12193  __pyx_pybuffernd_q_detJ.data = NULL;
12194  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
12195  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
12196  __pyx_pybuffer_q_m.refcount = 0;
12197  __pyx_pybuffernd_q_m.data = NULL;
12198  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
12199  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
12200  __pyx_pybuffer_q_mt.refcount = 0;
12201  __pyx_pybuffernd_q_mt.data = NULL;
12202  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
12203  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
12204  __pyx_pybuffer_q_r.refcount = 0;
12205  __pyx_pybuffernd_q_r.data = NULL;
12206  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
12207  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
12208  __pyx_pybuffer_q_kr.refcount = 0;
12209  __pyx_pybuffernd_q_kr.data = NULL;
12210  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
12211  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
12212  __pyx_pybuffer_q_kr_up.refcount = 0;
12213  __pyx_pybuffernd_q_kr_up.data = NULL;
12214  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
12215  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
12216  __pyx_pybuffer_q_flin.refcount = 0;
12217  __pyx_pybuffernd_q_flin.data = NULL;
12218  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
12219  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
12220  __pyx_pybuffer_q_alin.refcount = 0;
12221  __pyx_pybuffernd_q_alin.data = NULL;
12222  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
12223  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
12224  __pyx_pybuffer_elementResidual.refcount = 0;
12225  __pyx_pybuffernd_elementResidual.data = NULL;
12226  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
12227  {
12228  __Pyx_BufFmt_StackElem __pyx_stack[1];
12229  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12230  }
12231  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
12232  {
12233  __Pyx_BufFmt_StackElem __pyx_stack[1];
12234  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12235  }
12236  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
12237  {
12238  __Pyx_BufFmt_StackElem __pyx_stack[1];
12239  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12240  }
12241  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
12242  {
12243  __Pyx_BufFmt_StackElem __pyx_stack[1];
12244  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12245  }
12246  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
12247  {
12248  __Pyx_BufFmt_StackElem __pyx_stack[1];
12249  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12250  }
12251  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
12252  {
12253  __Pyx_BufFmt_StackElem __pyx_stack[1];
12254  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12255  }
12256  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
12257  {
12258  __Pyx_BufFmt_StackElem __pyx_stack[1];
12259  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12260  }
12261  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
12262  {
12263  __Pyx_BufFmt_StackElem __pyx_stack[1];
12264  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12265  }
12266  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
12267  {
12268  __Pyx_BufFmt_StackElem __pyx_stack[1];
12269  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12270  }
12271  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
12272  {
12273  __Pyx_BufFmt_StackElem __pyx_stack[1];
12274  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12275  }
12276  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
12277  {
12278  __Pyx_BufFmt_StackElem __pyx_stack[1];
12279  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12280  }
12281  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
12282  {
12283  __Pyx_BufFmt_StackElem __pyx_stack[1];
12284  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12285  }
12286  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
12287  {
12288  __Pyx_BufFmt_StackElem __pyx_stack[1];
12289  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12290  }
12291  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
12292  {
12293  __Pyx_BufFmt_StackElem __pyx_stack[1];
12294  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12295  }
12296  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
12297  {
12298  __Pyx_BufFmt_StackElem __pyx_stack[1];
12299  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12300  }
12301  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
12302  {
12303  __Pyx_BufFmt_StackElem __pyx_stack[1];
12304  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12305  }
12306  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
12307  {
12308  __Pyx_BufFmt_StackElem __pyx_stack[1];
12309  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12310  }
12311  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
12312 
12313  /* "subsurfaceTransportFunctions.pyx":527
12314  *
12315  * """
12316  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
12317  * #check some sizes
12318  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12319  */
12320  __pyx_v_upwindFlag = 1;
12321 
12322  /* "subsurfaceTransportFunctions.pyx":529
12323  * cdef int upwindFlag = 1
12324  * #check some sizes
12325  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12326  * assert q.shape[1] == nSpace+1
12327  * assert nDOF_test_element == nSpace+1
12328  */
12329  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12330  __Pyx_GOTREF(__pyx_t_1);
12331  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
12332  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
12333  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
12334  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
12335  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
12336  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
12337  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
12338  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
12339  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
12340  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
12341  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
12342  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
12343  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
12344  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
12345  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
12346  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12347  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12348  for (;;) {
12349  if (__pyx_t_3 >= 5) break;
12350  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12351  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 529, __pyx_L1_error)
12352  #else
12353  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12354  __Pyx_GOTREF(__pyx_t_1);
12355  #endif
12356  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
12357  __pyx_t_1 = 0;
12358 
12359  /* "subsurfaceTransportFunctions.pyx":530
12360  * #check some sizes
12361  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12362  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
12363  * assert nDOF_test_element == nSpace+1
12364  * cdef int nnz = rowptr[nSpace]
12365  */
12366  #ifndef CYTHON_WITHOUT_ASSERTIONS
12367  if (unlikely(!Py_OptimizeFlag)) {
12368  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12369  __Pyx_GOTREF(__pyx_t_1);
12370  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
12371  __Pyx_GOTREF(__pyx_t_4);
12372  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12373  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12374  __Pyx_GOTREF(__pyx_t_1);
12375  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
12376  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12377  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12378  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 530, __pyx_L1_error)
12379  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12380  if (unlikely(!__pyx_t_6)) {
12381  PyErr_SetNone(PyExc_AssertionError);
12382  __PYX_ERR(0, 530, __pyx_L1_error)
12383  }
12384  }
12385  #endif
12386 
12387  /* "subsurfaceTransportFunctions.pyx":529
12388  * cdef int upwindFlag = 1
12389  * #check some sizes
12390  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12391  * assert q.shape[1] == nSpace+1
12392  * assert nDOF_test_element == nSpace+1
12393  */
12394  }
12395  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12396 
12397  /* "subsurfaceTransportFunctions.pyx":531
12398  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12399  * assert q.shape[1] == nSpace+1
12400  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
12401  * cdef int nnz = rowptr[nSpace]
12402  * #temporaries
12403  */
12404  #ifndef CYTHON_WITHOUT_ASSERTIONS
12405  if (unlikely(!Py_OptimizeFlag)) {
12406  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
12407  PyErr_SetNone(PyExc_AssertionError);
12408  __PYX_ERR(0, 531, __pyx_L1_error)
12409  }
12410  }
12411  #endif
12412 
12413  /* "subsurfaceTransportFunctions.pyx":532
12414  * assert q.shape[1] == nSpace+1
12415  * assert nDOF_test_element == nSpace+1
12416  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
12417  * #temporaries
12418  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12419  */
12420  __pyx_t_7 = __pyx_v_nSpace;
12421  __pyx_t_8 = -1;
12422  if (__pyx_t_7 < 0) {
12423  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12424  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
12425  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
12426  if (unlikely(__pyx_t_8 != -1)) {
12427  __Pyx_RaiseBufferIndexError(__pyx_t_8);
12428  __PYX_ERR(0, 532, __pyx_L1_error)
12429  }
12430  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12431 
12432  /* "subsurfaceTransportFunctions.pyx":536
12433  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12434  * cdef int eN,eN_neighbor,ii,I,i,ebN
12435  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
12436  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12437  * #for averaging/integration weights
12438  */
12439  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12440  __Pyx_GOTREF(__pyx_t_5);
12441  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
12442  __Pyx_GOTREF(__pyx_t_1);
12443  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12444  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12445  __Pyx_GOTREF(__pyx_t_5);
12446  __pyx_t_4 = NULL;
12447  __pyx_t_8 = 0;
12448  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
12449  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
12450  if (likely(__pyx_t_4)) {
12451  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12452  __Pyx_INCREF(__pyx_t_4);
12453  __Pyx_INCREF(function);
12454  __Pyx_DECREF_SET(__pyx_t_1, function);
12455  __pyx_t_8 = 1;
12456  }
12457  }
12458  #if CYTHON_FAST_PYCALL
12459  if (PyFunction_Check(__pyx_t_1)) {
12460  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12461  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12462  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12463  __Pyx_GOTREF(__pyx_t_2);
12464  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12465  } else
12466  #endif
12467  #if CYTHON_FAST_PYCCALL
12468  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
12469  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12470  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12471  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12472  __Pyx_GOTREF(__pyx_t_2);
12473  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12474  } else
12475  #endif
12476  {
12477  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
12478  __Pyx_GOTREF(__pyx_t_9);
12479  if (__pyx_t_4) {
12480  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
12481  }
12482  __Pyx_GIVEREF(__pyx_t_5);
12483  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
12484  __Pyx_INCREF(__pyx_n_s_d);
12485  __Pyx_GIVEREF(__pyx_n_s_d);
12486  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
12487  __pyx_t_5 = 0;
12488  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12489  __Pyx_GOTREF(__pyx_t_2);
12490  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12491  }
12492  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12493  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 536, __pyx_L1_error)
12494  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
12495  {
12496  __Pyx_BufFmt_StackElem __pyx_stack[1];
12497  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12498  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
12499  __PYX_ERR(0, 536, __pyx_L1_error)
12500  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
12501  }
12502  }
12503  __pyx_t_10 = 0;
12504  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
12505  __pyx_t_2 = 0;
12506 
12507  /* "subsurfaceTransportFunctions.pyx":537
12508  * cdef int eN,eN_neighbor,ii,I,i,ebN
12509  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
12510  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
12511  * #for averaging/integration weights
12512  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12513  */
12514  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12515  __Pyx_GOTREF(__pyx_t_1);
12516  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
12517  __Pyx_GOTREF(__pyx_t_9);
12518  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12519  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12520  __Pyx_GOTREF(__pyx_t_1);
12521  __pyx_t_5 = NULL;
12522  __pyx_t_8 = 0;
12523  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
12524  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
12525  if (likely(__pyx_t_5)) {
12526  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
12527  __Pyx_INCREF(__pyx_t_5);
12528  __Pyx_INCREF(function);
12529  __Pyx_DECREF_SET(__pyx_t_9, function);
12530  __pyx_t_8 = 1;
12531  }
12532  }
12533  #if CYTHON_FAST_PYCALL
12534  if (PyFunction_Check(__pyx_t_9)) {
12535  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12536  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12537  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12538  __Pyx_GOTREF(__pyx_t_2);
12539  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12540  } else
12541  #endif
12542  #if CYTHON_FAST_PYCCALL
12543  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
12544  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12545  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12546  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12547  __Pyx_GOTREF(__pyx_t_2);
12548  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12549  } else
12550  #endif
12551  {
12552  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
12553  __Pyx_GOTREF(__pyx_t_4);
12554  if (__pyx_t_5) {
12555  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12556  }
12557  __Pyx_GIVEREF(__pyx_t_1);
12558  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
12559  __Pyx_INCREF(__pyx_n_s_d);
12560  __Pyx_GIVEREF(__pyx_n_s_d);
12561  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
12562  __pyx_t_1 = 0;
12563  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12564  __Pyx_GOTREF(__pyx_t_2);
12565  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12566  }
12567  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12568  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 537, __pyx_L1_error)
12569  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12570  {
12571  __Pyx_BufFmt_StackElem __pyx_stack[1];
12572  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12573  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12574  __PYX_ERR(0, 537, __pyx_L1_error)
12575  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12576  }
12577  }
12578  __pyx_t_11 = 0;
12579  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12580  __pyx_t_2 = 0;
12581 
12582  /* "subsurfaceTransportFunctions.pyx":539
12583  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12584  * #for averaging/integration weights
12585  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12586  * cdef double weight=1.0,volFactor = 1.0
12587  * if nSpace == 2:
12588  */
12589  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12590  if (unlikely(__pyx_t_12 == 0)) {
12591  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12592  __PYX_ERR(0, 539, __pyx_L1_error)
12593  }
12594  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12595 
12596  /* "subsurfaceTransportFunctions.pyx":540
12597  * #for averaging/integration weights
12598  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12599  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12600  * if nSpace == 2:
12601  * volFactor = 0.5
12602  */
12603  __pyx_v_weight = 1.0;
12604  __pyx_v_volFactor = 1.0;
12605 
12606  /* "subsurfaceTransportFunctions.pyx":541
12607  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12608  * cdef double weight=1.0,volFactor = 1.0
12609  * if nSpace == 2: # <<<<<<<<<<<<<<
12610  * volFactor = 0.5
12611  * if nSpace == 3:
12612  */
12613  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12614  if (__pyx_t_6) {
12615 
12616  /* "subsurfaceTransportFunctions.pyx":542
12617  * cdef double weight=1.0,volFactor = 1.0
12618  * if nSpace == 2:
12619  * volFactor = 0.5 # <<<<<<<<<<<<<<
12620  * if nSpace == 3:
12621  * volFactor = 1.0/6.0
12622  */
12623  __pyx_v_volFactor = 0.5;
12624 
12625  /* "subsurfaceTransportFunctions.pyx":541
12626  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12627  * cdef double weight=1.0,volFactor = 1.0
12628  * if nSpace == 2: # <<<<<<<<<<<<<<
12629  * volFactor = 0.5
12630  * if nSpace == 3:
12631  */
12632  }
12633 
12634  /* "subsurfaceTransportFunctions.pyx":543
12635  * if nSpace == 2:
12636  * volFactor = 0.5
12637  * if nSpace == 3: # <<<<<<<<<<<<<<
12638  * volFactor = 1.0/6.0
12639  * #
12640  */
12641  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12642  if (__pyx_t_6) {
12643 
12644  /* "subsurfaceTransportFunctions.pyx":544
12645  * volFactor = 0.5
12646  * if nSpace == 3:
12647  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12648  * #
12649  * for eN in range(nElements_global):
12650  */
12651  __pyx_v_volFactor = (1.0 / 6.0);
12652 
12653  /* "subsurfaceTransportFunctions.pyx":543
12654  * if nSpace == 2:
12655  * volFactor = 0.5
12656  * if nSpace == 3: # <<<<<<<<<<<<<<
12657  * volFactor = 1.0/6.0
12658  * #
12659  */
12660  }
12661 
12662  /* "subsurfaceTransportFunctions.pyx":546
12663  * volFactor = 1.0/6.0
12664  * #
12665  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12666  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12667  * weight = nAvgWeight*volume
12668  */
12669  __pyx_t_8 = __pyx_v_nElements_global;
12670  __pyx_t_13 = __pyx_t_8;
12671  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12672  __pyx_v_eN = __pyx_t_14;
12673 
12674  /* "subsurfaceTransportFunctions.pyx":547
12675  * #
12676  * for eN in range(nElements_global):
12677  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12678  * weight = nAvgWeight*volume
12679  *
12680  */
12681  __pyx_t_7 = __pyx_v_eN;
12682  __pyx_t_15 = 0;
12683  __pyx_t_16 = -1;
12684  if (__pyx_t_7 < 0) {
12685  __pyx_t_7 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12686  if (unlikely(__pyx_t_7 < 0)) __pyx_t_16 = 0;
12687  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
12688  if (__pyx_t_15 < 0) {
12689  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12690  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
12691  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
12692  if (unlikely(__pyx_t_16 != -1)) {
12693  __Pyx_RaiseBufferIndexError(__pyx_t_16);
12694  __PYX_ERR(0, 547, __pyx_L1_error)
12695  }
12696  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12697 
12698  /* "subsurfaceTransportFunctions.pyx":548
12699  * for eN in range(nElements_global):
12700  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12701  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12702  *
12703  * for i in range(nDOF_test_element):
12704  */
12705  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12706 
12707  /* "subsurfaceTransportFunctions.pyx":550
12708  * weight = nAvgWeight*volume
12709  *
12710  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12711  * #nodal quadrature so diagonal
12712  * ##mass
12713  */
12714  __pyx_t_16 = __pyx_v_nDOF_test_element;
12715  __pyx_t_17 = __pyx_t_16;
12716  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
12717  __pyx_v_i = __pyx_t_18;
12718 
12719  /* "subsurfaceTransportFunctions.pyx":553
12720  * #nodal quadrature so diagonal
12721  * ##mass
12722  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
12723  * ##sources
12724  * elementResidual[eN,i] += weight*q_r[eN,i]
12725  */
12726  __pyx_t_15 = __pyx_v_eN;
12727  __pyx_t_7 = __pyx_v_i;
12728  __pyx_t_19 = -1;
12729  if (__pyx_t_15 < 0) {
12730  __pyx_t_15 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
12731  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 0;
12732  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_19 = 0;
12733  if (__pyx_t_7 < 0) {
12734  __pyx_t_7 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
12735  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 1;
12736  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_19 = 1;
12737  if (unlikely(__pyx_t_19 != -1)) {
12738  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12739  __PYX_ERR(0, 553, __pyx_L1_error)
12740  }
12741  __pyx_t_20 = __pyx_v_eN;
12742  __pyx_t_21 = __pyx_v_i;
12743  __pyx_t_19 = -1;
12744  if (__pyx_t_20 < 0) {
12745  __pyx_t_20 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12746  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
12747  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_19 = 0;
12748  if (__pyx_t_21 < 0) {
12749  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12750  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 1;
12751  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_19 = 1;
12752  if (unlikely(__pyx_t_19 != -1)) {
12753  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12754  __PYX_ERR(0, 553, __pyx_L1_error)
12755  }
12756  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
12757 
12758  /* "subsurfaceTransportFunctions.pyx":555
12759  * elementResidual[eN,i] += weight*q_mt[eN,i]
12760  * ##sources
12761  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
12762  *
12763  * #have to actually compute loop over other nodes for stiffness terms
12764  */
12765  __pyx_t_7 = __pyx_v_eN;
12766  __pyx_t_15 = __pyx_v_i;
12767  __pyx_t_19 = -1;
12768  if (__pyx_t_7 < 0) {
12769  __pyx_t_7 += __pyx_pybuffernd_q_r.diminfo[0].shape;
12770  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 0;
12771  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_19 = 0;
12772  if (__pyx_t_15 < 0) {
12773  __pyx_t_15 += __pyx_pybuffernd_q_r.diminfo[1].shape;
12774  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 1;
12775  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_19 = 1;
12776  if (unlikely(__pyx_t_19 != -1)) {
12777  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12778  __PYX_ERR(0, 555, __pyx_L1_error)
12779  }
12780  __pyx_t_21 = __pyx_v_eN;
12781  __pyx_t_20 = __pyx_v_i;
12782  __pyx_t_19 = -1;
12783  if (__pyx_t_21 < 0) {
12784  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12785  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 0;
12786  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_19 = 0;
12787  if (__pyx_t_20 < 0) {
12788  __pyx_t_20 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12789  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 1;
12790  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_19 = 1;
12791  if (unlikely(__pyx_t_19 != -1)) {
12792  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12793  __PYX_ERR(0, 555, __pyx_L1_error)
12794  }
12795  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_r.diminfo[1].strides)));
12796 
12797  /* "subsurfaceTransportFunctions.pyx":558
12798  *
12799  * #have to actually compute loop over other nodes for stiffness terms
12800  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12801  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12802  * for ii in range(nnz):
12803  */
12804  __pyx_t_19 = __pyx_v_nElementBoundaries_element;
12805  __pyx_t_22 = __pyx_t_19;
12806  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
12807  __pyx_v_ebN = __pyx_t_23;
12808 
12809  /* "subsurfaceTransportFunctions.pyx":560
12810  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
12811  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12812  * for ii in range(nnz): # <<<<<<<<<<<<<<
12813  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12814  * for I in range(nSpace):
12815  */
12816  __pyx_t_24 = __pyx_v_nnz;
12817  __pyx_t_25 = __pyx_t_24;
12818  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12819  __pyx_v_ii = __pyx_t_26;
12820 
12821  /* "subsurfaceTransportFunctions.pyx":561
12822  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12823  * for ii in range(nnz):
12824  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12825  * for I in range(nSpace):
12826  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12827  */
12828  __pyx_t_15 = __pyx_v_eN;
12829  __pyx_t_7 = __pyx_v_ebN;
12830  __pyx_t_20 = __pyx_v_ii;
12831  __pyx_t_27 = -1;
12832  if (__pyx_t_15 < 0) {
12833  __pyx_t_15 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
12834  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 0;
12835  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_27 = 0;
12836  if (__pyx_t_7 < 0) {
12837  __pyx_t_7 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
12838  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 1;
12839  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_27 = 1;
12840  if (__pyx_t_20 < 0) {
12841  __pyx_t_20 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
12842  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 2;
12843  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_27 = 2;
12844  if (unlikely(__pyx_t_27 != -1)) {
12845  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12846  __PYX_ERR(0, 561, __pyx_L1_error)
12847  }
12848  __pyx_t_21 = __pyx_v_eN;
12849  __pyx_t_28 = __pyx_v_ebN;
12850  __pyx_t_27 = -1;
12851  if (__pyx_t_21 < 0) {
12852  __pyx_t_21 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12853  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 0;
12854  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_27 = 0;
12855  if (__pyx_t_28 < 0) {
12856  __pyx_t_28 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12857  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 1;
12858  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_27 = 1;
12859  if (unlikely(__pyx_t_27 != -1)) {
12860  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12861  __PYX_ERR(0, 561, __pyx_L1_error)
12862  }
12863  __pyx_t_29 = __pyx_v_ii;
12864  __pyx_t_27 = -1;
12865  if (__pyx_t_29 < 0) {
12866  __pyx_t_29 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12867  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12868  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_27 = 0;
12869  if (unlikely(__pyx_t_27 != -1)) {
12870  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12871  __PYX_ERR(0, 561, __pyx_L1_error)
12872  }
12873  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12874  }
12875 
12876  /* "subsurfaceTransportFunctions.pyx":562
12877  * for ii in range(nnz):
12878  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12879  * for I in range(nSpace): # <<<<<<<<<<<<<<
12880  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12881  * #
12882  */
12883  __pyx_t_24 = __pyx_v_nSpace;
12884  __pyx_t_25 = __pyx_t_24;
12885  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12886  __pyx_v_I = __pyx_t_26;
12887 
12888  /* "subsurfaceTransportFunctions.pyx":563
12889  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12890  * for I in range(nSpace):
12891  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12892  * #
12893  * #accumulate advection and stiffness contributions
12894  */
12895  __pyx_t_28 = __pyx_v_eN;
12896  __pyx_t_21 = __pyx_v_ebN;
12897  __pyx_t_20 = __pyx_v_I;
12898  __pyx_t_27 = -1;
12899  if (__pyx_t_28 < 0) {
12900  __pyx_t_28 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
12901  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12902  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_27 = 0;
12903  if (__pyx_t_21 < 0) {
12904  __pyx_t_21 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
12905  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 1;
12906  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_27 = 1;
12907  if (__pyx_t_20 < 0) {
12908  __pyx_t_20 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
12909  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 2;
12910  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_27 = 2;
12911  if (unlikely(__pyx_t_27 != -1)) {
12912  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12913  __PYX_ERR(0, 563, __pyx_L1_error)
12914  }
12915  __pyx_t_7 = __pyx_v_eN;
12916  __pyx_t_15 = __pyx_v_ebN;
12917  __pyx_t_27 = -1;
12918  if (__pyx_t_7 < 0) {
12919  __pyx_t_7 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12920  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 0;
12921  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_27 = 0;
12922  if (__pyx_t_15 < 0) {
12923  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12924  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 1;
12925  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_27 = 1;
12926  if (unlikely(__pyx_t_27 != -1)) {
12927  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12928  __PYX_ERR(0, 563, __pyx_L1_error)
12929  }
12930  __pyx_t_29 = __pyx_v_I;
12931  __pyx_t_27 = -1;
12932  if (__pyx_t_29 < 0) {
12933  __pyx_t_29 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12934  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12935  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_27 = 0;
12936  if (unlikely(__pyx_t_27 != -1)) {
12937  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12938  __PYX_ERR(0, 563, __pyx_L1_error)
12939  }
12940  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12941  }
12942 
12943  /* "subsurfaceTransportFunctions.pyx":566
12944  * #
12945  * #accumulate advection and stiffness contributions
12946  * for I in range(nSpace): # <<<<<<<<<<<<<<
12947  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12948  * for ii in range(rowptr[I],rowptr[I+1]):
12949  */
12950  __pyx_t_24 = __pyx_v_nSpace;
12951  __pyx_t_25 = __pyx_t_24;
12952  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12953  __pyx_v_I = __pyx_t_26;
12954 
12955  /* "subsurfaceTransportFunctions.pyx":567
12956  * #accumulate advection and stiffness contributions
12957  * for I in range(nSpace):
12958  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12959  * for ii in range(rowptr[I],rowptr[I+1]):
12960  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12961  */
12962  __pyx_t_15 = __pyx_v_I;
12963  __pyx_t_27 = -1;
12964  if (__pyx_t_15 < 0) {
12965  __pyx_t_15 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12966  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 0;
12967  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_27 = 0;
12968  if (unlikely(__pyx_t_27 != -1)) {
12969  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12970  __PYX_ERR(0, 567, __pyx_L1_error)
12971  }
12972  __pyx_t_7 = __pyx_v_eN;
12973  __pyx_t_20 = __pyx_v_ebN;
12974  __pyx_t_21 = __pyx_v_i;
12975  __pyx_t_28 = __pyx_v_I;
12976  __pyx_t_27 = -1;
12977  if (__pyx_t_7 < 0) {
12978  __pyx_t_7 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12979  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 0;
12980  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_27 = 0;
12981  if (__pyx_t_20 < 0) {
12982  __pyx_t_20 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12983  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 1;
12984  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_27 = 1;
12985  if (__pyx_t_21 < 0) {
12986  __pyx_t_21 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12987  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 2;
12988  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_27 = 2;
12989  if (__pyx_t_28 < 0) {
12990  __pyx_t_28 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12991  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 3;
12992  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_27 = 3;
12993  if (unlikely(__pyx_t_27 != -1)) {
12994  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12995  __PYX_ERR(0, 567, __pyx_L1_error)
12996  }
12997  __pyx_t_29 = __pyx_v_eN;
12998  __pyx_t_30 = __pyx_v_i;
12999  __pyx_t_27 = -1;
13000  if (__pyx_t_29 < 0) {
13001  __pyx_t_29 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
13002  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
13003  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_27 = 0;
13004  if (__pyx_t_30 < 0) {
13005  __pyx_t_30 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
13006  if (unlikely(__pyx_t_30 < 0)) __pyx_t_27 = 1;
13007  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_27 = 1;
13008  if (unlikely(__pyx_t_27 != -1)) {
13009  __Pyx_RaiseBufferIndexError(__pyx_t_27);
13010  __PYX_ERR(0, 567, __pyx_L1_error)
13011  }
13012  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13013 
13014  /* "subsurfaceTransportFunctions.pyx":568
13015  * for I in range(nSpace):
13016  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
13017  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
13018  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
13019  * #I
13020  */
13021  __pyx_t_28 = (__pyx_v_I + 1);
13022  __pyx_t_27 = -1;
13023  if (__pyx_t_28 < 0) {
13024  __pyx_t_28 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13025  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
13026  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_27 = 0;
13027  if (unlikely(__pyx_t_27 != -1)) {
13028  __Pyx_RaiseBufferIndexError(__pyx_t_27);
13029  __PYX_ERR(0, 568, __pyx_L1_error)
13030  }
13031  __pyx_t_31 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13032  __pyx_t_28 = __pyx_v_I;
13033  __pyx_t_27 = -1;
13034  if (__pyx_t_28 < 0) {
13035  __pyx_t_28 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13036  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
13037  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_27 = 0;
13038  if (unlikely(__pyx_t_27 != -1)) {
13039  __Pyx_RaiseBufferIndexError(__pyx_t_27);
13040  __PYX_ERR(0, 568, __pyx_L1_error)
13041  }
13042  __pyx_t_32 = __pyx_t_31;
13043  for (__pyx_t_27 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_27 < __pyx_t_32; __pyx_t_27+=1) {
13044  __pyx_v_ii = __pyx_t_27;
13045 
13046  /* "subsurfaceTransportFunctions.pyx":569
13047  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
13048  * for ii in range(rowptr[I],rowptr[I+1]):
13049  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
13050  * #I
13051  * #j
13052  */
13053  __pyx_t_21 = __pyx_v_ii;
13054  __pyx_t_33 = -1;
13055  if (__pyx_t_21 < 0) {
13056  __pyx_t_21 += __pyx_pybuffernd_a_up.diminfo[0].shape;
13057  if (unlikely(__pyx_t_21 < 0)) __pyx_t_33 = 0;
13058  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_33 = 0;
13059  if (unlikely(__pyx_t_33 != -1)) {
13060  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13061  __PYX_ERR(0, 569, __pyx_L1_error)
13062  }
13063  __pyx_t_20 = __pyx_v_ii;
13064  __pyx_t_33 = -1;
13065  if (__pyx_t_20 < 0) {
13066  __pyx_t_20 += __pyx_pybuffernd_colind.diminfo[0].shape;
13067  if (unlikely(__pyx_t_20 < 0)) __pyx_t_33 = 0;
13068  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_33 = 0;
13069  if (unlikely(__pyx_t_33 != -1)) {
13070  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13071  __PYX_ERR(0, 569, __pyx_L1_error)
13072  }
13073  __pyx_t_7 = __pyx_v_eN;
13074  __pyx_t_15 = __pyx_v_ebN;
13075  __pyx_t_30 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_colind.diminfo[0].strides));
13076  __pyx_t_33 = -1;
13077  if (__pyx_t_7 < 0) {
13078  __pyx_t_7 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
13079  if (unlikely(__pyx_t_7 < 0)) __pyx_t_33 = 0;
13080  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_33 = 0;
13081  if (__pyx_t_15 < 0) {
13082  __pyx_t_15 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
13083  if (unlikely(__pyx_t_15 < 0)) __pyx_t_33 = 1;
13084  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_33 = 1;
13085  if (__pyx_t_30 < 0) {
13086  __pyx_t_30 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
13087  if (unlikely(__pyx_t_30 < 0)) __pyx_t_33 = 2;
13088  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_33 = 2;
13089  if (unlikely(__pyx_t_33 != -1)) {
13090  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13091  __PYX_ERR(0, 569, __pyx_L1_error)
13092  }
13093  __pyx_t_29 = __pyx_v_eN;
13094  __pyx_t_34 = __pyx_v_ebN;
13095  __pyx_t_35 = __pyx_v_i;
13096  __pyx_t_36 = __pyx_v_I;
13097  __pyx_t_33 = -1;
13098  if (__pyx_t_29 < 0) {
13099  __pyx_t_29 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
13100  if (unlikely(__pyx_t_29 < 0)) __pyx_t_33 = 0;
13101  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_33 = 0;
13102  if (__pyx_t_34 < 0) {
13103  __pyx_t_34 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
13104  if (unlikely(__pyx_t_34 < 0)) __pyx_t_33 = 1;
13105  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_33 = 1;
13106  if (__pyx_t_35 < 0) {
13107  __pyx_t_35 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
13108  if (unlikely(__pyx_t_35 < 0)) __pyx_t_33 = 2;
13109  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_33 = 2;
13110  if (__pyx_t_36 < 0) {
13111  __pyx_t_36 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
13112  if (unlikely(__pyx_t_36 < 0)) __pyx_t_33 = 3;
13113  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_33 = 3;
13114  if (unlikely(__pyx_t_33 != -1)) {
13115  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13116  __PYX_ERR(0, 569, __pyx_L1_error)
13117  }
13118  __pyx_t_37 = __pyx_v_eN;
13119  __pyx_t_38 = __pyx_v_i;
13120  __pyx_t_33 = -1;
13121  if (__pyx_t_37 < 0) {
13122  __pyx_t_37 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
13123  if (unlikely(__pyx_t_37 < 0)) __pyx_t_33 = 0;
13124  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_33 = 0;
13125  if (__pyx_t_38 < 0) {
13126  __pyx_t_38 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
13127  if (unlikely(__pyx_t_38 < 0)) __pyx_t_33 = 1;
13128  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_33 = 1;
13129  if (unlikely(__pyx_t_33 != -1)) {
13130  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13131  __PYX_ERR(0, 569, __pyx_L1_error)
13132  }
13133  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_36, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13134  }
13135  }
13136  }
13137  }
13138  }
13139 
13140  /* "subsurfaceTransportFunctions.pyx":486
13141  * #eN for upwind
13142  *
13143  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13144  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13145  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13146  */
13147 
13148  /* function exit code */
13149  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13150  goto __pyx_L0;
13151  __pyx_L1_error:;
13152  __Pyx_XDECREF(__pyx_t_1);
13153  __Pyx_XDECREF(__pyx_t_2);
13154  __Pyx_XDECREF(__pyx_t_4);
13155  __Pyx_XDECREF(__pyx_t_5);
13156  __Pyx_XDECREF(__pyx_t_9);
13157  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13158  __Pyx_PyThreadState_declare
13159  __Pyx_PyThreadState_assign
13160  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13161  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13162  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13163  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13164  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13165  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13166  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13167  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13168  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13169  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13170  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13171  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13172  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13173  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13174  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13175  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13176  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13177  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13178  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13179  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13180  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13181  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
13182  __pyx_r = NULL;
13183  goto __pyx_L2;
13184  __pyx_L0:;
13185  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13186  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13187  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13188  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13189  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13190  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13191  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13192  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13193  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13194  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13195  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13196  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13197  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13198  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13199  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13200  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13201  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13202  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13203  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13204  __pyx_L2:;
13205  __Pyx_XDECREF(__pyx_v_q);
13206  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
13207  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
13208  __Pyx_XGIVEREF(__pyx_r);
13209  __Pyx_RefNannyFinishContext();
13210  return __pyx_r;
13211 }
13212 
13213 /* "subsurfaceTransportFunctions.pyx":574
13214  * #i
13215  * #eN
13216  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13217  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13218  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13219  */
13220 
13221 /* Python wrapper */
13222 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13223 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
13224 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
13225 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13226  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
13227  PyArrayObject *__pyx_v_rowptr = 0;
13228  PyArrayObject *__pyx_v_colind = 0;
13229  int __pyx_v_nSpace;
13230  int __pyx_v_nElements_global;
13231  int __pyx_v_nElementBoundaries_element;
13232  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
13233  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
13234  int __pyx_v_nDOF_test_element;
13235  int __pyx_v_nDOF_trial_element;
13236  PyArrayObject *__pyx_v_q_u = 0;
13237  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
13238  PyArrayObject *__pyx_v_q_grad_w = 0;
13239  PyArrayObject *__pyx_v_q_grad_v = 0;
13240  PyArrayObject *__pyx_v_q_detJ = 0;
13241  PyArrayObject *__pyx_v_q_m = 0;
13242  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
13243  PyArrayObject *__pyx_v_q_mt = 0;
13244  PyArrayObject *__pyx_v_q_dmt = 0;
13245  PyArrayObject *__pyx_v_q_r = 0;
13246  PyArrayObject *__pyx_v_q_kr = 0;
13247  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
13248  PyArrayObject *__pyx_v_q_kr_up = 0;
13249  PyArrayObject *__pyx_v_q_flin = 0;
13250  PyArrayObject *__pyx_v_q_alin = 0;
13251  PyArrayObject *__pyx_v_elementJacobian = 0;
13252  int __pyx_lineno = 0;
13253  const char *__pyx_filename = NULL;
13254  int __pyx_clineno = 0;
13255  PyObject *__pyx_r = 0;
13256  __Pyx_RefNannyDeclarations
13257  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
13258  {
13259  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
13260  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
13261  if (unlikely(__pyx_kwds)) {
13262  Py_ssize_t kw_args;
13263  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13264  switch (pos_args) {
13265  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13266  CYTHON_FALLTHROUGH;
13267  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13268  CYTHON_FALLTHROUGH;
13269  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13270  CYTHON_FALLTHROUGH;
13271  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13272  CYTHON_FALLTHROUGH;
13273  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13274  CYTHON_FALLTHROUGH;
13275  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13276  CYTHON_FALLTHROUGH;
13277  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13278  CYTHON_FALLTHROUGH;
13279  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13280  CYTHON_FALLTHROUGH;
13281  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13282  CYTHON_FALLTHROUGH;
13283  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13284  CYTHON_FALLTHROUGH;
13285  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13286  CYTHON_FALLTHROUGH;
13287  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13288  CYTHON_FALLTHROUGH;
13289  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13290  CYTHON_FALLTHROUGH;
13291  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13292  CYTHON_FALLTHROUGH;
13293  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13294  CYTHON_FALLTHROUGH;
13295  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13296  CYTHON_FALLTHROUGH;
13297  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13298  CYTHON_FALLTHROUGH;
13299  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13300  CYTHON_FALLTHROUGH;
13301  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13302  CYTHON_FALLTHROUGH;
13303  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13304  CYTHON_FALLTHROUGH;
13305  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13306  CYTHON_FALLTHROUGH;
13307  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13308  CYTHON_FALLTHROUGH;
13309  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13310  CYTHON_FALLTHROUGH;
13311  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13312  CYTHON_FALLTHROUGH;
13313  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13314  CYTHON_FALLTHROUGH;
13315  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13316  CYTHON_FALLTHROUGH;
13317  case 0: break;
13318  default: goto __pyx_L5_argtuple_error;
13319  }
13320  kw_args = PyDict_Size(__pyx_kwds);
13321  switch (pos_args) {
13322  case 0:
13323  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
13324  else goto __pyx_L5_argtuple_error;
13325  CYTHON_FALLTHROUGH;
13326  case 1:
13327  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
13328  else {
13329  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); __PYX_ERR(0, 574, __pyx_L3_error)
13330  }
13331  CYTHON_FALLTHROUGH;
13332  case 2:
13333  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
13334  else {
13335  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); __PYX_ERR(0, 574, __pyx_L3_error)
13336  }
13337  CYTHON_FALLTHROUGH;
13338  case 3:
13339  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
13340  else {
13341  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); __PYX_ERR(0, 574, __pyx_L3_error)
13342  }
13343  CYTHON_FALLTHROUGH;
13344  case 4:
13345  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
13346  else {
13347  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); __PYX_ERR(0, 574, __pyx_L3_error)
13348  }
13349  CYTHON_FALLTHROUGH;
13350  case 5:
13351  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
13352  else {
13353  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); __PYX_ERR(0, 574, __pyx_L3_error)
13354  }
13355  CYTHON_FALLTHROUGH;
13356  case 6:
13357  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
13358  else {
13359  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); __PYX_ERR(0, 574, __pyx_L3_error)
13360  }
13361  CYTHON_FALLTHROUGH;
13362  case 7:
13363  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
13364  else {
13365  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); __PYX_ERR(0, 574, __pyx_L3_error)
13366  }
13367  CYTHON_FALLTHROUGH;
13368  case 8:
13369  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
13370  else {
13371  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); __PYX_ERR(0, 574, __pyx_L3_error)
13372  }
13373  CYTHON_FALLTHROUGH;
13374  case 9:
13375  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
13376  else {
13377  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); __PYX_ERR(0, 574, __pyx_L3_error)
13378  }
13379  CYTHON_FALLTHROUGH;
13380  case 10:
13381  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
13382  else {
13383  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); __PYX_ERR(0, 574, __pyx_L3_error)
13384  }
13385  CYTHON_FALLTHROUGH;
13386  case 11:
13387  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
13388  else {
13389  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); __PYX_ERR(0, 574, __pyx_L3_error)
13390  }
13391  CYTHON_FALLTHROUGH;
13392  case 12:
13393  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
13394  else {
13395  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); __PYX_ERR(0, 574, __pyx_L3_error)
13396  }
13397  CYTHON_FALLTHROUGH;
13398  case 13:
13399  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
13400  else {
13401  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); __PYX_ERR(0, 574, __pyx_L3_error)
13402  }
13403  CYTHON_FALLTHROUGH;
13404  case 14:
13405  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
13406  else {
13407  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); __PYX_ERR(0, 574, __pyx_L3_error)
13408  }
13409  CYTHON_FALLTHROUGH;
13410  case 15:
13411  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
13412  else {
13413  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); __PYX_ERR(0, 574, __pyx_L3_error)
13414  }
13415  CYTHON_FALLTHROUGH;
13416  case 16:
13417  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
13418  else {
13419  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); __PYX_ERR(0, 574, __pyx_L3_error)
13420  }
13421  CYTHON_FALLTHROUGH;
13422  case 17:
13423  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
13424  else {
13425  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); __PYX_ERR(0, 574, __pyx_L3_error)
13426  }
13427  CYTHON_FALLTHROUGH;
13428  case 18:
13429  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
13430  else {
13431  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); __PYX_ERR(0, 574, __pyx_L3_error)
13432  }
13433  CYTHON_FALLTHROUGH;
13434  case 19:
13435  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
13436  else {
13437  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); __PYX_ERR(0, 574, __pyx_L3_error)
13438  }
13439  CYTHON_FALLTHROUGH;
13440  case 20:
13441  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
13442  else {
13443  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); __PYX_ERR(0, 574, __pyx_L3_error)
13444  }
13445  CYTHON_FALLTHROUGH;
13446  case 21:
13447  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
13448  else {
13449  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); __PYX_ERR(0, 574, __pyx_L3_error)
13450  }
13451  CYTHON_FALLTHROUGH;
13452  case 22:
13453  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
13454  else {
13455  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); __PYX_ERR(0, 574, __pyx_L3_error)
13456  }
13457  CYTHON_FALLTHROUGH;
13458  case 23:
13459  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
13460  else {
13461  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); __PYX_ERR(0, 574, __pyx_L3_error)
13462  }
13463  CYTHON_FALLTHROUGH;
13464  case 24:
13465  if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
13466  else {
13467  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); __PYX_ERR(0, 574, __pyx_L3_error)
13468  }
13469  CYTHON_FALLTHROUGH;
13470  case 25:
13471  if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
13472  else {
13473  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); __PYX_ERR(0, 574, __pyx_L3_error)
13474  }
13475  }
13476  if (unlikely(kw_args > 0)) {
13477  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
13478  }
13479  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
13480  goto __pyx_L5_argtuple_error;
13481  } else {
13482  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13483  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13484  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13485  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13486  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13487  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13488  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13489  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13490  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13491  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13492  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13493  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13494  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13495  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13496  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13497  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13498  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13499  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13500  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13501  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13502  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13503  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13504  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13505  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13506  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13507  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13508  }
13509  __pyx_v_gravity = ((PyArrayObject *)values[0]);
13510  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
13511  __pyx_v_colind = ((PyArrayObject *)values[2]);
13512  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L3_error)
13513  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L3_error)
13514  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error)
13515  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
13516  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
13517  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L3_error)
13518  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L3_error)
13519  __pyx_v_q_u = ((PyArrayObject *)values[10]);
13520  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
13521  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
13522  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
13523  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
13524  __pyx_v_q_m = ((PyArrayObject *)values[15]);
13525  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
13526  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
13527  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
13528  __pyx_v_q_r = ((PyArrayObject *)values[19]);
13529  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
13530  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
13531  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
13532  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
13533  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
13534  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
13535  }
13536  goto __pyx_L4_argument_unpacking_done;
13537  __pyx_L5_argtuple_error:;
13538  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 574, __pyx_L3_error)
13539  __pyx_L3_error:;
13540  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
13541  __Pyx_RefNannyFinishContext();
13542  return NULL;
13543  __pyx_L4_argument_unpacking_done:;
13544  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 574, __pyx_L1_error)
13545  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 575, __pyx_L1_error)
13546  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 576, __pyx_L1_error)
13547  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 581, __pyx_L1_error)
13548  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 582, __pyx_L1_error)
13549  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 586, __pyx_L1_error)
13550  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 587, __pyx_L1_error)
13551  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 588, __pyx_L1_error)
13552  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) __PYX_ERR(0, 589, __pyx_L1_error)
13553  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 591, __pyx_L1_error)
13554  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
13555  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) __PYX_ERR(0, 593, __pyx_L1_error)
13556  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
13557  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) __PYX_ERR(0, 595, __pyx_L1_error)
13558  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 596, __pyx_L1_error)
13559  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 597, __pyx_L1_error)
13560  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 598, __pyx_L1_error)
13561  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 599, __pyx_L1_error)
13562  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 602, __pyx_L1_error)
13563  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 603, __pyx_L1_error)
13564  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) __PYX_ERR(0, 605, __pyx_L1_error)
13565  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
13566 
13567  /* function exit code */
13568  goto __pyx_L0;
13569  __pyx_L1_error:;
13570  __pyx_r = NULL;
13571  __pyx_L0:;
13572  __Pyx_RefNannyFinishContext();
13573  return __pyx_r;
13574 }
13575 
13576 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) {
13577  CYTHON_UNUSED int __pyx_v_upwindFlag;
13578  CYTHON_UNUSED int __pyx_v_picard;
13579  PyObject *__pyx_v_q = NULL;
13580  int __pyx_v_nnz;
13581  int __pyx_v_eN;
13582  int __pyx_v_ii;
13583  int __pyx_v_I;
13584  PyArrayObject *__pyx_v_a_up = 0;
13585  PyArrayObject *__pyx_v_f_up = 0;
13586  double __pyx_v_nAvgWeight;
13587  double __pyx_v_weight;
13588  double __pyx_v_volFactor;
13589  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
13590  double __pyx_v_volume;
13591  int __pyx_v_i;
13592  int __pyx_v_ebN;
13593  int __pyx_v_j;
13594  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
13595  __Pyx_Buffer __pyx_pybuffer_a_up;
13596  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
13597  __Pyx_Buffer __pyx_pybuffer_colind;
13598  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
13599  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
13600  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
13601  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
13602  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
13603  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
13604  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
13605  __Pyx_Buffer __pyx_pybuffer_f_up;
13606  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
13607  __Pyx_Buffer __pyx_pybuffer_gravity;
13608  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
13609  __Pyx_Buffer __pyx_pybuffer_q_alin;
13610  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
13611  __Pyx_Buffer __pyx_pybuffer_q_detJ;
13612  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
13613  __Pyx_Buffer __pyx_pybuffer_q_dkr;
13614  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
13615  __Pyx_Buffer __pyx_pybuffer_q_dm;
13616  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
13617  __Pyx_Buffer __pyx_pybuffer_q_dmt;
13618  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
13619  __Pyx_Buffer __pyx_pybuffer_q_flin;
13620  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
13621  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
13622  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
13623  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
13624  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
13625  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
13626  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
13627  __Pyx_Buffer __pyx_pybuffer_q_kr;
13628  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
13629  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
13630  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
13631  __Pyx_Buffer __pyx_pybuffer_q_m;
13632  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
13633  __Pyx_Buffer __pyx_pybuffer_q_mt;
13634  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
13635  __Pyx_Buffer __pyx_pybuffer_q_r;
13636  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
13637  __Pyx_Buffer __pyx_pybuffer_q_u;
13638  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
13639  __Pyx_Buffer __pyx_pybuffer_rowptr;
13640  PyObject *__pyx_r = NULL;
13641  __Pyx_RefNannyDeclarations
13642  PyObject *__pyx_t_1 = NULL;
13643  PyObject *__pyx_t_2 = NULL;
13644  Py_ssize_t __pyx_t_3;
13645  PyObject *__pyx_t_4 = NULL;
13646  PyObject *__pyx_t_5 = NULL;
13647  int __pyx_t_6;
13648  Py_ssize_t __pyx_t_7;
13649  int __pyx_t_8;
13650  PyObject *__pyx_t_9 = NULL;
13651  PyArrayObject *__pyx_t_10 = NULL;
13652  PyArrayObject *__pyx_t_11 = NULL;
13653  double __pyx_t_12;
13654  int __pyx_t_13;
13655  int __pyx_t_14;
13656  Py_ssize_t __pyx_t_15;
13657  int __pyx_t_16;
13658  int __pyx_t_17;
13659  int __pyx_t_18;
13660  int __pyx_t_19;
13661  Py_ssize_t __pyx_t_20;
13662  Py_ssize_t __pyx_t_21;
13663  Py_ssize_t __pyx_t_22;
13664  int __pyx_t_23;
13665  int __pyx_t_24;
13666  int __pyx_t_25;
13667  int __pyx_t_26;
13668  int __pyx_t_27;
13669  int __pyx_t_28;
13670  Py_ssize_t __pyx_t_29;
13671  int __pyx_t_30;
13672  int __pyx_t_31;
13673  int __pyx_t_32;
13674  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_33;
13675  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_34;
13676  int __pyx_t_35;
13677  Py_ssize_t __pyx_t_36;
13678  Py_ssize_t __pyx_t_37;
13679  Py_ssize_t __pyx_t_38;
13680  Py_ssize_t __pyx_t_39;
13681  Py_ssize_t __pyx_t_40;
13682  Py_ssize_t __pyx_t_41;
13683  Py_ssize_t __pyx_t_42;
13684  Py_ssize_t __pyx_t_43;
13685  int __pyx_lineno = 0;
13686  const char *__pyx_filename = NULL;
13687  int __pyx_clineno = 0;
13688  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
13689  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
13690  __pyx_pybuffer_a_up.refcount = 0;
13691  __pyx_pybuffernd_a_up.data = NULL;
13692  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
13693  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
13694  __pyx_pybuffer_f_up.refcount = 0;
13695  __pyx_pybuffernd_f_up.data = NULL;
13696  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
13697  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
13698  __pyx_pybuffer_gravity.refcount = 0;
13699  __pyx_pybuffernd_gravity.data = NULL;
13700  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
13701  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
13702  __pyx_pybuffer_rowptr.refcount = 0;
13703  __pyx_pybuffernd_rowptr.data = NULL;
13704  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
13705  __pyx_pybuffer_colind.pybuffer.buf = NULL;
13706  __pyx_pybuffer_colind.refcount = 0;
13707  __pyx_pybuffernd_colind.data = NULL;
13708  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
13709  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
13710  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
13711  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
13712  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
13713  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
13714  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
13715  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
13716  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
13717  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
13718  __pyx_pybuffer_q_u.refcount = 0;
13719  __pyx_pybuffernd_q_u.data = NULL;
13720  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
13721  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
13722  __pyx_pybuffer_q_grad_u.refcount = 0;
13723  __pyx_pybuffernd_q_grad_u.data = NULL;
13724  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
13725  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
13726  __pyx_pybuffer_q_grad_w.refcount = 0;
13727  __pyx_pybuffernd_q_grad_w.data = NULL;
13728  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
13729  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
13730  __pyx_pybuffer_q_grad_v.refcount = 0;
13731  __pyx_pybuffernd_q_grad_v.data = NULL;
13732  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
13733  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
13734  __pyx_pybuffer_q_detJ.refcount = 0;
13735  __pyx_pybuffernd_q_detJ.data = NULL;
13736  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
13737  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
13738  __pyx_pybuffer_q_m.refcount = 0;
13739  __pyx_pybuffernd_q_m.data = NULL;
13740  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
13741  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
13742  __pyx_pybuffer_q_dm.refcount = 0;
13743  __pyx_pybuffernd_q_dm.data = NULL;
13744  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
13745  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
13746  __pyx_pybuffer_q_mt.refcount = 0;
13747  __pyx_pybuffernd_q_mt.data = NULL;
13748  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
13749  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
13750  __pyx_pybuffer_q_dmt.refcount = 0;
13751  __pyx_pybuffernd_q_dmt.data = NULL;
13752  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
13753  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
13754  __pyx_pybuffer_q_r.refcount = 0;
13755  __pyx_pybuffernd_q_r.data = NULL;
13756  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
13757  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
13758  __pyx_pybuffer_q_kr.refcount = 0;
13759  __pyx_pybuffernd_q_kr.data = NULL;
13760  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
13761  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
13762  __pyx_pybuffer_q_dkr.refcount = 0;
13763  __pyx_pybuffernd_q_dkr.data = NULL;
13764  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
13765  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
13766  __pyx_pybuffer_q_kr_up.refcount = 0;
13767  __pyx_pybuffernd_q_kr_up.data = NULL;
13768  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
13769  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
13770  __pyx_pybuffer_q_flin.refcount = 0;
13771  __pyx_pybuffernd_q_flin.data = NULL;
13772  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
13773  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
13774  __pyx_pybuffer_q_alin.refcount = 0;
13775  __pyx_pybuffernd_q_alin.data = NULL;
13776  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
13777  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
13778  __pyx_pybuffer_elementJacobian.refcount = 0;
13779  __pyx_pybuffernd_elementJacobian.data = NULL;
13780  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
13781  {
13782  __Pyx_BufFmt_StackElem __pyx_stack[1];
13783  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13784  }
13785  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
13786  {
13787  __Pyx_BufFmt_StackElem __pyx_stack[1];
13788  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13789  }
13790  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
13791  {
13792  __Pyx_BufFmt_StackElem __pyx_stack[1];
13793  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13794  }
13795  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
13796  {
13797  __Pyx_BufFmt_StackElem __pyx_stack[1];
13798  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13799  }
13800  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
13801  {
13802  __Pyx_BufFmt_StackElem __pyx_stack[1];
13803  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13804  }
13805  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
13806  {
13807  __Pyx_BufFmt_StackElem __pyx_stack[1];
13808  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13809  }
13810  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
13811  {
13812  __Pyx_BufFmt_StackElem __pyx_stack[1];
13813  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13814  }
13815  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
13816  {
13817  __Pyx_BufFmt_StackElem __pyx_stack[1];
13818  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13819  }
13820  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
13821  {
13822  __Pyx_BufFmt_StackElem __pyx_stack[1];
13823  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13824  }
13825  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
13826  {
13827  __Pyx_BufFmt_StackElem __pyx_stack[1];
13828  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13829  }
13830  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
13831  {
13832  __Pyx_BufFmt_StackElem __pyx_stack[1];
13833  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13834  }
13835  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
13836  {
13837  __Pyx_BufFmt_StackElem __pyx_stack[1];
13838  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13839  }
13840  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
13841  {
13842  __Pyx_BufFmt_StackElem __pyx_stack[1];
13843  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13844  }
13845  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
13846  {
13847  __Pyx_BufFmt_StackElem __pyx_stack[1];
13848  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13849  }
13850  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
13851  {
13852  __Pyx_BufFmt_StackElem __pyx_stack[1];
13853  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13854  }
13855  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
13856  {
13857  __Pyx_BufFmt_StackElem __pyx_stack[1];
13858  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13859  }
13860  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
13861  {
13862  __Pyx_BufFmt_StackElem __pyx_stack[1];
13863  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13864  }
13865  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
13866  {
13867  __Pyx_BufFmt_StackElem __pyx_stack[1];
13868  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13869  }
13870  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
13871  {
13872  __Pyx_BufFmt_StackElem __pyx_stack[1];
13873  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13874  }
13875  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
13876  {
13877  __Pyx_BufFmt_StackElem __pyx_stack[1];
13878  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13879  }
13880  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
13881  {
13882  __Pyx_BufFmt_StackElem __pyx_stack[1];
13883  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13884  }
13885  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
13886 
13887  /* "subsurfaceTransportFunctions.pyx":620
13888  *
13889  * """
13890  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
13891  * cdef int picard = 1
13892  * #check some sizes
13893  */
13894  __pyx_v_upwindFlag = 1;
13895 
13896  /* "subsurfaceTransportFunctions.pyx":621
13897  * """
13898  * cdef int upwindFlag = 1
13899  * cdef int picard = 1 # <<<<<<<<<<<<<<
13900  * #check some sizes
13901  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13902  */
13903  __pyx_v_picard = 1;
13904 
13905  /* "subsurfaceTransportFunctions.pyx":623
13906  * cdef int picard = 1
13907  * #check some sizes
13908  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13909  * assert q.shape[1] == nSpace+1
13910  * assert nDOF_test_element == nSpace+1
13911  */
13912  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13913  __Pyx_GOTREF(__pyx_t_1);
13914  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
13915  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
13916  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
13917  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
13918  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
13919  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
13920  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
13921  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
13922  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
13923  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
13924  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
13925  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
13926  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
13927  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
13928  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
13929  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13930  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13931  for (;;) {
13932  if (__pyx_t_3 >= 5) break;
13933  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13934  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13935  #else
13936  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13937  __Pyx_GOTREF(__pyx_t_1);
13938  #endif
13939  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
13940  __pyx_t_1 = 0;
13941 
13942  /* "subsurfaceTransportFunctions.pyx":624
13943  * #check some sizes
13944  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13945  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
13946  * assert nDOF_test_element == nSpace+1
13947  * cdef int nnz = rowptr[nSpace]
13948  */
13949  #ifndef CYTHON_WITHOUT_ASSERTIONS
13950  if (unlikely(!Py_OptimizeFlag)) {
13951  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13952  __Pyx_GOTREF(__pyx_t_1);
13953  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
13954  __Pyx_GOTREF(__pyx_t_4);
13955  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13956  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13957  __Pyx_GOTREF(__pyx_t_1);
13958  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
13959  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13960  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13961  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 624, __pyx_L1_error)
13962  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13963  if (unlikely(!__pyx_t_6)) {
13964  PyErr_SetNone(PyExc_AssertionError);
13965  __PYX_ERR(0, 624, __pyx_L1_error)
13966  }
13967  }
13968  #endif
13969 
13970  /* "subsurfaceTransportFunctions.pyx":623
13971  * cdef int picard = 1
13972  * #check some sizes
13973  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13974  * assert q.shape[1] == nSpace+1
13975  * assert nDOF_test_element == nSpace+1
13976  */
13977  }
13978  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13979 
13980  /* "subsurfaceTransportFunctions.pyx":625
13981  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13982  * assert q.shape[1] == nSpace+1
13983  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
13984  * cdef int nnz = rowptr[nSpace]
13985  * #temporaries
13986  */
13987  #ifndef CYTHON_WITHOUT_ASSERTIONS
13988  if (unlikely(!Py_OptimizeFlag)) {
13989  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
13990  PyErr_SetNone(PyExc_AssertionError);
13991  __PYX_ERR(0, 625, __pyx_L1_error)
13992  }
13993  }
13994  #endif
13995 
13996  /* "subsurfaceTransportFunctions.pyx":626
13997  * assert q.shape[1] == nSpace+1
13998  * assert nDOF_test_element == nSpace+1
13999  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
14000  * #temporaries
14001  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
14002  */
14003  __pyx_t_7 = __pyx_v_nSpace;
14004  __pyx_t_8 = -1;
14005  if (__pyx_t_7 < 0) {
14006  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14007  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
14008  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
14009  if (unlikely(__pyx_t_8 != -1)) {
14010  __Pyx_RaiseBufferIndexError(__pyx_t_8);
14011  __PYX_ERR(0, 626, __pyx_L1_error)
14012  }
14013  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14014 
14015  /* "subsurfaceTransportFunctions.pyx":630
14016  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
14017  * cdef int eN,eN_neighbor,ii,I
14018  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
14019  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14020  * #for averaging/integration weights
14021  */
14022  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
14023  __Pyx_GOTREF(__pyx_t_5);
14024  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
14025  __Pyx_GOTREF(__pyx_t_1);
14026  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14027  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
14028  __Pyx_GOTREF(__pyx_t_5);
14029  __pyx_t_4 = NULL;
14030  __pyx_t_8 = 0;
14031  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
14032  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
14033  if (likely(__pyx_t_4)) {
14034  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
14035  __Pyx_INCREF(__pyx_t_4);
14036  __Pyx_INCREF(function);
14037  __Pyx_DECREF_SET(__pyx_t_1, function);
14038  __pyx_t_8 = 1;
14039  }
14040  }
14041  #if CYTHON_FAST_PYCALL
14042  if (PyFunction_Check(__pyx_t_1)) {
14043  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
14044  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14045  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14046  __Pyx_GOTREF(__pyx_t_2);
14047  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14048  } else
14049  #endif
14050  #if CYTHON_FAST_PYCCALL
14051  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
14052  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
14053  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14054  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14055  __Pyx_GOTREF(__pyx_t_2);
14056  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14057  } else
14058  #endif
14059  {
14060  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error)
14061  __Pyx_GOTREF(__pyx_t_9);
14062  if (__pyx_t_4) {
14063  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
14064  }
14065  __Pyx_GIVEREF(__pyx_t_5);
14066  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
14067  __Pyx_INCREF(__pyx_n_s_d);
14068  __Pyx_GIVEREF(__pyx_n_s_d);
14069  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
14070  __pyx_t_5 = 0;
14071  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
14072  __Pyx_GOTREF(__pyx_t_2);
14073  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14074  }
14075  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14076  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 630, __pyx_L1_error)
14077  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
14078  {
14079  __Pyx_BufFmt_StackElem __pyx_stack[1];
14080  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14081  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
14082  __PYX_ERR(0, 630, __pyx_L1_error)
14083  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
14084  }
14085  }
14086  __pyx_t_10 = 0;
14087  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
14088  __pyx_t_2 = 0;
14089 
14090  /* "subsurfaceTransportFunctions.pyx":631
14091  * cdef int eN,eN_neighbor,ii,I
14092  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
14093  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
14094  * #for averaging/integration weights
14095  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14096  */
14097  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14098  __Pyx_GOTREF(__pyx_t_1);
14099  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
14100  __Pyx_GOTREF(__pyx_t_9);
14101  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14102  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14103  __Pyx_GOTREF(__pyx_t_1);
14104  __pyx_t_5 = NULL;
14105  __pyx_t_8 = 0;
14106  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14107  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
14108  if (likely(__pyx_t_5)) {
14109  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14110  __Pyx_INCREF(__pyx_t_5);
14111  __Pyx_INCREF(function);
14112  __Pyx_DECREF_SET(__pyx_t_9, function);
14113  __pyx_t_8 = 1;
14114  }
14115  }
14116  #if CYTHON_FAST_PYCALL
14117  if (PyFunction_Check(__pyx_t_9)) {
14118  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14119  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14120  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14121  __Pyx_GOTREF(__pyx_t_2);
14122  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14123  } else
14124  #endif
14125  #if CYTHON_FAST_PYCCALL
14126  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14127  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14128  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14129  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14130  __Pyx_GOTREF(__pyx_t_2);
14131  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14132  } else
14133  #endif
14134  {
14135  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
14136  __Pyx_GOTREF(__pyx_t_4);
14137  if (__pyx_t_5) {
14138  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
14139  }
14140  __Pyx_GIVEREF(__pyx_t_1);
14141  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
14142  __Pyx_INCREF(__pyx_n_s_d);
14143  __Pyx_GIVEREF(__pyx_n_s_d);
14144  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
14145  __pyx_t_1 = 0;
14146  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14147  __Pyx_GOTREF(__pyx_t_2);
14148  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14149  }
14150  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14151  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 631, __pyx_L1_error)
14152  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
14153  {
14154  __Pyx_BufFmt_StackElem __pyx_stack[1];
14155  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14156  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
14157  __PYX_ERR(0, 631, __pyx_L1_error)
14158  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
14159  }
14160  }
14161  __pyx_t_11 = 0;
14162  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
14163  __pyx_t_2 = 0;
14164 
14165  /* "subsurfaceTransportFunctions.pyx":633
14166  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14167  * #for averaging/integration weights
14168  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
14169  * cdef double weight=1.0,volFactor = 1.0
14170  * cdef int thisElementIsUpwind = 1
14171  */
14172  __pyx_t_12 = (__pyx_v_nSpace + 1.);
14173  if (unlikely(__pyx_t_12 == 0)) {
14174  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14175  __PYX_ERR(0, 633, __pyx_L1_error)
14176  }
14177  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
14178 
14179  /* "subsurfaceTransportFunctions.pyx":634
14180  * #for averaging/integration weights
14181  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14182  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
14183  * cdef int thisElementIsUpwind = 1
14184  * if nSpace == 2:
14185  */
14186  __pyx_v_weight = 1.0;
14187  __pyx_v_volFactor = 1.0;
14188 
14189  /* "subsurfaceTransportFunctions.pyx":635
14190  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14191  * cdef double weight=1.0,volFactor = 1.0
14192  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
14193  * if nSpace == 2:
14194  * volFactor = 0.5
14195  */
14196  __pyx_v_thisElementIsUpwind = 1;
14197 
14198  /* "subsurfaceTransportFunctions.pyx":636
14199  * cdef double weight=1.0,volFactor = 1.0
14200  * cdef int thisElementIsUpwind = 1
14201  * if nSpace == 2: # <<<<<<<<<<<<<<
14202  * volFactor = 0.5
14203  * if nSpace == 3:
14204  */
14205  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
14206  if (__pyx_t_6) {
14207 
14208  /* "subsurfaceTransportFunctions.pyx":637
14209  * cdef int thisElementIsUpwind = 1
14210  * if nSpace == 2:
14211  * volFactor = 0.5 # <<<<<<<<<<<<<<
14212  * if nSpace == 3:
14213  * volFactor = 1.0/6.0
14214  */
14215  __pyx_v_volFactor = 0.5;
14216 
14217  /* "subsurfaceTransportFunctions.pyx":636
14218  * cdef double weight=1.0,volFactor = 1.0
14219  * cdef int thisElementIsUpwind = 1
14220  * if nSpace == 2: # <<<<<<<<<<<<<<
14221  * volFactor = 0.5
14222  * if nSpace == 3:
14223  */
14224  }
14225 
14226  /* "subsurfaceTransportFunctions.pyx":638
14227  * if nSpace == 2:
14228  * volFactor = 0.5
14229  * if nSpace == 3: # <<<<<<<<<<<<<<
14230  * volFactor = 1.0/6.0
14231  * #
14232  */
14233  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
14234  if (__pyx_t_6) {
14235 
14236  /* "subsurfaceTransportFunctions.pyx":639
14237  * volFactor = 0.5
14238  * if nSpace == 3:
14239  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
14240  * #
14241  * for eN in range(nElements_global):
14242  */
14243  __pyx_v_volFactor = (1.0 / 6.0);
14244 
14245  /* "subsurfaceTransportFunctions.pyx":638
14246  * if nSpace == 2:
14247  * volFactor = 0.5
14248  * if nSpace == 3: # <<<<<<<<<<<<<<
14249  * volFactor = 1.0/6.0
14250  * #
14251  */
14252  }
14253 
14254  /* "subsurfaceTransportFunctions.pyx":641
14255  * volFactor = 1.0/6.0
14256  * #
14257  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
14258  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14259  * weight = nAvgWeight*volume
14260  */
14261  __pyx_t_8 = __pyx_v_nElements_global;
14262  __pyx_t_13 = __pyx_t_8;
14263  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
14264  __pyx_v_eN = __pyx_t_14;
14265 
14266  /* "subsurfaceTransportFunctions.pyx":642
14267  * #
14268  * for eN in range(nElements_global):
14269  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
14270  * weight = nAvgWeight*volume
14271  *
14272  */
14273  __pyx_t_7 = __pyx_v_eN;
14274  __pyx_t_15 = 0;
14275  __pyx_t_16 = -1;
14276  if (__pyx_t_7 < 0) {
14277  __pyx_t_7 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
14278  if (unlikely(__pyx_t_7 < 0)) __pyx_t_16 = 0;
14279  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
14280  if (__pyx_t_15 < 0) {
14281  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
14282  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
14283  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
14284  if (unlikely(__pyx_t_16 != -1)) {
14285  __Pyx_RaiseBufferIndexError(__pyx_t_16);
14286  __PYX_ERR(0, 642, __pyx_L1_error)
14287  }
14288  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
14289 
14290  /* "subsurfaceTransportFunctions.pyx":643
14291  * for eN in range(nElements_global):
14292  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14293  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
14294  *
14295  *
14296  */
14297  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
14298 
14299  /* "subsurfaceTransportFunctions.pyx":646
14300  *
14301  *
14302  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
14303  * #nodal quadrature so diagonal
14304  * ##mass
14305  */
14306  __pyx_t_16 = __pyx_v_nDOF_test_element;
14307  __pyx_t_17 = __pyx_t_16;
14308  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
14309  __pyx_v_i = __pyx_t_18;
14310 
14311  /* "subsurfaceTransportFunctions.pyx":650
14312  * ##mass
14313  * #elementResidual[eN,i] += weight*q_m[eN,i]
14314  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
14315  *
14316  * #have to actually compute loop over other nodes for stiffness terms
14317  */
14318  __pyx_t_15 = __pyx_v_eN;
14319  __pyx_t_7 = __pyx_v_i;
14320  __pyx_t_19 = -1;
14321  if (__pyx_t_15 < 0) {
14322  __pyx_t_15 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
14323  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 0;
14324  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_19 = 0;
14325  if (__pyx_t_7 < 0) {
14326  __pyx_t_7 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
14327  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 1;
14328  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_19 = 1;
14329  if (unlikely(__pyx_t_19 != -1)) {
14330  __Pyx_RaiseBufferIndexError(__pyx_t_19);
14331  __PYX_ERR(0, 650, __pyx_L1_error)
14332  }
14333  __pyx_t_20 = __pyx_v_eN;
14334  __pyx_t_21 = __pyx_v_i;
14335  __pyx_t_22 = __pyx_v_i;
14336  __pyx_t_19 = -1;
14337  if (__pyx_t_20 < 0) {
14338  __pyx_t_20 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14339  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
14340  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_19 = 0;
14341  if (__pyx_t_21 < 0) {
14342  __pyx_t_21 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14343  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 1;
14344  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_19 = 1;
14345  if (__pyx_t_22 < 0) {
14346  __pyx_t_22 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14347  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 2;
14348  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_19 = 2;
14349  if (unlikely(__pyx_t_19 != -1)) {
14350  __Pyx_RaiseBufferIndexError(__pyx_t_19);
14351  __PYX_ERR(0, 650, __pyx_L1_error)
14352  }
14353  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
14354 
14355  /* "subsurfaceTransportFunctions.pyx":653
14356  *
14357  * #have to actually compute loop over other nodes for stiffness terms
14358  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
14359  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14360  * for ii in range(nnz):
14361  */
14362  __pyx_t_19 = __pyx_v_nElementBoundaries_element;
14363  __pyx_t_23 = __pyx_t_19;
14364  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
14365  __pyx_v_ebN = __pyx_t_24;
14366 
14367  /* "subsurfaceTransportFunctions.pyx":655
14368  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
14369  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14370  * for ii in range(nnz): # <<<<<<<<<<<<<<
14371  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14372  * for I in range(nSpace):
14373  */
14374  __pyx_t_25 = __pyx_v_nnz;
14375  __pyx_t_26 = __pyx_t_25;
14376  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14377  __pyx_v_ii = __pyx_t_27;
14378 
14379  /* "subsurfaceTransportFunctions.pyx":656
14380  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14381  * for ii in range(nnz):
14382  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14383  * for I in range(nSpace):
14384  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14385  */
14386  __pyx_t_7 = __pyx_v_eN;
14387  __pyx_t_15 = __pyx_v_ebN;
14388  __pyx_t_22 = __pyx_v_ii;
14389  __pyx_t_28 = -1;
14390  if (__pyx_t_7 < 0) {
14391  __pyx_t_7 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
14392  if (unlikely(__pyx_t_7 < 0)) __pyx_t_28 = 0;
14393  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_28 = 0;
14394  if (__pyx_t_15 < 0) {
14395  __pyx_t_15 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
14396  if (unlikely(__pyx_t_15 < 0)) __pyx_t_28 = 1;
14397  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_28 = 1;
14398  if (__pyx_t_22 < 0) {
14399  __pyx_t_22 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
14400  if (unlikely(__pyx_t_22 < 0)) __pyx_t_28 = 2;
14401  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_28 = 2;
14402  if (unlikely(__pyx_t_28 != -1)) {
14403  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14404  __PYX_ERR(0, 656, __pyx_L1_error)
14405  }
14406  __pyx_t_21 = __pyx_v_eN;
14407  __pyx_t_20 = __pyx_v_ebN;
14408  __pyx_t_28 = -1;
14409  if (__pyx_t_21 < 0) {
14410  __pyx_t_21 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14411  if (unlikely(__pyx_t_21 < 0)) __pyx_t_28 = 0;
14412  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_28 = 0;
14413  if (__pyx_t_20 < 0) {
14414  __pyx_t_20 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14415  if (unlikely(__pyx_t_20 < 0)) __pyx_t_28 = 1;
14416  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_28 = 1;
14417  if (unlikely(__pyx_t_28 != -1)) {
14418  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14419  __PYX_ERR(0, 656, __pyx_L1_error)
14420  }
14421  __pyx_t_29 = __pyx_v_ii;
14422  __pyx_t_28 = -1;
14423  if (__pyx_t_29 < 0) {
14424  __pyx_t_29 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14425  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
14426  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_28 = 0;
14427  if (unlikely(__pyx_t_28 != -1)) {
14428  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14429  __PYX_ERR(0, 656, __pyx_L1_error)
14430  }
14431  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14432  }
14433 
14434  /* "subsurfaceTransportFunctions.pyx":657
14435  * for ii in range(nnz):
14436  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14437  * for I in range(nSpace): # <<<<<<<<<<<<<<
14438  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14439  * #
14440  */
14441  __pyx_t_25 = __pyx_v_nSpace;
14442  __pyx_t_26 = __pyx_t_25;
14443  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14444  __pyx_v_I = __pyx_t_27;
14445 
14446  /* "subsurfaceTransportFunctions.pyx":658
14447  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14448  * for I in range(nSpace):
14449  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14450  * #
14451  *
14452  */
14453  __pyx_t_20 = __pyx_v_eN;
14454  __pyx_t_21 = __pyx_v_ebN;
14455  __pyx_t_22 = __pyx_v_I;
14456  __pyx_t_28 = -1;
14457  if (__pyx_t_20 < 0) {
14458  __pyx_t_20 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
14459  if (unlikely(__pyx_t_20 < 0)) __pyx_t_28 = 0;
14460  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_28 = 0;
14461  if (__pyx_t_21 < 0) {
14462  __pyx_t_21 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
14463  if (unlikely(__pyx_t_21 < 0)) __pyx_t_28 = 1;
14464  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_28 = 1;
14465  if (__pyx_t_22 < 0) {
14466  __pyx_t_22 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
14467  if (unlikely(__pyx_t_22 < 0)) __pyx_t_28 = 2;
14468  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_28 = 2;
14469  if (unlikely(__pyx_t_28 != -1)) {
14470  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14471  __PYX_ERR(0, 658, __pyx_L1_error)
14472  }
14473  __pyx_t_15 = __pyx_v_eN;
14474  __pyx_t_7 = __pyx_v_ebN;
14475  __pyx_t_28 = -1;
14476  if (__pyx_t_15 < 0) {
14477  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14478  if (unlikely(__pyx_t_15 < 0)) __pyx_t_28 = 0;
14479  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_28 = 0;
14480  if (__pyx_t_7 < 0) {
14481  __pyx_t_7 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14482  if (unlikely(__pyx_t_7 < 0)) __pyx_t_28 = 1;
14483  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_28 = 1;
14484  if (unlikely(__pyx_t_28 != -1)) {
14485  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14486  __PYX_ERR(0, 658, __pyx_L1_error)
14487  }
14488  __pyx_t_29 = __pyx_v_I;
14489  __pyx_t_28 = -1;
14490  if (__pyx_t_29 < 0) {
14491  __pyx_t_29 += __pyx_pybuffernd_f_up.diminfo[0].shape;
14492  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
14493  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_28 = 0;
14494  if (unlikely(__pyx_t_28 != -1)) {
14495  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14496  __PYX_ERR(0, 658, __pyx_L1_error)
14497  }
14498  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14499  }
14500 
14501  /* "subsurfaceTransportFunctions.pyx":662
14502  *
14503  * #Picard part first
14504  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
14505  * for I in range(nSpace):
14506  * for ii in range(rowptr[I],rowptr[I+1]):
14507  */
14508  __pyx_t_25 = __pyx_v_nDOF_trial_element;
14509  __pyx_t_26 = __pyx_t_25;
14510  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14511  __pyx_v_j = __pyx_t_27;
14512 
14513  /* "subsurfaceTransportFunctions.pyx":663
14514  * #Picard part first
14515  * for j in range(nDOF_trial_element):
14516  * for I in range(nSpace): # <<<<<<<<<<<<<<
14517  * for ii in range(rowptr[I],rowptr[I+1]):
14518  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14519  */
14520  __pyx_t_28 = __pyx_v_nSpace;
14521  __pyx_t_30 = __pyx_t_28;
14522  for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
14523  __pyx_v_I = __pyx_t_31;
14524 
14525  /* "subsurfaceTransportFunctions.pyx":664
14526  * for j in range(nDOF_trial_element):
14527  * for I in range(nSpace):
14528  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
14529  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14530  * #j picard
14531  */
14532  __pyx_t_7 = (__pyx_v_I + 1);
14533  __pyx_t_32 = -1;
14534  if (__pyx_t_7 < 0) {
14535  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14536  if (unlikely(__pyx_t_7 < 0)) __pyx_t_32 = 0;
14537  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_32 = 0;
14538  if (unlikely(__pyx_t_32 != -1)) {
14539  __Pyx_RaiseBufferIndexError(__pyx_t_32);
14540  __PYX_ERR(0, 664, __pyx_L1_error)
14541  }
14542  __pyx_t_33 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14543  __pyx_t_7 = __pyx_v_I;
14544  __pyx_t_32 = -1;
14545  if (__pyx_t_7 < 0) {
14546  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14547  if (unlikely(__pyx_t_7 < 0)) __pyx_t_32 = 0;
14548  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_32 = 0;
14549  if (unlikely(__pyx_t_32 != -1)) {
14550  __Pyx_RaiseBufferIndexError(__pyx_t_32);
14551  __PYX_ERR(0, 664, __pyx_L1_error)
14552  }
14553  __pyx_t_34 = __pyx_t_33;
14554  for (__pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_32 < __pyx_t_34; __pyx_t_32+=1) {
14555  __pyx_v_ii = __pyx_t_32;
14556 
14557  /* "subsurfaceTransportFunctions.pyx":665
14558  * for I in range(nSpace):
14559  * for ii in range(rowptr[I],rowptr[I+1]):
14560  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
14561  * #j picard
14562  * #i
14563  */
14564  __pyx_t_15 = __pyx_v_ii;
14565  __pyx_t_35 = -1;
14566  if (__pyx_t_15 < 0) {
14567  __pyx_t_15 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14568  if (unlikely(__pyx_t_15 < 0)) __pyx_t_35 = 0;
14569  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_35 = 0;
14570  if (unlikely(__pyx_t_35 != -1)) {
14571  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14572  __PYX_ERR(0, 665, __pyx_L1_error)
14573  }
14574  __pyx_t_22 = __pyx_v_ii;
14575  __pyx_t_35 = -1;
14576  if (__pyx_t_22 < 0) {
14577  __pyx_t_22 += __pyx_pybuffernd_colind.diminfo[0].shape;
14578  if (unlikely(__pyx_t_22 < 0)) __pyx_t_35 = 0;
14579  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_35 = 0;
14580  if (unlikely(__pyx_t_35 != -1)) {
14581  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14582  __PYX_ERR(0, 665, __pyx_L1_error)
14583  }
14584  __pyx_t_21 = __pyx_v_eN;
14585  __pyx_t_20 = __pyx_v_ebN;
14586  __pyx_t_29 = __pyx_v_j;
14587  __pyx_t_36 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_colind.diminfo[0].strides));
14588  __pyx_t_35 = -1;
14589  if (__pyx_t_21 < 0) {
14590  __pyx_t_21 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
14591  if (unlikely(__pyx_t_21 < 0)) __pyx_t_35 = 0;
14592  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_35 = 0;
14593  if (__pyx_t_20 < 0) {
14594  __pyx_t_20 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
14595  if (unlikely(__pyx_t_20 < 0)) __pyx_t_35 = 1;
14596  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_35 = 1;
14597  if (__pyx_t_29 < 0) {
14598  __pyx_t_29 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
14599  if (unlikely(__pyx_t_29 < 0)) __pyx_t_35 = 2;
14600  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_35 = 2;
14601  if (__pyx_t_36 < 0) {
14602  __pyx_t_36 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
14603  if (unlikely(__pyx_t_36 < 0)) __pyx_t_35 = 3;
14604  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_35 = 3;
14605  if (unlikely(__pyx_t_35 != -1)) {
14606  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14607  __PYX_ERR(0, 665, __pyx_L1_error)
14608  }
14609  __pyx_t_37 = __pyx_v_eN;
14610  __pyx_t_38 = __pyx_v_ebN;
14611  __pyx_t_39 = __pyx_v_i;
14612  __pyx_t_40 = __pyx_v_I;
14613  __pyx_t_35 = -1;
14614  if (__pyx_t_37 < 0) {
14615  __pyx_t_37 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
14616  if (unlikely(__pyx_t_37 < 0)) __pyx_t_35 = 0;
14617  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_35 = 0;
14618  if (__pyx_t_38 < 0) {
14619  __pyx_t_38 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
14620  if (unlikely(__pyx_t_38 < 0)) __pyx_t_35 = 1;
14621  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_35 = 1;
14622  if (__pyx_t_39 < 0) {
14623  __pyx_t_39 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
14624  if (unlikely(__pyx_t_39 < 0)) __pyx_t_35 = 2;
14625  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_35 = 2;
14626  if (__pyx_t_40 < 0) {
14627  __pyx_t_40 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
14628  if (unlikely(__pyx_t_40 < 0)) __pyx_t_35 = 3;
14629  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_35 = 3;
14630  if (unlikely(__pyx_t_35 != -1)) {
14631  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14632  __PYX_ERR(0, 665, __pyx_L1_error)
14633  }
14634  __pyx_t_41 = __pyx_v_eN;
14635  __pyx_t_42 = __pyx_v_i;
14636  __pyx_t_43 = __pyx_v_j;
14637  __pyx_t_35 = -1;
14638  if (__pyx_t_41 < 0) {
14639  __pyx_t_41 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14640  if (unlikely(__pyx_t_41 < 0)) __pyx_t_35 = 0;
14641  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_35 = 0;
14642  if (__pyx_t_42 < 0) {
14643  __pyx_t_42 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14644  if (unlikely(__pyx_t_42 < 0)) __pyx_t_35 = 1;
14645  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_35 = 1;
14646  if (__pyx_t_43 < 0) {
14647  __pyx_t_43 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14648  if (unlikely(__pyx_t_43 < 0)) __pyx_t_35 = 2;
14649  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_35 = 2;
14650  if (unlikely(__pyx_t_35 != -1)) {
14651  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14652  __PYX_ERR(0, 665, __pyx_L1_error)
14653  }
14654  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_36, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_40, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
14655  }
14656  }
14657  }
14658  }
14659  }
14660  }
14661 
14662  /* "subsurfaceTransportFunctions.pyx":574
14663  * #i
14664  * #eN
14665  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
14666  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
14667  * numpy.ndarray[ITYPE_t,ndim=1] colind,
14668  */
14669 
14670  /* function exit code */
14671  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14672  goto __pyx_L0;
14673  __pyx_L1_error:;
14674  __Pyx_XDECREF(__pyx_t_1);
14675  __Pyx_XDECREF(__pyx_t_2);
14676  __Pyx_XDECREF(__pyx_t_4);
14677  __Pyx_XDECREF(__pyx_t_5);
14678  __Pyx_XDECREF(__pyx_t_9);
14679  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14680  __Pyx_PyThreadState_declare
14681  __Pyx_PyThreadState_assign
14682  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14683  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14684  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14685  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14686  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14687  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14688  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14689  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14690  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14691  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14692  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14693  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14694  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14695  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14696  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14697  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14698  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14699  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14700  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14701  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14702  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14703  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14704  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14705  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14706  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14707  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
14708  __pyx_r = NULL;
14709  goto __pyx_L2;
14710  __pyx_L0:;
14711  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14712  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14713  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14714  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14715  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14716  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14717  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14718  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14719  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14720  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14721  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14722  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14723  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14724  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14725  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14726  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14727  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14728  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14729  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14730  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14731  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14732  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14733  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14734  __pyx_L2:;
14735  __Pyx_XDECREF(__pyx_v_q);
14736  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
14737  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
14738  __Pyx_XGIVEREF(__pyx_r);
14739  __Pyx_RefNannyFinishContext();
14740  return __pyx_r;
14741 }
14742 
14743 /* "subsurfaceTransportFunctions.pyx":673
14744  * ##################################################
14745  *
14746  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14747  * numpy.ndarray[DTYPE_t,ndim=3] w,
14748  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14749  */
14750 
14751 /* Python wrapper */
14752 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14753 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
14754 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
14755 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14756  PyArrayObject *__pyx_v_mt = 0;
14757  PyArrayObject *__pyx_v_w = 0;
14758  PyArrayObject *__pyx_v_dV = 0;
14759  PyArrayObject *__pyx_v_weak_residual = 0;
14760  int __pyx_lineno = 0;
14761  const char *__pyx_filename = NULL;
14762  int __pyx_clineno = 0;
14763  PyObject *__pyx_r = 0;
14764  __Pyx_RefNannyDeclarations
14765  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
14766  {
14767  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
14768  PyObject* values[4] = {0,0,0,0};
14769  if (unlikely(__pyx_kwds)) {
14770  Py_ssize_t kw_args;
14771  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14772  switch (pos_args) {
14773  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14774  CYTHON_FALLTHROUGH;
14775  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14776  CYTHON_FALLTHROUGH;
14777  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14778  CYTHON_FALLTHROUGH;
14779  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14780  CYTHON_FALLTHROUGH;
14781  case 0: break;
14782  default: goto __pyx_L5_argtuple_error;
14783  }
14784  kw_args = PyDict_Size(__pyx_kwds);
14785  switch (pos_args) {
14786  case 0:
14787  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
14788  else goto __pyx_L5_argtuple_error;
14789  CYTHON_FALLTHROUGH;
14790  case 1:
14791  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14792  else {
14793  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); __PYX_ERR(0, 673, __pyx_L3_error)
14794  }
14795  CYTHON_FALLTHROUGH;
14796  case 2:
14797  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14798  else {
14799  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); __PYX_ERR(0, 673, __pyx_L3_error)
14800  }
14801  CYTHON_FALLTHROUGH;
14802  case 3:
14803  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
14804  else {
14805  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); __PYX_ERR(0, 673, __pyx_L3_error)
14806  }
14807  }
14808  if (unlikely(kw_args > 0)) {
14809  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) __PYX_ERR(0, 673, __pyx_L3_error)
14810  }
14811  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14812  goto __pyx_L5_argtuple_error;
14813  } else {
14814  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14815  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14816  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14817  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14818  }
14819  __pyx_v_mt = ((PyArrayObject *)values[0]);
14820  __pyx_v_w = ((PyArrayObject *)values[1]);
14821  __pyx_v_dV = ((PyArrayObject *)values[2]);
14822  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
14823  }
14824  goto __pyx_L4_argument_unpacking_done;
14825  __pyx_L5_argtuple_error:;
14826  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 673, __pyx_L3_error)
14827  __pyx_L3_error:;
14828  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14829  __Pyx_RefNannyFinishContext();
14830  return NULL;
14831  __pyx_L4_argument_unpacking_done:;
14832  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 673, __pyx_L1_error)
14833  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 674, __pyx_L1_error)
14834  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 675, __pyx_L1_error)
14835  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) __PYX_ERR(0, 676, __pyx_L1_error)
14836  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
14837 
14838  /* function exit code */
14839  goto __pyx_L0;
14840  __pyx_L1_error:;
14841  __pyx_r = NULL;
14842  __pyx_L0:;
14843  __Pyx_RefNannyFinishContext();
14844  return __pyx_r;
14845 }
14846 
14847 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) {
14848  int __pyx_v_eN;
14849  int __pyx_v_i;
14850  int __pyx_v_k;
14851  PyObject *__pyx_v_mt_avg = 0;
14852  PyObject *__pyx_v_vol = 0;
14853  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14854  __Pyx_Buffer __pyx_pybuffer_dV;
14855  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
14856  __Pyx_Buffer __pyx_pybuffer_mt;
14857  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14858  __Pyx_Buffer __pyx_pybuffer_w;
14859  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
14860  __Pyx_Buffer __pyx_pybuffer_weak_residual;
14861  PyObject *__pyx_r = NULL;
14862  __Pyx_RefNannyDeclarations
14863  npy_intp __pyx_t_1;
14864  npy_intp __pyx_t_2;
14865  int __pyx_t_3;
14866  npy_intp __pyx_t_4;
14867  npy_intp __pyx_t_5;
14868  int __pyx_t_6;
14869  Py_ssize_t __pyx_t_7;
14870  Py_ssize_t __pyx_t_8;
14871  int __pyx_t_9;
14872  Py_ssize_t __pyx_t_10;
14873  Py_ssize_t __pyx_t_11;
14874  PyObject *__pyx_t_12 = NULL;
14875  PyObject *__pyx_t_13 = NULL;
14876  PyObject *__pyx_t_14 = NULL;
14877  double __pyx_t_15;
14878  int __pyx_lineno = 0;
14879  const char *__pyx_filename = NULL;
14880  int __pyx_clineno = 0;
14881  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
14882  __pyx_pybuffer_mt.pybuffer.buf = NULL;
14883  __pyx_pybuffer_mt.refcount = 0;
14884  __pyx_pybuffernd_mt.data = NULL;
14885  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
14886  __pyx_pybuffer_w.pybuffer.buf = NULL;
14887  __pyx_pybuffer_w.refcount = 0;
14888  __pyx_pybuffernd_w.data = NULL;
14889  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14890  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14891  __pyx_pybuffer_dV.refcount = 0;
14892  __pyx_pybuffernd_dV.data = NULL;
14893  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14894  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
14895  __pyx_pybuffer_weak_residual.refcount = 0;
14896  __pyx_pybuffernd_weak_residual.data = NULL;
14897  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
14898  {
14899  __Pyx_BufFmt_StackElem __pyx_stack[1];
14900  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14901  }
14902  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
14903  {
14904  __Pyx_BufFmt_StackElem __pyx_stack[1];
14905  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14906  }
14907  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14908  {
14909  __Pyx_BufFmt_StackElem __pyx_stack[1];
14910  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14911  }
14912  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14913  {
14914  __Pyx_BufFmt_StackElem __pyx_stack[1];
14915  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14916  }
14917  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
14918 
14919  /* "subsurfaceTransportFunctions.pyx":682
14920  * cdef int eN,i,k
14921  * cdef mt_avg,vol
14922  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
14923  * mt_avg = 0.0
14924  * vol = 0.0
14925  */
14926  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
14927  __pyx_t_2 = __pyx_t_1;
14928  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14929  __pyx_v_eN = __pyx_t_3;
14930 
14931  /* "subsurfaceTransportFunctions.pyx":683
14932  * cdef mt_avg,vol
14933  * for eN in range(mt.shape[0]):
14934  * mt_avg = 0.0 # <<<<<<<<<<<<<<
14935  * vol = 0.0
14936  * for k in range(mt.shape[1]):
14937  */
14938  __Pyx_INCREF(__pyx_float_0_0);
14939  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
14940 
14941  /* "subsurfaceTransportFunctions.pyx":684
14942  * for eN in range(mt.shape[0]):
14943  * mt_avg = 0.0
14944  * vol = 0.0 # <<<<<<<<<<<<<<
14945  * for k in range(mt.shape[1]):
14946  * mt_avg += dV[eN,k]*mt[eN,k]
14947  */
14948  __Pyx_INCREF(__pyx_float_0_0);
14949  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
14950 
14951  /* "subsurfaceTransportFunctions.pyx":685
14952  * mt_avg = 0.0
14953  * vol = 0.0
14954  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
14955  * mt_avg += dV[eN,k]*mt[eN,k]
14956  * vol += dV[eN,k]
14957  */
14958  __pyx_t_4 = (__pyx_v_mt->dimensions[1]);
14959  __pyx_t_5 = __pyx_t_4;
14960  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14961  __pyx_v_k = __pyx_t_6;
14962 
14963  /* "subsurfaceTransportFunctions.pyx":686
14964  * vol = 0.0
14965  * for k in range(mt.shape[1]):
14966  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
14967  * vol += dV[eN,k]
14968  * mt_avg /= vol
14969  */
14970  __pyx_t_7 = __pyx_v_eN;
14971  __pyx_t_8 = __pyx_v_k;
14972  __pyx_t_9 = -1;
14973  if (__pyx_t_7 < 0) {
14974  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
14975  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
14976  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14977  if (__pyx_t_8 < 0) {
14978  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
14979  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
14980  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14981  if (unlikely(__pyx_t_9 != -1)) {
14982  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14983  __PYX_ERR(0, 686, __pyx_L1_error)
14984  }
14985  __pyx_t_10 = __pyx_v_eN;
14986  __pyx_t_11 = __pyx_v_k;
14987  __pyx_t_9 = -1;
14988  if (__pyx_t_10 < 0) {
14989  __pyx_t_10 += __pyx_pybuffernd_mt.diminfo[0].shape;
14990  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14991  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_9 = 0;
14992  if (__pyx_t_11 < 0) {
14993  __pyx_t_11 += __pyx_pybuffernd_mt.diminfo[1].shape;
14994  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14995  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_9 = 1;
14996  if (unlikely(__pyx_t_9 != -1)) {
14997  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14998  __PYX_ERR(0, 686, __pyx_L1_error)
14999  }
15000  __pyx_t_12 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 686, __pyx_L1_error)
15001  __Pyx_GOTREF(__pyx_t_12);
15002  __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 686, __pyx_L1_error)
15003  __Pyx_GOTREF(__pyx_t_13);
15004  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15005  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_13);
15006  __pyx_t_13 = 0;
15007 
15008  /* "subsurfaceTransportFunctions.pyx":687
15009  * for k in range(mt.shape[1]):
15010  * mt_avg += dV[eN,k]*mt[eN,k]
15011  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15012  * mt_avg /= vol
15013  * for i in range(weak_residual.shape[1]):
15014  */
15015  __pyx_t_11 = __pyx_v_eN;
15016  __pyx_t_10 = __pyx_v_k;
15017  __pyx_t_9 = -1;
15018  if (__pyx_t_11 < 0) {
15019  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[0].shape;
15020  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
15021  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15022  if (__pyx_t_10 < 0) {
15023  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[1].shape;
15024  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 1;
15025  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15026  if (unlikely(__pyx_t_9 != -1)) {
15027  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15028  __PYX_ERR(0, 687, __pyx_L1_error)
15029  }
15030  __pyx_t_13 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 687, __pyx_L1_error)
15031  __Pyx_GOTREF(__pyx_t_13);
15032  __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 687, __pyx_L1_error)
15033  __Pyx_GOTREF(__pyx_t_12);
15034  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15035  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_12);
15036  __pyx_t_12 = 0;
15037  }
15038 
15039  /* "subsurfaceTransportFunctions.pyx":688
15040  * mt_avg += dV[eN,k]*mt[eN,k]
15041  * vol += dV[eN,k]
15042  * mt_avg /= vol # <<<<<<<<<<<<<<
15043  * for i in range(weak_residual.shape[1]):
15044  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15045  */
15046  __pyx_t_12 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 688, __pyx_L1_error)
15047  __Pyx_GOTREF(__pyx_t_12);
15048  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_12);
15049  __pyx_t_12 = 0;
15050 
15051  /* "subsurfaceTransportFunctions.pyx":689
15052  * vol += dV[eN,k]
15053  * mt_avg /= vol
15054  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
15055  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15056  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15057  */
15058  __pyx_t_4 = (__pyx_v_weak_residual->dimensions[1]);
15059  __pyx_t_5 = __pyx_t_4;
15060  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15061  __pyx_v_i = __pyx_t_6;
15062 
15063  /* "subsurfaceTransportFunctions.pyx":691
15064  * for i in range(weak_residual.shape[1]):
15065  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15066  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
15067  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
15068  * numpy.ndarray[DTYPE_t,ndim=3] w,
15069  */
15070  __pyx_t_10 = __pyx_v_eN;
15071  __pyx_t_11 = __pyx_v_k;
15072  __pyx_t_8 = __pyx_v_i;
15073  __pyx_t_9 = -1;
15074  if (__pyx_t_10 < 0) {
15075  __pyx_t_10 += __pyx_pybuffernd_w.diminfo[0].shape;
15076  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
15077  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_9 = 0;
15078  if (__pyx_t_11 < 0) {
15079  __pyx_t_11 += __pyx_pybuffernd_w.diminfo[1].shape;
15080  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
15081  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_9 = 1;
15082  if (__pyx_t_8 < 0) {
15083  __pyx_t_8 += __pyx_pybuffernd_w.diminfo[2].shape;
15084  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
15085  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_9 = 2;
15086  if (unlikely(__pyx_t_9 != -1)) {
15087  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15088  __PYX_ERR(0, 691, __pyx_L1_error)
15089  }
15090  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15091  __Pyx_GOTREF(__pyx_t_12);
15092  __pyx_t_13 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 691, __pyx_L1_error)
15093  __Pyx_GOTREF(__pyx_t_13);
15094  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15095  __pyx_t_8 = __pyx_v_eN;
15096  __pyx_t_11 = __pyx_v_k;
15097  __pyx_t_9 = -1;
15098  if (__pyx_t_8 < 0) {
15099  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15100  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
15101  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15102  if (__pyx_t_11 < 0) {
15103  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
15104  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
15105  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15106  if (unlikely(__pyx_t_9 != -1)) {
15107  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15108  __PYX_ERR(0, 691, __pyx_L1_error)
15109  }
15110  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15111  __Pyx_GOTREF(__pyx_t_12);
15112  __pyx_t_14 = PyNumber_Multiply(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 691, __pyx_L1_error)
15113  __Pyx_GOTREF(__pyx_t_14);
15114  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15115  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15116  __pyx_t_15 = __Pyx_PyObject_AsDouble(__pyx_t_14); if (unlikely(__pyx_t_15 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
15117  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
15118  __pyx_t_11 = __pyx_v_eN;
15119  __pyx_t_8 = __pyx_v_i;
15120  __pyx_t_9 = -1;
15121  if (__pyx_t_11 < 0) {
15122  __pyx_t_11 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
15123  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
15124  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_9 = 0;
15125  if (__pyx_t_8 < 0) {
15126  __pyx_t_8 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
15127  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15128  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_9 = 1;
15129  if (unlikely(__pyx_t_9 != -1)) {
15130  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15131  __PYX_ERR(0, 691, __pyx_L1_error)
15132  }
15133  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_15;
15134  }
15135  }
15136 
15137  /* "subsurfaceTransportFunctions.pyx":673
15138  * ##################################################
15139  *
15140  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
15141  * numpy.ndarray[DTYPE_t,ndim=3] w,
15142  * numpy.ndarray[DTYPE_t,ndim=2] dV,
15143  */
15144 
15145  /* function exit code */
15146  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15147  goto __pyx_L0;
15148  __pyx_L1_error:;
15149  __Pyx_XDECREF(__pyx_t_12);
15150  __Pyx_XDECREF(__pyx_t_13);
15151  __Pyx_XDECREF(__pyx_t_14);
15152  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15153  __Pyx_PyThreadState_declare
15154  __Pyx_PyThreadState_assign
15155  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15156  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15157  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15158  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15159  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15160  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15161  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15162  __pyx_r = NULL;
15163  goto __pyx_L2;
15164  __pyx_L0:;
15165  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15166  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15167  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15168  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15169  __pyx_L2:;
15170  __Pyx_XDECREF(__pyx_v_mt_avg);
15171  __Pyx_XDECREF(__pyx_v_vol);
15172  __Pyx_XGIVEREF(__pyx_r);
15173  __Pyx_RefNannyFinishContext();
15174  return __pyx_r;
15175 }
15176 
15177 /* "subsurfaceTransportFunctions.pyx":692
15178  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15179  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15180  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15181  * numpy.ndarray[DTYPE_t,ndim=3] w,
15182  * numpy.ndarray[DTYPE_t,ndim=3] v,
15183  */
15184 
15185 /* Python wrapper */
15186 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15187 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
15188 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
15189 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15190  PyArrayObject *__pyx_v_dmt = 0;
15191  PyArrayObject *__pyx_v_w = 0;
15192  PyArrayObject *__pyx_v_v = 0;
15193  PyArrayObject *__pyx_v_dV = 0;
15194  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
15195  int __pyx_lineno = 0;
15196  const char *__pyx_filename = NULL;
15197  int __pyx_clineno = 0;
15198  PyObject *__pyx_r = 0;
15199  __Pyx_RefNannyDeclarations
15200  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
15201  {
15202  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
15203  PyObject* values[5] = {0,0,0,0,0};
15204  if (unlikely(__pyx_kwds)) {
15205  Py_ssize_t kw_args;
15206  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15207  switch (pos_args) {
15208  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15209  CYTHON_FALLTHROUGH;
15210  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15211  CYTHON_FALLTHROUGH;
15212  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15213  CYTHON_FALLTHROUGH;
15214  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15215  CYTHON_FALLTHROUGH;
15216  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15217  CYTHON_FALLTHROUGH;
15218  case 0: break;
15219  default: goto __pyx_L5_argtuple_error;
15220  }
15221  kw_args = PyDict_Size(__pyx_kwds);
15222  switch (pos_args) {
15223  case 0:
15224  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
15225  else goto __pyx_L5_argtuple_error;
15226  CYTHON_FALLTHROUGH;
15227  case 1:
15228  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
15229  else {
15230  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); __PYX_ERR(0, 692, __pyx_L3_error)
15231  }
15232  CYTHON_FALLTHROUGH;
15233  case 2:
15234  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15235  else {
15236  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); __PYX_ERR(0, 692, __pyx_L3_error)
15237  }
15238  CYTHON_FALLTHROUGH;
15239  case 3:
15240  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15241  else {
15242  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); __PYX_ERR(0, 692, __pyx_L3_error)
15243  }
15244  CYTHON_FALLTHROUGH;
15245  case 4:
15246  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
15247  else {
15248  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); __PYX_ERR(0, 692, __pyx_L3_error)
15249  }
15250  }
15251  if (unlikely(kw_args > 0)) {
15252  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
15253  }
15254  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15255  goto __pyx_L5_argtuple_error;
15256  } else {
15257  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15258  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15259  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15260  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15261  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15262  }
15263  __pyx_v_dmt = ((PyArrayObject *)values[0]);
15264  __pyx_v_w = ((PyArrayObject *)values[1]);
15265  __pyx_v_v = ((PyArrayObject *)values[2]);
15266  __pyx_v_dV = ((PyArrayObject *)values[3]);
15267  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
15268  }
15269  goto __pyx_L4_argument_unpacking_done;
15270  __pyx_L5_argtuple_error:;
15271  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
15272  __pyx_L3_error:;
15273  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15274  __Pyx_RefNannyFinishContext();
15275  return NULL;
15276  __pyx_L4_argument_unpacking_done:;
15277  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) __PYX_ERR(0, 692, __pyx_L1_error)
15278  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 693, __pyx_L1_error)
15279  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 694, __pyx_L1_error)
15280  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 695, __pyx_L1_error)
15281  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) __PYX_ERR(0, 696, __pyx_L1_error)
15282  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
15283 
15284  /* function exit code */
15285  goto __pyx_L0;
15286  __pyx_L1_error:;
15287  __pyx_r = NULL;
15288  __pyx_L0:;
15289  __Pyx_RefNannyFinishContext();
15290  return __pyx_r;
15291 }
15292 
15293 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) {
15294  int __pyx_v_eN;
15295  int __pyx_v_i;
15296  int __pyx_v_j;
15297  int __pyx_v_k;
15298  double __pyx_v_dmtj_avg;
15299  double __pyx_v_vol;
15300  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15301  __Pyx_Buffer __pyx_pybuffer_dV;
15302  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
15303  __Pyx_Buffer __pyx_pybuffer_dmt;
15304  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
15305  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
15306  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15307  __Pyx_Buffer __pyx_pybuffer_v;
15308  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
15309  __Pyx_Buffer __pyx_pybuffer_w;
15310  PyObject *__pyx_r = NULL;
15311  __Pyx_RefNannyDeclarations
15312  npy_intp __pyx_t_1;
15313  npy_intp __pyx_t_2;
15314  int __pyx_t_3;
15315  npy_intp __pyx_t_4;
15316  npy_intp __pyx_t_5;
15317  int __pyx_t_6;
15318  Py_ssize_t __pyx_t_7;
15319  Py_ssize_t __pyx_t_8;
15320  int __pyx_t_9;
15321  npy_intp __pyx_t_10;
15322  npy_intp __pyx_t_11;
15323  npy_intp __pyx_t_12;
15324  npy_intp __pyx_t_13;
15325  int __pyx_t_14;
15326  int __pyx_t_15;
15327  Py_ssize_t __pyx_t_16;
15328  Py_ssize_t __pyx_t_17;
15329  Py_ssize_t __pyx_t_18;
15330  Py_ssize_t __pyx_t_19;
15331  Py_ssize_t __pyx_t_20;
15332  Py_ssize_t __pyx_t_21;
15333  int __pyx_lineno = 0;
15334  const char *__pyx_filename = NULL;
15335  int __pyx_clineno = 0;
15336  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
15337  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
15338  __pyx_pybuffer_dmt.refcount = 0;
15339  __pyx_pybuffernd_dmt.data = NULL;
15340  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
15341  __pyx_pybuffer_w.pybuffer.buf = NULL;
15342  __pyx_pybuffer_w.refcount = 0;
15343  __pyx_pybuffernd_w.data = NULL;
15344  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
15345  __pyx_pybuffer_v.pybuffer.buf = NULL;
15346  __pyx_pybuffer_v.refcount = 0;
15347  __pyx_pybuffernd_v.data = NULL;
15348  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15349  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15350  __pyx_pybuffer_dV.refcount = 0;
15351  __pyx_pybuffernd_dV.data = NULL;
15352  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15353  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
15354  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
15355  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
15356  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
15357  {
15358  __Pyx_BufFmt_StackElem __pyx_stack[1];
15359  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15360  }
15361  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
15362  {
15363  __Pyx_BufFmt_StackElem __pyx_stack[1];
15364  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15365  }
15366  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
15367  {
15368  __Pyx_BufFmt_StackElem __pyx_stack[1];
15369  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15370  }
15371  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
15372  {
15373  __Pyx_BufFmt_StackElem __pyx_stack[1];
15374  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15375  }
15376  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15377  {
15378  __Pyx_BufFmt_StackElem __pyx_stack[1];
15379  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15380  }
15381  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
15382 
15383  /* "subsurfaceTransportFunctions.pyx":702
15384  * cdef int eN,i,j,k
15385  * cdef double dmtj_avg,vol
15386  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
15387  * vol = 0.0 #should I save a loop?
15388  * for k in range(dmt.shape[1]):
15389  */
15390  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
15391  __pyx_t_2 = __pyx_t_1;
15392  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15393  __pyx_v_eN = __pyx_t_3;
15394 
15395  /* "subsurfaceTransportFunctions.pyx":703
15396  * cdef double dmtj_avg,vol
15397  * for eN in range(dmt.shape[0]):
15398  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
15399  * for k in range(dmt.shape[1]):
15400  * vol += dV[eN,k]
15401  */
15402  __pyx_v_vol = 0.0;
15403 
15404  /* "subsurfaceTransportFunctions.pyx":704
15405  * for eN in range(dmt.shape[0]):
15406  * vol = 0.0 #should I save a loop?
15407  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15408  * vol += dV[eN,k]
15409  * for i in range(w.shape[2]):
15410  */
15411  __pyx_t_4 = (__pyx_v_dmt->dimensions[1]);
15412  __pyx_t_5 = __pyx_t_4;
15413  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15414  __pyx_v_k = __pyx_t_6;
15415 
15416  /* "subsurfaceTransportFunctions.pyx":705
15417  * vol = 0.0 #should I save a loop?
15418  * for k in range(dmt.shape[1]):
15419  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15420  * for i in range(w.shape[2]):
15421  * for j in range(v.shape[2]):
15422  */
15423  __pyx_t_7 = __pyx_v_eN;
15424  __pyx_t_8 = __pyx_v_k;
15425  __pyx_t_9 = -1;
15426  if (__pyx_t_7 < 0) {
15427  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
15428  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
15429  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15430  if (__pyx_t_8 < 0) {
15431  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
15432  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15433  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15434  if (unlikely(__pyx_t_9 != -1)) {
15435  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15436  __PYX_ERR(0, 705, __pyx_L1_error)
15437  }
15438  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
15439  }
15440 
15441  /* "subsurfaceTransportFunctions.pyx":706
15442  * for k in range(dmt.shape[1]):
15443  * vol += dV[eN,k]
15444  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
15445  * for j in range(v.shape[2]):
15446  * dmtj_avg = 0.0
15447  */
15448  __pyx_t_4 = (__pyx_v_w->dimensions[2]);
15449  __pyx_t_5 = __pyx_t_4;
15450  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15451  __pyx_v_i = __pyx_t_6;
15452 
15453  /* "subsurfaceTransportFunctions.pyx":707
15454  * vol += dV[eN,k]
15455  * for i in range(w.shape[2]):
15456  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
15457  * dmtj_avg = 0.0
15458  * for k in range(dmt.shape[1]):
15459  */
15460  __pyx_t_10 = (__pyx_v_v->dimensions[2]);
15461  __pyx_t_11 = __pyx_t_10;
15462  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
15463  __pyx_v_j = __pyx_t_9;
15464 
15465  /* "subsurfaceTransportFunctions.pyx":708
15466  * for i in range(w.shape[2]):
15467  * for j in range(v.shape[2]):
15468  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
15469  * for k in range(dmt.shape[1]):
15470  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15471  */
15472  __pyx_v_dmtj_avg = 0.0;
15473 
15474  /* "subsurfaceTransportFunctions.pyx":709
15475  * for j in range(v.shape[2]):
15476  * dmtj_avg = 0.0
15477  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15478  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15479  * dmtj_avg /= vol
15480  */
15481  __pyx_t_12 = (__pyx_v_dmt->dimensions[1]);
15482  __pyx_t_13 = __pyx_t_12;
15483  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
15484  __pyx_v_k = __pyx_t_14;
15485 
15486  /* "subsurfaceTransportFunctions.pyx":710
15487  * dmtj_avg = 0.0
15488  * for k in range(dmt.shape[1]):
15489  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
15490  * dmtj_avg /= vol
15491  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15492  */
15493  __pyx_t_8 = __pyx_v_eN;
15494  __pyx_t_7 = __pyx_v_k;
15495  __pyx_t_15 = -1;
15496  if (__pyx_t_8 < 0) {
15497  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15498  if (unlikely(__pyx_t_8 < 0)) __pyx_t_15 = 0;
15499  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_15 = 0;
15500  if (__pyx_t_7 < 0) {
15501  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
15502  if (unlikely(__pyx_t_7 < 0)) __pyx_t_15 = 1;
15503  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_15 = 1;
15504  if (unlikely(__pyx_t_15 != -1)) {
15505  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15506  __PYX_ERR(0, 710, __pyx_L1_error)
15507  }
15508  __pyx_t_16 = __pyx_v_eN;
15509  __pyx_t_17 = __pyx_v_k;
15510  __pyx_t_15 = -1;
15511  if (__pyx_t_16 < 0) {
15512  __pyx_t_16 += __pyx_pybuffernd_dmt.diminfo[0].shape;
15513  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
15514  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_15 = 0;
15515  if (__pyx_t_17 < 0) {
15516  __pyx_t_17 += __pyx_pybuffernd_dmt.diminfo[1].shape;
15517  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
15518  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_15 = 1;
15519  if (unlikely(__pyx_t_15 != -1)) {
15520  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15521  __PYX_ERR(0, 710, __pyx_L1_error)
15522  }
15523  __pyx_t_18 = __pyx_v_eN;
15524  __pyx_t_19 = __pyx_v_k;
15525  __pyx_t_20 = __pyx_v_j;
15526  __pyx_t_15 = -1;
15527  if (__pyx_t_18 < 0) {
15528  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
15529  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0;
15530  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
15531  if (__pyx_t_19 < 0) {
15532  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
15533  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 1;
15534  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
15535  if (__pyx_t_20 < 0) {
15536  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
15537  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 2;
15538  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
15539  if (unlikely(__pyx_t_15 != -1)) {
15540  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15541  __PYX_ERR(0, 710, __pyx_L1_error)
15542  }
15543  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides))));
15544  }
15545 
15546  /* "subsurfaceTransportFunctions.pyx":711
15547  * for k in range(dmt.shape[1]):
15548  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15549  * dmtj_avg /= vol # <<<<<<<<<<<<<<
15550  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15551  *
15552  */
15553  if (unlikely(__pyx_v_vol == 0)) {
15554  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15555  __PYX_ERR(0, 711, __pyx_L1_error)
15556  }
15557  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
15558 
15559  /* "subsurfaceTransportFunctions.pyx":712
15560  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15561  * dmtj_avg /= vol
15562  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
15563  *
15564  * ########################################################################
15565  */
15566  __pyx_t_20 = __pyx_v_eN;
15567  __pyx_t_19 = __pyx_v_k;
15568  __pyx_t_18 = __pyx_v_i;
15569  __pyx_t_14 = -1;
15570  if (__pyx_t_20 < 0) {
15571  __pyx_t_20 += __pyx_pybuffernd_w.diminfo[0].shape;
15572  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 0;
15573  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_14 = 0;
15574  if (__pyx_t_19 < 0) {
15575  __pyx_t_19 += __pyx_pybuffernd_w.diminfo[1].shape;
15576  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 1;
15577  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_14 = 1;
15578  if (__pyx_t_18 < 0) {
15579  __pyx_t_18 += __pyx_pybuffernd_w.diminfo[2].shape;
15580  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 2;
15581  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_14 = 2;
15582  if (unlikely(__pyx_t_14 != -1)) {
15583  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15584  __PYX_ERR(0, 712, __pyx_L1_error)
15585  }
15586  __pyx_t_17 = __pyx_v_eN;
15587  __pyx_t_16 = __pyx_v_k;
15588  __pyx_t_14 = -1;
15589  if (__pyx_t_17 < 0) {
15590  __pyx_t_17 += __pyx_pybuffernd_dV.diminfo[0].shape;
15591  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 0;
15592  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_14 = 0;
15593  if (__pyx_t_16 < 0) {
15594  __pyx_t_16 += __pyx_pybuffernd_dV.diminfo[1].shape;
15595  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
15596  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_14 = 1;
15597  if (unlikely(__pyx_t_14 != -1)) {
15598  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15599  __PYX_ERR(0, 712, __pyx_L1_error)
15600  }
15601  __pyx_t_7 = __pyx_v_eN;
15602  __pyx_t_8 = __pyx_v_i;
15603  __pyx_t_21 = __pyx_v_j;
15604  __pyx_t_14 = -1;
15605  if (__pyx_t_7 < 0) {
15606  __pyx_t_7 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
15607  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 0;
15608  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_14 = 0;
15609  if (__pyx_t_8 < 0) {
15610  __pyx_t_8 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
15611  if (unlikely(__pyx_t_8 < 0)) __pyx_t_14 = 1;
15612  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_14 = 1;
15613  if (__pyx_t_21 < 0) {
15614  __pyx_t_21 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
15615  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
15616  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_14 = 2;
15617  if (unlikely(__pyx_t_14 != -1)) {
15618  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15619  __PYX_ERR(0, 712, __pyx_L1_error)
15620  }
15621  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_dV.diminfo[1].strides)));
15622  }
15623  }
15624  }
15625 
15626  /* "subsurfaceTransportFunctions.pyx":692
15627  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15628  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15629  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15630  * numpy.ndarray[DTYPE_t,ndim=3] w,
15631  * numpy.ndarray[DTYPE_t,ndim=3] v,
15632  */
15633 
15634  /* function exit code */
15635  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15636  goto __pyx_L0;
15637  __pyx_L1_error:;
15638  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15639  __Pyx_PyThreadState_declare
15640  __Pyx_PyThreadState_assign
15641  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15644  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15645  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15646  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15647  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15648  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15649  __pyx_r = NULL;
15650  goto __pyx_L2;
15651  __pyx_L0:;
15652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15656  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15657  __pyx_L2:;
15658  __Pyx_XGIVEREF(__pyx_r);
15659  __Pyx_RefNannyFinishContext();
15660  return __pyx_r;
15661 }
15662 
15663 /* "subsurfaceTransportFunctions.pyx":717
15664  * #ELLAM
15665  * ########################################################################
15666  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15667  * numpy.ndarray[DTYPE_t,ndim=4] n,
15668  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15669  */
15670 
15671 /* Python wrapper */
15672 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15673 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
15674 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15675  PyArrayObject *__pyx_v_v = 0;
15676  PyArrayObject *__pyx_v_n = 0;
15677  PyArrayObject *__pyx_v_dS = 0;
15678  PyArrayObject *__pyx_v_flux = 0;
15679  int __pyx_lineno = 0;
15680  const char *__pyx_filename = NULL;
15681  int __pyx_clineno = 0;
15682  PyObject *__pyx_r = 0;
15683  __Pyx_RefNannyDeclarations
15684  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
15685  {
15686  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
15687  PyObject* values[4] = {0,0,0,0};
15688  if (unlikely(__pyx_kwds)) {
15689  Py_ssize_t kw_args;
15690  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15691  switch (pos_args) {
15692  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15693  CYTHON_FALLTHROUGH;
15694  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15695  CYTHON_FALLTHROUGH;
15696  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15697  CYTHON_FALLTHROUGH;
15698  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15699  CYTHON_FALLTHROUGH;
15700  case 0: break;
15701  default: goto __pyx_L5_argtuple_error;
15702  }
15703  kw_args = PyDict_Size(__pyx_kwds);
15704  switch (pos_args) {
15705  case 0:
15706  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15707  else goto __pyx_L5_argtuple_error;
15708  CYTHON_FALLTHROUGH;
15709  case 1:
15710  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
15711  else {
15712  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
15713  }
15714  CYTHON_FALLTHROUGH;
15715  case 2:
15716  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
15717  else {
15718  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
15719  }
15720  CYTHON_FALLTHROUGH;
15721  case 3:
15722  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
15723  else {
15724  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
15725  }
15726  }
15727  if (unlikely(kw_args > 0)) {
15728  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
15729  }
15730  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15731  goto __pyx_L5_argtuple_error;
15732  } else {
15733  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15734  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15735  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15736  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15737  }
15738  __pyx_v_v = ((PyArrayObject *)values[0]);
15739  __pyx_v_n = ((PyArrayObject *)values[1]);
15740  __pyx_v_dS = ((PyArrayObject *)values[2]);
15741  __pyx_v_flux = ((PyArrayObject *)values[3]);
15742  }
15743  goto __pyx_L4_argument_unpacking_done;
15744  __pyx_L5_argtuple_error:;
15745  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
15746  __pyx_L3_error:;
15747  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15748  __Pyx_RefNannyFinishContext();
15749  return NULL;
15750  __pyx_L4_argument_unpacking_done:;
15751  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 717, __pyx_L1_error)
15752  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 718, __pyx_L1_error)
15753  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) __PYX_ERR(0, 719, __pyx_L1_error)
15754  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) __PYX_ERR(0, 720, __pyx_L1_error)
15755  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
15756 
15757  /* function exit code */
15758  goto __pyx_L0;
15759  __pyx_L1_error:;
15760  __pyx_r = NULL;
15761  __pyx_L0:;
15762  __Pyx_RefNannyFinishContext();
15763  return __pyx_r;
15764 }
15765 
15766 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) {
15767  int __pyx_v_eN;
15768  int __pyx_v_ebN;
15769  int __pyx_v_kb;
15770  double __pyx_v_integral;
15771  npy_intp __pyx_v_I;
15772  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
15773  __Pyx_Buffer __pyx_pybuffer_dS;
15774  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
15775  __Pyx_Buffer __pyx_pybuffer_flux;
15776  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
15777  __Pyx_Buffer __pyx_pybuffer_n;
15778  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15779  __Pyx_Buffer __pyx_pybuffer_v;
15780  PyObject *__pyx_r = NULL;
15781  __Pyx_RefNannyDeclarations
15782  npy_intp __pyx_t_1;
15783  npy_intp __pyx_t_2;
15784  int __pyx_t_3;
15785  npy_intp __pyx_t_4;
15786  npy_intp __pyx_t_5;
15787  int __pyx_t_6;
15788  npy_intp __pyx_t_7;
15789  npy_intp __pyx_t_8;
15790  int __pyx_t_9;
15791  npy_intp __pyx_t_10;
15792  npy_intp __pyx_t_11;
15793  npy_intp __pyx_t_12;
15794  Py_ssize_t __pyx_t_13;
15795  Py_ssize_t __pyx_t_14;
15796  Py_ssize_t __pyx_t_15;
15797  Py_ssize_t __pyx_t_16;
15798  int __pyx_t_17;
15799  Py_ssize_t __pyx_t_18;
15800  Py_ssize_t __pyx_t_19;
15801  Py_ssize_t __pyx_t_20;
15802  Py_ssize_t __pyx_t_21;
15803  Py_ssize_t __pyx_t_22;
15804  Py_ssize_t __pyx_t_23;
15805  Py_ssize_t __pyx_t_24;
15806  int __pyx_lineno = 0;
15807  const char *__pyx_filename = NULL;
15808  int __pyx_clineno = 0;
15809  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
15810  __pyx_pybuffer_v.pybuffer.buf = NULL;
15811  __pyx_pybuffer_v.refcount = 0;
15812  __pyx_pybuffernd_v.data = NULL;
15813  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15814  __pyx_pybuffer_n.pybuffer.buf = NULL;
15815  __pyx_pybuffer_n.refcount = 0;
15816  __pyx_pybuffernd_n.data = NULL;
15817  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
15818  __pyx_pybuffer_dS.pybuffer.buf = NULL;
15819  __pyx_pybuffer_dS.refcount = 0;
15820  __pyx_pybuffernd_dS.data = NULL;
15821  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
15822  __pyx_pybuffer_flux.pybuffer.buf = NULL;
15823  __pyx_pybuffer_flux.refcount = 0;
15824  __pyx_pybuffernd_flux.data = NULL;
15825  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
15826  {
15827  __Pyx_BufFmt_StackElem __pyx_stack[1];
15828  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15829  }
15830  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
15831  {
15832  __Pyx_BufFmt_StackElem __pyx_stack[1];
15833  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15834  }
15835  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
15836  {
15837  __Pyx_BufFmt_StackElem __pyx_stack[1];
15838  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15839  }
15840  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
15841  {
15842  __Pyx_BufFmt_StackElem __pyx_stack[1];
15843  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15844  }
15845  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
15846 
15847  /* "subsurfaceTransportFunctions.pyx":724
15848  * cdef int eN,ebN,kb
15849  * cdef double integral
15850  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
15851  * for ebN in range(n.shape[1]):
15852  * integral = 0.0
15853  */
15854  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
15855  __pyx_t_2 = __pyx_t_1;
15856  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15857  __pyx_v_eN = __pyx_t_3;
15858 
15859  /* "subsurfaceTransportFunctions.pyx":725
15860  * cdef double integral
15861  * for eN in range(n.shape[0]):
15862  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
15863  * integral = 0.0
15864  * for kb in range(n.shape[2]):
15865  */
15866  __pyx_t_4 = (__pyx_v_n->dimensions[1]);
15867  __pyx_t_5 = __pyx_t_4;
15868  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15869  __pyx_v_ebN = __pyx_t_6;
15870 
15871  /* "subsurfaceTransportFunctions.pyx":726
15872  * for eN in range(n.shape[0]):
15873  * for ebN in range(n.shape[1]):
15874  * integral = 0.0 # <<<<<<<<<<<<<<
15875  * for kb in range(n.shape[2]):
15876  * for I in range(n.shape[3]):
15877  */
15878  __pyx_v_integral = 0.0;
15879 
15880  /* "subsurfaceTransportFunctions.pyx":727
15881  * for ebN in range(n.shape[1]):
15882  * integral = 0.0
15883  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
15884  * for I in range(n.shape[3]):
15885  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15886  */
15887  __pyx_t_7 = (__pyx_v_n->dimensions[2]);
15888  __pyx_t_8 = __pyx_t_7;
15889  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15890  __pyx_v_kb = __pyx_t_9;
15891 
15892  /* "subsurfaceTransportFunctions.pyx":728
15893  * integral = 0.0
15894  * for kb in range(n.shape[2]):
15895  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
15896  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15897  * flux[eN,ebN] = integral
15898  */
15899  __pyx_t_10 = (__pyx_v_n->dimensions[3]);
15900  __pyx_t_11 = __pyx_t_10;
15901  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
15902  __pyx_v_I = __pyx_t_12;
15903 
15904  /* "subsurfaceTransportFunctions.pyx":729
15905  * for kb in range(n.shape[2]):
15906  * for I in range(n.shape[3]):
15907  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
15908  * flux[eN,ebN] = integral
15909  *
15910  */
15911  __pyx_t_13 = __pyx_v_eN;
15912  __pyx_t_14 = __pyx_v_ebN;
15913  __pyx_t_15 = __pyx_v_kb;
15914  __pyx_t_16 = __pyx_v_I;
15915  __pyx_t_17 = -1;
15916  if (__pyx_t_13 < 0) {
15917  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
15918  if (unlikely(__pyx_t_13 < 0)) __pyx_t_17 = 0;
15919  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15920  if (__pyx_t_14 < 0) {
15921  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
15922  if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 1;
15923  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15924  if (__pyx_t_15 < 0) {
15925  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
15926  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 2;
15927  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15928  if (__pyx_t_16 < 0) {
15929  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
15930  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 3;
15931  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_17 = 3;
15932  if (unlikely(__pyx_t_17 != -1)) {
15933  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15934  __PYX_ERR(0, 729, __pyx_L1_error)
15935  }
15936  __pyx_t_18 = __pyx_v_eN;
15937  __pyx_t_19 = __pyx_v_ebN;
15938  __pyx_t_20 = __pyx_v_kb;
15939  __pyx_t_21 = __pyx_v_I;
15940  __pyx_t_17 = -1;
15941  if (__pyx_t_18 < 0) {
15942  __pyx_t_18 += __pyx_pybuffernd_n.diminfo[0].shape;
15943  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15944  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
15945  if (__pyx_t_19 < 0) {
15946  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[1].shape;
15947  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15948  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_17 = 1;
15949  if (__pyx_t_20 < 0) {
15950  __pyx_t_20 += __pyx_pybuffernd_n.diminfo[2].shape;
15951  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 2;
15952  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_17 = 2;
15953  if (__pyx_t_21 < 0) {
15954  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[3].shape;
15955  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 3;
15956  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_17 = 3;
15957  if (unlikely(__pyx_t_17 != -1)) {
15958  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15959  __PYX_ERR(0, 729, __pyx_L1_error)
15960  }
15961  __pyx_t_22 = __pyx_v_eN;
15962  __pyx_t_23 = __pyx_v_ebN;
15963  __pyx_t_24 = __pyx_v_kb;
15964  __pyx_t_17 = -1;
15965  if (__pyx_t_22 < 0) {
15966  __pyx_t_22 += __pyx_pybuffernd_dS.diminfo[0].shape;
15967  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 0;
15968  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_17 = 0;
15969  if (__pyx_t_23 < 0) {
15970  __pyx_t_23 += __pyx_pybuffernd_dS.diminfo[1].shape;
15971  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 1;
15972  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_17 = 1;
15973  if (__pyx_t_24 < 0) {
15974  __pyx_t_24 += __pyx_pybuffernd_dS.diminfo[2].shape;
15975  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 2;
15976  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_17 = 2;
15977  if (unlikely(__pyx_t_17 != -1)) {
15978  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15979  __PYX_ERR(0, 729, __pyx_L1_error)
15980  }
15981  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_21, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_dS.diminfo[2].strides))));
15982  }
15983  }
15984 
15985  /* "subsurfaceTransportFunctions.pyx":730
15986  * for I in range(n.shape[3]):
15987  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15988  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
15989  *
15990  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
15991  */
15992  __pyx_t_24 = __pyx_v_eN;
15993  __pyx_t_23 = __pyx_v_ebN;
15994  __pyx_t_9 = -1;
15995  if (__pyx_t_24 < 0) {
15996  __pyx_t_24 += __pyx_pybuffernd_flux.diminfo[0].shape;
15997  if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 0;
15998  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_9 = 0;
15999  if (__pyx_t_23 < 0) {
16000  __pyx_t_23 += __pyx_pybuffernd_flux.diminfo[1].shape;
16001  if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 1;
16002  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_9 = 1;
16003  if (unlikely(__pyx_t_9 != -1)) {
16004  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16005  __PYX_ERR(0, 730, __pyx_L1_error)
16006  }
16007  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
16008  }
16009  }
16010 
16011  /* "subsurfaceTransportFunctions.pyx":717
16012  * #ELLAM
16013  * ########################################################################
16014  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
16015  * numpy.ndarray[DTYPE_t,ndim=4] n,
16016  * numpy.ndarray[DTYPE_t,ndim=3] dS,
16017  */
16018 
16019  /* function exit code */
16020  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16021  goto __pyx_L0;
16022  __pyx_L1_error:;
16023  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16024  __Pyx_PyThreadState_declare
16025  __Pyx_PyThreadState_assign
16026  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16027  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
16028  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
16029  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
16030  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16031  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16032  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
16033  __pyx_r = NULL;
16034  goto __pyx_L2;
16035  __pyx_L0:;
16036  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
16037  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
16038  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
16039  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
16040  __pyx_L2:;
16041  __Pyx_XGIVEREF(__pyx_r);
16042  __Pyx_RefNannyFinishContext();
16043  return __pyx_r;
16044 }
16045 
16046 /* "subsurfaceTransportFunctions.pyx":732
16047  * flux[eN,ebN] = integral
16048  *
16049  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16050  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16051  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16052  */
16053 
16054 /* Python wrapper */
16055 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16056 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16057 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
16058 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16059  PyArrayObject *__pyx_v_df = 0;
16060  PyArrayObject *__pyx_v_characteristic_velocity = 0;
16061  PyArrayObject *__pyx_v_dm = 0;
16062  PyArrayObject *__pyx_v_dV = 0;
16063  int __pyx_lineno = 0;
16064  const char *__pyx_filename = NULL;
16065  int __pyx_clineno = 0;
16066  PyObject *__pyx_r = 0;
16067  __Pyx_RefNannyDeclarations
16068  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
16069  {
16070  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16071  PyObject* values[4] = {0,0,0,0};
16072  if (unlikely(__pyx_kwds)) {
16073  Py_ssize_t kw_args;
16074  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16075  switch (pos_args) {
16076  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16077  CYTHON_FALLTHROUGH;
16078  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16079  CYTHON_FALLTHROUGH;
16080  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16081  CYTHON_FALLTHROUGH;
16082  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16083  CYTHON_FALLTHROUGH;
16084  case 0: break;
16085  default: goto __pyx_L5_argtuple_error;
16086  }
16087  kw_args = PyDict_Size(__pyx_kwds);
16088  switch (pos_args) {
16089  case 0:
16090  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
16091  else goto __pyx_L5_argtuple_error;
16092  CYTHON_FALLTHROUGH;
16093  case 1:
16094  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
16095  else {
16096  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); __PYX_ERR(0, 732, __pyx_L3_error)
16097  }
16098  CYTHON_FALLTHROUGH;
16099  case 2:
16100  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16101  else {
16102  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); __PYX_ERR(0, 732, __pyx_L3_error)
16103  }
16104  CYTHON_FALLTHROUGH;
16105  case 3:
16106  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16107  else {
16108  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); __PYX_ERR(0, 732, __pyx_L3_error)
16109  }
16110  }
16111  if (unlikely(kw_args > 0)) {
16112  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
16113  }
16114  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
16115  goto __pyx_L5_argtuple_error;
16116  } else {
16117  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16118  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16119  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16120  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16121  }
16122  __pyx_v_df = ((PyArrayObject *)values[0]);
16123  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
16124  __pyx_v_dm = ((PyArrayObject *)values[2]);
16125  __pyx_v_dV = ((PyArrayObject *)values[3]);
16126  }
16127  goto __pyx_L4_argument_unpacking_done;
16128  __pyx_L5_argtuple_error:;
16129  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
16130  __pyx_L3_error:;
16131  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16132  __Pyx_RefNannyFinishContext();
16133  return NULL;
16134  __pyx_L4_argument_unpacking_done:;
16135  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 732, __pyx_L1_error)
16136  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
16137  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 734, __pyx_L1_error)
16138  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 735, __pyx_L1_error)
16139  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
16140 
16141  /* function exit code */
16142  goto __pyx_L0;
16143  __pyx_L1_error:;
16144  __pyx_r = NULL;
16145  __pyx_L0:;
16146  __Pyx_RefNannyFinishContext();
16147  return __pyx_r;
16148 }
16149 
16150 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) {
16151  int __pyx_v_eN;
16152  int __pyx_v_k;
16153  int __pyx_v_I;
16154  double __pyx_v_omega_e;
16155  double __pyx_v_vol_e;
16156  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
16157  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
16158  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16159  __Pyx_Buffer __pyx_pybuffer_dV;
16160  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
16161  __Pyx_Buffer __pyx_pybuffer_df;
16162  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16163  __Pyx_Buffer __pyx_pybuffer_dm;
16164  PyObject *__pyx_r = NULL;
16165  __Pyx_RefNannyDeclarations
16166  npy_intp __pyx_t_1;
16167  npy_intp __pyx_t_2;
16168  int __pyx_t_3;
16169  npy_intp __pyx_t_4;
16170  npy_intp __pyx_t_5;
16171  int __pyx_t_6;
16172  Py_ssize_t __pyx_t_7;
16173  Py_ssize_t __pyx_t_8;
16174  int __pyx_t_9;
16175  Py_ssize_t __pyx_t_10;
16176  Py_ssize_t __pyx_t_11;
16177  npy_intp __pyx_t_12;
16178  npy_intp __pyx_t_13;
16179  int __pyx_t_14;
16180  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
16181  double __pyx_t_16;
16182  int __pyx_lineno = 0;
16183  const char *__pyx_filename = NULL;
16184  int __pyx_clineno = 0;
16185  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
16186  __pyx_pybuffer_df.pybuffer.buf = NULL;
16187  __pyx_pybuffer_df.refcount = 0;
16188  __pyx_pybuffernd_df.data = NULL;
16189  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
16190  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
16191  __pyx_pybuffer_characteristic_velocity.refcount = 0;
16192  __pyx_pybuffernd_characteristic_velocity.data = NULL;
16193  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
16194  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16195  __pyx_pybuffer_dm.refcount = 0;
16196  __pyx_pybuffernd_dm.data = NULL;
16197  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16198  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16199  __pyx_pybuffer_dV.refcount = 0;
16200  __pyx_pybuffernd_dV.data = NULL;
16201  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16202  {
16203  __Pyx_BufFmt_StackElem __pyx_stack[1];
16204  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16205  }
16206  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
16207  {
16208  __Pyx_BufFmt_StackElem __pyx_stack[1];
16209  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16210  }
16211  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
16212  {
16213  __Pyx_BufFmt_StackElem __pyx_stack[1];
16214  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16215  }
16216  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16217  {
16218  __Pyx_BufFmt_StackElem __pyx_stack[1];
16219  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16220  }
16221  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16222 
16223  /* "subsurfaceTransportFunctions.pyx":743
16224  * cdef double omega_e, vol_e
16225  *
16226  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16227  * omega_e = 0.0
16228  * vol_e = 0.0
16229  */
16230  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16231  __pyx_t_2 = __pyx_t_1;
16232  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16233  __pyx_v_eN = __pyx_t_3;
16234 
16235  /* "subsurfaceTransportFunctions.pyx":744
16236  *
16237  * for eN in range(dm.shape[0]):
16238  * omega_e = 0.0 # <<<<<<<<<<<<<<
16239  * vol_e = 0.0
16240  * for k in range(dm.shape[1]):
16241  */
16242  __pyx_v_omega_e = 0.0;
16243 
16244  /* "subsurfaceTransportFunctions.pyx":745
16245  * for eN in range(dm.shape[0]):
16246  * omega_e = 0.0
16247  * vol_e = 0.0 # <<<<<<<<<<<<<<
16248  * for k in range(dm.shape[1]):
16249  * vol_e += dV[eN,k]
16250  */
16251  __pyx_v_vol_e = 0.0;
16252 
16253  /* "subsurfaceTransportFunctions.pyx":746
16254  * omega_e = 0.0
16255  * vol_e = 0.0
16256  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16257  * vol_e += dV[eN,k]
16258  * omega_e += dV[eN,k]*dm[eN,k]
16259  */
16260  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16261  __pyx_t_5 = __pyx_t_4;
16262  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16263  __pyx_v_k = __pyx_t_6;
16264 
16265  /* "subsurfaceTransportFunctions.pyx":747
16266  * vol_e = 0.0
16267  * for k in range(dm.shape[1]):
16268  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16269  * omega_e += dV[eN,k]*dm[eN,k]
16270  * for k in range(df.shape[1]):
16271  */
16272  __pyx_t_7 = __pyx_v_eN;
16273  __pyx_t_8 = __pyx_v_k;
16274  __pyx_t_9 = -1;
16275  if (__pyx_t_7 < 0) {
16276  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16277  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16278  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16279  if (__pyx_t_8 < 0) {
16280  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16281  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16282  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16283  if (unlikely(__pyx_t_9 != -1)) {
16284  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16285  __PYX_ERR(0, 747, __pyx_L1_error)
16286  }
16287  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16288 
16289  /* "subsurfaceTransportFunctions.pyx":748
16290  * for k in range(dm.shape[1]):
16291  * vol_e += dV[eN,k]
16292  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16293  * for k in range(df.shape[1]):
16294  * for I in range(df.shape[2]):
16295  */
16296  __pyx_t_8 = __pyx_v_eN;
16297  __pyx_t_7 = __pyx_v_k;
16298  __pyx_t_9 = -1;
16299  if (__pyx_t_8 < 0) {
16300  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16301  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
16302  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16303  if (__pyx_t_7 < 0) {
16304  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
16305  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16306  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16307  if (unlikely(__pyx_t_9 != -1)) {
16308  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16309  __PYX_ERR(0, 748, __pyx_L1_error)
16310  }
16311  __pyx_t_10 = __pyx_v_eN;
16312  __pyx_t_11 = __pyx_v_k;
16313  __pyx_t_9 = -1;
16314  if (__pyx_t_10 < 0) {
16315  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16316  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16317  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16318  if (__pyx_t_11 < 0) {
16319  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16320  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16321  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16322  if (unlikely(__pyx_t_9 != -1)) {
16323  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16324  __PYX_ERR(0, 748, __pyx_L1_error)
16325  }
16326  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16327  }
16328 
16329  /* "subsurfaceTransportFunctions.pyx":749
16330  * vol_e += dV[eN,k]
16331  * omega_e += dV[eN,k]*dm[eN,k]
16332  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
16333  * for I in range(df.shape[2]):
16334  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16335  */
16336  __pyx_t_4 = (__pyx_v_df->dimensions[1]);
16337  __pyx_t_5 = __pyx_t_4;
16338  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16339  __pyx_v_k = __pyx_t_6;
16340 
16341  /* "subsurfaceTransportFunctions.pyx":750
16342  * omega_e += dV[eN,k]*dm[eN,k]
16343  * for k in range(df.shape[1]):
16344  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
16345  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16346  *
16347  */
16348  __pyx_t_12 = (__pyx_v_df->dimensions[2]);
16349  __pyx_t_13 = __pyx_t_12;
16350  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_13; __pyx_t_9+=1) {
16351  __pyx_v_I = __pyx_t_9;
16352 
16353  /* "subsurfaceTransportFunctions.pyx":751
16354  * for k in range(df.shape[1]):
16355  * for I in range(df.shape[2]):
16356  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16357  *
16358  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
16359  */
16360  __pyx_t_11 = __pyx_v_eN;
16361  __pyx_t_10 = __pyx_v_k;
16362  __pyx_t_7 = __pyx_v_I;
16363  __pyx_t_14 = -1;
16364  if (__pyx_t_11 < 0) {
16365  __pyx_t_11 += __pyx_pybuffernd_df.diminfo[0].shape;
16366  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 0;
16367  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_14 = 0;
16368  if (__pyx_t_10 < 0) {
16369  __pyx_t_10 += __pyx_pybuffernd_df.diminfo[1].shape;
16370  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 1;
16371  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_14 = 1;
16372  if (__pyx_t_7 < 0) {
16373  __pyx_t_7 += __pyx_pybuffernd_df.diminfo[2].shape;
16374  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 2;
16375  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_14 = 2;
16376  if (unlikely(__pyx_t_14 != -1)) {
16377  __Pyx_RaiseBufferIndexError(__pyx_t_14);
16378  __PYX_ERR(0, 751, __pyx_L1_error)
16379  }
16380  __pyx_t_15 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
16381  __pyx_t_16 = (__pyx_v_omega_e + 1.0e-12);
16382  if (unlikely(__pyx_t_16 == 0)) {
16383  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16384  __PYX_ERR(0, 751, __pyx_L1_error)
16385  }
16386  __pyx_t_7 = __pyx_v_eN;
16387  __pyx_t_10 = __pyx_v_k;
16388  __pyx_t_11 = __pyx_v_I;
16389  __pyx_t_14 = -1;
16390  if (__pyx_t_7 < 0) {
16391  __pyx_t_7 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
16392  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 0;
16393  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_14 = 0;
16394  if (__pyx_t_10 < 0) {
16395  __pyx_t_10 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
16396  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 1;
16397  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_14 = 1;
16398  if (__pyx_t_11 < 0) {
16399  __pyx_t_11 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
16400  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 2;
16401  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_14 = 2;
16402  if (unlikely(__pyx_t_14 != -1)) {
16403  __Pyx_RaiseBufferIndexError(__pyx_t_14);
16404  __PYX_ERR(0, 751, __pyx_L1_error)
16405  }
16406  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_15 / __pyx_t_16);
16407  }
16408  }
16409  }
16410 
16411  /* "subsurfaceTransportFunctions.pyx":732
16412  * flux[eN,ebN] = integral
16413  *
16414  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16415  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16416  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16417  */
16418 
16419  /* function exit code */
16420  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16421  goto __pyx_L0;
16422  __pyx_L1_error:;
16423  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16424  __Pyx_PyThreadState_declare
16425  __Pyx_PyThreadState_assign
16426  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16427  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16428  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16429  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16430  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16431  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16432  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16433  __pyx_r = NULL;
16434  goto __pyx_L2;
16435  __pyx_L0:;
16436  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16437  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16438  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16439  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16440  __pyx_L2:;
16441  __Pyx_XGIVEREF(__pyx_r);
16442  __Pyx_RefNannyFinishContext();
16443  return __pyx_r;
16444 }
16445 
16446 /* "subsurfaceTransportFunctions.pyx":753
16447  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16448  *
16449  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16450  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16451  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16452  */
16453 
16454 /* Python wrapper */
16455 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16456 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16457 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
16458 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16459  PyArrayObject *__pyx_v_df_dofs = 0;
16460  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
16461  PyArrayObject *__pyx_v_l2g = 0;
16462  PyArrayObject *__pyx_v_dm = 0;
16463  PyArrayObject *__pyx_v_dV = 0;
16464  int __pyx_lineno = 0;
16465  const char *__pyx_filename = NULL;
16466  int __pyx_clineno = 0;
16467  PyObject *__pyx_r = 0;
16468  __Pyx_RefNannyDeclarations
16469  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
16470  {
16471  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16472  PyObject* values[5] = {0,0,0,0,0};
16473  if (unlikely(__pyx_kwds)) {
16474  Py_ssize_t kw_args;
16475  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16476  switch (pos_args) {
16477  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16478  CYTHON_FALLTHROUGH;
16479  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16480  CYTHON_FALLTHROUGH;
16481  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16482  CYTHON_FALLTHROUGH;
16483  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16484  CYTHON_FALLTHROUGH;
16485  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16486  CYTHON_FALLTHROUGH;
16487  case 0: break;
16488  default: goto __pyx_L5_argtuple_error;
16489  }
16490  kw_args = PyDict_Size(__pyx_kwds);
16491  switch (pos_args) {
16492  case 0:
16493  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
16494  else goto __pyx_L5_argtuple_error;
16495  CYTHON_FALLTHROUGH;
16496  case 1:
16497  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
16498  else {
16499  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); __PYX_ERR(0, 753, __pyx_L3_error)
16500  }
16501  CYTHON_FALLTHROUGH;
16502  case 2:
16503  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
16504  else {
16505  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); __PYX_ERR(0, 753, __pyx_L3_error)
16506  }
16507  CYTHON_FALLTHROUGH;
16508  case 3:
16509  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16510  else {
16511  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); __PYX_ERR(0, 753, __pyx_L3_error)
16512  }
16513  CYTHON_FALLTHROUGH;
16514  case 4:
16515  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16516  else {
16517  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); __PYX_ERR(0, 753, __pyx_L3_error)
16518  }
16519  }
16520  if (unlikely(kw_args > 0)) {
16521  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) __PYX_ERR(0, 753, __pyx_L3_error)
16522  }
16523  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
16524  goto __pyx_L5_argtuple_error;
16525  } else {
16526  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16527  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16528  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16529  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16530  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16531  }
16532  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
16533  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
16534  __pyx_v_l2g = ((PyArrayObject *)values[2]);
16535  __pyx_v_dm = ((PyArrayObject *)values[3]);
16536  __pyx_v_dV = ((PyArrayObject *)values[4]);
16537  }
16538  goto __pyx_L4_argument_unpacking_done;
16539  __pyx_L5_argtuple_error:;
16540  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error)
16541  __pyx_L3_error:;
16542  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16543  __Pyx_RefNannyFinishContext();
16544  return NULL;
16545  __pyx_L4_argument_unpacking_done:;
16546  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) __PYX_ERR(0, 753, __pyx_L1_error)
16547  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) __PYX_ERR(0, 754, __pyx_L1_error)
16548  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) __PYX_ERR(0, 755, __pyx_L1_error)
16549  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 756, __pyx_L1_error)
16550  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 757, __pyx_L1_error)
16551  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
16552 
16553  /* function exit code */
16554  goto __pyx_L0;
16555  __pyx_L1_error:;
16556  __pyx_r = NULL;
16557  __pyx_L0:;
16558  __Pyx_RefNannyFinishContext();
16559  return __pyx_r;
16560 }
16561 
16562 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) {
16563  int __pyx_v_eN;
16564  int __pyx_v_k;
16565  int __pyx_v_j;
16566  int __pyx_v_J;
16567  double __pyx_v_omega_e;
16568  double __pyx_v_vol_e;
16569  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
16570  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
16571  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16572  __Pyx_Buffer __pyx_pybuffer_dV;
16573  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
16574  __Pyx_Buffer __pyx_pybuffer_df_dofs;
16575  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16576  __Pyx_Buffer __pyx_pybuffer_dm;
16577  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
16578  __Pyx_Buffer __pyx_pybuffer_l2g;
16579  PyObject *__pyx_r = NULL;
16580  __Pyx_RefNannyDeclarations
16581  npy_intp __pyx_t_1;
16582  npy_intp __pyx_t_2;
16583  int __pyx_t_3;
16584  npy_intp __pyx_t_4;
16585  npy_intp __pyx_t_5;
16586  int __pyx_t_6;
16587  Py_ssize_t __pyx_t_7;
16588  Py_ssize_t __pyx_t_8;
16589  int __pyx_t_9;
16590  Py_ssize_t __pyx_t_10;
16591  Py_ssize_t __pyx_t_11;
16592  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_12;
16593  double __pyx_t_13;
16594  int __pyx_lineno = 0;
16595  const char *__pyx_filename = NULL;
16596  int __pyx_clineno = 0;
16597  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
16598  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
16599  __pyx_pybuffer_df_dofs.refcount = 0;
16600  __pyx_pybuffernd_df_dofs.data = NULL;
16601  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
16602  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
16603  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
16604  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
16605  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
16606  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
16607  __pyx_pybuffer_l2g.refcount = 0;
16608  __pyx_pybuffernd_l2g.data = NULL;
16609  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
16610  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16611  __pyx_pybuffer_dm.refcount = 0;
16612  __pyx_pybuffernd_dm.data = NULL;
16613  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16614  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16615  __pyx_pybuffer_dV.refcount = 0;
16616  __pyx_pybuffernd_dV.data = NULL;
16617  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16618  {
16619  __Pyx_BufFmt_StackElem __pyx_stack[1];
16620  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16621  }
16622  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
16623  {
16624  __Pyx_BufFmt_StackElem __pyx_stack[1];
16625  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16626  }
16627  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
16628  {
16629  __Pyx_BufFmt_StackElem __pyx_stack[1];
16630  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16631  }
16632  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
16633  {
16634  __Pyx_BufFmt_StackElem __pyx_stack[1];
16635  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16636  }
16637  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16638  {
16639  __Pyx_BufFmt_StackElem __pyx_stack[1];
16640  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16641  }
16642  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16643 
16644  /* "subsurfaceTransportFunctions.pyx":765
16645  * cdef double omega_e, vol_e
16646  *
16647  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16648  * omega_e = 0.0
16649  * vol_e = 0.0
16650  */
16651  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16652  __pyx_t_2 = __pyx_t_1;
16653  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16654  __pyx_v_eN = __pyx_t_3;
16655 
16656  /* "subsurfaceTransportFunctions.pyx":766
16657  *
16658  * for eN in range(dm.shape[0]):
16659  * omega_e = 0.0 # <<<<<<<<<<<<<<
16660  * vol_e = 0.0
16661  * for k in range(dm.shape[1]):
16662  */
16663  __pyx_v_omega_e = 0.0;
16664 
16665  /* "subsurfaceTransportFunctions.pyx":767
16666  * for eN in range(dm.shape[0]):
16667  * omega_e = 0.0
16668  * vol_e = 0.0 # <<<<<<<<<<<<<<
16669  * for k in range(dm.shape[1]):
16670  * vol_e += dV[eN,k]
16671  */
16672  __pyx_v_vol_e = 0.0;
16673 
16674  /* "subsurfaceTransportFunctions.pyx":768
16675  * omega_e = 0.0
16676  * vol_e = 0.0
16677  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16678  * vol_e += dV[eN,k]
16679  * omega_e += dV[eN,k]*dm[eN,k]
16680  */
16681  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16682  __pyx_t_5 = __pyx_t_4;
16683  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16684  __pyx_v_k = __pyx_t_6;
16685 
16686  /* "subsurfaceTransportFunctions.pyx":769
16687  * vol_e = 0.0
16688  * for k in range(dm.shape[1]):
16689  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16690  * omega_e += dV[eN,k]*dm[eN,k]
16691  * for j in range(l2g.shape[1]):
16692  */
16693  __pyx_t_7 = __pyx_v_eN;
16694  __pyx_t_8 = __pyx_v_k;
16695  __pyx_t_9 = -1;
16696  if (__pyx_t_7 < 0) {
16697  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16698  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16699  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16700  if (__pyx_t_8 < 0) {
16701  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16702  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16703  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16704  if (unlikely(__pyx_t_9 != -1)) {
16705  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16706  __PYX_ERR(0, 769, __pyx_L1_error)
16707  }
16708  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16709 
16710  /* "subsurfaceTransportFunctions.pyx":770
16711  * for k in range(dm.shape[1]):
16712  * vol_e += dV[eN,k]
16713  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16714  * for j in range(l2g.shape[1]):
16715  * J = l2g[eN,j]
16716  */
16717  __pyx_t_8 = __pyx_v_eN;
16718  __pyx_t_7 = __pyx_v_k;
16719  __pyx_t_9 = -1;
16720  if (__pyx_t_8 < 0) {
16721  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16722  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
16723  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16724  if (__pyx_t_7 < 0) {
16725  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
16726  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16727  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16728  if (unlikely(__pyx_t_9 != -1)) {
16729  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16730  __PYX_ERR(0, 770, __pyx_L1_error)
16731  }
16732  __pyx_t_10 = __pyx_v_eN;
16733  __pyx_t_11 = __pyx_v_k;
16734  __pyx_t_9 = -1;
16735  if (__pyx_t_10 < 0) {
16736  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16737  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16738  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16739  if (__pyx_t_11 < 0) {
16740  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16741  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16742  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16743  if (unlikely(__pyx_t_9 != -1)) {
16744  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16745  __PYX_ERR(0, 770, __pyx_L1_error)
16746  }
16747  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16748  }
16749 
16750  /* "subsurfaceTransportFunctions.pyx":771
16751  * vol_e += dV[eN,k]
16752  * omega_e += dV[eN,k]*dm[eN,k]
16753  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
16754  * J = l2g[eN,j]
16755  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16756  */
16757  __pyx_t_4 = (__pyx_v_l2g->dimensions[1]);
16758  __pyx_t_5 = __pyx_t_4;
16759  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16760  __pyx_v_j = __pyx_t_6;
16761 
16762  /* "subsurfaceTransportFunctions.pyx":772
16763  * omega_e += dV[eN,k]*dm[eN,k]
16764  * for j in range(l2g.shape[1]):
16765  * J = l2g[eN,j] # <<<<<<<<<<<<<<
16766  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16767  *
16768  */
16769  __pyx_t_11 = __pyx_v_eN;
16770  __pyx_t_10 = __pyx_v_j;
16771  __pyx_t_9 = -1;
16772  if (__pyx_t_11 < 0) {
16773  __pyx_t_11 += __pyx_pybuffernd_l2g.diminfo[0].shape;
16774  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
16775  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_9 = 0;
16776  if (__pyx_t_10 < 0) {
16777  __pyx_t_10 += __pyx_pybuffernd_l2g.diminfo[1].shape;
16778  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 1;
16779  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_9 = 1;
16780  if (unlikely(__pyx_t_9 != -1)) {
16781  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16782  __PYX_ERR(0, 772, __pyx_L1_error)
16783  }
16784  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_l2g.diminfo[1].strides));
16785 
16786  /* "subsurfaceTransportFunctions.pyx":773
16787  * for j in range(l2g.shape[1]):
16788  * J = l2g[eN,j]
16789  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16790  *
16791  * #problem specific velocity evaluation
16792  */
16793  __pyx_t_10 = __pyx_v_J;
16794  __pyx_t_9 = -1;
16795  if (__pyx_t_10 < 0) {
16796  __pyx_t_10 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
16797  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16798  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16799  if (unlikely(__pyx_t_9 != -1)) {
16800  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16801  __PYX_ERR(0, 773, __pyx_L1_error)
16802  }
16803  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
16804  __pyx_t_13 = (__pyx_v_omega_e + 1.0e-12);
16805  if (unlikely(__pyx_t_13 == 0)) {
16806  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16807  __PYX_ERR(0, 773, __pyx_L1_error)
16808  }
16809  __pyx_t_10 = __pyx_v_J;
16810  __pyx_t_9 = -1;
16811  if (__pyx_t_10 < 0) {
16812  __pyx_t_10 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
16813  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16814  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16815  if (unlikely(__pyx_t_9 != -1)) {
16816  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16817  __PYX_ERR(0, 773, __pyx_L1_error)
16818  }
16819  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_12 / __pyx_t_13);
16820  }
16821  }
16822 
16823  /* "subsurfaceTransportFunctions.pyx":753
16824  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16825  *
16826  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16827  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16828  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16829  */
16830 
16831  /* function exit code */
16832  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16833  goto __pyx_L0;
16834  __pyx_L1_error:;
16835  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16836  __Pyx_PyThreadState_declare
16837  __Pyx_PyThreadState_assign
16838  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16839  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16840  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16841  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16843  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16844  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16845  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16846  __pyx_r = NULL;
16847  goto __pyx_L2;
16848  __pyx_L0:;
16849  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16850  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16851  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16852  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16853  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16854  __pyx_L2:;
16855  __Pyx_XGIVEREF(__pyx_r);
16856  __Pyx_RefNannyFinishContext();
16857  return __pyx_r;
16858 }
16859 
16860 /* "subsurfaceTransportFunctions.pyx":776
16861  *
16862  * #problem specific velocity evaluation
16863  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16864  * double t,
16865  * double tForReversal,
16866  */
16867 
16868 /* Python wrapper */
16869 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16870 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
16871 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16872  int __pyx_v_transient;
16873  double __pyx_v_t;
16874  double __pyx_v_tForReversal;
16875  double __pyx_v_clock;
16876  double __pyx_v_xc;
16877  double __pyx_v_yc;
16878  PyArrayObject *__pyx_v_x = 0;
16879  PyArrayObject *__pyx_v_v = 0;
16880  double __pyx_v_zvelocity;
16881  int __pyx_lineno = 0;
16882  const char *__pyx_filename = NULL;
16883  int __pyx_clineno = 0;
16884  PyObject *__pyx_r = 0;
16885  __Pyx_RefNannyDeclarations
16886  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
16887  {
16888  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16889  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16890  if (unlikely(__pyx_kwds)) {
16891  Py_ssize_t kw_args;
16892  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16893  switch (pos_args) {
16894  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16895  CYTHON_FALLTHROUGH;
16896  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16897  CYTHON_FALLTHROUGH;
16898  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16899  CYTHON_FALLTHROUGH;
16900  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16901  CYTHON_FALLTHROUGH;
16902  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16903  CYTHON_FALLTHROUGH;
16904  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16905  CYTHON_FALLTHROUGH;
16906  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16907  CYTHON_FALLTHROUGH;
16908  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16909  CYTHON_FALLTHROUGH;
16910  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16911  CYTHON_FALLTHROUGH;
16912  case 0: break;
16913  default: goto __pyx_L5_argtuple_error;
16914  }
16915  kw_args = PyDict_Size(__pyx_kwds);
16916  switch (pos_args) {
16917  case 0:
16918  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16919  else goto __pyx_L5_argtuple_error;
16920  CYTHON_FALLTHROUGH;
16921  case 1:
16922  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16923  else {
16924  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); __PYX_ERR(0, 776, __pyx_L3_error)
16925  }
16926  CYTHON_FALLTHROUGH;
16927  case 2:
16928  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16929  else {
16930  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); __PYX_ERR(0, 776, __pyx_L3_error)
16931  }
16932  CYTHON_FALLTHROUGH;
16933  case 3:
16934  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16935  else {
16936  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); __PYX_ERR(0, 776, __pyx_L3_error)
16937  }
16938  CYTHON_FALLTHROUGH;
16939  case 4:
16940  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16941  else {
16942  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); __PYX_ERR(0, 776, __pyx_L3_error)
16943  }
16944  CYTHON_FALLTHROUGH;
16945  case 5:
16946  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16947  else {
16948  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); __PYX_ERR(0, 776, __pyx_L3_error)
16949  }
16950  CYTHON_FALLTHROUGH;
16951  case 6:
16952  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16953  else {
16954  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); __PYX_ERR(0, 776, __pyx_L3_error)
16955  }
16956  CYTHON_FALLTHROUGH;
16957  case 7:
16958  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16959  else {
16960  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); __PYX_ERR(0, 776, __pyx_L3_error)
16961  }
16962  CYTHON_FALLTHROUGH;
16963  case 8:
16964  if (kw_args > 0) {
16965  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
16966  if (value) { values[8] = value; kw_args--; }
16967  }
16968  }
16969  if (unlikely(kw_args > 0)) {
16970  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
16971  }
16972  } else {
16973  switch (PyTuple_GET_SIZE(__pyx_args)) {
16974  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16975  CYTHON_FALLTHROUGH;
16976  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16977  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16978  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16979  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16980  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16981  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16982  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16983  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16984  break;
16985  default: goto __pyx_L5_argtuple_error;
16986  }
16987  }
16988  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error)
16989  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L3_error)
16990  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L3_error)
16991  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L3_error)
16992  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16993  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16994  __pyx_v_x = ((PyArrayObject *)values[6]);
16995  __pyx_v_v = ((PyArrayObject *)values[7]);
16996  if (values[8]) {
16997  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
16998  } else {
16999  __pyx_v_zvelocity = ((double)0.0);
17000  }
17001  }
17002  goto __pyx_L4_argument_unpacking_done;
17003  __pyx_L5_argtuple_error:;
17004  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
17005  __pyx_L3_error:;
17006  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17007  __Pyx_RefNannyFinishContext();
17008  return NULL;
17009  __pyx_L4_argument_unpacking_done:;
17010  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
17011  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 782, __pyx_L1_error)
17012  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17013 
17014  /* function exit code */
17015  goto __pyx_L0;
17016  __pyx_L1_error:;
17017  __pyx_r = NULL;
17018  __pyx_L0:;
17019  __Pyx_RefNannyFinishContext();
17020  return __pyx_r;
17021 }
17022 
17023 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) {
17024  int __pyx_v_eN;
17025  int __pyx_v_k;
17026  double __pyx_v_pi;
17027  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
17028  __Pyx_Buffer __pyx_pybuffer_v;
17029  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
17030  __Pyx_Buffer __pyx_pybuffer_x;
17031  PyObject *__pyx_r = NULL;
17032  __Pyx_RefNannyDeclarations
17033  int __pyx_t_1;
17034  npy_intp __pyx_t_2;
17035  npy_intp __pyx_t_3;
17036  int __pyx_t_4;
17037  npy_intp __pyx_t_5;
17038  npy_intp __pyx_t_6;
17039  int __pyx_t_7;
17040  Py_ssize_t __pyx_t_8;
17041  Py_ssize_t __pyx_t_9;
17042  Py_ssize_t __pyx_t_10;
17043  int __pyx_t_11;
17044  Py_ssize_t __pyx_t_12;
17045  Py_ssize_t __pyx_t_13;
17046  Py_ssize_t __pyx_t_14;
17047  PyObject *__pyx_t_15 = NULL;
17048  PyObject *__pyx_t_16 = NULL;
17049  PyObject *__pyx_t_17 = NULL;
17050  double __pyx_t_18;
17051  double __pyx_t_19;
17052  PyObject *__pyx_t_20 = NULL;
17053  int __pyx_lineno = 0;
17054  const char *__pyx_filename = NULL;
17055  int __pyx_clineno = 0;
17056  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
17057  __pyx_pybuffer_x.pybuffer.buf = NULL;
17058  __pyx_pybuffer_x.refcount = 0;
17059  __pyx_pybuffernd_x.data = NULL;
17060  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17061  __pyx_pybuffer_v.pybuffer.buf = NULL;
17062  __pyx_pybuffer_v.refcount = 0;
17063  __pyx_pybuffernd_v.data = NULL;
17064  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17065  {
17066  __Pyx_BufFmt_StackElem __pyx_stack[1];
17067  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, 776, __pyx_L1_error)
17068  }
17069  __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];
17070  {
17071  __Pyx_BufFmt_StackElem __pyx_stack[1];
17072  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
17073  }
17074  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
17075 
17076  /* "subsurfaceTransportFunctions.pyx":786
17077  * cdef int eN,k
17078  * cdef double pi
17079  * pi = M_PI # <<<<<<<<<<<<<<
17080  * if v.shape[2] == 3:
17081  * if transient == 1:
17082  */
17083  __pyx_v_pi = M_PI;
17084 
17085  /* "subsurfaceTransportFunctions.pyx":787
17086  * cdef double pi
17087  * pi = M_PI
17088  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17089  * if transient == 1:
17090  * for eN in range(x.shape[0]):
17091  */
17092  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
17093  if (__pyx_t_1) {
17094 
17095  /* "subsurfaceTransportFunctions.pyx":788
17096  * pi = M_PI
17097  * if v.shape[2] == 3:
17098  * if transient == 1: # <<<<<<<<<<<<<<
17099  * for eN in range(x.shape[0]):
17100  * for k in range(x.shape[1]):
17101  */
17102  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17103  if (__pyx_t_1) {
17104 
17105  /* "subsurfaceTransportFunctions.pyx":789
17106  * if v.shape[2] == 3:
17107  * if transient == 1:
17108  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17109  * for k in range(x.shape[1]):
17110  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17111  */
17112  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17113  __pyx_t_3 = __pyx_t_2;
17114  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17115  __pyx_v_eN = __pyx_t_4;
17116 
17117  /* "subsurfaceTransportFunctions.pyx":790
17118  * if transient == 1:
17119  * for eN in range(x.shape[0]):
17120  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17121  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17122  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17123  */
17124  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17125  __pyx_t_6 = __pyx_t_5;
17126  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17127  __pyx_v_k = __pyx_t_7;
17128 
17129  /* "subsurfaceTransportFunctions.pyx":791
17130  * for eN in range(x.shape[0]):
17131  * for k in range(x.shape[1]):
17132  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17133  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17134  * v[eN,k,2]=zvelocity
17135  */
17136  __pyx_t_8 = __pyx_v_eN;
17137  __pyx_t_9 = __pyx_v_k;
17138  __pyx_t_10 = 1;
17139  __pyx_t_11 = -1;
17140  if (__pyx_t_8 < 0) {
17141  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17142  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17143  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17144  if (__pyx_t_9 < 0) {
17145  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17146  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17147  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17148  if (__pyx_t_10 < 0) {
17149  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17150  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17151  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17152  if (unlikely(__pyx_t_11 != -1)) {
17153  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17154  __PYX_ERR(0, 791, __pyx_L1_error)
17155  }
17156  __pyx_t_12 = __pyx_v_eN;
17157  __pyx_t_13 = __pyx_v_k;
17158  __pyx_t_14 = 0;
17159  __pyx_t_11 = -1;
17160  if (__pyx_t_12 < 0) {
17161  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17162  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17163  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17164  if (__pyx_t_13 < 0) {
17165  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17166  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17167  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17168  if (__pyx_t_14 < 0) {
17169  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17170  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17171  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17172  if (unlikely(__pyx_t_11 != -1)) {
17173  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17174  __PYX_ERR(0, 791, __pyx_L1_error)
17175  }
17176  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17177 
17178  /* "subsurfaceTransportFunctions.pyx":792
17179  * for k in range(x.shape[1]):
17180  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17181  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17182  * v[eN,k,2]=zvelocity
17183  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17184  */
17185  __pyx_t_10 = __pyx_v_eN;
17186  __pyx_t_9 = __pyx_v_k;
17187  __pyx_t_8 = 0;
17188  __pyx_t_11 = -1;
17189  if (__pyx_t_10 < 0) {
17190  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17191  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17192  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17193  if (__pyx_t_9 < 0) {
17194  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17195  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17196  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17197  if (__pyx_t_8 < 0) {
17198  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17199  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17200  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17201  if (unlikely(__pyx_t_11 != -1)) {
17202  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17203  __PYX_ERR(0, 792, __pyx_L1_error)
17204  }
17205  __pyx_t_14 = __pyx_v_eN;
17206  __pyx_t_13 = __pyx_v_k;
17207  __pyx_t_12 = 1;
17208  __pyx_t_11 = -1;
17209  if (__pyx_t_14 < 0) {
17210  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17211  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17212  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17213  if (__pyx_t_13 < 0) {
17214  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17215  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17216  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17217  if (__pyx_t_12 < 0) {
17218  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17219  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17220  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17221  if (unlikely(__pyx_t_11 != -1)) {
17222  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17223  __PYX_ERR(0, 792, __pyx_L1_error)
17224  }
17225  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17226 
17227  /* "subsurfaceTransportFunctions.pyx":793
17228  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17229  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17230  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17231  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17232  * else:
17233  */
17234  __pyx_t_8 = __pyx_v_eN;
17235  __pyx_t_9 = __pyx_v_k;
17236  __pyx_t_10 = 2;
17237  __pyx_t_11 = -1;
17238  if (__pyx_t_8 < 0) {
17239  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[0].shape;
17240  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17241  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17242  if (__pyx_t_9 < 0) {
17243  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
17244  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17245  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17246  if (__pyx_t_10 < 0) {
17247  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[2].shape;
17248  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17249  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17250  if (unlikely(__pyx_t_11 != -1)) {
17251  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17252  __PYX_ERR(0, 793, __pyx_L1_error)
17253  }
17254  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17255 
17256  /* "subsurfaceTransportFunctions.pyx":794
17257  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17258  * v[eN,k,2]=zvelocity
17259  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17260  * else:
17261  * for eN in range(x.shape[0]):
17262  */
17263  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L1_error)
17264  __Pyx_GOTREF(__pyx_t_15);
17265  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 794, __pyx_L1_error)
17266  __Pyx_GOTREF(__pyx_t_16);
17267  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 794, __pyx_L1_error)
17268  __Pyx_GOTREF(__pyx_t_17);
17269  __Pyx_GIVEREF(__pyx_t_15);
17270  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
17271  __Pyx_GIVEREF(__pyx_t_16);
17272  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
17273  __Pyx_INCREF(__pyx_slice_);
17274  __Pyx_GIVEREF(__pyx_slice_);
17275  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_slice_);
17276  __pyx_t_15 = 0;
17277  __pyx_t_16 = 0;
17278  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 794, __pyx_L1_error)
17279  __Pyx_GOTREF(__pyx_t_16);
17280  __pyx_t_18 = (__pyx_v_tForReversal - __pyx_v_t);
17281  __pyx_t_19 = (__pyx_v_tForReversal - 0.0);
17282  if (unlikely(__pyx_t_19 == 0)) {
17283  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17284  __PYX_ERR(0, 794, __pyx_L1_error)
17285  }
17286  __pyx_t_15 = PyFloat_FromDouble(((__pyx_t_18 / __pyx_t_19) * __pyx_v_clock)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L1_error)
17287  __Pyx_GOTREF(__pyx_t_15);
17288  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 794, __pyx_L1_error)
17289  __Pyx_GOTREF(__pyx_t_20);
17290  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17291  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17292  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_17, __pyx_t_20) < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
17293  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
17294  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17295  }
17296  }
17297 
17298  /* "subsurfaceTransportFunctions.pyx":788
17299  * pi = M_PI
17300  * if v.shape[2] == 3:
17301  * if transient == 1: # <<<<<<<<<<<<<<
17302  * for eN in range(x.shape[0]):
17303  * for k in range(x.shape[1]):
17304  */
17305  goto __pyx_L4;
17306  }
17307 
17308  /* "subsurfaceTransportFunctions.pyx":796
17309  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17310  * else:
17311  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17312  * for k in range(x.shape[1]):
17313  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17314  */
17315  /*else*/ {
17316  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17317  __pyx_t_3 = __pyx_t_2;
17318  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17319  __pyx_v_eN = __pyx_t_4;
17320 
17321  /* "subsurfaceTransportFunctions.pyx":797
17322  * else:
17323  * for eN in range(x.shape[0]):
17324  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17325  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17326  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17327  */
17328  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17329  __pyx_t_6 = __pyx_t_5;
17330  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17331  __pyx_v_k = __pyx_t_7;
17332 
17333  /* "subsurfaceTransportFunctions.pyx":798
17334  * for eN in range(x.shape[0]):
17335  * for k in range(x.shape[1]):
17336  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17337  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17338  * v[eN,k,2]=zvelocity
17339  */
17340  __pyx_t_10 = __pyx_v_eN;
17341  __pyx_t_9 = __pyx_v_k;
17342  __pyx_t_8 = 1;
17343  __pyx_t_11 = -1;
17344  if (__pyx_t_10 < 0) {
17345  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17346  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17347  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17348  if (__pyx_t_9 < 0) {
17349  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17350  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17351  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17352  if (__pyx_t_8 < 0) {
17353  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17354  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17355  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17356  if (unlikely(__pyx_t_11 != -1)) {
17357  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17358  __PYX_ERR(0, 798, __pyx_L1_error)
17359  }
17360  __pyx_t_12 = __pyx_v_eN;
17361  __pyx_t_13 = __pyx_v_k;
17362  __pyx_t_14 = 0;
17363  __pyx_t_11 = -1;
17364  if (__pyx_t_12 < 0) {
17365  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17366  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17367  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17368  if (__pyx_t_13 < 0) {
17369  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17370  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17371  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17372  if (__pyx_t_14 < 0) {
17373  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17374  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17375  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17376  if (unlikely(__pyx_t_11 != -1)) {
17377  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17378  __PYX_ERR(0, 798, __pyx_L1_error)
17379  }
17380  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17381 
17382  /* "subsurfaceTransportFunctions.pyx":799
17383  * for k in range(x.shape[1]):
17384  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17385  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17386  * v[eN,k,2]=zvelocity
17387  * else:
17388  */
17389  __pyx_t_8 = __pyx_v_eN;
17390  __pyx_t_9 = __pyx_v_k;
17391  __pyx_t_10 = 0;
17392  __pyx_t_11 = -1;
17393  if (__pyx_t_8 < 0) {
17394  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17395  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17396  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17397  if (__pyx_t_9 < 0) {
17398  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17399  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17400  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17401  if (__pyx_t_10 < 0) {
17402  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17403  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17404  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17405  if (unlikely(__pyx_t_11 != -1)) {
17406  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17407  __PYX_ERR(0, 799, __pyx_L1_error)
17408  }
17409  __pyx_t_14 = __pyx_v_eN;
17410  __pyx_t_13 = __pyx_v_k;
17411  __pyx_t_12 = 1;
17412  __pyx_t_11 = -1;
17413  if (__pyx_t_14 < 0) {
17414  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17415  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17416  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17417  if (__pyx_t_13 < 0) {
17418  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17419  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17420  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17421  if (__pyx_t_12 < 0) {
17422  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17423  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17424  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17425  if (unlikely(__pyx_t_11 != -1)) {
17426  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17427  __PYX_ERR(0, 799, __pyx_L1_error)
17428  }
17429  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides))));
17430 
17431  /* "subsurfaceTransportFunctions.pyx":800
17432  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17433  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17434  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17435  * else:
17436  * assert v.shape[2] == 2
17437  */
17438  __pyx_t_10 = __pyx_v_eN;
17439  __pyx_t_9 = __pyx_v_k;
17440  __pyx_t_8 = 2;
17441  __pyx_t_11 = -1;
17442  if (__pyx_t_10 < 0) {
17443  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
17444  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17445  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17446  if (__pyx_t_9 < 0) {
17447  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
17448  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17449  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17450  if (__pyx_t_8 < 0) {
17451  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[2].shape;
17452  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17453  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17454  if (unlikely(__pyx_t_11 != -1)) {
17455  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17456  __PYX_ERR(0, 800, __pyx_L1_error)
17457  }
17458  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17459  }
17460  }
17461  }
17462  __pyx_L4:;
17463 
17464  /* "subsurfaceTransportFunctions.pyx":787
17465  * cdef double pi
17466  * pi = M_PI
17467  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17468  * if transient == 1:
17469  * for eN in range(x.shape[0]):
17470  */
17471  goto __pyx_L3;
17472  }
17473 
17474  /* "subsurfaceTransportFunctions.pyx":802
17475  * v[eN,k,2]=zvelocity
17476  * else:
17477  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
17478  * if transient == 1:
17479  * for eN in range(x.shape[0]):
17480  */
17481  /*else*/ {
17482  #ifndef CYTHON_WITHOUT_ASSERTIONS
17483  if (unlikely(!Py_OptimizeFlag)) {
17484  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
17485  PyErr_SetNone(PyExc_AssertionError);
17486  __PYX_ERR(0, 802, __pyx_L1_error)
17487  }
17488  }
17489  #endif
17490 
17491  /* "subsurfaceTransportFunctions.pyx":803
17492  * else:
17493  * assert v.shape[2] == 2
17494  * if transient == 1: # <<<<<<<<<<<<<<
17495  * for eN in range(x.shape[0]):
17496  * for k in range(x.shape[1]):
17497  */
17498  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17499  if (__pyx_t_1) {
17500 
17501  /* "subsurfaceTransportFunctions.pyx":804
17502  * assert v.shape[2] == 2
17503  * if transient == 1:
17504  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17505  * for k in range(x.shape[1]):
17506  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17507  */
17508  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17509  __pyx_t_3 = __pyx_t_2;
17510  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17511  __pyx_v_eN = __pyx_t_4;
17512 
17513  /* "subsurfaceTransportFunctions.pyx":805
17514  * if transient == 1:
17515  * for eN in range(x.shape[0]):
17516  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17517  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17518  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17519  */
17520  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17521  __pyx_t_6 = __pyx_t_5;
17522  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17523  __pyx_v_k = __pyx_t_7;
17524 
17525  /* "subsurfaceTransportFunctions.pyx":806
17526  * for eN in range(x.shape[0]):
17527  * for k in range(x.shape[1]):
17528  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17529  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17530  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17531  */
17532  __pyx_t_8 = __pyx_v_eN;
17533  __pyx_t_9 = __pyx_v_k;
17534  __pyx_t_10 = 1;
17535  __pyx_t_11 = -1;
17536  if (__pyx_t_8 < 0) {
17537  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17538  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17539  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17540  if (__pyx_t_9 < 0) {
17541  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17542  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17543  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17544  if (__pyx_t_10 < 0) {
17545  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17546  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17547  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17548  if (unlikely(__pyx_t_11 != -1)) {
17549  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17550  __PYX_ERR(0, 806, __pyx_L1_error)
17551  }
17552  __pyx_t_12 = __pyx_v_eN;
17553  __pyx_t_13 = __pyx_v_k;
17554  __pyx_t_14 = 0;
17555  __pyx_t_11 = -1;
17556  if (__pyx_t_12 < 0) {
17557  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17558  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17559  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17560  if (__pyx_t_13 < 0) {
17561  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17562  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17563  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17564  if (__pyx_t_14 < 0) {
17565  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17566  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17567  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17568  if (unlikely(__pyx_t_11 != -1)) {
17569  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17570  __PYX_ERR(0, 806, __pyx_L1_error)
17571  }
17572  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17573 
17574  /* "subsurfaceTransportFunctions.pyx":807
17575  * for k in range(x.shape[1]):
17576  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17577  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17578  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17579  * else:
17580  */
17581  __pyx_t_10 = __pyx_v_eN;
17582  __pyx_t_9 = __pyx_v_k;
17583  __pyx_t_8 = 0;
17584  __pyx_t_11 = -1;
17585  if (__pyx_t_10 < 0) {
17586  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17587  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17588  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17589  if (__pyx_t_9 < 0) {
17590  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17591  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17592  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17593  if (__pyx_t_8 < 0) {
17594  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17595  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17596  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17597  if (unlikely(__pyx_t_11 != -1)) {
17598  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17599  __PYX_ERR(0, 807, __pyx_L1_error)
17600  }
17601  __pyx_t_14 = __pyx_v_eN;
17602  __pyx_t_13 = __pyx_v_k;
17603  __pyx_t_12 = 1;
17604  __pyx_t_11 = -1;
17605  if (__pyx_t_14 < 0) {
17606  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17607  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17608  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17609  if (__pyx_t_13 < 0) {
17610  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17611  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17612  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17613  if (__pyx_t_12 < 0) {
17614  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17615  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17616  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17617  if (unlikely(__pyx_t_11 != -1)) {
17618  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17619  __PYX_ERR(0, 807, __pyx_L1_error)
17620  }
17621  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17622 
17623  /* "subsurfaceTransportFunctions.pyx":808
17624  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17625  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17626  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17627  * else:
17628  * for eN in range(x.shape[0]):
17629  */
17630  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 808, __pyx_L1_error)
17631  __Pyx_GOTREF(__pyx_t_17);
17632  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 808, __pyx_L1_error)
17633  __Pyx_GOTREF(__pyx_t_20);
17634  __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 808, __pyx_L1_error)
17635  __Pyx_GOTREF(__pyx_t_15);
17636  __Pyx_GIVEREF(__pyx_t_17);
17637  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_17);
17638  __Pyx_GIVEREF(__pyx_t_20);
17639  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_20);
17640  __Pyx_INCREF(__pyx_slice_);
17641  __Pyx_GIVEREF(__pyx_slice_);
17642  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_slice_);
17643  __pyx_t_17 = 0;
17644  __pyx_t_20 = 0;
17645  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 808, __pyx_L1_error)
17646  __Pyx_GOTREF(__pyx_t_20);
17647  __pyx_t_19 = (__pyx_v_tForReversal - __pyx_v_t);
17648  __pyx_t_18 = (__pyx_v_tForReversal - 0.0);
17649  if (unlikely(__pyx_t_18 == 0)) {
17650  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17651  __PYX_ERR(0, 808, __pyx_L1_error)
17652  }
17653  __pyx_t_17 = PyFloat_FromDouble(((__pyx_t_19 / __pyx_t_18) * __pyx_v_clock)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 808, __pyx_L1_error)
17654  __Pyx_GOTREF(__pyx_t_17);
17655  __pyx_t_16 = PyNumber_InPlaceMultiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 808, __pyx_L1_error)
17656  __Pyx_GOTREF(__pyx_t_16);
17657  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
17658  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17659  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_15, __pyx_t_16) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
17660  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17661  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17662  }
17663  }
17664 
17665  /* "subsurfaceTransportFunctions.pyx":803
17666  * else:
17667  * assert v.shape[2] == 2
17668  * if transient == 1: # <<<<<<<<<<<<<<
17669  * for eN in range(x.shape[0]):
17670  * for k in range(x.shape[1]):
17671  */
17672  goto __pyx_L13;
17673  }
17674 
17675  /* "subsurfaceTransportFunctions.pyx":810
17676  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17677  * else:
17678  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17679  * for k in range(x.shape[1]):
17680  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17681  */
17682  /*else*/ {
17683  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17684  __pyx_t_3 = __pyx_t_2;
17685  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17686  __pyx_v_eN = __pyx_t_4;
17687 
17688  /* "subsurfaceTransportFunctions.pyx":811
17689  * else:
17690  * for eN in range(x.shape[0]):
17691  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17692  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17693  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17694  */
17695  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17696  __pyx_t_6 = __pyx_t_5;
17697  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17698  __pyx_v_k = __pyx_t_7;
17699 
17700  /* "subsurfaceTransportFunctions.pyx":812
17701  * for eN in range(x.shape[0]):
17702  * for k in range(x.shape[1]):
17703  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17704  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17705  *
17706  */
17707  __pyx_t_8 = __pyx_v_eN;
17708  __pyx_t_9 = __pyx_v_k;
17709  __pyx_t_10 = 1;
17710  __pyx_t_11 = -1;
17711  if (__pyx_t_8 < 0) {
17712  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17713  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17714  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17715  if (__pyx_t_9 < 0) {
17716  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17717  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17718  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17719  if (__pyx_t_10 < 0) {
17720  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17721  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17722  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17723  if (unlikely(__pyx_t_11 != -1)) {
17724  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17725  __PYX_ERR(0, 812, __pyx_L1_error)
17726  }
17727  __pyx_t_12 = __pyx_v_eN;
17728  __pyx_t_13 = __pyx_v_k;
17729  __pyx_t_14 = 0;
17730  __pyx_t_11 = -1;
17731  if (__pyx_t_12 < 0) {
17732  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17733  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17734  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17735  if (__pyx_t_13 < 0) {
17736  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17737  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17738  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17739  if (__pyx_t_14 < 0) {
17740  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17741  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17742  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17743  if (unlikely(__pyx_t_11 != -1)) {
17744  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17745  __PYX_ERR(0, 812, __pyx_L1_error)
17746  }
17747  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17748 
17749  /* "subsurfaceTransportFunctions.pyx":813
17750  * for k in range(x.shape[1]):
17751  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17752  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17753  *
17754  *
17755  */
17756  __pyx_t_10 = __pyx_v_eN;
17757  __pyx_t_9 = __pyx_v_k;
17758  __pyx_t_8 = 0;
17759  __pyx_t_11 = -1;
17760  if (__pyx_t_10 < 0) {
17761  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17762  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17763  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17764  if (__pyx_t_9 < 0) {
17765  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17766  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17767  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17768  if (__pyx_t_8 < 0) {
17769  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17770  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17771  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17772  if (unlikely(__pyx_t_11 != -1)) {
17773  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17774  __PYX_ERR(0, 813, __pyx_L1_error)
17775  }
17776  __pyx_t_14 = __pyx_v_eN;
17777  __pyx_t_13 = __pyx_v_k;
17778  __pyx_t_12 = 1;
17779  __pyx_t_11 = -1;
17780  if (__pyx_t_14 < 0) {
17781  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17782  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17783  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17784  if (__pyx_t_13 < 0) {
17785  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17786  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17787  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17788  if (__pyx_t_12 < 0) {
17789  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17790  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17791  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17792  if (unlikely(__pyx_t_11 != -1)) {
17793  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17794  __PYX_ERR(0, 813, __pyx_L1_error)
17795  }
17796  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17797  }
17798  }
17799  }
17800  __pyx_L13:;
17801  }
17802  __pyx_L3:;
17803 
17804  /* "subsurfaceTransportFunctions.pyx":776
17805  *
17806  * #problem specific velocity evaluation
17807  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17808  * double t,
17809  * double tForReversal,
17810  */
17811 
17812  /* function exit code */
17813  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17814  goto __pyx_L0;
17815  __pyx_L1_error:;
17816  __Pyx_XDECREF(__pyx_t_15);
17817  __Pyx_XDECREF(__pyx_t_16);
17818  __Pyx_XDECREF(__pyx_t_17);
17819  __Pyx_XDECREF(__pyx_t_20);
17820  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17821  __Pyx_PyThreadState_declare
17822  __Pyx_PyThreadState_assign
17823  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17824  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17825  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17826  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17827  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17828  __pyx_r = NULL;
17829  goto __pyx_L2;
17830  __pyx_L0:;
17831  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17832  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17833  __pyx_L2:;
17834  __Pyx_XGIVEREF(__pyx_r);
17835  __Pyx_RefNannyFinishContext();
17836  return __pyx_r;
17837 }
17838 
17839 /* "subsurfaceTransportFunctions.pyx":816
17840  *
17841  *
17842  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17843  * double t,
17844  * double tForReversal,
17845  */
17846 
17847 /* Python wrapper */
17848 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17849 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
17850 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17851  int __pyx_v_transient;
17852  double __pyx_v_t;
17853  double __pyx_v_tForReversal;
17854  double __pyx_v_clock;
17855  double __pyx_v_xc;
17856  double __pyx_v_yc;
17857  PyArrayObject *__pyx_v_x = 0;
17858  PyArrayObject *__pyx_v_v = 0;
17859  double __pyx_v_zvelocity;
17860  int __pyx_lineno = 0;
17861  const char *__pyx_filename = NULL;
17862  int __pyx_clineno = 0;
17863  PyObject *__pyx_r = 0;
17864  __Pyx_RefNannyDeclarations
17865  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
17866  {
17867  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
17868  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17869  if (unlikely(__pyx_kwds)) {
17870  Py_ssize_t kw_args;
17871  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17872  switch (pos_args) {
17873  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17874  CYTHON_FALLTHROUGH;
17875  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17876  CYTHON_FALLTHROUGH;
17877  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17878  CYTHON_FALLTHROUGH;
17879  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17880  CYTHON_FALLTHROUGH;
17881  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17882  CYTHON_FALLTHROUGH;
17883  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17884  CYTHON_FALLTHROUGH;
17885  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17886  CYTHON_FALLTHROUGH;
17887  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17888  CYTHON_FALLTHROUGH;
17889  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17890  CYTHON_FALLTHROUGH;
17891  case 0: break;
17892  default: goto __pyx_L5_argtuple_error;
17893  }
17894  kw_args = PyDict_Size(__pyx_kwds);
17895  switch (pos_args) {
17896  case 0:
17897  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17898  else goto __pyx_L5_argtuple_error;
17899  CYTHON_FALLTHROUGH;
17900  case 1:
17901  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17902  else {
17903  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); __PYX_ERR(0, 816, __pyx_L3_error)
17904  }
17905  CYTHON_FALLTHROUGH;
17906  case 2:
17907  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17908  else {
17909  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); __PYX_ERR(0, 816, __pyx_L3_error)
17910  }
17911  CYTHON_FALLTHROUGH;
17912  case 3:
17913  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17914  else {
17915  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); __PYX_ERR(0, 816, __pyx_L3_error)
17916  }
17917  CYTHON_FALLTHROUGH;
17918  case 4:
17919  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17920  else {
17921  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); __PYX_ERR(0, 816, __pyx_L3_error)
17922  }
17923  CYTHON_FALLTHROUGH;
17924  case 5:
17925  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17926  else {
17927  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); __PYX_ERR(0, 816, __pyx_L3_error)
17928  }
17929  CYTHON_FALLTHROUGH;
17930  case 6:
17931  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17932  else {
17933  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); __PYX_ERR(0, 816, __pyx_L3_error)
17934  }
17935  CYTHON_FALLTHROUGH;
17936  case 7:
17937  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17938  else {
17939  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); __PYX_ERR(0, 816, __pyx_L3_error)
17940  }
17941  CYTHON_FALLTHROUGH;
17942  case 8:
17943  if (kw_args > 0) {
17944  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
17945  if (value) { values[8] = value; kw_args--; }
17946  }
17947  }
17948  if (unlikely(kw_args > 0)) {
17949  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) __PYX_ERR(0, 816, __pyx_L3_error)
17950  }
17951  } else {
17952  switch (PyTuple_GET_SIZE(__pyx_args)) {
17953  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17954  CYTHON_FALLTHROUGH;
17955  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17956  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17957  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17958  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17959  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17960  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17961  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17962  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17963  break;
17964  default: goto __pyx_L5_argtuple_error;
17965  }
17966  }
17967  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L3_error)
17968  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
17969  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
17970  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L3_error)
17971  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17972  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17973  __pyx_v_x = ((PyArrayObject *)values[6]);
17974  __pyx_v_v = ((PyArrayObject *)values[7]);
17975  if (values[8]) {
17976  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error)
17977  } else {
17978  __pyx_v_zvelocity = ((double)0.0);
17979  }
17980  }
17981  goto __pyx_L4_argument_unpacking_done;
17982  __pyx_L5_argtuple_error:;
17983  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 816, __pyx_L3_error)
17984  __pyx_L3_error:;
17985  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
17986  __Pyx_RefNannyFinishContext();
17987  return NULL;
17988  __pyx_L4_argument_unpacking_done:;
17989  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 821, __pyx_L1_error)
17990  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
17991  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17992 
17993  /* function exit code */
17994  goto __pyx_L0;
17995  __pyx_L1_error:;
17996  __pyx_r = NULL;
17997  __pyx_L0:;
17998  __Pyx_RefNannyFinishContext();
17999  return __pyx_r;
18000 }
18001 
18002 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) {
18003  int __pyx_v_eN;
18004  int __pyx_v_ebN;
18005  int __pyx_v_k;
18006  double __pyx_v_pi;
18007  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
18008  __Pyx_Buffer __pyx_pybuffer_v;
18009  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
18010  __Pyx_Buffer __pyx_pybuffer_x;
18011  PyObject *__pyx_r = NULL;
18012  __Pyx_RefNannyDeclarations
18013  int __pyx_t_1;
18014  npy_intp __pyx_t_2;
18015  npy_intp __pyx_t_3;
18016  int __pyx_t_4;
18017  npy_intp __pyx_t_5;
18018  npy_intp __pyx_t_6;
18019  int __pyx_t_7;
18020  npy_intp __pyx_t_8;
18021  npy_intp __pyx_t_9;
18022  int __pyx_t_10;
18023  Py_ssize_t __pyx_t_11;
18024  Py_ssize_t __pyx_t_12;
18025  Py_ssize_t __pyx_t_13;
18026  Py_ssize_t __pyx_t_14;
18027  int __pyx_t_15;
18028  Py_ssize_t __pyx_t_16;
18029  Py_ssize_t __pyx_t_17;
18030  Py_ssize_t __pyx_t_18;
18031  Py_ssize_t __pyx_t_19;
18032  PyObject *__pyx_t_20 = NULL;
18033  PyObject *__pyx_t_21 = NULL;
18034  PyObject *__pyx_t_22 = NULL;
18035  PyObject *__pyx_t_23 = NULL;
18036  double __pyx_t_24;
18037  double __pyx_t_25;
18038  int __pyx_lineno = 0;
18039  const char *__pyx_filename = NULL;
18040  int __pyx_clineno = 0;
18041  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
18042  __pyx_pybuffer_x.pybuffer.buf = NULL;
18043  __pyx_pybuffer_x.refcount = 0;
18044  __pyx_pybuffernd_x.data = NULL;
18045  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
18046  __pyx_pybuffer_v.pybuffer.buf = NULL;
18047  __pyx_pybuffer_v.refcount = 0;
18048  __pyx_pybuffernd_v.data = NULL;
18049  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
18050  {
18051  __Pyx_BufFmt_StackElem __pyx_stack[1];
18052  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, 816, __pyx_L1_error)
18053  }
18054  __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];
18055  {
18056  __Pyx_BufFmt_StackElem __pyx_stack[1];
18057  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
18058  }
18059  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
18060 
18061  /* "subsurfaceTransportFunctions.pyx":826
18062  * cdef int eN,ebN,k
18063  * cdef double pi
18064  * pi = M_PI # <<<<<<<<<<<<<<
18065  * if v.shape[v.ndim-1] == 3:
18066  * if transient == 1:
18067  */
18068  __pyx_v_pi = M_PI;
18069 
18070  /* "subsurfaceTransportFunctions.pyx":827
18071  * cdef double pi
18072  * pi = M_PI
18073  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18074  * if transient == 1:
18075  * for eN in range(x.shape[0]):
18076  */
18077  __pyx_t_1 = (((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 3) != 0);
18078  if (__pyx_t_1) {
18079 
18080  /* "subsurfaceTransportFunctions.pyx":828
18081  * pi = M_PI
18082  * if v.shape[v.ndim-1] == 3:
18083  * if transient == 1: # <<<<<<<<<<<<<<
18084  * for eN in range(x.shape[0]):
18085  * for ebN in range(x.shape[1]):
18086  */
18087  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18088  if (__pyx_t_1) {
18089 
18090  /* "subsurfaceTransportFunctions.pyx":829
18091  * if v.shape[v.ndim-1] == 3:
18092  * if transient == 1:
18093  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18094  * for ebN in range(x.shape[1]):
18095  * for k in range(x.shape[2]):
18096  */
18097  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18098  __pyx_t_3 = __pyx_t_2;
18099  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18100  __pyx_v_eN = __pyx_t_4;
18101 
18102  /* "subsurfaceTransportFunctions.pyx":830
18103  * if transient == 1:
18104  * for eN in range(x.shape[0]):
18105  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18106  * for k in range(x.shape[2]):
18107  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18108  */
18109  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18110  __pyx_t_6 = __pyx_t_5;
18111  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18112  __pyx_v_ebN = __pyx_t_7;
18113 
18114  /* "subsurfaceTransportFunctions.pyx":831
18115  * for eN in range(x.shape[0]):
18116  * for ebN in range(x.shape[1]):
18117  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18118  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18119  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18120  */
18121  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18122  __pyx_t_9 = __pyx_t_8;
18123  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18124  __pyx_v_k = __pyx_t_10;
18125 
18126  /* "subsurfaceTransportFunctions.pyx":832
18127  * for ebN in range(x.shape[1]):
18128  * for k in range(x.shape[2]):
18129  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18130  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18131  * v[eN,ebN,k,2]=zvelocity
18132  */
18133  __pyx_t_11 = __pyx_v_eN;
18134  __pyx_t_12 = __pyx_v_ebN;
18135  __pyx_t_13 = __pyx_v_k;
18136  __pyx_t_14 = 1;
18137  __pyx_t_15 = -1;
18138  if (__pyx_t_11 < 0) {
18139  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18140  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18141  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18142  if (__pyx_t_12 < 0) {
18143  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18144  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18145  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18146  if (__pyx_t_13 < 0) {
18147  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18148  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18149  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18150  if (__pyx_t_14 < 0) {
18151  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18152  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18153  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18154  if (unlikely(__pyx_t_15 != -1)) {
18155  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18156  __PYX_ERR(0, 832, __pyx_L1_error)
18157  }
18158  __pyx_t_16 = __pyx_v_eN;
18159  __pyx_t_17 = __pyx_v_ebN;
18160  __pyx_t_18 = __pyx_v_k;
18161  __pyx_t_19 = 0;
18162  __pyx_t_15 = -1;
18163  if (__pyx_t_16 < 0) {
18164  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18165  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18166  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18167  if (__pyx_t_17 < 0) {
18168  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18169  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18170  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18171  if (__pyx_t_18 < 0) {
18172  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18173  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18174  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18175  if (__pyx_t_19 < 0) {
18176  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18177  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18178  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18179  if (unlikely(__pyx_t_15 != -1)) {
18180  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18181  __PYX_ERR(0, 832, __pyx_L1_error)
18182  }
18183  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18184 
18185  /* "subsurfaceTransportFunctions.pyx":833
18186  * for k in range(x.shape[2]):
18187  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18188  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18189  * v[eN,ebN,k,2]=zvelocity
18190  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18191  */
18192  __pyx_t_14 = __pyx_v_eN;
18193  __pyx_t_13 = __pyx_v_ebN;
18194  __pyx_t_12 = __pyx_v_k;
18195  __pyx_t_11 = 0;
18196  __pyx_t_15 = -1;
18197  if (__pyx_t_14 < 0) {
18198  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18199  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18200  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18201  if (__pyx_t_13 < 0) {
18202  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18203  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18204  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18205  if (__pyx_t_12 < 0) {
18206  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18207  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18208  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18209  if (__pyx_t_11 < 0) {
18210  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18211  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18212  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18213  if (unlikely(__pyx_t_15 != -1)) {
18214  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18215  __PYX_ERR(0, 833, __pyx_L1_error)
18216  }
18217  __pyx_t_19 = __pyx_v_eN;
18218  __pyx_t_18 = __pyx_v_ebN;
18219  __pyx_t_17 = __pyx_v_k;
18220  __pyx_t_16 = 1;
18221  __pyx_t_15 = -1;
18222  if (__pyx_t_19 < 0) {
18223  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18224  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18225  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18226  if (__pyx_t_18 < 0) {
18227  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18228  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18229  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18230  if (__pyx_t_17 < 0) {
18231  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18232  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18233  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18234  if (__pyx_t_16 < 0) {
18235  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18236  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18237  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18238  if (unlikely(__pyx_t_15 != -1)) {
18239  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18240  __PYX_ERR(0, 833, __pyx_L1_error)
18241  }
18242  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18243 
18244  /* "subsurfaceTransportFunctions.pyx":834
18245  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18246  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18247  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18248  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18249  * else:
18250  */
18251  __pyx_t_11 = __pyx_v_eN;
18252  __pyx_t_12 = __pyx_v_ebN;
18253  __pyx_t_13 = __pyx_v_k;
18254  __pyx_t_14 = 2;
18255  __pyx_t_15 = -1;
18256  if (__pyx_t_11 < 0) {
18257  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[0].shape;
18258  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18259  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18260  if (__pyx_t_12 < 0) {
18261  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[1].shape;
18262  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18263  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18264  if (__pyx_t_13 < 0) {
18265  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[2].shape;
18266  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18267  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18268  if (__pyx_t_14 < 0) {
18269  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[3].shape;
18270  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18271  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18272  if (unlikely(__pyx_t_15 != -1)) {
18273  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18274  __PYX_ERR(0, 834, __pyx_L1_error)
18275  }
18276  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18277 
18278  /* "subsurfaceTransportFunctions.pyx":835
18279  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18280  * v[eN,ebN,k,2]=zvelocity
18281  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18282  * else:
18283  * for eN in range(x.shape[0]):
18284  */
18285  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 835, __pyx_L1_error)
18286  __Pyx_GOTREF(__pyx_t_20);
18287  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 835, __pyx_L1_error)
18288  __Pyx_GOTREF(__pyx_t_21);
18289  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 835, __pyx_L1_error)
18290  __Pyx_GOTREF(__pyx_t_22);
18291  __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 835, __pyx_L1_error)
18292  __Pyx_GOTREF(__pyx_t_23);
18293  __Pyx_GIVEREF(__pyx_t_20);
18294  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
18295  __Pyx_GIVEREF(__pyx_t_21);
18296  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
18297  __Pyx_GIVEREF(__pyx_t_22);
18298  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
18299  __Pyx_INCREF(__pyx_slice_);
18300  __Pyx_GIVEREF(__pyx_slice_);
18301  PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_slice_);
18302  __pyx_t_20 = 0;
18303  __pyx_t_21 = 0;
18304  __pyx_t_22 = 0;
18305  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 835, __pyx_L1_error)
18306  __Pyx_GOTREF(__pyx_t_22);
18307  __pyx_t_24 = (__pyx_v_tForReversal - __pyx_v_t);
18308  __pyx_t_25 = (__pyx_v_tForReversal - 0.0);
18309  if (unlikely(__pyx_t_25 == 0)) {
18310  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18311  __PYX_ERR(0, 835, __pyx_L1_error)
18312  }
18313  __pyx_t_21 = PyFloat_FromDouble(((__pyx_t_24 / __pyx_t_25) * __pyx_v_clock)); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 835, __pyx_L1_error)
18314  __Pyx_GOTREF(__pyx_t_21);
18315  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_22, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 835, __pyx_L1_error)
18316  __Pyx_GOTREF(__pyx_t_20);
18317  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18318  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
18319  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_23, __pyx_t_20) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
18320  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18321  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18322  }
18323  }
18324  }
18325 
18326  /* "subsurfaceTransportFunctions.pyx":828
18327  * pi = M_PI
18328  * if v.shape[v.ndim-1] == 3:
18329  * if transient == 1: # <<<<<<<<<<<<<<
18330  * for eN in range(x.shape[0]):
18331  * for ebN in range(x.shape[1]):
18332  */
18333  goto __pyx_L4;
18334  }
18335 
18336  /* "subsurfaceTransportFunctions.pyx":837
18337  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18338  * else:
18339  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18340  * for ebN in range(x.shape[1]):
18341  * for k in range(x.shape[2]):
18342  */
18343  /*else*/ {
18344  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18345  __pyx_t_3 = __pyx_t_2;
18346  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18347  __pyx_v_eN = __pyx_t_4;
18348 
18349  /* "subsurfaceTransportFunctions.pyx":838
18350  * else:
18351  * for eN in range(x.shape[0]):
18352  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18353  * for k in range(x.shape[2]):
18354  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18355  */
18356  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18357  __pyx_t_6 = __pyx_t_5;
18358  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18359  __pyx_v_ebN = __pyx_t_7;
18360 
18361  /* "subsurfaceTransportFunctions.pyx":839
18362  * for eN in range(x.shape[0]):
18363  * for ebN in range(x.shape[1]):
18364  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18365  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18366  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18367  */
18368  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18369  __pyx_t_9 = __pyx_t_8;
18370  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18371  __pyx_v_k = __pyx_t_10;
18372 
18373  /* "subsurfaceTransportFunctions.pyx":840
18374  * for ebN in range(x.shape[1]):
18375  * for k in range(x.shape[2]):
18376  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18377  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18378  * v[eN,ebN,k,2]=zvelocity
18379  */
18380  __pyx_t_14 = __pyx_v_eN;
18381  __pyx_t_13 = __pyx_v_ebN;
18382  __pyx_t_12 = __pyx_v_k;
18383  __pyx_t_11 = 1;
18384  __pyx_t_15 = -1;
18385  if (__pyx_t_14 < 0) {
18386  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18387  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18388  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18389  if (__pyx_t_13 < 0) {
18390  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18391  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18392  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18393  if (__pyx_t_12 < 0) {
18394  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18395  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18396  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18397  if (__pyx_t_11 < 0) {
18398  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18399  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18400  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18401  if (unlikely(__pyx_t_15 != -1)) {
18402  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18403  __PYX_ERR(0, 840, __pyx_L1_error)
18404  }
18405  __pyx_t_16 = __pyx_v_eN;
18406  __pyx_t_17 = __pyx_v_ebN;
18407  __pyx_t_18 = __pyx_v_k;
18408  __pyx_t_19 = 0;
18409  __pyx_t_15 = -1;
18410  if (__pyx_t_16 < 0) {
18411  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18412  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18413  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18414  if (__pyx_t_17 < 0) {
18415  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18416  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18417  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18418  if (__pyx_t_18 < 0) {
18419  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18420  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18421  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18422  if (__pyx_t_19 < 0) {
18423  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18424  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18425  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18426  if (unlikely(__pyx_t_15 != -1)) {
18427  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18428  __PYX_ERR(0, 840, __pyx_L1_error)
18429  }
18430  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18431 
18432  /* "subsurfaceTransportFunctions.pyx":841
18433  * for k in range(x.shape[2]):
18434  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18435  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18436  * v[eN,ebN,k,2]=zvelocity
18437  * else:
18438  */
18439  __pyx_t_11 = __pyx_v_eN;
18440  __pyx_t_12 = __pyx_v_ebN;
18441  __pyx_t_13 = __pyx_v_k;
18442  __pyx_t_14 = 0;
18443  __pyx_t_15 = -1;
18444  if (__pyx_t_11 < 0) {
18445  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18446  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18447  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18448  if (__pyx_t_12 < 0) {
18449  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18450  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18451  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18452  if (__pyx_t_13 < 0) {
18453  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18454  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18455  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18456  if (__pyx_t_14 < 0) {
18457  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18458  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18459  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18460  if (unlikely(__pyx_t_15 != -1)) {
18461  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18462  __PYX_ERR(0, 841, __pyx_L1_error)
18463  }
18464  __pyx_t_19 = __pyx_v_eN;
18465  __pyx_t_18 = __pyx_v_ebN;
18466  __pyx_t_17 = __pyx_v_k;
18467  __pyx_t_16 = 1;
18468  __pyx_t_15 = -1;
18469  if (__pyx_t_19 < 0) {
18470  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18471  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18472  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18473  if (__pyx_t_18 < 0) {
18474  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18475  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18476  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18477  if (__pyx_t_17 < 0) {
18478  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18479  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18480  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18481  if (__pyx_t_16 < 0) {
18482  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18483  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18484  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18485  if (unlikely(__pyx_t_15 != -1)) {
18486  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18487  __PYX_ERR(0, 841, __pyx_L1_error)
18488  }
18489  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides))));
18490 
18491  /* "subsurfaceTransportFunctions.pyx":842
18492  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18493  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18494  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18495  * else:
18496  * assert v.shape[v.ndim-1] == 2
18497  */
18498  __pyx_t_14 = __pyx_v_eN;
18499  __pyx_t_13 = __pyx_v_ebN;
18500  __pyx_t_12 = __pyx_v_k;
18501  __pyx_t_11 = 2;
18502  __pyx_t_15 = -1;
18503  if (__pyx_t_14 < 0) {
18504  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
18505  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18506  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18507  if (__pyx_t_13 < 0) {
18508  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
18509  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18510  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18511  if (__pyx_t_12 < 0) {
18512  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
18513  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18514  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18515  if (__pyx_t_11 < 0) {
18516  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[3].shape;
18517  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18518  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18519  if (unlikely(__pyx_t_15 != -1)) {
18520  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18521  __PYX_ERR(0, 842, __pyx_L1_error)
18522  }
18523  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18524  }
18525  }
18526  }
18527  }
18528  __pyx_L4:;
18529 
18530  /* "subsurfaceTransportFunctions.pyx":827
18531  * cdef double pi
18532  * pi = M_PI
18533  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18534  * if transient == 1:
18535  * for eN in range(x.shape[0]):
18536  */
18537  goto __pyx_L3;
18538  }
18539 
18540  /* "subsurfaceTransportFunctions.pyx":844
18541  * v[eN,ebN,k,2]=zvelocity
18542  * else:
18543  * assert v.shape[v.ndim-1] == 2 # <<<<<<<<<<<<<<
18544  * if transient == 1:
18545  * for eN in range(x.shape[0]):
18546  */
18547  /*else*/ {
18548  #ifndef CYTHON_WITHOUT_ASSERTIONS
18549  if (unlikely(!Py_OptimizeFlag)) {
18550  if (unlikely(!(((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 2) != 0))) {
18551  PyErr_SetNone(PyExc_AssertionError);
18552  __PYX_ERR(0, 844, __pyx_L1_error)
18553  }
18554  }
18555  #endif
18556 
18557  /* "subsurfaceTransportFunctions.pyx":845
18558  * else:
18559  * assert v.shape[v.ndim-1] == 2
18560  * if transient == 1: # <<<<<<<<<<<<<<
18561  * for eN in range(x.shape[0]):
18562  * for ebN in range(x.shape[1]):
18563  */
18564  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18565  if (__pyx_t_1) {
18566 
18567  /* "subsurfaceTransportFunctions.pyx":846
18568  * assert v.shape[v.ndim-1] == 2
18569  * if transient == 1:
18570  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18571  * for ebN in range(x.shape[1]):
18572  * for k in range(x.shape[2]):
18573  */
18574  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18575  __pyx_t_3 = __pyx_t_2;
18576  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18577  __pyx_v_eN = __pyx_t_4;
18578 
18579  /* "subsurfaceTransportFunctions.pyx":847
18580  * if transient == 1:
18581  * for eN in range(x.shape[0]):
18582  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18583  * for k in range(x.shape[2]):
18584  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18585  */
18586  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18587  __pyx_t_6 = __pyx_t_5;
18588  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18589  __pyx_v_ebN = __pyx_t_7;
18590 
18591  /* "subsurfaceTransportFunctions.pyx":848
18592  * for eN in range(x.shape[0]):
18593  * for ebN in range(x.shape[1]):
18594  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18595  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18596  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18597  */
18598  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18599  __pyx_t_9 = __pyx_t_8;
18600  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18601  __pyx_v_k = __pyx_t_10;
18602 
18603  /* "subsurfaceTransportFunctions.pyx":849
18604  * for ebN in range(x.shape[1]):
18605  * for k in range(x.shape[2]):
18606  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18607  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18608  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18609  */
18610  __pyx_t_11 = __pyx_v_eN;
18611  __pyx_t_12 = __pyx_v_ebN;
18612  __pyx_t_13 = __pyx_v_k;
18613  __pyx_t_14 = 1;
18614  __pyx_t_15 = -1;
18615  if (__pyx_t_11 < 0) {
18616  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18617  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18618  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18619  if (__pyx_t_12 < 0) {
18620  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18621  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18622  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18623  if (__pyx_t_13 < 0) {
18624  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18625  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18626  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18627  if (__pyx_t_14 < 0) {
18628  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18629  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18630  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18631  if (unlikely(__pyx_t_15 != -1)) {
18632  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18633  __PYX_ERR(0, 849, __pyx_L1_error)
18634  }
18635  __pyx_t_16 = __pyx_v_eN;
18636  __pyx_t_17 = __pyx_v_ebN;
18637  __pyx_t_18 = __pyx_v_k;
18638  __pyx_t_19 = 0;
18639  __pyx_t_15 = -1;
18640  if (__pyx_t_16 < 0) {
18641  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18642  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18643  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18644  if (__pyx_t_17 < 0) {
18645  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18646  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18647  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18648  if (__pyx_t_18 < 0) {
18649  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18650  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18651  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18652  if (__pyx_t_19 < 0) {
18653  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18654  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18655  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18656  if (unlikely(__pyx_t_15 != -1)) {
18657  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18658  __PYX_ERR(0, 849, __pyx_L1_error)
18659  }
18660  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18661 
18662  /* "subsurfaceTransportFunctions.pyx":850
18663  * for k in range(x.shape[2]):
18664  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18665  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18666  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18667  * else:
18668  */
18669  __pyx_t_14 = __pyx_v_eN;
18670  __pyx_t_13 = __pyx_v_ebN;
18671  __pyx_t_12 = __pyx_v_k;
18672  __pyx_t_11 = 0;
18673  __pyx_t_15 = -1;
18674  if (__pyx_t_14 < 0) {
18675  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18676  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18677  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18678  if (__pyx_t_13 < 0) {
18679  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18680  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18681  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18682  if (__pyx_t_12 < 0) {
18683  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18684  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18685  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18686  if (__pyx_t_11 < 0) {
18687  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18688  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18689  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18690  if (unlikely(__pyx_t_15 != -1)) {
18691  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18692  __PYX_ERR(0, 850, __pyx_L1_error)
18693  }
18694  __pyx_t_19 = __pyx_v_eN;
18695  __pyx_t_18 = __pyx_v_ebN;
18696  __pyx_t_17 = __pyx_v_k;
18697  __pyx_t_16 = 1;
18698  __pyx_t_15 = -1;
18699  if (__pyx_t_19 < 0) {
18700  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18701  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18702  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18703  if (__pyx_t_18 < 0) {
18704  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18705  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18706  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18707  if (__pyx_t_17 < 0) {
18708  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18709  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18710  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18711  if (__pyx_t_16 < 0) {
18712  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18713  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18714  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18715  if (unlikely(__pyx_t_15 != -1)) {
18716  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18717  __PYX_ERR(0, 850, __pyx_L1_error)
18718  }
18719  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18720 
18721  /* "subsurfaceTransportFunctions.pyx":851
18722  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18723  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18724  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18725  * else:
18726  * for eN in range(x.shape[0]):
18727  */
18728  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 851, __pyx_L1_error)
18729  __Pyx_GOTREF(__pyx_t_23);
18730  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 851, __pyx_L1_error)
18731  __Pyx_GOTREF(__pyx_t_20);
18732  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 851, __pyx_L1_error)
18733  __Pyx_GOTREF(__pyx_t_21);
18734  __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 851, __pyx_L1_error)
18735  __Pyx_GOTREF(__pyx_t_22);
18736  __Pyx_GIVEREF(__pyx_t_23);
18737  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23);
18738  __Pyx_GIVEREF(__pyx_t_20);
18739  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
18740  __Pyx_GIVEREF(__pyx_t_21);
18741  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_21);
18742  __Pyx_INCREF(__pyx_slice_);
18743  __Pyx_GIVEREF(__pyx_slice_);
18744  PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_slice_);
18745  __pyx_t_23 = 0;
18746  __pyx_t_20 = 0;
18747  __pyx_t_21 = 0;
18748  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 851, __pyx_L1_error)
18749  __Pyx_GOTREF(__pyx_t_21);
18750  __pyx_t_25 = (__pyx_v_tForReversal - __pyx_v_t);
18751  __pyx_t_24 = (__pyx_v_tForReversal - 0.0);
18752  if (unlikely(__pyx_t_24 == 0)) {
18753  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18754  __PYX_ERR(0, 851, __pyx_L1_error)
18755  }
18756  __pyx_t_20 = PyFloat_FromDouble(((__pyx_t_25 / __pyx_t_24) * __pyx_v_clock)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 851, __pyx_L1_error)
18757  __Pyx_GOTREF(__pyx_t_20);
18758  __pyx_t_23 = PyNumber_InPlaceMultiply(__pyx_t_21, __pyx_t_20); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 851, __pyx_L1_error)
18759  __Pyx_GOTREF(__pyx_t_23);
18760  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
18761  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18762  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_23) < 0)) __PYX_ERR(0, 851, __pyx_L1_error)
18763  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18764  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18765  }
18766  }
18767  }
18768 
18769  /* "subsurfaceTransportFunctions.pyx":845
18770  * else:
18771  * assert v.shape[v.ndim-1] == 2
18772  * if transient == 1: # <<<<<<<<<<<<<<
18773  * for eN in range(x.shape[0]):
18774  * for ebN in range(x.shape[1]):
18775  */
18776  goto __pyx_L17;
18777  }
18778 
18779  /* "subsurfaceTransportFunctions.pyx":853
18780  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18781  * else:
18782  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18783  * for ebN in range(x.shape[1]):
18784  * for k in range(x.shape[2]):
18785  */
18786  /*else*/ {
18787  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18788  __pyx_t_3 = __pyx_t_2;
18789  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18790  __pyx_v_eN = __pyx_t_4;
18791 
18792  /* "subsurfaceTransportFunctions.pyx":854
18793  * else:
18794  * for eN in range(x.shape[0]):
18795  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18796  * for k in range(x.shape[2]):
18797  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18798  */
18799  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18800  __pyx_t_6 = __pyx_t_5;
18801  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18802  __pyx_v_ebN = __pyx_t_7;
18803 
18804  /* "subsurfaceTransportFunctions.pyx":855
18805  * for eN in range(x.shape[0]):
18806  * for ebN in range(x.shape[1]):
18807  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18808  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18809  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18810  */
18811  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18812  __pyx_t_9 = __pyx_t_8;
18813  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18814  __pyx_v_k = __pyx_t_10;
18815 
18816  /* "subsurfaceTransportFunctions.pyx":856
18817  * for ebN in range(x.shape[1]):
18818  * for k in range(x.shape[2]):
18819  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18820  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18821  *
18822  */
18823  __pyx_t_11 = __pyx_v_eN;
18824  __pyx_t_12 = __pyx_v_ebN;
18825  __pyx_t_13 = __pyx_v_k;
18826  __pyx_t_14 = 1;
18827  __pyx_t_15 = -1;
18828  if (__pyx_t_11 < 0) {
18829  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18830  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18831  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18832  if (__pyx_t_12 < 0) {
18833  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18834  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18835  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18836  if (__pyx_t_13 < 0) {
18837  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18838  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18839  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18840  if (__pyx_t_14 < 0) {
18841  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18842  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18843  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18844  if (unlikely(__pyx_t_15 != -1)) {
18845  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18846  __PYX_ERR(0, 856, __pyx_L1_error)
18847  }
18848  __pyx_t_16 = __pyx_v_eN;
18849  __pyx_t_17 = __pyx_v_ebN;
18850  __pyx_t_18 = __pyx_v_k;
18851  __pyx_t_19 = 0;
18852  __pyx_t_15 = -1;
18853  if (__pyx_t_16 < 0) {
18854  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18855  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18856  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18857  if (__pyx_t_17 < 0) {
18858  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18859  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18860  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18861  if (__pyx_t_18 < 0) {
18862  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18863  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18864  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18865  if (__pyx_t_19 < 0) {
18866  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18867  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18868  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18869  if (unlikely(__pyx_t_15 != -1)) {
18870  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18871  __PYX_ERR(0, 856, __pyx_L1_error)
18872  }
18873  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18874 
18875  /* "subsurfaceTransportFunctions.pyx":857
18876  * for k in range(x.shape[2]):
18877  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18878  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18879  *
18880  * def helicalElementVelocityEval3(int transient,
18881  */
18882  __pyx_t_14 = __pyx_v_eN;
18883  __pyx_t_13 = __pyx_v_ebN;
18884  __pyx_t_12 = __pyx_v_k;
18885  __pyx_t_11 = 0;
18886  __pyx_t_15 = -1;
18887  if (__pyx_t_14 < 0) {
18888  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18889  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18890  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18891  if (__pyx_t_13 < 0) {
18892  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18893  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18894  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18895  if (__pyx_t_12 < 0) {
18896  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18897  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18898  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18899  if (__pyx_t_11 < 0) {
18900  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18901  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18902  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18903  if (unlikely(__pyx_t_15 != -1)) {
18904  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18905  __PYX_ERR(0, 857, __pyx_L1_error)
18906  }
18907  __pyx_t_19 = __pyx_v_eN;
18908  __pyx_t_18 = __pyx_v_ebN;
18909  __pyx_t_17 = __pyx_v_k;
18910  __pyx_t_16 = 1;
18911  __pyx_t_15 = -1;
18912  if (__pyx_t_19 < 0) {
18913  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18914  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18915  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18916  if (__pyx_t_18 < 0) {
18917  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18918  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18919  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18920  if (__pyx_t_17 < 0) {
18921  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18922  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18923  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18924  if (__pyx_t_16 < 0) {
18925  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18926  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18927  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18928  if (unlikely(__pyx_t_15 != -1)) {
18929  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18930  __PYX_ERR(0, 857, __pyx_L1_error)
18931  }
18932  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18933  }
18934  }
18935  }
18936  }
18937  __pyx_L17:;
18938  }
18939  __pyx_L3:;
18940 
18941  /* "subsurfaceTransportFunctions.pyx":816
18942  *
18943  *
18944  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18945  * double t,
18946  * double tForReversal,
18947  */
18948 
18949  /* function exit code */
18950  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18951  goto __pyx_L0;
18952  __pyx_L1_error:;
18953  __Pyx_XDECREF(__pyx_t_20);
18954  __Pyx_XDECREF(__pyx_t_21);
18955  __Pyx_XDECREF(__pyx_t_22);
18956  __Pyx_XDECREF(__pyx_t_23);
18957  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18958  __Pyx_PyThreadState_declare
18959  __Pyx_PyThreadState_assign
18960  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18961  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18962  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18963  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18964  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18965  __pyx_r = NULL;
18966  goto __pyx_L2;
18967  __pyx_L0:;
18968  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18969  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18970  __pyx_L2:;
18971  __Pyx_XGIVEREF(__pyx_r);
18972  __Pyx_RefNannyFinishContext();
18973  return __pyx_r;
18974 }
18975 
18976 /* "subsurfaceTransportFunctions.pyx":859
18977  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18978  *
18979  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
18980  * double t,
18981  * double tForReversal,
18982  */
18983 
18984 /* Python wrapper */
18985 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18986 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
18987 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18988  int __pyx_v_transient;
18989  double __pyx_v_t;
18990  double __pyx_v_tForReversal;
18991  double __pyx_v_clock;
18992  double __pyx_v_zVelocity;
18993  double __pyx_v_xc;
18994  double __pyx_v_yc;
18995  PyArrayObject *__pyx_v_x = 0;
18996  PyArrayObject *__pyx_v_v = 0;
18997  int __pyx_lineno = 0;
18998  const char *__pyx_filename = NULL;
18999  int __pyx_clineno = 0;
19000  PyObject *__pyx_r = 0;
19001  __Pyx_RefNannyDeclarations
19002  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
19003  {
19004  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19005  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19006  if (unlikely(__pyx_kwds)) {
19007  Py_ssize_t kw_args;
19008  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19009  switch (pos_args) {
19010  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19011  CYTHON_FALLTHROUGH;
19012  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19013  CYTHON_FALLTHROUGH;
19014  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19015  CYTHON_FALLTHROUGH;
19016  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19017  CYTHON_FALLTHROUGH;
19018  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19019  CYTHON_FALLTHROUGH;
19020  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19021  CYTHON_FALLTHROUGH;
19022  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19023  CYTHON_FALLTHROUGH;
19024  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19025  CYTHON_FALLTHROUGH;
19026  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19027  CYTHON_FALLTHROUGH;
19028  case 0: break;
19029  default: goto __pyx_L5_argtuple_error;
19030  }
19031  kw_args = PyDict_Size(__pyx_kwds);
19032  switch (pos_args) {
19033  case 0:
19034  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19035  else goto __pyx_L5_argtuple_error;
19036  CYTHON_FALLTHROUGH;
19037  case 1:
19038  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19039  else {
19040  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); __PYX_ERR(0, 859, __pyx_L3_error)
19041  }
19042  CYTHON_FALLTHROUGH;
19043  case 2:
19044  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19045  else {
19046  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); __PYX_ERR(0, 859, __pyx_L3_error)
19047  }
19048  CYTHON_FALLTHROUGH;
19049  case 3:
19050  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19051  else {
19052  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); __PYX_ERR(0, 859, __pyx_L3_error)
19053  }
19054  CYTHON_FALLTHROUGH;
19055  case 4:
19056  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19057  else {
19058  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); __PYX_ERR(0, 859, __pyx_L3_error)
19059  }
19060  CYTHON_FALLTHROUGH;
19061  case 5:
19062  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19063  else {
19064  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); __PYX_ERR(0, 859, __pyx_L3_error)
19065  }
19066  CYTHON_FALLTHROUGH;
19067  case 6:
19068  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19069  else {
19070  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); __PYX_ERR(0, 859, __pyx_L3_error)
19071  }
19072  CYTHON_FALLTHROUGH;
19073  case 7:
19074  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19075  else {
19076  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); __PYX_ERR(0, 859, __pyx_L3_error)
19077  }
19078  CYTHON_FALLTHROUGH;
19079  case 8:
19080  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19081  else {
19082  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); __PYX_ERR(0, 859, __pyx_L3_error)
19083  }
19084  }
19085  if (unlikely(kw_args > 0)) {
19086  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
19087  }
19088  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19089  goto __pyx_L5_argtuple_error;
19090  } else {
19091  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19092  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19093  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19094  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19095  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19096  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19097  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19098  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19099  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19100  }
19101  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
19102  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
19103  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L3_error)
19104  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L3_error)
19105  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L3_error)
19106  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19107  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19108  __pyx_v_x = ((PyArrayObject *)values[7]);
19109  __pyx_v_v = ((PyArrayObject *)values[8]);
19110  }
19111  goto __pyx_L4_argument_unpacking_done;
19112  __pyx_L5_argtuple_error:;
19113  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
19114  __pyx_L3_error:;
19115  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19116  __Pyx_RefNannyFinishContext();
19117  return NULL;
19118  __pyx_L4_argument_unpacking_done:;
19119  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 865, __pyx_L1_error)
19120  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 866, __pyx_L1_error)
19121  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19122 
19123  /* function exit code */
19124  goto __pyx_L0;
19125  __pyx_L1_error:;
19126  __pyx_r = NULL;
19127  __pyx_L0:;
19128  __Pyx_RefNannyFinishContext();
19129  return __pyx_r;
19130 }
19131 
19132 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) {
19133  int __pyx_v_eN;
19134  int __pyx_v_k;
19135  double __pyx_v_pi;
19136  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19137  __Pyx_Buffer __pyx_pybuffer_v;
19138  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19139  __Pyx_Buffer __pyx_pybuffer_x;
19140  PyObject *__pyx_r = NULL;
19141  __Pyx_RefNannyDeclarations
19142  int __pyx_t_1;
19143  npy_intp __pyx_t_2;
19144  npy_intp __pyx_t_3;
19145  int __pyx_t_4;
19146  npy_intp __pyx_t_5;
19147  npy_intp __pyx_t_6;
19148  int __pyx_t_7;
19149  Py_ssize_t __pyx_t_8;
19150  Py_ssize_t __pyx_t_9;
19151  Py_ssize_t __pyx_t_10;
19152  int __pyx_t_11;
19153  Py_ssize_t __pyx_t_12;
19154  Py_ssize_t __pyx_t_13;
19155  Py_ssize_t __pyx_t_14;
19156  PyObject *__pyx_t_15 = NULL;
19157  PyObject *__pyx_t_16 = NULL;
19158  PyObject *__pyx_t_17 = NULL;
19159  double __pyx_t_18;
19160  double __pyx_t_19;
19161  PyObject *__pyx_t_20 = NULL;
19162  int __pyx_lineno = 0;
19163  const char *__pyx_filename = NULL;
19164  int __pyx_clineno = 0;
19165  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
19166  __pyx_pybuffer_x.pybuffer.buf = NULL;
19167  __pyx_pybuffer_x.refcount = 0;
19168  __pyx_pybuffernd_x.data = NULL;
19169  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19170  __pyx_pybuffer_v.pybuffer.buf = NULL;
19171  __pyx_pybuffer_v.refcount = 0;
19172  __pyx_pybuffernd_v.data = NULL;
19173  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19174  {
19175  __Pyx_BufFmt_StackElem __pyx_stack[1];
19176  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, 859, __pyx_L1_error)
19177  }
19178  __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];
19179  {
19180  __Pyx_BufFmt_StackElem __pyx_stack[1];
19181  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19182  }
19183  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19184 
19185  /* "subsurfaceTransportFunctions.pyx":869
19186  * cdef int eN,k
19187  * cdef double pi
19188  * pi = M_PI # <<<<<<<<<<<<<<
19189  * if transient == 1:
19190  * for eN in range(x.shape[0]):
19191  */
19192  __pyx_v_pi = M_PI;
19193 
19194  /* "subsurfaceTransportFunctions.pyx":870
19195  * cdef double pi
19196  * pi = M_PI
19197  * if transient == 1: # <<<<<<<<<<<<<<
19198  * for eN in range(x.shape[0]):
19199  * for k in range(x.shape[1]):
19200  */
19201  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19202  if (__pyx_t_1) {
19203 
19204  /* "subsurfaceTransportFunctions.pyx":871
19205  * pi = M_PI
19206  * if transient == 1:
19207  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19208  * for k in range(x.shape[1]):
19209  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19210  */
19211  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19212  __pyx_t_3 = __pyx_t_2;
19213  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19214  __pyx_v_eN = __pyx_t_4;
19215 
19216  /* "subsurfaceTransportFunctions.pyx":872
19217  * if transient == 1:
19218  * for eN in range(x.shape[0]):
19219  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19220  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19221  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19222  */
19223  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19224  __pyx_t_6 = __pyx_t_5;
19225  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19226  __pyx_v_k = __pyx_t_7;
19227 
19228  /* "subsurfaceTransportFunctions.pyx":873
19229  * for eN in range(x.shape[0]):
19230  * for k in range(x.shape[1]):
19231  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19232  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19233  * v[eN,k,2]=zVelocity
19234  */
19235  __pyx_t_8 = __pyx_v_eN;
19236  __pyx_t_9 = __pyx_v_k;
19237  __pyx_t_10 = 1;
19238  __pyx_t_11 = -1;
19239  if (__pyx_t_8 < 0) {
19240  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19241  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19242  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19243  if (__pyx_t_9 < 0) {
19244  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19245  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19246  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19247  if (__pyx_t_10 < 0) {
19248  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19249  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19250  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19251  if (unlikely(__pyx_t_11 != -1)) {
19252  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19253  __PYX_ERR(0, 873, __pyx_L1_error)
19254  }
19255  __pyx_t_12 = __pyx_v_eN;
19256  __pyx_t_13 = __pyx_v_k;
19257  __pyx_t_14 = 0;
19258  __pyx_t_11 = -1;
19259  if (__pyx_t_12 < 0) {
19260  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19261  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19262  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19263  if (__pyx_t_13 < 0) {
19264  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19265  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19266  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19267  if (__pyx_t_14 < 0) {
19268  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19269  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19270  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19271  if (unlikely(__pyx_t_11 != -1)) {
19272  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19273  __PYX_ERR(0, 873, __pyx_L1_error)
19274  }
19275  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19276 
19277  /* "subsurfaceTransportFunctions.pyx":874
19278  * for k in range(x.shape[1]):
19279  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19280  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19281  * v[eN,k,2]=zVelocity
19282  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19283  */
19284  __pyx_t_10 = __pyx_v_eN;
19285  __pyx_t_9 = __pyx_v_k;
19286  __pyx_t_8 = 0;
19287  __pyx_t_11 = -1;
19288  if (__pyx_t_10 < 0) {
19289  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
19290  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19291  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19292  if (__pyx_t_9 < 0) {
19293  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19294  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19295  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19296  if (__pyx_t_8 < 0) {
19297  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
19298  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19299  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19300  if (unlikely(__pyx_t_11 != -1)) {
19301  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19302  __PYX_ERR(0, 874, __pyx_L1_error)
19303  }
19304  __pyx_t_14 = __pyx_v_eN;
19305  __pyx_t_13 = __pyx_v_k;
19306  __pyx_t_12 = 1;
19307  __pyx_t_11 = -1;
19308  if (__pyx_t_14 < 0) {
19309  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
19310  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
19311  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19312  if (__pyx_t_13 < 0) {
19313  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19314  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19315  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19316  if (__pyx_t_12 < 0) {
19317  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
19318  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
19319  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19320  if (unlikely(__pyx_t_11 != -1)) {
19321  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19322  __PYX_ERR(0, 874, __pyx_L1_error)
19323  }
19324  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
19325 
19326  /* "subsurfaceTransportFunctions.pyx":875
19327  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19328  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19329  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19330  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19331  * else:
19332  */
19333  __pyx_t_8 = __pyx_v_eN;
19334  __pyx_t_9 = __pyx_v_k;
19335  __pyx_t_10 = 2;
19336  __pyx_t_11 = -1;
19337  if (__pyx_t_8 < 0) {
19338  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[0].shape;
19339  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19340  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19341  if (__pyx_t_9 < 0) {
19342  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
19343  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19344  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19345  if (__pyx_t_10 < 0) {
19346  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[2].shape;
19347  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19348  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19349  if (unlikely(__pyx_t_11 != -1)) {
19350  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19351  __PYX_ERR(0, 875, __pyx_L1_error)
19352  }
19353  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19354 
19355  /* "subsurfaceTransportFunctions.pyx":876
19356  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19357  * v[eN,k,2]=zVelocity
19358  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19359  * else:
19360  * for eN in range(x.shape[0]):
19361  */
19362  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 876, __pyx_L1_error)
19363  __Pyx_GOTREF(__pyx_t_15);
19364  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 876, __pyx_L1_error)
19365  __Pyx_GOTREF(__pyx_t_16);
19366  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 876, __pyx_L1_error)
19367  __Pyx_GOTREF(__pyx_t_17);
19368  __Pyx_GIVEREF(__pyx_t_15);
19369  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
19370  __Pyx_GIVEREF(__pyx_t_16);
19371  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
19372  __Pyx_INCREF(__pyx_slice_);
19373  __Pyx_GIVEREF(__pyx_slice_);
19374  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_slice_);
19375  __pyx_t_15 = 0;
19376  __pyx_t_16 = 0;
19377  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 876, __pyx_L1_error)
19378  __Pyx_GOTREF(__pyx_t_16);
19379  __pyx_t_18 = (__pyx_v_pi * __pyx_v_t);
19380  __pyx_t_19 = (__pyx_v_tForReversal * 2.0);
19381  if (unlikely(__pyx_t_19 == 0)) {
19382  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19383  __PYX_ERR(0, 876, __pyx_L1_error)
19384  }
19385  __pyx_t_15 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_18 / __pyx_t_19)))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 876, __pyx_L1_error)
19386  __Pyx_GOTREF(__pyx_t_15);
19387  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 876, __pyx_L1_error)
19388  __Pyx_GOTREF(__pyx_t_20);
19389  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
19390  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
19391  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_17, __pyx_t_20) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
19392  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
19393  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19394  }
19395  }
19396 
19397  /* "subsurfaceTransportFunctions.pyx":870
19398  * cdef double pi
19399  * pi = M_PI
19400  * if transient == 1: # <<<<<<<<<<<<<<
19401  * for eN in range(x.shape[0]):
19402  * for k in range(x.shape[1]):
19403  */
19404  goto __pyx_L3;
19405  }
19406 
19407  /* "subsurfaceTransportFunctions.pyx":878
19408  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19409  * else:
19410  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19411  * for k in range(x.shape[1]):
19412  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19413  */
19414  /*else*/ {
19415  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19416  __pyx_t_3 = __pyx_t_2;
19417  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19418  __pyx_v_eN = __pyx_t_4;
19419 
19420  /* "subsurfaceTransportFunctions.pyx":879
19421  * else:
19422  * for eN in range(x.shape[0]):
19423  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19424  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19425  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19426  */
19427  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19428  __pyx_t_6 = __pyx_t_5;
19429  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19430  __pyx_v_k = __pyx_t_7;
19431 
19432  /* "subsurfaceTransportFunctions.pyx":880
19433  * for eN in range(x.shape[0]):
19434  * for k in range(x.shape[1]):
19435  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19436  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19437  * v[eN,k,2]=zVelocity
19438  */
19439  __pyx_t_10 = __pyx_v_eN;
19440  __pyx_t_9 = __pyx_v_k;
19441  __pyx_t_8 = 1;
19442  __pyx_t_11 = -1;
19443  if (__pyx_t_10 < 0) {
19444  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
19445  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19446  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19447  if (__pyx_t_9 < 0) {
19448  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19449  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19450  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19451  if (__pyx_t_8 < 0) {
19452  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
19453  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19454  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19455  if (unlikely(__pyx_t_11 != -1)) {
19456  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19457  __PYX_ERR(0, 880, __pyx_L1_error)
19458  }
19459  __pyx_t_12 = __pyx_v_eN;
19460  __pyx_t_13 = __pyx_v_k;
19461  __pyx_t_14 = 0;
19462  __pyx_t_11 = -1;
19463  if (__pyx_t_12 < 0) {
19464  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19465  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19466  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19467  if (__pyx_t_13 < 0) {
19468  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19469  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19470  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19471  if (__pyx_t_14 < 0) {
19472  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19473  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19474  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19475  if (unlikely(__pyx_t_11 != -1)) {
19476  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19477  __PYX_ERR(0, 880, __pyx_L1_error)
19478  }
19479  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19480 
19481  /* "subsurfaceTransportFunctions.pyx":881
19482  * for k in range(x.shape[1]):
19483  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19484  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19485  * v[eN,k,2]=zVelocity
19486  *
19487  */
19488  __pyx_t_8 = __pyx_v_eN;
19489  __pyx_t_9 = __pyx_v_k;
19490  __pyx_t_10 = 0;
19491  __pyx_t_11 = -1;
19492  if (__pyx_t_8 < 0) {
19493  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19494  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19495  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19496  if (__pyx_t_9 < 0) {
19497  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19498  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19499  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19500  if (__pyx_t_10 < 0) {
19501  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19502  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19503  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19504  if (unlikely(__pyx_t_11 != -1)) {
19505  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19506  __PYX_ERR(0, 881, __pyx_L1_error)
19507  }
19508  __pyx_t_14 = __pyx_v_eN;
19509  __pyx_t_13 = __pyx_v_k;
19510  __pyx_t_12 = 1;
19511  __pyx_t_11 = -1;
19512  if (__pyx_t_14 < 0) {
19513  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
19514  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
19515  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19516  if (__pyx_t_13 < 0) {
19517  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19518  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19519  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19520  if (__pyx_t_12 < 0) {
19521  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
19522  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
19523  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19524  if (unlikely(__pyx_t_11 != -1)) {
19525  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19526  __PYX_ERR(0, 881, __pyx_L1_error)
19527  }
19528  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides))));
19529 
19530  /* "subsurfaceTransportFunctions.pyx":882
19531  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19532  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19533  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19534  *
19535  * def helicalElementVelocityEval4(int transient,
19536  */
19537  __pyx_t_10 = __pyx_v_eN;
19538  __pyx_t_9 = __pyx_v_k;
19539  __pyx_t_8 = 2;
19540  __pyx_t_11 = -1;
19541  if (__pyx_t_10 < 0) {
19542  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
19543  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19544  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19545  if (__pyx_t_9 < 0) {
19546  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
19547  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19548  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19549  if (__pyx_t_8 < 0) {
19550  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[2].shape;
19551  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19552  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19553  if (unlikely(__pyx_t_11 != -1)) {
19554  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19555  __PYX_ERR(0, 882, __pyx_L1_error)
19556  }
19557  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19558  }
19559  }
19560  }
19561  __pyx_L3:;
19562 
19563  /* "subsurfaceTransportFunctions.pyx":859
19564  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19565  *
19566  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19567  * double t,
19568  * double tForReversal,
19569  */
19570 
19571  /* function exit code */
19572  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19573  goto __pyx_L0;
19574  __pyx_L1_error:;
19575  __Pyx_XDECREF(__pyx_t_15);
19576  __Pyx_XDECREF(__pyx_t_16);
19577  __Pyx_XDECREF(__pyx_t_17);
19578  __Pyx_XDECREF(__pyx_t_20);
19579  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19580  __Pyx_PyThreadState_declare
19581  __Pyx_PyThreadState_assign
19582  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19583  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19584  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19585  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19586  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19587  __pyx_r = NULL;
19588  goto __pyx_L2;
19589  __pyx_L0:;
19590  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19591  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19592  __pyx_L2:;
19593  __Pyx_XGIVEREF(__pyx_r);
19594  __Pyx_RefNannyFinishContext();
19595  return __pyx_r;
19596 }
19597 
19598 /* "subsurfaceTransportFunctions.pyx":884
19599  * v[eN,k,2]=zVelocity
19600  *
19601  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19602  * double t,
19603  * double tForReversal,
19604  */
19605 
19606 /* Python wrapper */
19607 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19608 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
19609 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19610  int __pyx_v_transient;
19611  double __pyx_v_t;
19612  double __pyx_v_tForReversal;
19613  double __pyx_v_clock;
19614  double __pyx_v_zVelocity;
19615  double __pyx_v_xc;
19616  double __pyx_v_yc;
19617  PyArrayObject *__pyx_v_x = 0;
19618  PyArrayObject *__pyx_v_v = 0;
19619  int __pyx_lineno = 0;
19620  const char *__pyx_filename = NULL;
19621  int __pyx_clineno = 0;
19622  PyObject *__pyx_r = 0;
19623  __Pyx_RefNannyDeclarations
19624  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
19625  {
19626  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19627  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19628  if (unlikely(__pyx_kwds)) {
19629  Py_ssize_t kw_args;
19630  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19631  switch (pos_args) {
19632  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19633  CYTHON_FALLTHROUGH;
19634  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19635  CYTHON_FALLTHROUGH;
19636  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19637  CYTHON_FALLTHROUGH;
19638  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19639  CYTHON_FALLTHROUGH;
19640  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19641  CYTHON_FALLTHROUGH;
19642  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19643  CYTHON_FALLTHROUGH;
19644  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19645  CYTHON_FALLTHROUGH;
19646  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19647  CYTHON_FALLTHROUGH;
19648  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19649  CYTHON_FALLTHROUGH;
19650  case 0: break;
19651  default: goto __pyx_L5_argtuple_error;
19652  }
19653  kw_args = PyDict_Size(__pyx_kwds);
19654  switch (pos_args) {
19655  case 0:
19656  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19657  else goto __pyx_L5_argtuple_error;
19658  CYTHON_FALLTHROUGH;
19659  case 1:
19660  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19661  else {
19662  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); __PYX_ERR(0, 884, __pyx_L3_error)
19663  }
19664  CYTHON_FALLTHROUGH;
19665  case 2:
19666  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19667  else {
19668  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); __PYX_ERR(0, 884, __pyx_L3_error)
19669  }
19670  CYTHON_FALLTHROUGH;
19671  case 3:
19672  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19673  else {
19674  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); __PYX_ERR(0, 884, __pyx_L3_error)
19675  }
19676  CYTHON_FALLTHROUGH;
19677  case 4:
19678  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19679  else {
19680  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); __PYX_ERR(0, 884, __pyx_L3_error)
19681  }
19682  CYTHON_FALLTHROUGH;
19683  case 5:
19684  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19685  else {
19686  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); __PYX_ERR(0, 884, __pyx_L3_error)
19687  }
19688  CYTHON_FALLTHROUGH;
19689  case 6:
19690  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19691  else {
19692  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); __PYX_ERR(0, 884, __pyx_L3_error)
19693  }
19694  CYTHON_FALLTHROUGH;
19695  case 7:
19696  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19697  else {
19698  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); __PYX_ERR(0, 884, __pyx_L3_error)
19699  }
19700  CYTHON_FALLTHROUGH;
19701  case 8:
19702  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19703  else {
19704  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); __PYX_ERR(0, 884, __pyx_L3_error)
19705  }
19706  }
19707  if (unlikely(kw_args > 0)) {
19708  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) __PYX_ERR(0, 884, __pyx_L3_error)
19709  }
19710  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19711  goto __pyx_L5_argtuple_error;
19712  } else {
19713  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19714  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19715  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19716  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19717  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19718  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19719  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19720  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19721  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19722  }
19723  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)
19724  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
19725  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
19726  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
19727  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error)
19728  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19729  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19730  __pyx_v_x = ((PyArrayObject *)values[7]);
19731  __pyx_v_v = ((PyArrayObject *)values[8]);
19732  }
19733  goto __pyx_L4_argument_unpacking_done;
19734  __pyx_L5_argtuple_error:;
19735  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
19736  __pyx_L3_error:;
19737  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19738  __Pyx_RefNannyFinishContext();
19739  return NULL;
19740  __pyx_L4_argument_unpacking_done:;
19741  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 890, __pyx_L1_error)
19742  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 891, __pyx_L1_error)
19743  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19744 
19745  /* function exit code */
19746  goto __pyx_L0;
19747  __pyx_L1_error:;
19748  __pyx_r = NULL;
19749  __pyx_L0:;
19750  __Pyx_RefNannyFinishContext();
19751  return __pyx_r;
19752 }
19753 
19754 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) {
19755  int __pyx_v_eN;
19756  int __pyx_v_ebN;
19757  int __pyx_v_k;
19758  double __pyx_v_pi;
19759  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19760  __Pyx_Buffer __pyx_pybuffer_v;
19761  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19762  __Pyx_Buffer __pyx_pybuffer_x;
19763  PyObject *__pyx_r = NULL;
19764  __Pyx_RefNannyDeclarations
19765  int __pyx_t_1;
19766  npy_intp __pyx_t_2;
19767  npy_intp __pyx_t_3;
19768  int __pyx_t_4;
19769  npy_intp __pyx_t_5;
19770  npy_intp __pyx_t_6;
19771  int __pyx_t_7;
19772  npy_intp __pyx_t_8;
19773  npy_intp __pyx_t_9;
19774  int __pyx_t_10;
19775  Py_ssize_t __pyx_t_11;
19776  Py_ssize_t __pyx_t_12;
19777  Py_ssize_t __pyx_t_13;
19778  Py_ssize_t __pyx_t_14;
19779  int __pyx_t_15;
19780  Py_ssize_t __pyx_t_16;
19781  Py_ssize_t __pyx_t_17;
19782  Py_ssize_t __pyx_t_18;
19783  Py_ssize_t __pyx_t_19;
19784  PyObject *__pyx_t_20 = NULL;
19785  PyObject *__pyx_t_21 = NULL;
19786  PyObject *__pyx_t_22 = NULL;
19787  PyObject *__pyx_t_23 = NULL;
19788  double __pyx_t_24;
19789  double __pyx_t_25;
19790  int __pyx_lineno = 0;
19791  const char *__pyx_filename = NULL;
19792  int __pyx_clineno = 0;
19793  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
19794  __pyx_pybuffer_x.pybuffer.buf = NULL;
19795  __pyx_pybuffer_x.refcount = 0;
19796  __pyx_pybuffernd_x.data = NULL;
19797  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19798  __pyx_pybuffer_v.pybuffer.buf = NULL;
19799  __pyx_pybuffer_v.refcount = 0;
19800  __pyx_pybuffernd_v.data = NULL;
19801  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19802  {
19803  __Pyx_BufFmt_StackElem __pyx_stack[1];
19804  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, 884, __pyx_L1_error)
19805  }
19806  __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];
19807  {
19808  __Pyx_BufFmt_StackElem __pyx_stack[1];
19809  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19810  }
19811  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19812 
19813  /* "subsurfaceTransportFunctions.pyx":894
19814  * cdef int eN,ebN,k
19815  * cdef double pi
19816  * pi = M_PI # <<<<<<<<<<<<<<
19817  * if transient == 1:
19818  * for eN in range(x.shape[0]):
19819  */
19820  __pyx_v_pi = M_PI;
19821 
19822  /* "subsurfaceTransportFunctions.pyx":895
19823  * cdef double pi
19824  * pi = M_PI
19825  * if transient == 1: # <<<<<<<<<<<<<<
19826  * for eN in range(x.shape[0]):
19827  * for ebN in range(x.shape[1]):
19828  */
19829  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19830  if (__pyx_t_1) {
19831 
19832  /* "subsurfaceTransportFunctions.pyx":896
19833  * pi = M_PI
19834  * if transient == 1:
19835  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19836  * for ebN in range(x.shape[1]):
19837  * for k in range(x.shape[2]):
19838  */
19839  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19840  __pyx_t_3 = __pyx_t_2;
19841  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19842  __pyx_v_eN = __pyx_t_4;
19843 
19844  /* "subsurfaceTransportFunctions.pyx":897
19845  * if transient == 1:
19846  * for eN in range(x.shape[0]):
19847  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19848  * for k in range(x.shape[2]):
19849  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19850  */
19851  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19852  __pyx_t_6 = __pyx_t_5;
19853  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19854  __pyx_v_ebN = __pyx_t_7;
19855 
19856  /* "subsurfaceTransportFunctions.pyx":898
19857  * for eN in range(x.shape[0]):
19858  * for ebN in range(x.shape[1]):
19859  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19860  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19861  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19862  */
19863  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
19864  __pyx_t_9 = __pyx_t_8;
19865  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
19866  __pyx_v_k = __pyx_t_10;
19867 
19868  /* "subsurfaceTransportFunctions.pyx":899
19869  * for ebN in range(x.shape[1]):
19870  * for k in range(x.shape[2]):
19871  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
19872  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19873  * v[eN,ebN,k,2]=zVelocity
19874  */
19875  __pyx_t_11 = __pyx_v_eN;
19876  __pyx_t_12 = __pyx_v_ebN;
19877  __pyx_t_13 = __pyx_v_k;
19878  __pyx_t_14 = 1;
19879  __pyx_t_15 = -1;
19880  if (__pyx_t_11 < 0) {
19881  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
19882  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
19883  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19884  if (__pyx_t_12 < 0) {
19885  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
19886  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
19887  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
19888  if (__pyx_t_13 < 0) {
19889  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
19890  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
19891  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
19892  if (__pyx_t_14 < 0) {
19893  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
19894  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
19895  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19896  if (unlikely(__pyx_t_15 != -1)) {
19897  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19898  __PYX_ERR(0, 899, __pyx_L1_error)
19899  }
19900  __pyx_t_16 = __pyx_v_eN;
19901  __pyx_t_17 = __pyx_v_ebN;
19902  __pyx_t_18 = __pyx_v_k;
19903  __pyx_t_19 = 0;
19904  __pyx_t_15 = -1;
19905  if (__pyx_t_16 < 0) {
19906  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
19907  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
19908  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19909  if (__pyx_t_17 < 0) {
19910  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
19911  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
19912  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19913  if (__pyx_t_18 < 0) {
19914  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
19915  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
19916  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19917  if (__pyx_t_19 < 0) {
19918  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
19919  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
19920  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19921  if (unlikely(__pyx_t_15 != -1)) {
19922  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19923  __PYX_ERR(0, 899, __pyx_L1_error)
19924  }
19925  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
19926 
19927  /* "subsurfaceTransportFunctions.pyx":900
19928  * for k in range(x.shape[2]):
19929  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19930  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
19931  * v[eN,ebN,k,2]=zVelocity
19932  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19933  */
19934  __pyx_t_14 = __pyx_v_eN;
19935  __pyx_t_13 = __pyx_v_ebN;
19936  __pyx_t_12 = __pyx_v_k;
19937  __pyx_t_11 = 0;
19938  __pyx_t_15 = -1;
19939  if (__pyx_t_14 < 0) {
19940  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
19941  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
19942  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19943  if (__pyx_t_13 < 0) {
19944  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
19945  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
19946  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
19947  if (__pyx_t_12 < 0) {
19948  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
19949  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
19950  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
19951  if (__pyx_t_11 < 0) {
19952  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
19953  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
19954  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19955  if (unlikely(__pyx_t_15 != -1)) {
19956  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19957  __PYX_ERR(0, 900, __pyx_L1_error)
19958  }
19959  __pyx_t_19 = __pyx_v_eN;
19960  __pyx_t_18 = __pyx_v_ebN;
19961  __pyx_t_17 = __pyx_v_k;
19962  __pyx_t_16 = 1;
19963  __pyx_t_15 = -1;
19964  if (__pyx_t_19 < 0) {
19965  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
19966  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
19967  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19968  if (__pyx_t_18 < 0) {
19969  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
19970  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
19971  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19972  if (__pyx_t_17 < 0) {
19973  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
19974  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
19975  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19976  if (__pyx_t_16 < 0) {
19977  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
19978  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
19979  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19980  if (unlikely(__pyx_t_15 != -1)) {
19981  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19982  __PYX_ERR(0, 900, __pyx_L1_error)
19983  }
19984  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
19985 
19986  /* "subsurfaceTransportFunctions.pyx":901
19987  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19988  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19989  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
19990  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19991  * else:
19992  */
19993  __pyx_t_11 = __pyx_v_eN;
19994  __pyx_t_12 = __pyx_v_ebN;
19995  __pyx_t_13 = __pyx_v_k;
19996  __pyx_t_14 = 2;
19997  __pyx_t_15 = -1;
19998  if (__pyx_t_11 < 0) {
19999  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[0].shape;
20000  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
20001  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20002  if (__pyx_t_12 < 0) {
20003  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[1].shape;
20004  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
20005  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20006  if (__pyx_t_13 < 0) {
20007  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[2].shape;
20008  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
20009  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20010  if (__pyx_t_14 < 0) {
20011  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[3].shape;
20012  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
20013  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20014  if (unlikely(__pyx_t_15 != -1)) {
20015  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20016  __PYX_ERR(0, 901, __pyx_L1_error)
20017  }
20018  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20019 
20020  /* "subsurfaceTransportFunctions.pyx":902
20021  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20022  * v[eN,ebN,k,2]=zVelocity
20023  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
20024  * else:
20025  * for eN in range(x.shape[0]):
20026  */
20027  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L1_error)
20028  __Pyx_GOTREF(__pyx_t_20);
20029  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 902, __pyx_L1_error)
20030  __Pyx_GOTREF(__pyx_t_21);
20031  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 902, __pyx_L1_error)
20032  __Pyx_GOTREF(__pyx_t_22);
20033  __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 902, __pyx_L1_error)
20034  __Pyx_GOTREF(__pyx_t_23);
20035  __Pyx_GIVEREF(__pyx_t_20);
20036  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
20037  __Pyx_GIVEREF(__pyx_t_21);
20038  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
20039  __Pyx_GIVEREF(__pyx_t_22);
20040  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
20041  __Pyx_INCREF(__pyx_slice_);
20042  __Pyx_GIVEREF(__pyx_slice_);
20043  PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_slice_);
20044  __pyx_t_20 = 0;
20045  __pyx_t_21 = 0;
20046  __pyx_t_22 = 0;
20047  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 902, __pyx_L1_error)
20048  __Pyx_GOTREF(__pyx_t_22);
20049  __pyx_t_24 = (__pyx_v_pi * __pyx_v_t);
20050  __pyx_t_25 = (__pyx_v_tForReversal * 2.0);
20051  if (unlikely(__pyx_t_25 == 0)) {
20052  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
20053  __PYX_ERR(0, 902, __pyx_L1_error)
20054  }
20055  __pyx_t_21 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_24 / __pyx_t_25)))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 902, __pyx_L1_error)
20056  __Pyx_GOTREF(__pyx_t_21);
20057  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_22, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L1_error)
20058  __Pyx_GOTREF(__pyx_t_20);
20059  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
20060  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
20061  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_23, __pyx_t_20) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)
20062  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
20063  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
20064  }
20065  }
20066  }
20067 
20068  /* "subsurfaceTransportFunctions.pyx":895
20069  * cdef double pi
20070  * pi = M_PI
20071  * if transient == 1: # <<<<<<<<<<<<<<
20072  * for eN in range(x.shape[0]):
20073  * for ebN in range(x.shape[1]):
20074  */
20075  goto __pyx_L3;
20076  }
20077 
20078  /* "subsurfaceTransportFunctions.pyx":904
20079  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
20080  * else:
20081  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20082  * for ebN in range(x.shape[1]):
20083  * for k in range(x.shape[2]):
20084  */
20085  /*else*/ {
20086  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
20087  __pyx_t_3 = __pyx_t_2;
20088  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20089  __pyx_v_eN = __pyx_t_4;
20090 
20091  /* "subsurfaceTransportFunctions.pyx":905
20092  * else:
20093  * for eN in range(x.shape[0]):
20094  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20095  * for k in range(x.shape[2]):
20096  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20097  */
20098  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
20099  __pyx_t_6 = __pyx_t_5;
20100  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
20101  __pyx_v_ebN = __pyx_t_7;
20102 
20103  /* "subsurfaceTransportFunctions.pyx":906
20104  * for eN in range(x.shape[0]):
20105  * for ebN in range(x.shape[1]):
20106  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20107  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20108  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20109  */
20110  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
20111  __pyx_t_9 = __pyx_t_8;
20112  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
20113  __pyx_v_k = __pyx_t_10;
20114 
20115  /* "subsurfaceTransportFunctions.pyx":907
20116  * for ebN in range(x.shape[1]):
20117  * for k in range(x.shape[2]):
20118  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
20119  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20120  * v[eN,ebN,k,2]=zVelocity
20121  */
20122  __pyx_t_14 = __pyx_v_eN;
20123  __pyx_t_13 = __pyx_v_ebN;
20124  __pyx_t_12 = __pyx_v_k;
20125  __pyx_t_11 = 1;
20126  __pyx_t_15 = -1;
20127  if (__pyx_t_14 < 0) {
20128  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20129  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
20130  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20131  if (__pyx_t_13 < 0) {
20132  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
20133  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
20134  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20135  if (__pyx_t_12 < 0) {
20136  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
20137  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
20138  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20139  if (__pyx_t_11 < 0) {
20140  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
20141  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
20142  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20143  if (unlikely(__pyx_t_15 != -1)) {
20144  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20145  __PYX_ERR(0, 907, __pyx_L1_error)
20146  }
20147  __pyx_t_16 = __pyx_v_eN;
20148  __pyx_t_17 = __pyx_v_ebN;
20149  __pyx_t_18 = __pyx_v_k;
20150  __pyx_t_19 = 0;
20151  __pyx_t_15 = -1;
20152  if (__pyx_t_16 < 0) {
20153  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
20154  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
20155  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20156  if (__pyx_t_17 < 0) {
20157  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
20158  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
20159  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20160  if (__pyx_t_18 < 0) {
20161  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
20162  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
20163  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20164  if (__pyx_t_19 < 0) {
20165  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
20166  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
20167  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20168  if (unlikely(__pyx_t_15 != -1)) {
20169  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20170  __PYX_ERR(0, 907, __pyx_L1_error)
20171  }
20172  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20173 
20174  /* "subsurfaceTransportFunctions.pyx":908
20175  * for k in range(x.shape[2]):
20176  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20177  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20178  * v[eN,ebN,k,2]=zVelocity
20179  *
20180  */
20181  __pyx_t_11 = __pyx_v_eN;
20182  __pyx_t_12 = __pyx_v_ebN;
20183  __pyx_t_13 = __pyx_v_k;
20184  __pyx_t_14 = 0;
20185  __pyx_t_15 = -1;
20186  if (__pyx_t_11 < 0) {
20187  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20188  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
20189  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20190  if (__pyx_t_12 < 0) {
20191  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20192  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
20193  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20194  if (__pyx_t_13 < 0) {
20195  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20196  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
20197  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20198  if (__pyx_t_14 < 0) {
20199  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
20200  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
20201  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20202  if (unlikely(__pyx_t_15 != -1)) {
20203  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20204  __PYX_ERR(0, 908, __pyx_L1_error)
20205  }
20206  __pyx_t_19 = __pyx_v_eN;
20207  __pyx_t_18 = __pyx_v_ebN;
20208  __pyx_t_17 = __pyx_v_k;
20209  __pyx_t_16 = 1;
20210  __pyx_t_15 = -1;
20211  if (__pyx_t_19 < 0) {
20212  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
20213  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
20214  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20215  if (__pyx_t_18 < 0) {
20216  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20217  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
20218  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20219  if (__pyx_t_17 < 0) {
20220  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
20221  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
20222  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20223  if (__pyx_t_16 < 0) {
20224  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
20225  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
20226  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20227  if (unlikely(__pyx_t_15 != -1)) {
20228  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20229  __PYX_ERR(0, 908, __pyx_L1_error)
20230  }
20231  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides))));
20232 
20233  /* "subsurfaceTransportFunctions.pyx":909
20234  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20235  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20236  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20237  *
20238  * def vortexElementVelocityEval3(double t,
20239  */
20240  __pyx_t_14 = __pyx_v_eN;
20241  __pyx_t_13 = __pyx_v_ebN;
20242  __pyx_t_12 = __pyx_v_k;
20243  __pyx_t_11 = 2;
20244  __pyx_t_15 = -1;
20245  if (__pyx_t_14 < 0) {
20246  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
20247  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
20248  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20249  if (__pyx_t_13 < 0) {
20250  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
20251  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
20252  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20253  if (__pyx_t_12 < 0) {
20254  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
20255  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
20256  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20257  if (__pyx_t_11 < 0) {
20258  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[3].shape;
20259  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
20260  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20261  if (unlikely(__pyx_t_15 != -1)) {
20262  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20263  __PYX_ERR(0, 909, __pyx_L1_error)
20264  }
20265  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20266  }
20267  }
20268  }
20269  }
20270  __pyx_L3:;
20271 
20272  /* "subsurfaceTransportFunctions.pyx":884
20273  * v[eN,k,2]=zVelocity
20274  *
20275  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
20276  * double t,
20277  * double tForReversal,
20278  */
20279 
20280  /* function exit code */
20281  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20282  goto __pyx_L0;
20283  __pyx_L1_error:;
20284  __Pyx_XDECREF(__pyx_t_20);
20285  __Pyx_XDECREF(__pyx_t_21);
20286  __Pyx_XDECREF(__pyx_t_22);
20287  __Pyx_XDECREF(__pyx_t_23);
20288  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20289  __Pyx_PyThreadState_declare
20290  __Pyx_PyThreadState_assign
20291  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20292  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20293  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20294  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20295  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20296  __pyx_r = NULL;
20297  goto __pyx_L2;
20298  __pyx_L0:;
20299  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20300  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20301  __pyx_L2:;
20302  __Pyx_XGIVEREF(__pyx_r);
20303  __Pyx_RefNannyFinishContext();
20304  return __pyx_r;
20305 }
20306 
20307 /* "subsurfaceTransportFunctions.pyx":911
20308  * v[eN,ebN,k,2]=zVelocity
20309  *
20310  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20311  * numpy.ndarray[DTYPE_t,ndim=3] x,
20312  * numpy.ndarray[DTYPE_t,ndim=3] v):
20313  */
20314 
20315 /* Python wrapper */
20316 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20317 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
20318 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20319  double __pyx_v_t;
20320  PyArrayObject *__pyx_v_x = 0;
20321  PyArrayObject *__pyx_v_v = 0;
20322  int __pyx_lineno = 0;
20323  const char *__pyx_filename = NULL;
20324  int __pyx_clineno = 0;
20325  PyObject *__pyx_r = 0;
20326  __Pyx_RefNannyDeclarations
20327  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
20328  {
20329  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20330  PyObject* values[3] = {0,0,0};
20331  if (unlikely(__pyx_kwds)) {
20332  Py_ssize_t kw_args;
20333  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20334  switch (pos_args) {
20335  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20336  CYTHON_FALLTHROUGH;
20337  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20338  CYTHON_FALLTHROUGH;
20339  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20340  CYTHON_FALLTHROUGH;
20341  case 0: break;
20342  default: goto __pyx_L5_argtuple_error;
20343  }
20344  kw_args = PyDict_Size(__pyx_kwds);
20345  switch (pos_args) {
20346  case 0:
20347  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20348  else goto __pyx_L5_argtuple_error;
20349  CYTHON_FALLTHROUGH;
20350  case 1:
20351  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20352  else {
20353  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
20354  }
20355  CYTHON_FALLTHROUGH;
20356  case 2:
20357  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20358  else {
20359  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
20360  }
20361  }
20362  if (unlikely(kw_args > 0)) {
20363  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
20364  }
20365  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20366  goto __pyx_L5_argtuple_error;
20367  } else {
20368  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20369  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20370  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20371  }
20372  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L3_error)
20373  __pyx_v_x = ((PyArrayObject *)values[1]);
20374  __pyx_v_v = ((PyArrayObject *)values[2]);
20375  }
20376  goto __pyx_L4_argument_unpacking_done;
20377  __pyx_L5_argtuple_error:;
20378  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
20379  __pyx_L3_error:;
20380  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20381  __Pyx_RefNannyFinishContext();
20382  return NULL;
20383  __pyx_L4_argument_unpacking_done:;
20384  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 912, __pyx_L1_error)
20385  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 913, __pyx_L1_error)
20386  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20387 
20388  /* function exit code */
20389  goto __pyx_L0;
20390  __pyx_L1_error:;
20391  __pyx_r = NULL;
20392  __pyx_L0:;
20393  __Pyx_RefNannyFinishContext();
20394  return __pyx_r;
20395 }
20396 
20397 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20398  int __pyx_v_eN;
20399  int __pyx_v_k;
20400  double __pyx_v_pi;
20401  double __pyx_v_one8;
20402  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20403  __Pyx_Buffer __pyx_pybuffer_v;
20404  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20405  __Pyx_Buffer __pyx_pybuffer_x;
20406  PyObject *__pyx_r = NULL;
20407  __Pyx_RefNannyDeclarations
20408  npy_intp __pyx_t_1;
20409  npy_intp __pyx_t_2;
20410  int __pyx_t_3;
20411  npy_intp __pyx_t_4;
20412  npy_intp __pyx_t_5;
20413  int __pyx_t_6;
20414  Py_ssize_t __pyx_t_7;
20415  Py_ssize_t __pyx_t_8;
20416  Py_ssize_t __pyx_t_9;
20417  int __pyx_t_10;
20418  Py_ssize_t __pyx_t_11;
20419  Py_ssize_t __pyx_t_12;
20420  Py_ssize_t __pyx_t_13;
20421  Py_ssize_t __pyx_t_14;
20422  Py_ssize_t __pyx_t_15;
20423  Py_ssize_t __pyx_t_16;
20424  Py_ssize_t __pyx_t_17;
20425  Py_ssize_t __pyx_t_18;
20426  Py_ssize_t __pyx_t_19;
20427  int __pyx_lineno = 0;
20428  const char *__pyx_filename = NULL;
20429  int __pyx_clineno = 0;
20430  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
20431  __pyx_pybuffer_x.pybuffer.buf = NULL;
20432  __pyx_pybuffer_x.refcount = 0;
20433  __pyx_pybuffernd_x.data = NULL;
20434  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20435  __pyx_pybuffer_v.pybuffer.buf = NULL;
20436  __pyx_pybuffer_v.refcount = 0;
20437  __pyx_pybuffernd_v.data = NULL;
20438  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20439  {
20440  __Pyx_BufFmt_StackElem __pyx_stack[1];
20441  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, 911, __pyx_L1_error)
20442  }
20443  __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];
20444  {
20445  __Pyx_BufFmt_StackElem __pyx_stack[1];
20446  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20447  }
20448  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
20449 
20450  /* "subsurfaceTransportFunctions.pyx":916
20451  * cdef int eN,k
20452  * cdef double pi,one8
20453  * pi = M_PI # <<<<<<<<<<<<<<
20454  * one8 = 1.0/8.0
20455  * for eN in range(x.shape[0]):
20456  */
20457  __pyx_v_pi = M_PI;
20458 
20459  /* "subsurfaceTransportFunctions.pyx":917
20460  * cdef double pi,one8
20461  * pi = M_PI
20462  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20463  * for eN in range(x.shape[0]):
20464  * for k in range(x.shape[1]):
20465  */
20466  __pyx_v_one8 = (1.0 / 8.0);
20467 
20468  /* "subsurfaceTransportFunctions.pyx":918
20469  * pi = M_PI
20470  * one8 = 1.0/8.0
20471  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20472  * for k in range(x.shape[1]):
20473  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20474  */
20475  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20476  __pyx_t_2 = __pyx_t_1;
20477  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20478  __pyx_v_eN = __pyx_t_3;
20479 
20480  /* "subsurfaceTransportFunctions.pyx":919
20481  * one8 = 1.0/8.0
20482  * for eN in range(x.shape[0]):
20483  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
20484  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20485  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20486  */
20487  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20488  __pyx_t_5 = __pyx_t_4;
20489  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20490  __pyx_v_k = __pyx_t_6;
20491 
20492  /* "subsurfaceTransportFunctions.pyx":920
20493  * for eN in range(x.shape[0]):
20494  * for k in range(x.shape[1]):
20495  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
20496  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20497  *
20498  */
20499  __pyx_t_7 = __pyx_v_eN;
20500  __pyx_t_8 = __pyx_v_k;
20501  __pyx_t_9 = 1;
20502  __pyx_t_10 = -1;
20503  if (__pyx_t_7 < 0) {
20504  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
20505  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
20506  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20507  if (__pyx_t_8 < 0) {
20508  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20509  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20510  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20511  if (__pyx_t_9 < 0) {
20512  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
20513  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 2;
20514  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20515  if (unlikely(__pyx_t_10 != -1)) {
20516  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20517  __PYX_ERR(0, 920, __pyx_L1_error)
20518  }
20519  __pyx_t_11 = __pyx_v_eN;
20520  __pyx_t_12 = __pyx_v_k;
20521  __pyx_t_13 = 0;
20522  __pyx_t_10 = -1;
20523  if (__pyx_t_11 < 0) {
20524  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20525  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
20526  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20527  if (__pyx_t_12 < 0) {
20528  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20529  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20530  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20531  if (__pyx_t_13 < 0) {
20532  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20533  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 2;
20534  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20535  if (unlikely(__pyx_t_10 != -1)) {
20536  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20537  __PYX_ERR(0, 920, __pyx_L1_error)
20538  }
20539  __pyx_t_14 = __pyx_v_eN;
20540  __pyx_t_15 = __pyx_v_k;
20541  __pyx_t_16 = 0;
20542  __pyx_t_10 = -1;
20543  if (__pyx_t_14 < 0) {
20544  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20545  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
20546  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20547  if (__pyx_t_15 < 0) {
20548  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20549  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20550  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20551  if (__pyx_t_16 < 0) {
20552  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20553  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 2;
20554  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20555  if (unlikely(__pyx_t_10 != -1)) {
20556  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20557  __PYX_ERR(0, 920, __pyx_L1_error)
20558  }
20559  __pyx_t_17 = __pyx_v_eN;
20560  __pyx_t_18 = __pyx_v_k;
20561  __pyx_t_19 = 0;
20562  __pyx_t_10 = -1;
20563  if (__pyx_t_17 < 0) {
20564  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[0].shape;
20565  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
20566  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20567  if (__pyx_t_18 < 0) {
20568  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20569  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20570  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20571  if (__pyx_t_19 < 0) {
20572  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[2].shape;
20573  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 2;
20574  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20575  if (unlikely(__pyx_t_10 != -1)) {
20576  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20577  __PYX_ERR(0, 920, __pyx_L1_error)
20578  }
20579  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides)))));
20580 
20581  /* "subsurfaceTransportFunctions.pyx":921
20582  * for k in range(x.shape[1]):
20583  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20584  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
20585  *
20586  *
20587  */
20588  __pyx_t_16 = __pyx_v_eN;
20589  __pyx_t_15 = __pyx_v_k;
20590  __pyx_t_14 = 0;
20591  __pyx_t_10 = -1;
20592  if (__pyx_t_16 < 0) {
20593  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[0].shape;
20594  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
20595  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20596  if (__pyx_t_15 < 0) {
20597  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20598  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20599  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20600  if (__pyx_t_14 < 0) {
20601  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
20602  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 2;
20603  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20604  if (unlikely(__pyx_t_10 != -1)) {
20605  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20606  __PYX_ERR(0, 921, __pyx_L1_error)
20607  }
20608  __pyx_t_13 = __pyx_v_eN;
20609  __pyx_t_12 = __pyx_v_k;
20610  __pyx_t_11 = 1;
20611  __pyx_t_10 = -1;
20612  if (__pyx_t_13 < 0) {
20613  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
20614  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0;
20615  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20616  if (__pyx_t_12 < 0) {
20617  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20618  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20619  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20620  if (__pyx_t_11 < 0) {
20621  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
20622  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 2;
20623  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20624  if (unlikely(__pyx_t_10 != -1)) {
20625  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20626  __PYX_ERR(0, 921, __pyx_L1_error)
20627  }
20628  __pyx_t_9 = __pyx_v_eN;
20629  __pyx_t_8 = __pyx_v_k;
20630  __pyx_t_7 = 1;
20631  __pyx_t_10 = -1;
20632  if (__pyx_t_9 < 0) {
20633  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[0].shape;
20634  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
20635  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20636  if (__pyx_t_8 < 0) {
20637  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20638  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20639  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20640  if (__pyx_t_7 < 0) {
20641  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[2].shape;
20642  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 2;
20643  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20644  if (unlikely(__pyx_t_10 != -1)) {
20645  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20646  __PYX_ERR(0, 921, __pyx_L1_error)
20647  }
20648  __pyx_t_19 = __pyx_v_eN;
20649  __pyx_t_18 = __pyx_v_k;
20650  __pyx_t_17 = 1;
20651  __pyx_t_10 = -1;
20652  if (__pyx_t_19 < 0) {
20653  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
20654  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
20655  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20656  if (__pyx_t_18 < 0) {
20657  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20658  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20659  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20660  if (__pyx_t_17 < 0) {
20661  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
20662  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 2;
20663  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20664  if (unlikely(__pyx_t_10 != -1)) {
20665  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20666  __PYX_ERR(0, 921, __pyx_L1_error)
20667  }
20668  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[2].strides)))));
20669  }
20670  }
20671 
20672  /* "subsurfaceTransportFunctions.pyx":911
20673  * v[eN,ebN,k,2]=zVelocity
20674  *
20675  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20676  * numpy.ndarray[DTYPE_t,ndim=3] x,
20677  * numpy.ndarray[DTYPE_t,ndim=3] v):
20678  */
20679 
20680  /* function exit code */
20681  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20682  goto __pyx_L0;
20683  __pyx_L1_error:;
20684  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20685  __Pyx_PyThreadState_declare
20686  __Pyx_PyThreadState_assign
20687  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20688  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20689  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20690  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20691  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20692  __pyx_r = NULL;
20693  goto __pyx_L2;
20694  __pyx_L0:;
20695  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20696  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20697  __pyx_L2:;
20698  __Pyx_XGIVEREF(__pyx_r);
20699  __Pyx_RefNannyFinishContext();
20700  return __pyx_r;
20701 }
20702 
20703 /* "subsurfaceTransportFunctions.pyx":924
20704  *
20705  *
20706  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20707  * numpy.ndarray[DTYPE_t,ndim=4] x,
20708  * numpy.ndarray[DTYPE_t,ndim=4] v):
20709  */
20710 
20711 /* Python wrapper */
20712 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20713 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
20714 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20715  double __pyx_v_t;
20716  PyArrayObject *__pyx_v_x = 0;
20717  PyArrayObject *__pyx_v_v = 0;
20718  int __pyx_lineno = 0;
20719  const char *__pyx_filename = NULL;
20720  int __pyx_clineno = 0;
20721  PyObject *__pyx_r = 0;
20722  __Pyx_RefNannyDeclarations
20723  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
20724  {
20725  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20726  PyObject* values[3] = {0,0,0};
20727  if (unlikely(__pyx_kwds)) {
20728  Py_ssize_t kw_args;
20729  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20730  switch (pos_args) {
20731  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20732  CYTHON_FALLTHROUGH;
20733  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20734  CYTHON_FALLTHROUGH;
20735  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20736  CYTHON_FALLTHROUGH;
20737  case 0: break;
20738  default: goto __pyx_L5_argtuple_error;
20739  }
20740  kw_args = PyDict_Size(__pyx_kwds);
20741  switch (pos_args) {
20742  case 0:
20743  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20744  else goto __pyx_L5_argtuple_error;
20745  CYTHON_FALLTHROUGH;
20746  case 1:
20747  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20748  else {
20749  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); __PYX_ERR(0, 924, __pyx_L3_error)
20750  }
20751  CYTHON_FALLTHROUGH;
20752  case 2:
20753  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20754  else {
20755  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); __PYX_ERR(0, 924, __pyx_L3_error)
20756  }
20757  }
20758  if (unlikely(kw_args > 0)) {
20759  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
20760  }
20761  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20762  goto __pyx_L5_argtuple_error;
20763  } else {
20764  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20765  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20766  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20767  }
20768  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error)
20769  __pyx_v_x = ((PyArrayObject *)values[1]);
20770  __pyx_v_v = ((PyArrayObject *)values[2]);
20771  }
20772  goto __pyx_L4_argument_unpacking_done;
20773  __pyx_L5_argtuple_error:;
20774  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
20775  __pyx_L3_error:;
20776  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20777  __Pyx_RefNannyFinishContext();
20778  return NULL;
20779  __pyx_L4_argument_unpacking_done:;
20780  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
20781  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 926, __pyx_L1_error)
20782  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20783 
20784  /* function exit code */
20785  goto __pyx_L0;
20786  __pyx_L1_error:;
20787  __pyx_r = NULL;
20788  __pyx_L0:;
20789  __Pyx_RefNannyFinishContext();
20790  return __pyx_r;
20791 }
20792 
20793 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20794  int __pyx_v_eN;
20795  int __pyx_v_k;
20796  int __pyx_v_ebN;
20797  double __pyx_v_pi;
20798  double __pyx_v_one8;
20799  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20800  __Pyx_Buffer __pyx_pybuffer_v;
20801  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20802  __Pyx_Buffer __pyx_pybuffer_x;
20803  PyObject *__pyx_r = NULL;
20804  __Pyx_RefNannyDeclarations
20805  npy_intp __pyx_t_1;
20806  npy_intp __pyx_t_2;
20807  int __pyx_t_3;
20808  npy_intp __pyx_t_4;
20809  npy_intp __pyx_t_5;
20810  int __pyx_t_6;
20811  npy_intp __pyx_t_7;
20812  npy_intp __pyx_t_8;
20813  int __pyx_t_9;
20814  Py_ssize_t __pyx_t_10;
20815  Py_ssize_t __pyx_t_11;
20816  Py_ssize_t __pyx_t_12;
20817  Py_ssize_t __pyx_t_13;
20818  int __pyx_t_14;
20819  Py_ssize_t __pyx_t_15;
20820  Py_ssize_t __pyx_t_16;
20821  Py_ssize_t __pyx_t_17;
20822  Py_ssize_t __pyx_t_18;
20823  Py_ssize_t __pyx_t_19;
20824  Py_ssize_t __pyx_t_20;
20825  Py_ssize_t __pyx_t_21;
20826  Py_ssize_t __pyx_t_22;
20827  Py_ssize_t __pyx_t_23;
20828  Py_ssize_t __pyx_t_24;
20829  Py_ssize_t __pyx_t_25;
20830  Py_ssize_t __pyx_t_26;
20831  int __pyx_lineno = 0;
20832  const char *__pyx_filename = NULL;
20833  int __pyx_clineno = 0;
20834  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
20835  __pyx_pybuffer_x.pybuffer.buf = NULL;
20836  __pyx_pybuffer_x.refcount = 0;
20837  __pyx_pybuffernd_x.data = NULL;
20838  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20839  __pyx_pybuffer_v.pybuffer.buf = NULL;
20840  __pyx_pybuffer_v.refcount = 0;
20841  __pyx_pybuffernd_v.data = NULL;
20842  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20843  {
20844  __Pyx_BufFmt_StackElem __pyx_stack[1];
20845  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, 924, __pyx_L1_error)
20846  }
20847  __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];
20848  {
20849  __Pyx_BufFmt_StackElem __pyx_stack[1];
20850  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20851  }
20852  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
20853 
20854  /* "subsurfaceTransportFunctions.pyx":929
20855  * cdef int eN,k,ebN
20856  * cdef double pi,one8
20857  * pi = M_PI # <<<<<<<<<<<<<<
20858  * one8 = 1.0/8.0
20859  * for eN in range(x.shape[0]):
20860  */
20861  __pyx_v_pi = M_PI;
20862 
20863  /* "subsurfaceTransportFunctions.pyx":930
20864  * cdef double pi,one8
20865  * pi = M_PI
20866  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20867  * for eN in range(x.shape[0]):
20868  * for ebN in range(x.shape[1]):
20869  */
20870  __pyx_v_one8 = (1.0 / 8.0);
20871 
20872  /* "subsurfaceTransportFunctions.pyx":931
20873  * pi = M_PI
20874  * one8 = 1.0/8.0
20875  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20876  * for ebN in range(x.shape[1]):
20877  * for k in range(x.shape[2]):
20878  */
20879  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20880  __pyx_t_2 = __pyx_t_1;
20881  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20882  __pyx_v_eN = __pyx_t_3;
20883 
20884  /* "subsurfaceTransportFunctions.pyx":932
20885  * one8 = 1.0/8.0
20886  * for eN in range(x.shape[0]):
20887  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20888  * for k in range(x.shape[2]):
20889  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20890  */
20891  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20892  __pyx_t_5 = __pyx_t_4;
20893  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20894  __pyx_v_ebN = __pyx_t_6;
20895 
20896  /* "subsurfaceTransportFunctions.pyx":933
20897  * for eN in range(x.shape[0]):
20898  * for ebN in range(x.shape[1]):
20899  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20900  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20901  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20902  */
20903  __pyx_t_7 = (__pyx_v_x->dimensions[2]);
20904  __pyx_t_8 = __pyx_t_7;
20905  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
20906  __pyx_v_k = __pyx_t_9;
20907 
20908  /* "subsurfaceTransportFunctions.pyx":934
20909  * for ebN in range(x.shape[1]):
20910  * for k in range(x.shape[2]):
20911  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
20912  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20913  *
20914  */
20915  __pyx_t_10 = __pyx_v_eN;
20916  __pyx_t_11 = __pyx_v_ebN;
20917  __pyx_t_12 = __pyx_v_k;
20918  __pyx_t_13 = 1;
20919  __pyx_t_14 = -1;
20920  if (__pyx_t_10 < 0) {
20921  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
20922  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 0;
20923  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20924  if (__pyx_t_11 < 0) {
20925  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[1].shape;
20926  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 1;
20927  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20928  if (__pyx_t_12 < 0) {
20929  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
20930  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 2;
20931  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20932  if (__pyx_t_13 < 0) {
20933  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[3].shape;
20934  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 3;
20935  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20936  if (unlikely(__pyx_t_14 != -1)) {
20937  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20938  __PYX_ERR(0, 934, __pyx_L1_error)
20939  }
20940  __pyx_t_15 = __pyx_v_eN;
20941  __pyx_t_16 = __pyx_v_ebN;
20942  __pyx_t_17 = __pyx_v_k;
20943  __pyx_t_18 = 0;
20944  __pyx_t_14 = -1;
20945  if (__pyx_t_15 < 0) {
20946  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
20947  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0;
20948  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20949  if (__pyx_t_16 < 0) {
20950  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
20951  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
20952  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20953  if (__pyx_t_17 < 0) {
20954  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
20955  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 2;
20956  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20957  if (__pyx_t_18 < 0) {
20958  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[3].shape;
20959  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 3;
20960  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20961  if (unlikely(__pyx_t_14 != -1)) {
20962  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20963  __PYX_ERR(0, 934, __pyx_L1_error)
20964  }
20965  __pyx_t_19 = __pyx_v_eN;
20966  __pyx_t_20 = __pyx_v_ebN;
20967  __pyx_t_21 = __pyx_v_k;
20968  __pyx_t_22 = 0;
20969  __pyx_t_14 = -1;
20970  if (__pyx_t_19 < 0) {
20971  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[0].shape;
20972  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 0;
20973  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20974  if (__pyx_t_20 < 0) {
20975  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[1].shape;
20976  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 1;
20977  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20978  if (__pyx_t_21 < 0) {
20979  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[2].shape;
20980  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
20981  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20982  if (__pyx_t_22 < 0) {
20983  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[3].shape;
20984  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 3;
20985  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20986  if (unlikely(__pyx_t_14 != -1)) {
20987  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20988  __PYX_ERR(0, 934, __pyx_L1_error)
20989  }
20990  __pyx_t_23 = __pyx_v_eN;
20991  __pyx_t_24 = __pyx_v_ebN;
20992  __pyx_t_25 = __pyx_v_k;
20993  __pyx_t_26 = 0;
20994  __pyx_t_14 = -1;
20995  if (__pyx_t_23 < 0) {
20996  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[0].shape;
20997  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
20998  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
20999  if (__pyx_t_24 < 0) {
21000  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[1].shape;
21001  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
21002  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21003  if (__pyx_t_25 < 0) {
21004  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[2].shape;
21005  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
21006  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21007  if (__pyx_t_26 < 0) {
21008  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[3].shape;
21009  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 3;
21010  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21011  if (unlikely(__pyx_t_14 != -1)) {
21012  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21013  __PYX_ERR(0, 934, __pyx_L1_error)
21014  }
21015  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[3].strides)))));
21016 
21017  /* "subsurfaceTransportFunctions.pyx":935
21018  * for k in range(x.shape[2]):
21019  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
21020  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
21021  *
21022  *
21023  */
21024  __pyx_t_22 = __pyx_v_eN;
21025  __pyx_t_21 = __pyx_v_ebN;
21026  __pyx_t_20 = __pyx_v_k;
21027  __pyx_t_19 = 0;
21028  __pyx_t_14 = -1;
21029  if (__pyx_t_22 < 0) {
21030  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[0].shape;
21031  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 0;
21032  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21033  if (__pyx_t_21 < 0) {
21034  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
21035  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 1;
21036  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21037  if (__pyx_t_20 < 0) {
21038  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[2].shape;
21039  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 2;
21040  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21041  if (__pyx_t_19 < 0) {
21042  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[3].shape;
21043  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 3;
21044  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21045  if (unlikely(__pyx_t_14 != -1)) {
21046  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21047  __PYX_ERR(0, 935, __pyx_L1_error)
21048  }
21049  __pyx_t_18 = __pyx_v_eN;
21050  __pyx_t_17 = __pyx_v_ebN;
21051  __pyx_t_16 = __pyx_v_k;
21052  __pyx_t_15 = 1;
21053  __pyx_t_14 = -1;
21054  if (__pyx_t_18 < 0) {
21055  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[0].shape;
21056  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 0;
21057  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21058  if (__pyx_t_17 < 0) {
21059  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[1].shape;
21060  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 1;
21061  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21062  if (__pyx_t_16 < 0) {
21063  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
21064  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 2;
21065  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21066  if (__pyx_t_15 < 0) {
21067  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[3].shape;
21068  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 3;
21069  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21070  if (unlikely(__pyx_t_14 != -1)) {
21071  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21072  __PYX_ERR(0, 935, __pyx_L1_error)
21073  }
21074  __pyx_t_13 = __pyx_v_eN;
21075  __pyx_t_12 = __pyx_v_ebN;
21076  __pyx_t_11 = __pyx_v_k;
21077  __pyx_t_10 = 1;
21078  __pyx_t_14 = -1;
21079  if (__pyx_t_13 < 0) {
21080  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
21081  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
21082  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
21083  if (__pyx_t_12 < 0) {
21084  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
21085  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 1;
21086  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21087  if (__pyx_t_11 < 0) {
21088  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
21089  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 2;
21090  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21091  if (__pyx_t_10 < 0) {
21092  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[3].shape;
21093  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 3;
21094  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21095  if (unlikely(__pyx_t_14 != -1)) {
21096  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21097  __PYX_ERR(0, 935, __pyx_L1_error)
21098  }
21099  __pyx_t_26 = __pyx_v_eN;
21100  __pyx_t_25 = __pyx_v_ebN;
21101  __pyx_t_24 = __pyx_v_k;
21102  __pyx_t_23 = 1;
21103  __pyx_t_14 = -1;
21104  if (__pyx_t_26 < 0) {
21105  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[0].shape;
21106  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 0;
21107  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21108  if (__pyx_t_25 < 0) {
21109  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
21110  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 1;
21111  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21112  if (__pyx_t_24 < 0) {
21113  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[2].shape;
21114  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 2;
21115  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21116  if (__pyx_t_23 < 0) {
21117  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[3].shape;
21118  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 3;
21119  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21120  if (unlikely(__pyx_t_14 != -1)) {
21121  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21122  __PYX_ERR(0, 935, __pyx_L1_error)
21123  }
21124  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[3].strides)))));
21125  }
21126  }
21127  }
21128 
21129  /* "subsurfaceTransportFunctions.pyx":924
21130  *
21131  *
21132  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
21133  * numpy.ndarray[DTYPE_t,ndim=4] x,
21134  * numpy.ndarray[DTYPE_t,ndim=4] v):
21135  */
21136 
21137  /* function exit code */
21138  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21139  goto __pyx_L0;
21140  __pyx_L1_error:;
21141  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21142  __Pyx_PyThreadState_declare
21143  __Pyx_PyThreadState_assign
21144  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21145  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21146  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21147  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21148  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21149  __pyx_r = NULL;
21150  goto __pyx_L2;
21151  __pyx_L0:;
21152  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21153  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21154  __pyx_L2:;
21155  __Pyx_XGIVEREF(__pyx_r);
21156  __Pyx_RefNannyFinishContext();
21157  return __pyx_r;
21158 }
21159 
21160 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
21161  * ctypedef npy_cdouble complex_t
21162  *
21163  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21164  * return PyArray_MultiIterNew(1, <void*>a)
21165  *
21166  */
21167 
21168 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
21169  PyObject *__pyx_r = NULL;
21170  __Pyx_RefNannyDeclarations
21171  PyObject *__pyx_t_1 = NULL;
21172  int __pyx_lineno = 0;
21173  const char *__pyx_filename = NULL;
21174  int __pyx_clineno = 0;
21175  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
21176 
21177  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":736
21178  *
21179  * cdef inline object PyArray_MultiIterNew1(a):
21180  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
21181  *
21182  * cdef inline object PyArray_MultiIterNew2(a, b):
21183  */
21184  __Pyx_XDECREF(__pyx_r);
21185  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
21186  __Pyx_GOTREF(__pyx_t_1);
21187  __pyx_r = __pyx_t_1;
21188  __pyx_t_1 = 0;
21189  goto __pyx_L0;
21190 
21191  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
21192  * ctypedef npy_cdouble complex_t
21193  *
21194  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21195  * return PyArray_MultiIterNew(1, <void*>a)
21196  *
21197  */
21198 
21199  /* function exit code */
21200  __pyx_L1_error:;
21201  __Pyx_XDECREF(__pyx_t_1);
21202  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
21203  __pyx_r = 0;
21204  __pyx_L0:;
21205  __Pyx_XGIVEREF(__pyx_r);
21206  __Pyx_RefNannyFinishContext();
21207  return __pyx_r;
21208 }
21209 
21210 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
21211  * return PyArray_MultiIterNew(1, <void*>a)
21212  *
21213  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21214  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21215  *
21216  */
21217 
21218 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
21219  PyObject *__pyx_r = NULL;
21220  __Pyx_RefNannyDeclarations
21221  PyObject *__pyx_t_1 = NULL;
21222  int __pyx_lineno = 0;
21223  const char *__pyx_filename = NULL;
21224  int __pyx_clineno = 0;
21225  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
21226 
21227  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":739
21228  *
21229  * cdef inline object PyArray_MultiIterNew2(a, b):
21230  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
21231  *
21232  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21233  */
21234  __Pyx_XDECREF(__pyx_r);
21235  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
21236  __Pyx_GOTREF(__pyx_t_1);
21237  __pyx_r = __pyx_t_1;
21238  __pyx_t_1 = 0;
21239  goto __pyx_L0;
21240 
21241  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
21242  * return PyArray_MultiIterNew(1, <void*>a)
21243  *
21244  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21245  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21246  *
21247  */
21248 
21249  /* function exit code */
21250  __pyx_L1_error:;
21251  __Pyx_XDECREF(__pyx_t_1);
21252  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
21253  __pyx_r = 0;
21254  __pyx_L0:;
21255  __Pyx_XGIVEREF(__pyx_r);
21256  __Pyx_RefNannyFinishContext();
21257  return __pyx_r;
21258 }
21259 
21260 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
21261  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21262  *
21263  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21264  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21265  *
21266  */
21267 
21268 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
21269  PyObject *__pyx_r = NULL;
21270  __Pyx_RefNannyDeclarations
21271  PyObject *__pyx_t_1 = NULL;
21272  int __pyx_lineno = 0;
21273  const char *__pyx_filename = NULL;
21274  int __pyx_clineno = 0;
21275  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
21276 
21277  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":742
21278  *
21279  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21280  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
21281  *
21282  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21283  */
21284  __Pyx_XDECREF(__pyx_r);
21285  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
21286  __Pyx_GOTREF(__pyx_t_1);
21287  __pyx_r = __pyx_t_1;
21288  __pyx_t_1 = 0;
21289  goto __pyx_L0;
21290 
21291  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
21292  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21293  *
21294  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21295  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21296  *
21297  */
21298 
21299  /* function exit code */
21300  __pyx_L1_error:;
21301  __Pyx_XDECREF(__pyx_t_1);
21302  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
21303  __pyx_r = 0;
21304  __pyx_L0:;
21305  __Pyx_XGIVEREF(__pyx_r);
21306  __Pyx_RefNannyFinishContext();
21307  return __pyx_r;
21308 }
21309 
21310 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
21311  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21312  *
21313  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21314  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21315  *
21316  */
21317 
21318 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
21319  PyObject *__pyx_r = NULL;
21320  __Pyx_RefNannyDeclarations
21321  PyObject *__pyx_t_1 = NULL;
21322  int __pyx_lineno = 0;
21323  const char *__pyx_filename = NULL;
21324  int __pyx_clineno = 0;
21325  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
21326 
21327  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":745
21328  *
21329  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21330  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
21331  *
21332  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21333  */
21334  __Pyx_XDECREF(__pyx_r);
21335  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
21336  __Pyx_GOTREF(__pyx_t_1);
21337  __pyx_r = __pyx_t_1;
21338  __pyx_t_1 = 0;
21339  goto __pyx_L0;
21340 
21341  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
21342  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21343  *
21344  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21345  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21346  *
21347  */
21348 
21349  /* function exit code */
21350  __pyx_L1_error:;
21351  __Pyx_XDECREF(__pyx_t_1);
21352  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21353  __pyx_r = 0;
21354  __pyx_L0:;
21355  __Pyx_XGIVEREF(__pyx_r);
21356  __Pyx_RefNannyFinishContext();
21357  return __pyx_r;
21358 }
21359 
21360 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
21361  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21362  *
21363  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21364  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21365  *
21366  */
21367 
21368 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
21369  PyObject *__pyx_r = NULL;
21370  __Pyx_RefNannyDeclarations
21371  PyObject *__pyx_t_1 = NULL;
21372  int __pyx_lineno = 0;
21373  const char *__pyx_filename = NULL;
21374  int __pyx_clineno = 0;
21375  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
21376 
21377  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":748
21378  *
21379  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21380  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
21381  *
21382  * cdef inline tuple PyDataType_SHAPE(dtype d):
21383  */
21384  __Pyx_XDECREF(__pyx_r);
21385  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
21386  __Pyx_GOTREF(__pyx_t_1);
21387  __pyx_r = __pyx_t_1;
21388  __pyx_t_1 = 0;
21389  goto __pyx_L0;
21390 
21391  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
21392  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21393  *
21394  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21395  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21396  *
21397  */
21398 
21399  /* function exit code */
21400  __pyx_L1_error:;
21401  __Pyx_XDECREF(__pyx_t_1);
21402  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
21403  __pyx_r = 0;
21404  __pyx_L0:;
21405  __Pyx_XGIVEREF(__pyx_r);
21406  __Pyx_RefNannyFinishContext();
21407  return __pyx_r;
21408 }
21409 
21410 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
21411  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21412  *
21413  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
21414  * if PyDataType_HASSUBARRAY(d):
21415  * return <tuple>d.subarray.shape
21416  */
21417 
21418 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
21419  PyObject *__pyx_r = NULL;
21420  __Pyx_RefNannyDeclarations
21421  int __pyx_t_1;
21422  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
21423 
21424  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
21425  *
21426  * cdef inline tuple PyDataType_SHAPE(dtype d):
21427  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
21428  * return <tuple>d.subarray.shape
21429  * else:
21430  */
21431  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
21432  if (__pyx_t_1) {
21433 
21434  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":752
21435  * cdef inline tuple PyDataType_SHAPE(dtype d):
21436  * if PyDataType_HASSUBARRAY(d):
21437  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
21438  * else:
21439  * return ()
21440  */
21441  __Pyx_XDECREF(__pyx_r);
21442  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
21443  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
21444  goto __pyx_L0;
21445 
21446  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
21447  *
21448  * cdef inline tuple PyDataType_SHAPE(dtype d):
21449  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
21450  * return <tuple>d.subarray.shape
21451  * else:
21452  */
21453  }
21454 
21455  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":754
21456  * return <tuple>d.subarray.shape
21457  * else:
21458  * return () # <<<<<<<<<<<<<<
21459  *
21460  *
21461  */
21462  /*else*/ {
21463  __Pyx_XDECREF(__pyx_r);
21464  __Pyx_INCREF(__pyx_empty_tuple);
21465  __pyx_r = __pyx_empty_tuple;
21466  goto __pyx_L0;
21467  }
21468 
21469  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
21470  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21471  *
21472  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
21473  * if PyDataType_HASSUBARRAY(d):
21474  * return <tuple>d.subarray.shape
21475  */
21476 
21477  /* function exit code */
21478  __pyx_L0:;
21479  __Pyx_XGIVEREF(__pyx_r);
21480  __Pyx_RefNannyFinishContext();
21481  return __pyx_r;
21482 }
21483 
21484 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
21485  * int _import_umath() except -1
21486  *
21487  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
21488  * Py_INCREF(base) # important to do this before stealing the reference below!
21489  * PyArray_SetBaseObject(arr, base)
21490  */
21491 
21492 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
21493  __Pyx_RefNannyDeclarations
21494  __Pyx_RefNannySetupContext("set_array_base", 0);
21495 
21496  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":930
21497  *
21498  * cdef inline void set_array_base(ndarray arr, object base):
21499  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
21500  * PyArray_SetBaseObject(arr, base)
21501  *
21502  */
21503  Py_INCREF(__pyx_v_base);
21504 
21505  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":931
21506  * cdef inline void set_array_base(ndarray arr, object base):
21507  * Py_INCREF(base) # important to do this before stealing the reference below!
21508  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
21509  *
21510  * cdef inline object get_array_base(ndarray arr):
21511  */
21512  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
21513 
21514  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
21515  * int _import_umath() except -1
21516  *
21517  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
21518  * Py_INCREF(base) # important to do this before stealing the reference below!
21519  * PyArray_SetBaseObject(arr, base)
21520  */
21521 
21522  /* function exit code */
21523  __Pyx_RefNannyFinishContext();
21524 }
21525 
21526 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
21527  * PyArray_SetBaseObject(arr, base)
21528  *
21529  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
21530  * base = PyArray_BASE(arr)
21531  * if base is NULL:
21532  */
21533 
21534 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
21535  PyObject *__pyx_v_base;
21536  PyObject *__pyx_r = NULL;
21537  __Pyx_RefNannyDeclarations
21538  int __pyx_t_1;
21539  __Pyx_RefNannySetupContext("get_array_base", 0);
21540 
21541  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":934
21542  *
21543  * cdef inline object get_array_base(ndarray arr):
21544  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
21545  * if base is NULL:
21546  * return None
21547  */
21548  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
21549 
21550  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
21551  * cdef inline object get_array_base(ndarray arr):
21552  * base = PyArray_BASE(arr)
21553  * if base is NULL: # <<<<<<<<<<<<<<
21554  * return None
21555  * return <object>base
21556  */
21557  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
21558  if (__pyx_t_1) {
21559 
21560  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":936
21561  * base = PyArray_BASE(arr)
21562  * if base is NULL:
21563  * return None # <<<<<<<<<<<<<<
21564  * return <object>base
21565  *
21566  */
21567  __Pyx_XDECREF(__pyx_r);
21568  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21569  goto __pyx_L0;
21570 
21571  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
21572  * cdef inline object get_array_base(ndarray arr):
21573  * base = PyArray_BASE(arr)
21574  * if base is NULL: # <<<<<<<<<<<<<<
21575  * return None
21576  * return <object>base
21577  */
21578  }
21579 
21580  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":937
21581  * if base is NULL:
21582  * return None
21583  * return <object>base # <<<<<<<<<<<<<<
21584  *
21585  * # Versions of the import_* functions which are more suitable for
21586  */
21587  __Pyx_XDECREF(__pyx_r);
21588  __Pyx_INCREF(((PyObject *)__pyx_v_base));
21589  __pyx_r = ((PyObject *)__pyx_v_base);
21590  goto __pyx_L0;
21591 
21592  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
21593  * PyArray_SetBaseObject(arr, base)
21594  *
21595  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
21596  * base = PyArray_BASE(arr)
21597  * if base is NULL:
21598  */
21599 
21600  /* function exit code */
21601  __pyx_L0:;
21602  __Pyx_XGIVEREF(__pyx_r);
21603  __Pyx_RefNannyFinishContext();
21604  return __pyx_r;
21605 }
21606 
21607 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
21608  * # Versions of the import_* functions which are more suitable for
21609  * # Cython code.
21610  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
21611  * try:
21612  * __pyx_import_array()
21613  */
21614 
21615 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
21616  int __pyx_r;
21617  __Pyx_RefNannyDeclarations
21618  PyObject *__pyx_t_1 = NULL;
21619  PyObject *__pyx_t_2 = NULL;
21620  PyObject *__pyx_t_3 = NULL;
21621  int __pyx_t_4;
21622  PyObject *__pyx_t_5 = NULL;
21623  PyObject *__pyx_t_6 = NULL;
21624  PyObject *__pyx_t_7 = NULL;
21625  PyObject *__pyx_t_8 = NULL;
21626  int __pyx_lineno = 0;
21627  const char *__pyx_filename = NULL;
21628  int __pyx_clineno = 0;
21629  __Pyx_RefNannySetupContext("import_array", 0);
21630 
21631  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
21632  * # Cython code.
21633  * cdef inline int import_array() except -1:
21634  * try: # <<<<<<<<<<<<<<
21635  * __pyx_import_array()
21636  * except Exception:
21637  */
21638  {
21639  __Pyx_PyThreadState_declare
21640  __Pyx_PyThreadState_assign
21641  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
21642  __Pyx_XGOTREF(__pyx_t_1);
21643  __Pyx_XGOTREF(__pyx_t_2);
21644  __Pyx_XGOTREF(__pyx_t_3);
21645  /*try:*/ {
21646 
21647  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":943
21648  * cdef inline int import_array() except -1:
21649  * try:
21650  * __pyx_import_array() # <<<<<<<<<<<<<<
21651  * except Exception:
21652  * raise ImportError("numpy.core.multiarray failed to import")
21653  */
21654  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
21655 
21656  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
21657  * # Cython code.
21658  * cdef inline int import_array() except -1:
21659  * try: # <<<<<<<<<<<<<<
21660  * __pyx_import_array()
21661  * except Exception:
21662  */
21663  }
21664  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21665  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21666  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21667  goto __pyx_L8_try_end;
21668  __pyx_L3_error:;
21669 
21670  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":944
21671  * try:
21672  * __pyx_import_array()
21673  * except Exception: # <<<<<<<<<<<<<<
21674  * raise ImportError("numpy.core.multiarray failed to import")
21675  *
21676  */
21677  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
21678  if (__pyx_t_4) {
21679  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
21680  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
21681  __Pyx_GOTREF(__pyx_t_5);
21682  __Pyx_GOTREF(__pyx_t_6);
21683  __Pyx_GOTREF(__pyx_t_7);
21684 
21685  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
21686  * __pyx_import_array()
21687  * except Exception:
21688  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
21689  *
21690  * cdef inline int import_umath() except -1:
21691  */
21692  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
21693  __Pyx_GOTREF(__pyx_t_8);
21694  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
21695  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21696  __PYX_ERR(1, 945, __pyx_L5_except_error)
21697  }
21698  goto __pyx_L5_except_error;
21699  __pyx_L5_except_error:;
21700 
21701  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
21702  * # Cython code.
21703  * cdef inline int import_array() except -1:
21704  * try: # <<<<<<<<<<<<<<
21705  * __pyx_import_array()
21706  * except Exception:
21707  */
21708  __Pyx_XGIVEREF(__pyx_t_1);
21709  __Pyx_XGIVEREF(__pyx_t_2);
21710  __Pyx_XGIVEREF(__pyx_t_3);
21711  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
21712  goto __pyx_L1_error;
21713  __pyx_L8_try_end:;
21714  }
21715 
21716  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
21717  * # Versions of the import_* functions which are more suitable for
21718  * # Cython code.
21719  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
21720  * try:
21721  * __pyx_import_array()
21722  */
21723 
21724  /* function exit code */
21725  __pyx_r = 0;
21726  goto __pyx_L0;
21727  __pyx_L1_error:;
21728  __Pyx_XDECREF(__pyx_t_5);
21729  __Pyx_XDECREF(__pyx_t_6);
21730  __Pyx_XDECREF(__pyx_t_7);
21731  __Pyx_XDECREF(__pyx_t_8);
21732  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
21733  __pyx_r = -1;
21734  __pyx_L0:;
21735  __Pyx_RefNannyFinishContext();
21736  return __pyx_r;
21737 }
21738 
21739 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
21740  * raise ImportError("numpy.core.multiarray failed to import")
21741  *
21742  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
21743  * try:
21744  * _import_umath()
21745  */
21746 
21747 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
21748  int __pyx_r;
21749  __Pyx_RefNannyDeclarations
21750  PyObject *__pyx_t_1 = NULL;
21751  PyObject *__pyx_t_2 = NULL;
21752  PyObject *__pyx_t_3 = NULL;
21753  int __pyx_t_4;
21754  PyObject *__pyx_t_5 = NULL;
21755  PyObject *__pyx_t_6 = NULL;
21756  PyObject *__pyx_t_7 = NULL;
21757  PyObject *__pyx_t_8 = NULL;
21758  int __pyx_lineno = 0;
21759  const char *__pyx_filename = NULL;
21760  int __pyx_clineno = 0;
21761  __Pyx_RefNannySetupContext("import_umath", 0);
21762 
21763  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
21764  *
21765  * cdef inline int import_umath() except -1:
21766  * try: # <<<<<<<<<<<<<<
21767  * _import_umath()
21768  * except Exception:
21769  */
21770  {
21771  __Pyx_PyThreadState_declare
21772  __Pyx_PyThreadState_assign
21773  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
21774  __Pyx_XGOTREF(__pyx_t_1);
21775  __Pyx_XGOTREF(__pyx_t_2);
21776  __Pyx_XGOTREF(__pyx_t_3);
21777  /*try:*/ {
21778 
21779  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":949
21780  * cdef inline int import_umath() except -1:
21781  * try:
21782  * _import_umath() # <<<<<<<<<<<<<<
21783  * except Exception:
21784  * raise ImportError("numpy.core.umath failed to import")
21785  */
21786  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
21787 
21788  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
21789  *
21790  * cdef inline int import_umath() except -1:
21791  * try: # <<<<<<<<<<<<<<
21792  * _import_umath()
21793  * except Exception:
21794  */
21795  }
21796  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21797  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21798  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21799  goto __pyx_L8_try_end;
21800  __pyx_L3_error:;
21801 
21802  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":950
21803  * try:
21804  * _import_umath()
21805  * except Exception: # <<<<<<<<<<<<<<
21806  * raise ImportError("numpy.core.umath failed to import")
21807  *
21808  */
21809  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
21810  if (__pyx_t_4) {
21811  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
21812  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
21813  __Pyx_GOTREF(__pyx_t_5);
21814  __Pyx_GOTREF(__pyx_t_6);
21815  __Pyx_GOTREF(__pyx_t_7);
21816 
21817  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
21818  * _import_umath()
21819  * except Exception:
21820  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
21821  *
21822  * cdef inline int import_ufunc() except -1:
21823  */
21824  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
21825  __Pyx_GOTREF(__pyx_t_8);
21826  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
21827  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21828  __PYX_ERR(1, 951, __pyx_L5_except_error)
21829  }
21830  goto __pyx_L5_except_error;
21831  __pyx_L5_except_error:;
21832 
21833  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
21834  *
21835  * cdef inline int import_umath() except -1:
21836  * try: # <<<<<<<<<<<<<<
21837  * _import_umath()
21838  * except Exception:
21839  */
21840  __Pyx_XGIVEREF(__pyx_t_1);
21841  __Pyx_XGIVEREF(__pyx_t_2);
21842  __Pyx_XGIVEREF(__pyx_t_3);
21843  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
21844  goto __pyx_L1_error;
21845  __pyx_L8_try_end:;
21846  }
21847 
21848  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
21849  * raise ImportError("numpy.core.multiarray failed to import")
21850  *
21851  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
21852  * try:
21853  * _import_umath()
21854  */
21855 
21856  /* function exit code */
21857  __pyx_r = 0;
21858  goto __pyx_L0;
21859  __pyx_L1_error:;
21860  __Pyx_XDECREF(__pyx_t_5);
21861  __Pyx_XDECREF(__pyx_t_6);
21862  __Pyx_XDECREF(__pyx_t_7);
21863  __Pyx_XDECREF(__pyx_t_8);
21864  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
21865  __pyx_r = -1;
21866  __pyx_L0:;
21867  __Pyx_RefNannyFinishContext();
21868  return __pyx_r;
21869 }
21870 
21871 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
21872  * raise ImportError("numpy.core.umath failed to import")
21873  *
21874  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
21875  * try:
21876  * _import_umath()
21877  */
21878 
21879 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
21880  int __pyx_r;
21881  __Pyx_RefNannyDeclarations
21882  PyObject *__pyx_t_1 = NULL;
21883  PyObject *__pyx_t_2 = NULL;
21884  PyObject *__pyx_t_3 = NULL;
21885  int __pyx_t_4;
21886  PyObject *__pyx_t_5 = NULL;
21887  PyObject *__pyx_t_6 = NULL;
21888  PyObject *__pyx_t_7 = NULL;
21889  PyObject *__pyx_t_8 = NULL;
21890  int __pyx_lineno = 0;
21891  const char *__pyx_filename = NULL;
21892  int __pyx_clineno = 0;
21893  __Pyx_RefNannySetupContext("import_ufunc", 0);
21894 
21895  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
21896  *
21897  * cdef inline int import_ufunc() except -1:
21898  * try: # <<<<<<<<<<<<<<
21899  * _import_umath()
21900  * except Exception:
21901  */
21902  {
21903  __Pyx_PyThreadState_declare
21904  __Pyx_PyThreadState_assign
21905  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
21906  __Pyx_XGOTREF(__pyx_t_1);
21907  __Pyx_XGOTREF(__pyx_t_2);
21908  __Pyx_XGOTREF(__pyx_t_3);
21909  /*try:*/ {
21910 
21911  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":955
21912  * cdef inline int import_ufunc() except -1:
21913  * try:
21914  * _import_umath() # <<<<<<<<<<<<<<
21915  * except Exception:
21916  * raise ImportError("numpy.core.umath failed to import")
21917  */
21918  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
21919 
21920  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
21921  *
21922  * cdef inline int import_ufunc() except -1:
21923  * try: # <<<<<<<<<<<<<<
21924  * _import_umath()
21925  * except Exception:
21926  */
21927  }
21928  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21929  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21930  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
21931  goto __pyx_L8_try_end;
21932  __pyx_L3_error:;
21933 
21934  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":956
21935  * try:
21936  * _import_umath()
21937  * except Exception: # <<<<<<<<<<<<<<
21938  * raise ImportError("numpy.core.umath failed to import")
21939  *
21940  */
21941  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
21942  if (__pyx_t_4) {
21943  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
21944  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
21945  __Pyx_GOTREF(__pyx_t_5);
21946  __Pyx_GOTREF(__pyx_t_6);
21947  __Pyx_GOTREF(__pyx_t_7);
21948 
21949  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":957
21950  * _import_umath()
21951  * except Exception:
21952  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
21953  *
21954  * cdef extern from *:
21955  */
21956  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
21957  __Pyx_GOTREF(__pyx_t_8);
21958  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
21959  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21960  __PYX_ERR(1, 957, __pyx_L5_except_error)
21961  }
21962  goto __pyx_L5_except_error;
21963  __pyx_L5_except_error:;
21964 
21965  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
21966  *
21967  * cdef inline int import_ufunc() except -1:
21968  * try: # <<<<<<<<<<<<<<
21969  * _import_umath()
21970  * except Exception:
21971  */
21972  __Pyx_XGIVEREF(__pyx_t_1);
21973  __Pyx_XGIVEREF(__pyx_t_2);
21974  __Pyx_XGIVEREF(__pyx_t_3);
21975  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
21976  goto __pyx_L1_error;
21977  __pyx_L8_try_end:;
21978  }
21979 
21980  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
21981  * raise ImportError("numpy.core.umath failed to import")
21982  *
21983  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
21984  * try:
21985  * _import_umath()
21986  */
21987 
21988  /* function exit code */
21989  __pyx_r = 0;
21990  goto __pyx_L0;
21991  __pyx_L1_error:;
21992  __Pyx_XDECREF(__pyx_t_5);
21993  __Pyx_XDECREF(__pyx_t_6);
21994  __Pyx_XDECREF(__pyx_t_7);
21995  __Pyx_XDECREF(__pyx_t_8);
21996  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
21997  __pyx_r = -1;
21998  __pyx_L0:;
21999  __Pyx_RefNannyFinishContext();
22000  return __pyx_r;
22001 }
22002 
22003 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
22004  *
22005  *
22006  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
22007  * """
22008  * Cython equivalent of `isinstance(obj, np.timedelta64)`
22009  */
22010 
22011 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
22012  int __pyx_r;
22013  __Pyx_RefNannyDeclarations
22014  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
22015 
22016  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":979
22017  * bool
22018  * """
22019  * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
22020  *
22021  *
22022  */
22023  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
22024  goto __pyx_L0;
22025 
22026  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
22027  *
22028  *
22029  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
22030  * """
22031  * Cython equivalent of `isinstance(obj, np.timedelta64)`
22032  */
22033 
22034  /* function exit code */
22035  __pyx_L0:;
22036  __Pyx_RefNannyFinishContext();
22037  return __pyx_r;
22038 }
22039 
22040 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
22041  *
22042  *
22043  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
22044  * """
22045  * Cython equivalent of `isinstance(obj, np.datetime64)`
22046  */
22047 
22048 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
22049  int __pyx_r;
22050  __Pyx_RefNannyDeclarations
22051  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
22052 
22053  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":994
22054  * bool
22055  * """
22056  * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
22057  *
22058  *
22059  */
22060  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
22061  goto __pyx_L0;
22062 
22063  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
22064  *
22065  *
22066  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
22067  * """
22068  * Cython equivalent of `isinstance(obj, np.datetime64)`
22069  */
22070 
22071  /* function exit code */
22072  __pyx_L0:;
22073  __Pyx_RefNannyFinishContext();
22074  return __pyx_r;
22075 }
22076 
22077 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
22078  *
22079  *
22080  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
22081  * """
22082  * returns the int64 value underlying scalar numpy datetime64 object
22083  */
22084 
22085 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
22086  npy_datetime __pyx_r;
22087 
22088  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1004
22089  * also needed. That can be found using `get_datetime64_unit`.
22090  * """
22091  * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
22092  *
22093  *
22094  */
22095  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
22096  goto __pyx_L0;
22097 
22098  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
22099  *
22100  *
22101  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
22102  * """
22103  * returns the int64 value underlying scalar numpy datetime64 object
22104  */
22105 
22106  /* function exit code */
22107  __pyx_L0:;
22108  return __pyx_r;
22109 }
22110 
22111 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
22112  *
22113  *
22114  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
22115  * """
22116  * returns the int64 value underlying scalar numpy timedelta64 object
22117  */
22118 
22119 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
22120  npy_timedelta __pyx_r;
22121 
22122  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1011
22123  * returns the int64 value underlying scalar numpy timedelta64 object
22124  * """
22125  * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
22126  *
22127  *
22128  */
22129  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
22130  goto __pyx_L0;
22131 
22132  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
22133  *
22134  *
22135  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
22136  * """
22137  * returns the int64 value underlying scalar numpy timedelta64 object
22138  */
22139 
22140  /* function exit code */
22141  __pyx_L0:;
22142  return __pyx_r;
22143 }
22144 
22145 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
22146  *
22147  *
22148  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
22149  * """
22150  * returns the unit part of the dtype for a numpy datetime64 object.
22151  */
22152 
22153 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
22154  NPY_DATETIMEUNIT __pyx_r;
22155 
22156  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1018
22157  * returns the unit part of the dtype for a numpy datetime64 object.
22158  * """
22159  * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
22160  */
22161  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
22162  goto __pyx_L0;
22163 
22164  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
22165  *
22166  *
22167  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
22168  * """
22169  * returns the unit part of the dtype for a numpy datetime64 object.
22170  */
22171 
22172  /* function exit code */
22173  __pyx_L0:;
22174  return __pyx_r;
22175 }
22176 
22177 static PyMethodDef __pyx_methods[] = {
22178  {0, 0, 0, 0}
22179 };
22180 
22181 #if PY_MAJOR_VERSION >= 3
22182 #if CYTHON_PEP489_MULTI_PHASE_INIT
22183 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
22184 static int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject* module); /*proto*/
22185 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
22186  {Py_mod_create, (void*)__pyx_pymod_create},
22187  {Py_mod_exec, (void*)__pyx_pymod_exec_subsurfaceTransportFunctions},
22188  {0, NULL}
22189 };
22190 #endif
22191 
22192 static struct PyModuleDef __pyx_moduledef = {
22193  PyModuleDef_HEAD_INIT,
22194  "subsurfaceTransportFunctions",
22195  0, /* m_doc */
22196  #if CYTHON_PEP489_MULTI_PHASE_INIT
22197  0, /* m_size */
22198  #else
22199  -1, /* m_size */
22200  #endif
22201  __pyx_methods /* m_methods */,
22202  #if CYTHON_PEP489_MULTI_PHASE_INIT
22203  __pyx_moduledef_slots, /* m_slots */
22204  #else
22205  NULL, /* m_reload */
22206  #endif
22207  NULL, /* m_traverse */
22208  NULL, /* m_clear */
22209  NULL /* m_free */
22210 };
22211 #endif
22212 #ifndef CYTHON_SMALL_CODE
22213 #if defined(__clang__)
22214  #define CYTHON_SMALL_CODE
22215 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
22216  #define CYTHON_SMALL_CODE __attribute__((cold))
22217 #else
22218  #define CYTHON_SMALL_CODE
22219 #endif
22220 #endif
22221 
22222 static __Pyx_StringTabEntry __pyx_string_tab[] = {
22223  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
22224  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
22225  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
22226  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
22227  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
22228  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22229  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
22230  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
22231  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
22232  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
22233  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
22234  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
22235  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
22236  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
22237  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
22238  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
22239  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
22240  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
22241  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
22242  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
22243  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
22244  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
22245  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22246  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
22247  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
22248  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
22249  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
22250  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
22251  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
22252  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
22253  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
22254  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
22255  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
22256  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
22257  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
22258  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
22259  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
22260  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
22261  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
22262  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
22263  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
22264  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
22265  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
22266  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
22267  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
22268  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
22269  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
22270  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
22271  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
22272  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
22273  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
22274  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
22275  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
22276  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
22277  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
22278  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
22279  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
22280  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
22281  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
22282  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
22283  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
22284  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
22285  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
22286  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
22287  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
22288  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
22289  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
22290  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
22291  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
22292  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
22293  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
22294  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
22295  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
22296  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
22297  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
22298  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
22299  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
22300  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
22301  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
22302  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
22303  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
22304  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
22305  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
22306  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
22307  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
22308  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
22309  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
22310  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
22311  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
22312  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
22313  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
22314  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
22315  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
22316  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
22317  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
22318  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
22319  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
22320  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
22321  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
22322  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
22323  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
22324  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
22325  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
22326  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
22327  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
22328  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
22329  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22330  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
22331  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
22332  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
22333  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
22334  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
22335  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
22336  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
22337  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
22338  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
22339  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
22340  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
22341  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
22342  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
22343  {&__pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_k_proteus_subsurfaceTransportFunct, sizeof(__pyx_k_proteus_subsurfaceTransportFunct), 0, 0, 1, 0},
22344  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
22345  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
22346  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
22347  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
22348  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
22349  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
22350  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
22351  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
22352  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
22353  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
22354  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
22355  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
22356  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
22357  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
22358  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
22359  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
22360  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
22361  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
22362  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
22363  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
22364  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
22365  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
22366  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
22367  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
22368  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
22369  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
22370  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
22371  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
22372  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
22373  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
22374  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
22375  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
22376  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
22377  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
22378  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
22379  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
22380  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
22381  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
22382  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
22383  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
22384  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
22385  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
22386  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
22387  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
22388  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
22389  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
22390  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
22391  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
22392  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
22393  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
22394  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
22395  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
22396  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
22397  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
22398  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
22399  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
22400  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
22401  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
22402  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
22403  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
22404  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
22405  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
22406  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
22407  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
22408  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
22409  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
22410  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
22411  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
22412  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
22413  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
22414  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
22415  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
22416  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
22417  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
22418  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
22419  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
22420  {0, 0, 0, 0, 0, 0, 0}
22421 };
22422 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
22423  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 24, __pyx_L1_error)
22424  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
22425  return 0;
22426  __pyx_L1_error:;
22427  return -1;
22428 }
22429 
22430 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
22431  __Pyx_RefNannyDeclarations
22432  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
22433 
22434  /* "subsurfaceTransportFunctions.pyx":66
22435  * material = elementMaterialTypes[eN]
22436  * for k in range(q_vals.shape[1]):
22437  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
22438  *
22439  *
22440  */
22441  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 66, __pyx_L1_error)
22442  __Pyx_GOTREF(__pyx_slice_);
22443  __Pyx_GIVEREF(__pyx_slice_);
22444 
22445  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
22446  * __pyx_import_array()
22447  * except Exception:
22448  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
22449  *
22450  * cdef inline int import_umath() except -1:
22451  */
22452  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 945, __pyx_L1_error)
22453  __Pyx_GOTREF(__pyx_tuple__2);
22454  __Pyx_GIVEREF(__pyx_tuple__2);
22455 
22456  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
22457  * _import_umath()
22458  * except Exception:
22459  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22460  *
22461  * cdef inline int import_ufunc() except -1:
22462  */
22463  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 951, __pyx_L1_error)
22464  __Pyx_GOTREF(__pyx_tuple__3);
22465  __Pyx_GIVEREF(__pyx_tuple__3);
22466 
22467  /* "subsurfaceTransportFunctions.pyx":18
22468  * ctypedef int ITYPE_t
22469  *
22470  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
22471  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
22472  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22473  */
22474  __pyx_tuple__4 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 18, __pyx_L1_error)
22475  __Pyx_GOTREF(__pyx_tuple__4);
22476  __Pyx_GIVEREF(__pyx_tuple__4);
22477  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 18, __pyx_L1_error)
22478 
22479  /* "subsurfaceTransportFunctions.pyx":29
22480  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
22481  *
22482  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
22483  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
22484  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22485  */
22486  __pyx_tuple__6 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 29, __pyx_L1_error)
22487  __Pyx_GOTREF(__pyx_tuple__6);
22488  __Pyx_GIVEREF(__pyx_tuple__6);
22489  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 29, __pyx_L1_error)
22490 
22491  /* "subsurfaceTransportFunctions.pyx":43
22492  *
22493  * ###
22494  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22495  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
22496  * dict material_functions):
22497  */
22498  __pyx_tuple__8 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 43, __pyx_L1_error)
22499  __Pyx_GOTREF(__pyx_tuple__8);
22500  __Pyx_GIVEREF(__pyx_tuple__8);
22501  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 43, __pyx_L1_error)
22502 
22503  /* "subsurfaceTransportFunctions.pyx":56
22504  * q_vals[eN,k] = material_functions[material]
22505  *
22506  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
22507  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
22508  * dict material_functions):
22509  */
22510  __pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 56, __pyx_L1_error)
22511  __Pyx_GOTREF(__pyx_tuple__10);
22512  __Pyx_GIVEREF(__pyx_tuple__10);
22513  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 56, __pyx_L1_error)
22514 
22515  /* "subsurfaceTransportFunctions.pyx":69
22516  *
22517  *
22518  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22519  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22520  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
22521  */
22522  __pyx_tuple__12 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 69, __pyx_L1_error)
22523  __Pyx_GOTREF(__pyx_tuple__12);
22524  __Pyx_GIVEREF(__pyx_tuple__12);
22525  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 69, __pyx_L1_error)
22526 
22527  /* "subsurfaceTransportFunctions.pyx":91
22528  * material_functions[material_right])
22529  *
22530  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22531  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22532  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22533  */
22534  __pyx_tuple__14 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 91, __pyx_L1_error)
22535  __Pyx_GOTREF(__pyx_tuple__14);
22536  __Pyx_GIVEREF(__pyx_tuple__14);
22537  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 91, __pyx_L1_error)
22538 
22539  /* "subsurfaceTransportFunctions.pyx":118
22540  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22541  *
22542  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
22543  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22544  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
22545  */
22546  __pyx_tuple__16 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 118, __pyx_L1_error)
22547  __Pyx_GOTREF(__pyx_tuple__16);
22548  __Pyx_GIVEREF(__pyx_tuple__16);
22549  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 118, __pyx_L1_error)
22550 
22551  /* "subsurfaceTransportFunctions.pyx":139
22552  *
22553  *
22554  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22555  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22556  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22557  */
22558  __pyx_tuple__18 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 139, __pyx_L1_error)
22559  __Pyx_GOTREF(__pyx_tuple__18);
22560  __Pyx_GIVEREF(__pyx_tuple__18);
22561  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 139, __pyx_L1_error)
22562 
22563  /* "subsurfaceTransportFunctions.pyx":165
22564  *
22565  * ###
22566  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22567  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22568  * numpy.ndarray[DTYPE_t,ndim=3] x,
22569  */
22570  __pyx_tuple__20 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 165, __pyx_L1_error)
22571  __Pyx_GOTREF(__pyx_tuple__20);
22572  __Pyx_GIVEREF(__pyx_tuple__20);
22573  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 165, __pyx_L1_error)
22574 
22575  /* "subsurfaceTransportFunctions.pyx":180
22576  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
22577  *
22578  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
22579  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
22580  * numpy.ndarray[DTYPE_t,ndim=3] x,
22581  */
22582  __pyx_tuple__22 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 180, __pyx_L1_error)
22583  __Pyx_GOTREF(__pyx_tuple__22);
22584  __Pyx_GIVEREF(__pyx_tuple__22);
22585  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 180, __pyx_L1_error)
22586 
22587  /* "subsurfaceTransportFunctions.pyx":195
22588  *
22589  *
22590  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22591  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22592  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22593  */
22594  __pyx_tuple__24 = PyTuple_Pack(12, __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, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 195, __pyx_L1_error)
22595  __Pyx_GOTREF(__pyx_tuple__24);
22596  __Pyx_GIVEREF(__pyx_tuple__24);
22597  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 195, __pyx_L1_error)
22598 
22599  /* "subsurfaceTransportFunctions.pyx":219
22600  * material_functions[material_right](x[eN,ebN_local,k],t))
22601  *
22602  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22603  * double t,
22604  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22605  */
22606  __pyx_tuple__26 = PyTuple_Pack(17, __pyx_n_s_nd, __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, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 219, __pyx_L1_error)
22607  __Pyx_GOTREF(__pyx_tuple__26);
22608  __Pyx_GIVEREF(__pyx_tuple__26);
22609  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 219, __pyx_L1_error)
22610 
22611  /* "subsurfaceTransportFunctions.pyx":248
22612  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
22613  *
22614  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
22615  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22616  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
22617  */
22618  __pyx_tuple__28 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 248, __pyx_L1_error)
22619  __Pyx_GOTREF(__pyx_tuple__28);
22620  __Pyx_GIVEREF(__pyx_tuple__28);
22621  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 248, __pyx_L1_error)
22622 
22623  /* "subsurfaceTransportFunctions.pyx":271
22624  *
22625  *
22626  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
22627  * double t,
22628  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
22629  */
22630  __pyx_tuple__30 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 271, __pyx_L1_error)
22631  __Pyx_GOTREF(__pyx_tuple__30);
22632  __Pyx_GIVEREF(__pyx_tuple__30);
22633  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 271, __pyx_L1_error)
22634 
22635  /* "subsurfaceTransportFunctions.pyx":301
22636  *
22637  * ##################################################
22638  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
22639  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22640  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22641  */
22642  __pyx_tuple__32 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 301, __pyx_L1_error)
22643  __Pyx_GOTREF(__pyx_tuple__32);
22644  __Pyx_GIVEREF(__pyx_tuple__32);
22645  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 301, __pyx_L1_error)
22646 
22647  /* "subsurfaceTransportFunctions.pyx":359
22648  *
22649  *
22650  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
22651  * double beta,
22652  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
22653  */
22654  __pyx_tuple__34 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 359, __pyx_L1_error)
22655  __Pyx_GOTREF(__pyx_tuple__34);
22656  __Pyx_GIVEREF(__pyx_tuple__34);
22657  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 359, __pyx_L1_error)
22658 
22659  /* "subsurfaceTransportFunctions.pyx":486
22660  * #eN for upwind
22661  *
22662  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
22663  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22664  * numpy.ndarray[ITYPE_t,ndim=1] colind,
22665  */
22666  __pyx_tuple__36 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 486, __pyx_L1_error)
22667  __Pyx_GOTREF(__pyx_tuple__36);
22668  __Pyx_GIVEREF(__pyx_tuple__36);
22669  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 486, __pyx_L1_error)
22670 
22671  /* "subsurfaceTransportFunctions.pyx":574
22672  * #i
22673  * #eN
22674  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
22675  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
22676  * numpy.ndarray[ITYPE_t,ndim=1] colind,
22677  */
22678  __pyx_tuple__38 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 574, __pyx_L1_error)
22679  __Pyx_GOTREF(__pyx_tuple__38);
22680  __Pyx_GIVEREF(__pyx_tuple__38);
22681  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 574, __pyx_L1_error)
22682 
22683  /* "subsurfaceTransportFunctions.pyx":673
22684  * ##################################################
22685  *
22686  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
22687  * numpy.ndarray[DTYPE_t,ndim=3] w,
22688  * numpy.ndarray[DTYPE_t,ndim=2] dV,
22689  */
22690  __pyx_tuple__40 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 673, __pyx_L1_error)
22691  __Pyx_GOTREF(__pyx_tuple__40);
22692  __Pyx_GIVEREF(__pyx_tuple__40);
22693  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 673, __pyx_L1_error)
22694 
22695  /* "subsurfaceTransportFunctions.pyx":692
22696  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
22697  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
22698  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
22699  * numpy.ndarray[DTYPE_t,ndim=3] w,
22700  * numpy.ndarray[DTYPE_t,ndim=3] v,
22701  */
22702  __pyx_tuple__42 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 692, __pyx_L1_error)
22703  __Pyx_GOTREF(__pyx_tuple__42);
22704  __Pyx_GIVEREF(__pyx_tuple__42);
22705  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 692, __pyx_L1_error)
22706 
22707  /* "subsurfaceTransportFunctions.pyx":717
22708  * #ELLAM
22709  * ########################################################################
22710  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
22711  * numpy.ndarray[DTYPE_t,ndim=4] n,
22712  * numpy.ndarray[DTYPE_t,ndim=3] dS,
22713  */
22714  __pyx_tuple__44 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 717, __pyx_L1_error)
22715  __Pyx_GOTREF(__pyx_tuple__44);
22716  __Pyx_GIVEREF(__pyx_tuple__44);
22717  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 717, __pyx_L1_error)
22718 
22719  /* "subsurfaceTransportFunctions.pyx":732
22720  * flux[eN,ebN] = integral
22721  *
22722  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
22723  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
22724  * numpy.ndarray[DTYPE_t,ndim=2] dm,
22725  */
22726  __pyx_tuple__46 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 732, __pyx_L1_error)
22727  __Pyx_GOTREF(__pyx_tuple__46);
22728  __Pyx_GIVEREF(__pyx_tuple__46);
22729  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 732, __pyx_L1_error)
22730 
22731  /* "subsurfaceTransportFunctions.pyx":753
22732  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
22733  *
22734  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
22735  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
22736  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
22737  */
22738  __pyx_tuple__48 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 753, __pyx_L1_error)
22739  __Pyx_GOTREF(__pyx_tuple__48);
22740  __Pyx_GIVEREF(__pyx_tuple__48);
22741  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 753, __pyx_L1_error)
22742 
22743  /* "subsurfaceTransportFunctions.pyx":776
22744  *
22745  * #problem specific velocity evaluation
22746  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
22747  * double t,
22748  * double tForReversal,
22749  */
22750  __pyx_tuple__50 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 776, __pyx_L1_error)
22751  __Pyx_GOTREF(__pyx_tuple__50);
22752  __Pyx_GIVEREF(__pyx_tuple__50);
22753  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 776, __pyx_L1_error)
22754 
22755  /* "subsurfaceTransportFunctions.pyx":816
22756  *
22757  *
22758  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
22759  * double t,
22760  * double tForReversal,
22761  */
22762  __pyx_tuple__52 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 816, __pyx_L1_error)
22763  __Pyx_GOTREF(__pyx_tuple__52);
22764  __Pyx_GIVEREF(__pyx_tuple__52);
22765  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 816, __pyx_L1_error)
22766 
22767  /* "subsurfaceTransportFunctions.pyx":859
22768  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
22769  *
22770  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
22771  * double t,
22772  * double tForReversal,
22773  */
22774  __pyx_tuple__54 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 859, __pyx_L1_error)
22775  __Pyx_GOTREF(__pyx_tuple__54);
22776  __Pyx_GIVEREF(__pyx_tuple__54);
22777  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 859, __pyx_L1_error)
22778 
22779  /* "subsurfaceTransportFunctions.pyx":884
22780  * v[eN,k,2]=zVelocity
22781  *
22782  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
22783  * double t,
22784  * double tForReversal,
22785  */
22786  __pyx_tuple__56 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 884, __pyx_L1_error)
22787  __Pyx_GOTREF(__pyx_tuple__56);
22788  __Pyx_GIVEREF(__pyx_tuple__56);
22789  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 884, __pyx_L1_error)
22790 
22791  /* "subsurfaceTransportFunctions.pyx":911
22792  * v[eN,ebN,k,2]=zVelocity
22793  *
22794  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
22795  * numpy.ndarray[DTYPE_t,ndim=3] x,
22796  * numpy.ndarray[DTYPE_t,ndim=3] v):
22797  */
22798  __pyx_tuple__58 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 911, __pyx_L1_error)
22799  __Pyx_GOTREF(__pyx_tuple__58);
22800  __Pyx_GIVEREF(__pyx_tuple__58);
22801  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 911, __pyx_L1_error)
22802 
22803  /* "subsurfaceTransportFunctions.pyx":924
22804  *
22805  *
22806  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
22807  * numpy.ndarray[DTYPE_t,ndim=4] x,
22808  * numpy.ndarray[DTYPE_t,ndim=4] v):
22809  */
22810  __pyx_tuple__60 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 924, __pyx_L1_error)
22811  __Pyx_GOTREF(__pyx_tuple__60);
22812  __Pyx_GIVEREF(__pyx_tuple__60);
22813  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 924, __pyx_L1_error)
22814  __Pyx_RefNannyFinishContext();
22815  return 0;
22816  __pyx_L1_error:;
22817  __Pyx_RefNannyFinishContext();
22818  return -1;
22819 }
22820 
22821 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
22822  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22823  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22824  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
22825  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22826  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) __PYX_ERR(0, 1, __pyx_L1_error)
22827  return 0;
22828  __pyx_L1_error:;
22829  return -1;
22830 }
22831 
22832 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
22833 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
22834 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
22835 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
22836 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
22837 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
22838 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
22839 
22840 static int __Pyx_modinit_global_init_code(void) {
22841  __Pyx_RefNannyDeclarations
22842  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
22843  /*--- Global init code ---*/
22844  __Pyx_RefNannyFinishContext();
22845  return 0;
22846 }
22847 
22848 static int __Pyx_modinit_variable_export_code(void) {
22849  __Pyx_RefNannyDeclarations
22850  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
22851  /*--- Variable export code ---*/
22852  __Pyx_RefNannyFinishContext();
22853  return 0;
22854 }
22855 
22856 static int __Pyx_modinit_function_export_code(void) {
22857  __Pyx_RefNannyDeclarations
22858  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
22859  /*--- Function export code ---*/
22860  __Pyx_RefNannyFinishContext();
22861  return 0;
22862 }
22863 
22864 static int __Pyx_modinit_type_init_code(void) {
22865  __Pyx_RefNannyDeclarations
22866  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
22867  /*--- Type init code ---*/
22868  __Pyx_RefNannyFinishContext();
22869  return 0;
22870 }
22871 
22872 static int __Pyx_modinit_type_import_code(void) {
22873  __Pyx_RefNannyDeclarations
22874  PyObject *__pyx_t_1 = NULL;
22875  int __pyx_lineno = 0;
22876  const char *__pyx_filename = NULL;
22877  int __pyx_clineno = 0;
22878  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
22879  /*--- Type import code ---*/
22880  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
22881  __Pyx_GOTREF(__pyx_t_1);
22882  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
22883  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
22884  sizeof(PyTypeObject),
22885  #else
22886  sizeof(PyHeapTypeObject),
22887  #endif
22888  __Pyx_ImportType_CheckSize_Warn);
22889  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
22890  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22891  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
22892  __Pyx_GOTREF(__pyx_t_1);
22893  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
22894  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
22895  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
22896  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
22897  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
22898  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
22899  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
22900  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
22901  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22902  if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
22903  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22904  if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
22905  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22906  if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
22907  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22908  if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
22909  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22910  if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
22911  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22912  if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
22913  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22914  if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
22915  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22916  if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
22917  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22918  if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
22919  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22920  if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
22921  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
22922  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
22923  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22924  __Pyx_RefNannyFinishContext();
22925  return 0;
22926  __pyx_L1_error:;
22927  __Pyx_XDECREF(__pyx_t_1);
22928  __Pyx_RefNannyFinishContext();
22929  return -1;
22930 }
22931 
22932 static int __Pyx_modinit_variable_import_code(void) {
22933  __Pyx_RefNannyDeclarations
22934  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
22935  /*--- Variable import code ---*/
22936  __Pyx_RefNannyFinishContext();
22937  return 0;
22938 }
22939 
22940 static int __Pyx_modinit_function_import_code(void) {
22941  __Pyx_RefNannyDeclarations
22942  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
22943  /*--- Function import code ---*/
22944  __Pyx_RefNannyFinishContext();
22945  return 0;
22946 }
22947 
22948 
22949 #ifndef CYTHON_NO_PYINIT_EXPORT
22950 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
22951 #elif PY_MAJOR_VERSION < 3
22952 #ifdef __cplusplus
22953 #define __Pyx_PyMODINIT_FUNC extern "C" void
22954 #else
22955 #define __Pyx_PyMODINIT_FUNC void
22956 #endif
22957 #else
22958 #ifdef __cplusplus
22959 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
22960 #else
22961 #define __Pyx_PyMODINIT_FUNC PyObject *
22962 #endif
22963 #endif
22964 
22965 
22966 #if PY_MAJOR_VERSION < 3
22967 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
22968 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
22969 #else
22970 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
22971 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
22972 #if CYTHON_PEP489_MULTI_PHASE_INIT
22973 {
22974  return PyModuleDef_Init(&__pyx_moduledef);
22975 }
22976 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
22977  #if PY_VERSION_HEX >= 0x030700A1
22978  static PY_INT64_T main_interpreter_id = -1;
22979  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
22980  if (main_interpreter_id == -1) {
22981  main_interpreter_id = current_id;
22982  return (unlikely(current_id == -1)) ? -1 : 0;
22983  } else if (unlikely(main_interpreter_id != current_id))
22984  #else
22985  static PyInterpreterState *main_interpreter = NULL;
22986  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
22987  if (!main_interpreter) {
22988  main_interpreter = current_interpreter;
22989  } else if (unlikely(main_interpreter != current_interpreter))
22990  #endif
22991  {
22992  PyErr_SetString(
22993  PyExc_ImportError,
22994  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
22995  return -1;
22996  }
22997  return 0;
22998 }
22999 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
23000  PyObject *value = PyObject_GetAttrString(spec, from_name);
23001  int result = 0;
23002  if (likely(value)) {
23003  if (allow_none || value != Py_None) {
23004  result = PyDict_SetItemString(moddict, to_name, value);
23005  }
23006  Py_DECREF(value);
23007  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
23008  PyErr_Clear();
23009  } else {
23010  result = -1;
23011  }
23012  return result;
23013 }
23014 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
23015  PyObject *module = NULL, *moddict, *modname;
23016  if (__Pyx_check_single_interpreter())
23017  return NULL;
23018  if (__pyx_m)
23019  return __Pyx_NewRef(__pyx_m);
23020  modname = PyObject_GetAttrString(spec, "name");
23021  if (unlikely(!modname)) goto bad;
23022  module = PyModule_NewObject(modname);
23023  Py_DECREF(modname);
23024  if (unlikely(!module)) goto bad;
23025  moddict = PyModule_GetDict(module);
23026  if (unlikely(!moddict)) goto bad;
23027  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
23028  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
23029  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
23030  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
23031  return module;
23032 bad:
23033  Py_XDECREF(module);
23034  return NULL;
23035 }
23036 
23037 
23038 static CYTHON_SMALL_CODE int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject *__pyx_pyinit_module)
23039 #endif
23040 #endif
23041 {
23042  PyObject *__pyx_t_1 = NULL;
23043  int __pyx_lineno = 0;
23044  const char *__pyx_filename = NULL;
23045  int __pyx_clineno = 0;
23046  __Pyx_RefNannyDeclarations
23047  #if CYTHON_PEP489_MULTI_PHASE_INIT
23048  if (__pyx_m) {
23049  if (__pyx_m == __pyx_pyinit_module) return 0;
23050  PyErr_SetString(PyExc_RuntimeError, "Module 'subsurfaceTransportFunctions' has already been imported. Re-initialisation is not supported.");
23051  return -1;
23052  }
23053  #elif PY_MAJOR_VERSION >= 3
23054  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
23055  #endif
23056  #if CYTHON_REFNANNY
23057 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
23058 if (!__Pyx_RefNanny) {
23059  PyErr_Clear();
23060  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
23061  if (!__Pyx_RefNanny)
23062  Py_FatalError("failed to import 'refnanny' module");
23063 }
23064 #endif
23065  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
23066  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23067  #ifdef __Pxy_PyFrame_Initialize_Offsets
23068  __Pxy_PyFrame_Initialize_Offsets();
23069  #endif
23070  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
23071  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
23072  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
23073  #ifdef __Pyx_CyFunction_USED
23074  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23075  #endif
23076  #ifdef __Pyx_FusedFunction_USED
23077  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23078  #endif
23079  #ifdef __Pyx_Coroutine_USED
23080  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23081  #endif
23082  #ifdef __Pyx_Generator_USED
23083  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23084  #endif
23085  #ifdef __Pyx_AsyncGen_USED
23086  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23087  #endif
23088  #ifdef __Pyx_StopAsyncIteration_USED
23089  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23090  #endif
23091  /*--- Library function declarations ---*/
23092  /*--- Threads initialization code ---*/
23093  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
23094  PyEval_InitThreads();
23095  #endif
23096  /*--- Module creation code ---*/
23097  #if CYTHON_PEP489_MULTI_PHASE_INIT
23098  __pyx_m = __pyx_pyinit_module;
23099  Py_INCREF(__pyx_m);
23100  #else
23101  #if PY_MAJOR_VERSION < 3
23102  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23103  #else
23104  __pyx_m = PyModule_Create(&__pyx_moduledef);
23105  #endif
23106  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23107  #endif
23108  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23109  Py_INCREF(__pyx_d);
23110  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23111  Py_INCREF(__pyx_b);
23112  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
23113  Py_INCREF(__pyx_cython_runtime);
23114  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23115  /*--- Initialize various global constants etc. ---*/
23116  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23117  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
23118  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23119  #endif
23120  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
23121  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23122  }
23123  #if PY_MAJOR_VERSION >= 3
23124  {
23125  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23126  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
23127  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23128  }
23129  }
23130  #endif
23131  /*--- Builtin init code ---*/
23132  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23133  /*--- Constants init code ---*/
23134  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23135  /*--- Global type/function init code ---*/
23136  (void)__Pyx_modinit_global_init_code();
23137  (void)__Pyx_modinit_variable_export_code();
23138  (void)__Pyx_modinit_function_export_code();
23139  (void)__Pyx_modinit_type_init_code();
23140  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23141  (void)__Pyx_modinit_variable_import_code();
23142  (void)__Pyx_modinit_function_import_code();
23143  /*--- Execution code ---*/
23144  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23145  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23146  #endif
23147 
23148  /* "subsurfaceTransportFunctions.pyx":1
23149  * import numpy # <<<<<<<<<<<<<<
23150  * cimport numpy
23151  * cdef extern from "math.h":
23152  */
23153  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23154  __Pyx_GOTREF(__pyx_t_1);
23155  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23156  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23157 
23158  /* "subsurfaceTransportFunctions.pyx":18
23159  * ctypedef int ITYPE_t
23160  *
23161  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
23162  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
23163  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23164  */
23165  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
23166  __Pyx_GOTREF(__pyx_t_1);
23167  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
23168  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23169 
23170  /* "subsurfaceTransportFunctions.pyx":29
23171  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
23172  *
23173  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
23174  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23175  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23176  */
23177  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
23178  __Pyx_GOTREF(__pyx_t_1);
23179  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
23180  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23181 
23182  /* "subsurfaceTransportFunctions.pyx":43
23183  *
23184  * ###
23185  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23186  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
23187  * dict material_functions):
23188  */
23189  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
23190  __Pyx_GOTREF(__pyx_t_1);
23191  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
23192  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23193 
23194  /* "subsurfaceTransportFunctions.pyx":56
23195  * q_vals[eN,k] = material_functions[material]
23196  *
23197  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23198  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
23199  * dict material_functions):
23200  */
23201  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
23202  __Pyx_GOTREF(__pyx_t_1);
23203  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
23204  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23205 
23206  /* "subsurfaceTransportFunctions.pyx":69
23207  *
23208  *
23209  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23210  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23211  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
23212  */
23213  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
23214  __Pyx_GOTREF(__pyx_t_1);
23215  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
23216  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23217 
23218  /* "subsurfaceTransportFunctions.pyx":91
23219  * material_functions[material_right])
23220  *
23221  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23222  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23223  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23224  */
23225  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
23226  __Pyx_GOTREF(__pyx_t_1);
23227  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
23228  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23229 
23230  /* "subsurfaceTransportFunctions.pyx":118
23231  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23232  *
23233  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23234  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23235  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
23236  */
23237  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
23238  __Pyx_GOTREF(__pyx_t_1);
23239  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
23240  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23241 
23242  /* "subsurfaceTransportFunctions.pyx":139
23243  *
23244  *
23245  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23246  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23247  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23248  */
23249  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
23250  __Pyx_GOTREF(__pyx_t_1);
23251  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
23252  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23253 
23254  /* "subsurfaceTransportFunctions.pyx":165
23255  *
23256  * ###
23257  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23258  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23259  * numpy.ndarray[DTYPE_t,ndim=3] x,
23260  */
23261  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
23262  __Pyx_GOTREF(__pyx_t_1);
23263  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
23264  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23265 
23266  /* "subsurfaceTransportFunctions.pyx":180
23267  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
23268  *
23269  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23270  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23271  * numpy.ndarray[DTYPE_t,ndim=3] x,
23272  */
23273  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
23274  __Pyx_GOTREF(__pyx_t_1);
23275  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
23276  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23277 
23278  /* "subsurfaceTransportFunctions.pyx":195
23279  *
23280  *
23281  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23282  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23283  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23284  */
23285  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
23286  __Pyx_GOTREF(__pyx_t_1);
23287  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
23288  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23289 
23290  /* "subsurfaceTransportFunctions.pyx":219
23291  * material_functions[material_right](x[eN,ebN_local,k],t))
23292  *
23293  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23294  * double t,
23295  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23296  */
23297  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
23298  __Pyx_GOTREF(__pyx_t_1);
23299  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
23300  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23301 
23302  /* "subsurfaceTransportFunctions.pyx":248
23303  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23304  *
23305  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23306  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23307  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23308  */
23309  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
23310  __Pyx_GOTREF(__pyx_t_1);
23311  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
23312  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23313 
23314  /* "subsurfaceTransportFunctions.pyx":271
23315  *
23316  *
23317  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23318  * double t,
23319  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23320  */
23321  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
23322  __Pyx_GOTREF(__pyx_t_1);
23323  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
23324  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23325 
23326  /* "subsurfaceTransportFunctions.pyx":301
23327  *
23328  * ##################################################
23329  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
23330  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23331  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23332  */
23333  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
23334  __Pyx_GOTREF(__pyx_t_1);
23335  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
23336  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23337 
23338  /* "subsurfaceTransportFunctions.pyx":359
23339  *
23340  *
23341  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
23342  * double beta,
23343  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23344  */
23345  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
23346  __Pyx_GOTREF(__pyx_t_1);
23347  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
23348  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23349 
23350  /* "subsurfaceTransportFunctions.pyx":486
23351  * #eN for upwind
23352  *
23353  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23354  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23355  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23356  */
23357  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
23358  __Pyx_GOTREF(__pyx_t_1);
23359  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
23360  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23361 
23362  /* "subsurfaceTransportFunctions.pyx":574
23363  * #i
23364  * #eN
23365  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23366  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23367  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23368  */
23369  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
23370  __Pyx_GOTREF(__pyx_t_1);
23371  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
23372  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23373 
23374  /* "subsurfaceTransportFunctions.pyx":673
23375  * ##################################################
23376  *
23377  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
23378  * numpy.ndarray[DTYPE_t,ndim=3] w,
23379  * numpy.ndarray[DTYPE_t,ndim=2] dV,
23380  */
23381  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
23382  __Pyx_GOTREF(__pyx_t_1);
23383  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
23384  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23385 
23386  /* "subsurfaceTransportFunctions.pyx":692
23387  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
23388  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
23389  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
23390  * numpy.ndarray[DTYPE_t,ndim=3] w,
23391  * numpy.ndarray[DTYPE_t,ndim=3] v,
23392  */
23393  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
23394  __Pyx_GOTREF(__pyx_t_1);
23395  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
23396  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23397 
23398  /* "subsurfaceTransportFunctions.pyx":717
23399  * #ELLAM
23400  * ########################################################################
23401  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
23402  * numpy.ndarray[DTYPE_t,ndim=4] n,
23403  * numpy.ndarray[DTYPE_t,ndim=3] dS,
23404  */
23405  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
23406  __Pyx_GOTREF(__pyx_t_1);
23407  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
23408  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23409 
23410  /* "subsurfaceTransportFunctions.pyx":732
23411  * flux[eN,ebN] = integral
23412  *
23413  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
23414  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
23415  * numpy.ndarray[DTYPE_t,ndim=2] dm,
23416  */
23417  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
23418  __Pyx_GOTREF(__pyx_t_1);
23419  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
23420  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23421 
23422  /* "subsurfaceTransportFunctions.pyx":753
23423  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
23424  *
23425  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
23426  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
23427  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
23428  */
23429  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
23430  __Pyx_GOTREF(__pyx_t_1);
23431  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
23432  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23433 
23434  /* "subsurfaceTransportFunctions.pyx":776
23435  *
23436  * #problem specific velocity evaluation
23437  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23438  * double t,
23439  * double tForReversal,
23440  */
23441  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
23442  __Pyx_GOTREF(__pyx_t_1);
23443  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
23444  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23445 
23446  /* "subsurfaceTransportFunctions.pyx":816
23447  *
23448  *
23449  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23450  * double t,
23451  * double tForReversal,
23452  */
23453  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
23454  __Pyx_GOTREF(__pyx_t_1);
23455  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
23456  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23457 
23458  /* "subsurfaceTransportFunctions.pyx":859
23459  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23460  *
23461  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23462  * double t,
23463  * double tForReversal,
23464  */
23465  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
23466  __Pyx_GOTREF(__pyx_t_1);
23467  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
23468  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23469 
23470  /* "subsurfaceTransportFunctions.pyx":884
23471  * v[eN,k,2]=zVelocity
23472  *
23473  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23474  * double t,
23475  * double tForReversal,
23476  */
23477  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
23478  __Pyx_GOTREF(__pyx_t_1);
23479  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
23480  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23481 
23482  /* "subsurfaceTransportFunctions.pyx":911
23483  * v[eN,ebN,k,2]=zVelocity
23484  *
23485  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
23486  * numpy.ndarray[DTYPE_t,ndim=3] x,
23487  * numpy.ndarray[DTYPE_t,ndim=3] v):
23488  */
23489  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
23490  __Pyx_GOTREF(__pyx_t_1);
23491  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
23492  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23493 
23494  /* "subsurfaceTransportFunctions.pyx":924
23495  *
23496  *
23497  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
23498  * numpy.ndarray[DTYPE_t,ndim=4] x,
23499  * numpy.ndarray[DTYPE_t,ndim=4] v):
23500  */
23501  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
23502  __Pyx_GOTREF(__pyx_t_1);
23503  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
23504  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23505 
23506  /* "subsurfaceTransportFunctions.pyx":1
23507  * import numpy # <<<<<<<<<<<<<<
23508  * cimport numpy
23509  * cdef extern from "math.h":
23510  */
23511  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23512  __Pyx_GOTREF(__pyx_t_1);
23513  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23514  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23515 
23516  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
23517  *
23518  *
23519  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
23520  * """
23521  * returns the unit part of the dtype for a numpy datetime64 object.
23522  */
23523 
23524  /*--- Wrapped vars code ---*/
23525 
23526  goto __pyx_L0;
23527  __pyx_L1_error:;
23528  __Pyx_XDECREF(__pyx_t_1);
23529  if (__pyx_m) {
23530  if (__pyx_d) {
23531  __Pyx_AddTraceback("init subsurfaceTransportFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
23532  }
23533  Py_CLEAR(__pyx_m);
23534  } else if (!PyErr_Occurred()) {
23535  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
23536  }
23537  __pyx_L0:;
23538  __Pyx_RefNannyFinishContext();
23539  #if CYTHON_PEP489_MULTI_PHASE_INIT
23540  return (__pyx_m != NULL) ? 0 : -1;
23541  #elif PY_MAJOR_VERSION >= 3
23542  return __pyx_m;
23543  #else
23544  return;
23545  #endif
23546 }
23547 
23548 /* --- Runtime support code --- */
23549 /* Refnanny */
23550 #if CYTHON_REFNANNY
23551 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
23552  PyObject *m = NULL, *p = NULL;
23553  void *r = NULL;
23554  m = PyImport_ImportModule(modname);
23555  if (!m) goto end;
23556  p = PyObject_GetAttrString(m, "RefNannyAPI");
23557  if (!p) goto end;
23558  r = PyLong_AsVoidPtr(p);
23559 end:
23560  Py_XDECREF(p);
23561  Py_XDECREF(m);
23562  return (__Pyx_RefNannyAPIStruct *)r;
23563 }
23564 #endif
23565 
23566 /* PyObjectGetAttrStr */
23567 #if CYTHON_USE_TYPE_SLOTS
23568 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
23569  PyTypeObject* tp = Py_TYPE(obj);
23570  if (likely(tp->tp_getattro))
23571  return tp->tp_getattro(obj, attr_name);
23572 #if PY_MAJOR_VERSION < 3
23573  if (likely(tp->tp_getattr))
23574  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
23575 #endif
23576  return PyObject_GetAttr(obj, attr_name);
23577 }
23578 #endif
23579 
23580 /* GetBuiltinName */
23581 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23582  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23583  if (unlikely(!result)) {
23584  PyErr_Format(PyExc_NameError,
23585 #if PY_MAJOR_VERSION >= 3
23586  "name '%U' is not defined", name);
23587 #else
23588  "name '%.200s' is not defined", PyString_AS_STRING(name));
23589 #endif
23590  }
23591  return result;
23592 }
23593 
23594 /* RaiseArgTupleInvalid */
23595 static void __Pyx_RaiseArgtupleInvalid(
23596  const char* func_name,
23597  int exact,
23598  Py_ssize_t num_min,
23599  Py_ssize_t num_max,
23600  Py_ssize_t num_found)
23601 {
23602  Py_ssize_t num_expected;
23603  const char *more_or_less;
23604  if (num_found < num_min) {
23605  num_expected = num_min;
23606  more_or_less = "at least";
23607  } else {
23608  num_expected = num_max;
23609  more_or_less = "at most";
23610  }
23611  if (exact) {
23612  more_or_less = "exactly";
23613  }
23614  PyErr_Format(PyExc_TypeError,
23615  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
23616  func_name, more_or_less, num_expected,
23617  (num_expected == 1) ? "" : "s", num_found);
23618 }
23619 
23620 /* RaiseDoubleKeywords */
23621 static void __Pyx_RaiseDoubleKeywordsError(
23622  const char* func_name,
23623  PyObject* kw_name)
23624 {
23625  PyErr_Format(PyExc_TypeError,
23626  #if PY_MAJOR_VERSION >= 3
23627  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23628  #else
23629  "%s() got multiple values for keyword argument '%s'", func_name,
23630  PyString_AsString(kw_name));
23631  #endif
23632 }
23633 
23634 /* ParseKeywords */
23635 static int __Pyx_ParseOptionalKeywords(
23636  PyObject *kwds,
23637  PyObject **argnames[],
23638  PyObject *kwds2,
23639  PyObject *values[],
23640  Py_ssize_t num_pos_args,
23641  const char* function_name)
23642 {
23643  PyObject *key = 0, *value = 0;
23644  Py_ssize_t pos = 0;
23645  PyObject*** name;
23646  PyObject*** first_kw_arg = argnames + num_pos_args;
23647  while (PyDict_Next(kwds, &pos, &key, &value)) {
23648  name = first_kw_arg;
23649  while (*name && (**name != key)) name++;
23650  if (*name) {
23651  values[name-argnames] = value;
23652  continue;
23653  }
23654  name = first_kw_arg;
23655  #if PY_MAJOR_VERSION < 3
23656  if (likely(PyString_Check(key))) {
23657  while (*name) {
23658  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23659  && _PyString_Eq(**name, key)) {
23660  values[name-argnames] = value;
23661  break;
23662  }
23663  name++;
23664  }
23665  if (*name) continue;
23666  else {
23667  PyObject*** argname = argnames;
23668  while (argname != first_kw_arg) {
23669  if ((**argname == key) || (
23670  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23671  && _PyString_Eq(**argname, key))) {
23672  goto arg_passed_twice;
23673  }
23674  argname++;
23675  }
23676  }
23677  } else
23678  #endif
23679  if (likely(PyUnicode_Check(key))) {
23680  while (*name) {
23681  int cmp = (**name == key) ? 0 :
23682  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23683  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23684  #endif
23685  PyUnicode_Compare(**name, key);
23686  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23687  if (cmp == 0) {
23688  values[name-argnames] = value;
23689  break;
23690  }
23691  name++;
23692  }
23693  if (*name) continue;
23694  else {
23695  PyObject*** argname = argnames;
23696  while (argname != first_kw_arg) {
23697  int cmp = (**argname == key) ? 0 :
23698  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23699  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23700  #endif
23701  PyUnicode_Compare(**argname, key);
23702  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23703  if (cmp == 0) goto arg_passed_twice;
23704  argname++;
23705  }
23706  }
23707  } else
23708  goto invalid_keyword_type;
23709  if (kwds2) {
23710  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
23711  } else {
23712  goto invalid_keyword;
23713  }
23714  }
23715  return 0;
23716 arg_passed_twice:
23717  __Pyx_RaiseDoubleKeywordsError(function_name, key);
23718  goto bad;
23719 invalid_keyword_type:
23720  PyErr_Format(PyExc_TypeError,
23721  "%.200s() keywords must be strings", function_name);
23722  goto bad;
23723 invalid_keyword:
23724  PyErr_Format(PyExc_TypeError,
23725  #if PY_MAJOR_VERSION < 3
23726  "%.200s() got an unexpected keyword argument '%.200s'",
23727  function_name, PyString_AsString(key));
23728  #else
23729  "%s() got an unexpected keyword argument '%U'",
23730  function_name, key);
23731  #endif
23732 bad:
23733  return -1;
23734 }
23735 
23736 /* ArgTypeTest */
23737 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
23738 {
23739  if (unlikely(!type)) {
23740  PyErr_SetString(PyExc_SystemError, "Missing type object");
23741  return 0;
23742  }
23743  else if (exact) {
23744  #if PY_MAJOR_VERSION == 2
23745  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
23746  #endif
23747  }
23748  else {
23749  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
23750  }
23751  PyErr_Format(PyExc_TypeError,
23752  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23753  name, type->tp_name, Py_TYPE(obj)->tp_name);
23754  return 0;
23755 }
23756 
23757 /* IsLittleEndian */
23758 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
23759 {
23760  union {
23761  uint32_t u32;
23762  uint8_t u8[4];
23763  } S;
23764  S.u32 = 0x01020304;
23765  return S.u8[0] == 4;
23766 }
23767 
23768 /* BufferFormatCheck */
23769 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
23770  __Pyx_BufFmt_StackElem* stack,
23771  __Pyx_TypeInfo* type) {
23772  stack[0].field = &ctx->root;
23773  stack[0].parent_offset = 0;
23774  ctx->root.type = type;
23775  ctx->root.name = "buffer dtype";
23776  ctx->root.offset = 0;
23777  ctx->head = stack;
23778  ctx->head->field = &ctx->root;
23779  ctx->fmt_offset = 0;
23780  ctx->head->parent_offset = 0;
23781  ctx->new_packmode = '@';
23782  ctx->enc_packmode = '@';
23783  ctx->new_count = 1;
23784  ctx->enc_count = 0;
23785  ctx->enc_type = 0;
23786  ctx->is_complex = 0;
23787  ctx->is_valid_array = 0;
23788  ctx->struct_alignment = 0;
23789  while (type->typegroup == 'S') {
23790  ++ctx->head;
23791  ctx->head->field = type->fields;
23792  ctx->head->parent_offset = 0;
23793  type = type->fields->type;
23794  }
23795 }
23796 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
23797  int count;
23798  const char* t = *ts;
23799  if (*t < '0' || *t > '9') {
23800  return -1;
23801  } else {
23802  count = *t++ - '0';
23803  while (*t >= '0' && *t <= '9') {
23804  count *= 10;
23805  count += *t++ - '0';
23806  }
23807  }
23808  *ts = t;
23809  return count;
23810 }
23811 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
23812  int number = __Pyx_BufFmt_ParseNumber(ts);
23813  if (number == -1)
23814  PyErr_Format(PyExc_ValueError,\
23815  "Does not understand character buffer dtype format string ('%c')", **ts);
23816  return number;
23817 }
23818 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
23819  PyErr_Format(PyExc_ValueError,
23820  "Unexpected format string character: '%c'", ch);
23821 }
23822 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
23823  switch (ch) {
23824  case '?': return "'bool'";
23825  case 'c': return "'char'";
23826  case 'b': return "'signed char'";
23827  case 'B': return "'unsigned char'";
23828  case 'h': return "'short'";
23829  case 'H': return "'unsigned short'";
23830  case 'i': return "'int'";
23831  case 'I': return "'unsigned int'";
23832  case 'l': return "'long'";
23833  case 'L': return "'unsigned long'";
23834  case 'q': return "'long long'";
23835  case 'Q': return "'unsigned long long'";
23836  case 'f': return (is_complex ? "'complex float'" : "'float'");
23837  case 'd': return (is_complex ? "'complex double'" : "'double'");
23838  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
23839  case 'T': return "a struct";
23840  case 'O': return "Python object";
23841  case 'P': return "a pointer";
23842  case 's': case 'p': return "a string";
23843  case 0: return "end";
23844  default: return "unparseable format string";
23845  }
23846 }
23847 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
23848  switch (ch) {
23849  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23850  case 'h': case 'H': return 2;
23851  case 'i': case 'I': case 'l': case 'L': return 4;
23852  case 'q': case 'Q': return 8;
23853  case 'f': return (is_complex ? 8 : 4);
23854  case 'd': return (is_complex ? 16 : 8);
23855  case 'g': {
23856  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
23857  return 0;
23858  }
23859  case 'O': case 'P': return sizeof(void*);
23860  default:
23861  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23862  return 0;
23863  }
23864 }
23865 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
23866  switch (ch) {
23867  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23868  case 'h': case 'H': return sizeof(short);
23869  case 'i': case 'I': return sizeof(int);
23870  case 'l': case 'L': return sizeof(long);
23871  #ifdef HAVE_LONG_LONG
23872  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
23873  #endif
23874  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
23875  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
23876  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
23877  case 'O': case 'P': return sizeof(void*);
23878  default: {
23879  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23880  return 0;
23881  }
23882  }
23883 }
23884 typedef struct { char c; short x; } __Pyx_st_short;
23885 typedef struct { char c; int x; } __Pyx_st_int;
23886 typedef struct { char c; long x; } __Pyx_st_long;
23887 typedef struct { char c; float x; } __Pyx_st_float;
23888 typedef struct { char c; double x; } __Pyx_st_double;
23889 typedef struct { char c; long double x; } __Pyx_st_longdouble;
23890 typedef struct { char c; void *x; } __Pyx_st_void_p;
23891 #ifdef HAVE_LONG_LONG
23892 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
23893 #endif
23894 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
23895  switch (ch) {
23896  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23897  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
23898  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
23899  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
23900 #ifdef HAVE_LONG_LONG
23901  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
23902 #endif
23903  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
23904  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
23905  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
23906  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
23907  default:
23908  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23909  return 0;
23910  }
23911 }
23912 /* These are for computing the padding at the end of the struct to align
23913  on the first member of the struct. This will probably the same as above,
23914  but we don't have any guarantees.
23915  */
23916 typedef struct { short x; char c; } __Pyx_pad_short;
23917 typedef struct { int x; char c; } __Pyx_pad_int;
23918 typedef struct { long x; char c; } __Pyx_pad_long;
23919 typedef struct { float x; char c; } __Pyx_pad_float;
23920 typedef struct { double x; char c; } __Pyx_pad_double;
23921 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
23922 typedef struct { void *x; char c; } __Pyx_pad_void_p;
23923 #ifdef HAVE_LONG_LONG
23924 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
23925 #endif
23926 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
23927  switch (ch) {
23928  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
23929  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
23930  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
23931  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
23932 #ifdef HAVE_LONG_LONG
23933  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
23934 #endif
23935  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
23936  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
23937  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
23938  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
23939  default:
23940  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23941  return 0;
23942  }
23943 }
23944 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
23945  switch (ch) {
23946  case 'c':
23947  return 'H';
23948  case 'b': case 'h': case 'i':
23949  case 'l': case 'q': case 's': case 'p':
23950  return 'I';
23951  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
23952  return 'U';
23953  case 'f': case 'd': case 'g':
23954  return (is_complex ? 'C' : 'R');
23955  case 'O':
23956  return 'O';
23957  case 'P':
23958  return 'P';
23959  default: {
23960  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
23961  return 0;
23962  }
23963  }
23964 }
23965 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
23966  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
23967  const char* expected;
23968  const char* quote;
23969  if (ctx->head == NULL) {
23970  expected = "end";
23971  quote = "";
23972  } else {
23973  expected = ctx->head->field->type->name;
23974  quote = "'";
23975  }
23976  PyErr_Format(PyExc_ValueError,
23977  "Buffer dtype mismatch, expected %s%s%s but got %s",
23978  quote, expected, quote,
23979  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
23980  } else {
23981  __Pyx_StructField* field = ctx->head->field;
23982  __Pyx_StructField* parent = (ctx->head - 1)->field;
23983  PyErr_Format(PyExc_ValueError,
23984  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
23985  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
23986  parent->type->name, field->name);
23987  }
23988 }
23989 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
23990  char group;
23991  size_t size, offset, arraysize = 1;
23992  if (ctx->enc_type == 0) return 0;
23993  if (ctx->head->field->type->arraysize[0]) {
23994  int i, ndim = 0;
23995  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
23996  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
23997  ndim = 1;
23998  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
23999  PyErr_Format(PyExc_ValueError,
24000  "Expected a dimension of size %zu, got %zu",
24001  ctx->head->field->type->arraysize[0], ctx->enc_count);
24002  return -1;
24003  }
24004  }
24005  if (!ctx->is_valid_array) {
24006  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
24007  ctx->head->field->type->ndim, ndim);
24008  return -1;
24009  }
24010  for (i = 0; i < ctx->head->field->type->ndim; i++) {
24011  arraysize *= ctx->head->field->type->arraysize[i];
24012  }
24013  ctx->is_valid_array = 0;
24014  ctx->enc_count = 1;
24015  }
24016  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
24017  do {
24018  __Pyx_StructField* field = ctx->head->field;
24019  __Pyx_TypeInfo* type = field->type;
24020  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
24021  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
24022  } else {
24023  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
24024  }
24025  if (ctx->enc_packmode == '@') {
24026  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
24027  size_t align_mod_offset;
24028  if (align_at == 0) return -1;
24029  align_mod_offset = ctx->fmt_offset % align_at;
24030  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
24031  if (ctx->struct_alignment == 0)
24032  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
24033  ctx->is_complex);
24034  }
24035  if (type->size != size || type->typegroup != group) {
24036  if (type->typegroup == 'C' && type->fields != NULL) {
24037  size_t parent_offset = ctx->head->parent_offset + field->offset;
24038  ++ctx->head;
24039  ctx->head->field = type->fields;
24040  ctx->head->parent_offset = parent_offset;
24041  continue;
24042  }
24043  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
24044  } else {
24045  __Pyx_BufFmt_RaiseExpected(ctx);
24046  return -1;
24047  }
24048  }
24049  offset = ctx->head->parent_offset + field->offset;
24050  if (ctx->fmt_offset != offset) {
24051  PyErr_Format(PyExc_ValueError,
24052  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
24053  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
24054  return -1;
24055  }
24056  ctx->fmt_offset += size;
24057  if (arraysize)
24058  ctx->fmt_offset += (arraysize - 1) * size;
24059  --ctx->enc_count;
24060  while (1) {
24061  if (field == &ctx->root) {
24062  ctx->head = NULL;
24063  if (ctx->enc_count != 0) {
24064  __Pyx_BufFmt_RaiseExpected(ctx);
24065  return -1;
24066  }
24067  break;
24068  }
24069  ctx->head->field = ++field;
24070  if (field->type == NULL) {
24071  --ctx->head;
24072  field = ctx->head->field;
24073  continue;
24074  } else if (field->type->typegroup == 'S') {
24075  size_t parent_offset = ctx->head->parent_offset + field->offset;
24076  if (field->type->fields->type == NULL) continue;
24077  field = field->type->fields;
24078  ++ctx->head;
24079  ctx->head->field = field;
24080  ctx->head->parent_offset = parent_offset;
24081  break;
24082  } else {
24083  break;
24084  }
24085  }
24086  } while (ctx->enc_count);
24087  ctx->enc_type = 0;
24088  ctx->is_complex = 0;
24089  return 0;
24090 }
24091 static PyObject *
24092 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24093 {
24094  const char *ts = *tsp;
24095  int i = 0, number, ndim;
24096  ++ts;
24097  if (ctx->new_count != 1) {
24098  PyErr_SetString(PyExc_ValueError,
24099  "Cannot handle repeated arrays in format string");
24100  return NULL;
24101  }
24102  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24103  ndim = ctx->head->field->type->ndim;
24104  while (*ts && *ts != ')') {
24105  switch (*ts) {
24106  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
24107  default: break;
24108  }
24109  number = __Pyx_BufFmt_ExpectNumber(&ts);
24110  if (number == -1) return NULL;
24111  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24112  return PyErr_Format(PyExc_ValueError,
24113  "Expected a dimension of size %zu, got %d",
24114  ctx->head->field->type->arraysize[i], number);
24115  if (*ts != ',' && *ts != ')')
24116  return PyErr_Format(PyExc_ValueError,
24117  "Expected a comma in format string, got '%c'", *ts);
24118  if (*ts == ',') ts++;
24119  i++;
24120  }
24121  if (i != ndim)
24122  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24123  ctx->head->field->type->ndim, i);
24124  if (!*ts) {
24125  PyErr_SetString(PyExc_ValueError,
24126  "Unexpected end of format string, expected ')'");
24127  return NULL;
24128  }
24129  ctx->is_valid_array = 1;
24130  ctx->new_count = 1;
24131  *tsp = ++ts;
24132  return Py_None;
24133 }
24134 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24135  int got_Z = 0;
24136  while (1) {
24137  switch(*ts) {
24138  case 0:
24139  if (ctx->enc_type != 0 && ctx->head == NULL) {
24140  __Pyx_BufFmt_RaiseExpected(ctx);
24141  return NULL;
24142  }
24143  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24144  if (ctx->head != NULL) {
24145  __Pyx_BufFmt_RaiseExpected(ctx);
24146  return NULL;
24147  }
24148  return ts;
24149  case ' ':
24150  case '\r':
24151  case '\n':
24152  ++ts;
24153  break;
24154  case '<':
24155  if (!__Pyx_Is_Little_Endian()) {
24156  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24157  return NULL;
24158  }
24159  ctx->new_packmode = '=';
24160  ++ts;
24161  break;
24162  case '>':
24163  case '!':
24164  if (__Pyx_Is_Little_Endian()) {
24165  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24166  return NULL;
24167  }
24168  ctx->new_packmode = '=';
24169  ++ts;
24170  break;
24171  case '=':
24172  case '@':
24173  case '^':
24174  ctx->new_packmode = *ts++;
24175  break;
24176  case 'T':
24177  {
24178  const char* ts_after_sub;
24179  size_t i, struct_count = ctx->new_count;
24180  size_t struct_alignment = ctx->struct_alignment;
24181  ctx->new_count = 1;
24182  ++ts;
24183  if (*ts != '{') {
24184  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24185  return NULL;
24186  }
24187  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24188  ctx->enc_type = 0;
24189  ctx->enc_count = 0;
24190  ctx->struct_alignment = 0;
24191  ++ts;
24192  ts_after_sub = ts;
24193  for (i = 0; i != struct_count; ++i) {
24194  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24195  if (!ts_after_sub) return NULL;
24196  }
24197  ts = ts_after_sub;
24198  if (struct_alignment) ctx->struct_alignment = struct_alignment;
24199  }
24200  break;
24201  case '}':
24202  {
24203  size_t alignment = ctx->struct_alignment;
24204  ++ts;
24205  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24206  ctx->enc_type = 0;
24207  if (alignment && ctx->fmt_offset % alignment) {
24208  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24209  }
24210  }
24211  return ts;
24212  case 'x':
24213  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24214  ctx->fmt_offset += ctx->new_count;
24215  ctx->new_count = 1;
24216  ctx->enc_count = 0;
24217  ctx->enc_type = 0;
24218  ctx->enc_packmode = ctx->new_packmode;
24219  ++ts;
24220  break;
24221  case 'Z':
24222  got_Z = 1;
24223  ++ts;
24224  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
24225  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
24226  return NULL;
24227  }
24228  CYTHON_FALLTHROUGH;
24229  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
24230  case 'l': case 'L': case 'q': case 'Q':
24231  case 'f': case 'd': case 'g':
24232  case 'O': case 'p':
24233  if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
24234  (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
24235  ctx->enc_count += ctx->new_count;
24236  ctx->new_count = 1;
24237  got_Z = 0;
24238  ++ts;
24239  break;
24240  }
24241  CYTHON_FALLTHROUGH;
24242  case 's':
24243  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24244  ctx->enc_count = ctx->new_count;
24245  ctx->enc_packmode = ctx->new_packmode;
24246  ctx->enc_type = *ts;
24247  ctx->is_complex = got_Z;
24248  ++ts;
24249  ctx->new_count = 1;
24250  got_Z = 0;
24251  break;
24252  case ':':
24253  ++ts;
24254  while(*ts != ':') ++ts;
24255  ++ts;
24256  break;
24257  case '(':
24258  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
24259  break;
24260  default:
24261  {
24262  int number = __Pyx_BufFmt_ExpectNumber(&ts);
24263  if (number == -1) return NULL;
24264  ctx->new_count = (size_t)number;
24265  }
24266  }
24267  }
24268 }
24269 
24270 /* BufferGetAndValidate */
24271  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
24272  if (unlikely(info->buf == NULL)) return;
24273  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
24274  __Pyx_ReleaseBuffer(info);
24275 }
24276 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
24277  buf->buf = NULL;
24278  buf->obj = NULL;
24279  buf->strides = __Pyx_zeros;
24280  buf->shape = __Pyx_zeros;
24281  buf->suboffsets = __Pyx_minusones;
24282 }
24283 static int __Pyx__GetBufferAndValidate(
24284  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
24285  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
24286 {
24287  buf->buf = NULL;
24288  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
24289  __Pyx_ZeroBuffer(buf);
24290  return -1;
24291  }
24292  if (unlikely(buf->ndim != nd)) {
24293  PyErr_Format(PyExc_ValueError,
24294  "Buffer has wrong number of dimensions (expected %d, got %d)",
24295  nd, buf->ndim);
24296  goto fail;
24297  }
24298  if (!cast) {
24299  __Pyx_BufFmt_Context ctx;
24300  __Pyx_BufFmt_Init(&ctx, stack, dtype);
24301  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
24302  }
24303  if (unlikely((size_t)buf->itemsize != dtype->size)) {
24304  PyErr_Format(PyExc_ValueError,
24305  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
24306  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
24307  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
24308  goto fail;
24309  }
24310  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
24311  return 0;
24312 fail:;
24313  __Pyx_SafeReleaseBuffer(buf);
24314  return -1;
24315 }
24316 
24317 /* BufferIndexError */
24318  static void __Pyx_RaiseBufferIndexError(int axis) {
24319  PyErr_Format(PyExc_IndexError,
24320  "Out of bounds on buffer access (axis %d)", axis);
24321 }
24322 
24323 /* PyErrFetchRestore */
24324  #if CYTHON_FAST_THREAD_STATE
24325 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24326  PyObject *tmp_type, *tmp_value, *tmp_tb;
24327  tmp_type = tstate->curexc_type;
24328  tmp_value = tstate->curexc_value;
24329  tmp_tb = tstate->curexc_traceback;
24330  tstate->curexc_type = type;
24331  tstate->curexc_value = value;
24332  tstate->curexc_traceback = tb;
24333  Py_XDECREF(tmp_type);
24334  Py_XDECREF(tmp_value);
24335  Py_XDECREF(tmp_tb);
24336 }
24337 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24338  *type = tstate->curexc_type;
24339  *value = tstate->curexc_value;
24340  *tb = tstate->curexc_traceback;
24341  tstate->curexc_type = 0;
24342  tstate->curexc_value = 0;
24343  tstate->curexc_traceback = 0;
24344 }
24345 #endif
24346 
24347 /* DictGetItem */
24348  #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
24349 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
24350  PyObject *value;
24351  value = PyDict_GetItemWithError(d, key);
24352  if (unlikely(!value)) {
24353  if (!PyErr_Occurred()) {
24354  if (unlikely(PyTuple_Check(key))) {
24355  PyObject* args = PyTuple_Pack(1, key);
24356  if (likely(args)) {
24357  PyErr_SetObject(PyExc_KeyError, args);
24358  Py_DECREF(args);
24359  }
24360  } else {
24361  PyErr_SetObject(PyExc_KeyError, key);
24362  }
24363  }
24364  return NULL;
24365  }
24366  Py_INCREF(value);
24367  return value;
24368 }
24369 #endif
24370 
24371 /* GetItemInt */
24372  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24373  PyObject *r;
24374  if (!j) return NULL;
24375  r = PyObject_GetItem(o, j);
24376  Py_DECREF(j);
24377  return r;
24378 }
24379 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24380  CYTHON_NCP_UNUSED int wraparound,
24381  CYTHON_NCP_UNUSED int boundscheck) {
24382 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24383  Py_ssize_t wrapped_i = i;
24384  if (wraparound & unlikely(i < 0)) {
24385  wrapped_i += PyList_GET_SIZE(o);
24386  }
24387  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
24388  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
24389  Py_INCREF(r);
24390  return r;
24391  }
24392  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24393 #else
24394  return PySequence_GetItem(o, i);
24395 #endif
24396 }
24397 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24398  CYTHON_NCP_UNUSED int wraparound,
24399  CYTHON_NCP_UNUSED int boundscheck) {
24400 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24401  Py_ssize_t wrapped_i = i;
24402  if (wraparound & unlikely(i < 0)) {
24403  wrapped_i += PyTuple_GET_SIZE(o);
24404  }
24405  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
24406  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
24407  Py_INCREF(r);
24408  return r;
24409  }
24410  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24411 #else
24412  return PySequence_GetItem(o, i);
24413 #endif
24414 }
24415 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
24416  CYTHON_NCP_UNUSED int wraparound,
24417  CYTHON_NCP_UNUSED int boundscheck) {
24418 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
24419  if (is_list || PyList_CheckExact(o)) {
24420  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24421  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
24422  PyObject *r = PyList_GET_ITEM(o, n);
24423  Py_INCREF(r);
24424  return r;
24425  }
24426  }
24427  else if (PyTuple_CheckExact(o)) {
24428  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24429  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
24430  PyObject *r = PyTuple_GET_ITEM(o, n);
24431  Py_INCREF(r);
24432  return r;
24433  }
24434  } else {
24435  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
24436  if (likely(m && m->sq_item)) {
24437  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
24438  Py_ssize_t l = m->sq_length(o);
24439  if (likely(l >= 0)) {
24440  i += l;
24441  } else {
24442  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24443  return NULL;
24444  PyErr_Clear();
24445  }
24446  }
24447  return m->sq_item(o, i);
24448  }
24449  }
24450 #else
24451  if (is_list || PySequence_Check(o)) {
24452  return PySequence_GetItem(o, i);
24453  }
24454 #endif
24455  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24456 }
24457 
24458 /* ObjectGetItem */
24459  #if CYTHON_USE_TYPE_SLOTS
24460 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
24461  PyObject *runerr;
24462  Py_ssize_t key_value;
24463  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
24464  if (unlikely(!(m && m->sq_item))) {
24465  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
24466  return NULL;
24467  }
24468  key_value = __Pyx_PyIndex_AsSsize_t(index);
24469  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24470  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24471  }
24472  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24473  PyErr_Clear();
24474  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
24475  }
24476  return NULL;
24477 }
24478 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
24479  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
24480  if (likely(m && m->mp_subscript)) {
24481  return m->mp_subscript(obj, key);
24482  }
24483  return __Pyx_PyObject_GetIndex(obj, key);
24484 }
24485 #endif
24486 
24487 /* PyFloatBinop */
24488  #if !CYTHON_COMPILING_IN_PYPY
24489 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
24490  const double b = floatval;
24491  double a, result;
24492  (void)inplace;
24493  (void)zerodivision_check;
24494  if (likely(PyFloat_CheckExact(op1))) {
24495  a = PyFloat_AS_DOUBLE(op1);
24496 
24497  } else
24498  #if PY_MAJOR_VERSION < 3
24499  if (likely(PyInt_CheckExact(op1))) {
24500  a = (double) PyInt_AS_LONG(op1);
24501 
24502  } else
24503  #endif
24504  if (likely(PyLong_CheckExact(op1))) {
24505  #if CYTHON_USE_PYLONG_INTERNALS
24506  const digit* digits = ((PyLongObject*)op1)->ob_digit;
24507  const Py_ssize_t size = Py_SIZE(op1);
24508  switch (size) {
24509  case 0: a = 0.0; break;
24510  case -1: a = -(double) digits[0]; break;
24511  case 1: a = (double) digits[0]; break;
24512  case -2:
24513  case 2:
24514  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
24515  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24516  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
24517  if (size == -2)
24518  a = -a;
24519  break;
24520  }
24521  }
24522  CYTHON_FALLTHROUGH;
24523  case -3:
24524  case 3:
24525  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
24526  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24527  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
24528  if (size == -3)
24529  a = -a;
24530  break;
24531  }
24532  }
24533  CYTHON_FALLTHROUGH;
24534  case -4:
24535  case 4:
24536  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
24537  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24538  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
24539  if (size == -4)
24540  a = -a;
24541  break;
24542  }
24543  }
24544  CYTHON_FALLTHROUGH;
24545  default:
24546  #else
24547  {
24548  #endif
24549  a = PyLong_AsDouble(op1);
24550  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
24551 
24552  }
24553  } else {
24554  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24555  }
24556 
24557  PyFPE_START_PROTECT("add", return NULL)
24558  result = a + b;
24559  PyFPE_END_PROTECT(result)
24560  return PyFloat_FromDouble(result);
24561 }
24562 #endif
24563 
24564 /* PyFunctionFastCall */
24565  #if CYTHON_FAST_PYCALL
24566 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
24567  PyObject *globals) {
24568  PyFrameObject *f;
24569  PyThreadState *tstate = __Pyx_PyThreadState_Current;
24570  PyObject **fastlocals;
24571  Py_ssize_t i;
24572  PyObject *result;
24573  assert(globals != NULL);
24574  /* XXX Perhaps we should create a specialized
24575  PyFrame_New() that doesn't take locals, but does
24576  take builtins without sanity checking them.
24577  */
24578  assert(tstate != NULL);
24579  f = PyFrame_New(tstate, co, globals, NULL);
24580  if (f == NULL) {
24581  return NULL;
24582  }
24583  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
24584  for (i = 0; i < na; i++) {
24585  Py_INCREF(*args);
24586  fastlocals[i] = *args++;
24587  }
24588  result = PyEval_EvalFrameEx(f,0);
24589  ++tstate->recursion_depth;
24590  Py_DECREF(f);
24591  --tstate->recursion_depth;
24592  return result;
24593 }
24594 #if 1 || PY_VERSION_HEX < 0x030600B1
24595 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
24596  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
24597  PyObject *globals = PyFunction_GET_GLOBALS(func);
24598  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
24599  PyObject *closure;
24600 #if PY_MAJOR_VERSION >= 3
24601  PyObject *kwdefs;
24602 #endif
24603  PyObject *kwtuple, **k;
24604  PyObject **d;
24605  Py_ssize_t nd;
24606  Py_ssize_t nk;
24607  PyObject *result;
24608  assert(kwargs == NULL || PyDict_Check(kwargs));
24609  nk = kwargs ? PyDict_Size(kwargs) : 0;
24610  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
24611  return NULL;
24612  }
24613  if (
24614 #if PY_MAJOR_VERSION >= 3
24615  co->co_kwonlyargcount == 0 &&
24616 #endif
24617  likely(kwargs == NULL || nk == 0) &&
24618  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
24619  if (argdefs == NULL && co->co_argcount == nargs) {
24620  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
24621  goto done;
24622  }
24623  else if (nargs == 0 && argdefs != NULL
24624  && co->co_argcount == Py_SIZE(argdefs)) {
24625  /* function called with no arguments, but all parameters have
24626  a default value: use default values as arguments .*/
24627  args = &PyTuple_GET_ITEM(argdefs, 0);
24628  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
24629  goto done;
24630  }
24631  }
24632  if (kwargs != NULL) {
24633  Py_ssize_t pos, i;
24634  kwtuple = PyTuple_New(2 * nk);
24635  if (kwtuple == NULL) {
24636  result = NULL;
24637  goto done;
24638  }
24639  k = &PyTuple_GET_ITEM(kwtuple, 0);
24640  pos = i = 0;
24641  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
24642  Py_INCREF(k[i]);
24643  Py_INCREF(k[i+1]);
24644  i += 2;
24645  }
24646  nk = i / 2;
24647  }
24648  else {
24649  kwtuple = NULL;
24650  k = NULL;
24651  }
24652  closure = PyFunction_GET_CLOSURE(func);
24653 #if PY_MAJOR_VERSION >= 3
24654  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
24655 #endif
24656  if (argdefs != NULL) {
24657  d = &PyTuple_GET_ITEM(argdefs, 0);
24658  nd = Py_SIZE(argdefs);
24659  }
24660  else {
24661  d = NULL;
24662  nd = 0;
24663  }
24664 #if PY_MAJOR_VERSION >= 3
24665  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
24666  args, (int)nargs,
24667  k, (int)nk,
24668  d, (int)nd, kwdefs, closure);
24669 #else
24670  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
24671  args, (int)nargs,
24672  k, (int)nk,
24673  d, (int)nd, closure);
24674 #endif
24675  Py_XDECREF(kwtuple);
24676 done:
24677  Py_LeaveRecursiveCall();
24678  return result;
24679 }
24680 #endif
24681 #endif
24682 
24683 /* PyCFunctionFastCall */
24684  #if CYTHON_FAST_PYCCALL
24685 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
24686  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
24687  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
24688  PyObject *self = PyCFunction_GET_SELF(func);
24689  int flags = PyCFunction_GET_FLAGS(func);
24690  assert(PyCFunction_Check(func));
24691  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
24692  assert(nargs >= 0);
24693  assert(nargs == 0 || args != NULL);
24694  /* _PyCFunction_FastCallDict() must not be called with an exception set,
24695  because it may clear it (directly or indirectly) and so the
24696  caller loses its exception */
24697  assert(!PyErr_Occurred());
24698  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
24699  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
24700  } else {
24701  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
24702  }
24703 }
24704 #endif
24705 
24706 /* PyObjectCall */
24707  #if CYTHON_COMPILING_IN_CPYTHON
24708 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
24709  PyObject *result;
24710  ternaryfunc call = Py_TYPE(func)->tp_call;
24711  if (unlikely(!call))
24712  return PyObject_Call(func, arg, kw);
24713  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24714  return NULL;
24715  result = (*call)(func, arg, kw);
24716  Py_LeaveRecursiveCall();
24717  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24718  PyErr_SetString(
24719  PyExc_SystemError,
24720  "NULL result without error in PyObject_Call");
24721  }
24722  return result;
24723 }
24724 #endif
24725 
24726 /* PyDictVersioning */
24727  #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
24728 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
24729  PyObject *dict = Py_TYPE(obj)->tp_dict;
24730  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
24731 }
24732 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
24733  PyObject **dictptr = NULL;
24734  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
24735  if (offset) {
24736 #if CYTHON_COMPILING_IN_CPYTHON
24737  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
24738 #else
24739  dictptr = _PyObject_GetDictPtr(obj);
24740 #endif
24741  }
24742  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24743 }
24744 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24745  PyObject *dict = Py_TYPE(obj)->tp_dict;
24746  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24747  return 0;
24748  return obj_dict_version == __Pyx_get_object_dict_version(obj);
24749 }
24750 #endif
24751 
24752 /* GetModuleGlobalName */
24753  #if CYTHON_USE_DICT_VERSIONS
24754 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24755 #else
24756 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24757 #endif
24758 {
24759  PyObject *result;
24760 #if !CYTHON_AVOID_BORROWED_REFS
24761 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
24762  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24763  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24764  if (likely(result)) {
24765  return __Pyx_NewRef(result);
24766  } else if (unlikely(PyErr_Occurred())) {
24767  return NULL;
24768  }
24769 #else
24770  result = PyDict_GetItem(__pyx_d, name);
24771  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24772  if (likely(result)) {
24773  return __Pyx_NewRef(result);
24774  }
24775 #endif
24776 #else
24777  result = PyObject_GetItem(__pyx_d, name);
24778  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24779  if (likely(result)) {
24780  return __Pyx_NewRef(result);
24781  }
24782  PyErr_Clear();
24783 #endif
24784  return __Pyx_GetBuiltinName(name);
24785 }
24786 
24787 /* ExtTypeTest */
24788  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
24789  if (unlikely(!type)) {
24790  PyErr_SetString(PyExc_SystemError, "Missing type object");
24791  return 0;
24792  }
24793  if (likely(__Pyx_TypeCheck(obj, type)))
24794  return 1;
24795  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
24796  Py_TYPE(obj)->tp_name, type->tp_name);
24797  return 0;
24798 }
24799 
24800 /* PyObjectCall2Args */
24801  static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
24802  PyObject *args, *result = NULL;
24803  #if CYTHON_FAST_PYCALL
24804  if (PyFunction_Check(function)) {
24805  PyObject *args[2] = {arg1, arg2};
24806  return __Pyx_PyFunction_FastCall(function, args, 2);
24807  }
24808  #endif
24809  #if CYTHON_FAST_PYCCALL
24810  if (__Pyx_PyFastCFunction_Check(function)) {
24811  PyObject *args[2] = {arg1, arg2};
24812  return __Pyx_PyCFunction_FastCall(function, args, 2);
24813  }
24814  #endif
24815  args = PyTuple_New(2);
24816  if (unlikely(!args)) goto done;
24817  Py_INCREF(arg1);
24818  PyTuple_SET_ITEM(args, 0, arg1);
24819  Py_INCREF(arg2);
24820  PyTuple_SET_ITEM(args, 1, arg2);
24821  Py_INCREF(function);
24822  result = __Pyx_PyObject_Call(function, args, NULL);
24823  Py_DECREF(args);
24824  Py_DECREF(function);
24825 done:
24826  return result;
24827 }
24828 
24829 /* PyObjectCallMethO */
24830  #if CYTHON_COMPILING_IN_CPYTHON
24831 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
24832  PyObject *self, *result;
24833  PyCFunction cfunc;
24834  cfunc = PyCFunction_GET_FUNCTION(func);
24835  self = PyCFunction_GET_SELF(func);
24836  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24837  return NULL;
24838  result = cfunc(self, arg);
24839  Py_LeaveRecursiveCall();
24840  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24841  PyErr_SetString(
24842  PyExc_SystemError,
24843  "NULL result without error in PyObject_Call");
24844  }
24845  return result;
24846 }
24847 #endif
24848 
24849 /* PyObjectCallOneArg */
24850  #if CYTHON_COMPILING_IN_CPYTHON
24851 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24852  PyObject *result;
24853  PyObject *args = PyTuple_New(1);
24854  if (unlikely(!args)) return NULL;
24855  Py_INCREF(arg);
24856  PyTuple_SET_ITEM(args, 0, arg);
24857  result = __Pyx_PyObject_Call(func, args, NULL);
24858  Py_DECREF(args);
24859  return result;
24860 }
24861 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24862 #if CYTHON_FAST_PYCALL
24863  if (PyFunction_Check(func)) {
24864  return __Pyx_PyFunction_FastCall(func, &arg, 1);
24865  }
24866 #endif
24867  if (likely(PyCFunction_Check(func))) {
24868  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
24869  return __Pyx_PyObject_CallMethO(func, arg);
24870 #if CYTHON_FAST_PYCCALL
24871  } else if (__Pyx_PyFastCFunction_Check(func)) {
24872  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
24873 #endif
24874  }
24875  }
24876  return __Pyx__PyObject_CallOneArg(func, arg);
24877 }
24878 #else
24879 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
24880  PyObject *result;
24881  PyObject *args = PyTuple_Pack(1, arg);
24882  if (unlikely(!args)) return NULL;
24883  result = __Pyx_PyObject_Call(func, args, NULL);
24884  Py_DECREF(args);
24885  return result;
24886 }
24887 #endif
24888 
24889 /* pyobject_as_double */
24890  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
24891  PyObject* float_value;
24892 #if !CYTHON_USE_TYPE_SLOTS
24893  float_value = PyNumber_Float(obj); if ((0)) goto bad;
24894 #else
24895  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
24896  if (likely(nb) && likely(nb->nb_float)) {
24897  float_value = nb->nb_float(obj);
24898  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
24899  PyErr_Format(PyExc_TypeError,
24900  "__float__ returned non-float (type %.200s)",
24901  Py_TYPE(float_value)->tp_name);
24902  Py_DECREF(float_value);
24903  goto bad;
24904  }
24905  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
24906 #if PY_MAJOR_VERSION >= 3
24907  float_value = PyFloat_FromString(obj);
24908 #else
24909  float_value = PyFloat_FromString(obj, 0);
24910 #endif
24911  } else {
24912  PyObject* args = PyTuple_New(1);
24913  if (unlikely(!args)) goto bad;
24914  PyTuple_SET_ITEM(args, 0, obj);
24915  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
24916  PyTuple_SET_ITEM(args, 0, 0);
24917  Py_DECREF(args);
24918  }
24919 #endif
24920  if (likely(float_value)) {
24921  double value = PyFloat_AS_DOUBLE(float_value);
24922  Py_DECREF(float_value);
24923  return value;
24924  }
24925 bad:
24926  return (double)-1;
24927 }
24928 
24929 /* GetTopmostException */
24930  #if CYTHON_USE_EXC_INFO_STACK
24931 static _PyErr_StackItem *
24932 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
24933 {
24934  _PyErr_StackItem *exc_info = tstate->exc_info;
24935  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
24936  exc_info->previous_item != NULL)
24937  {
24938  exc_info = exc_info->previous_item;
24939  }
24940  return exc_info;
24941 }
24942 #endif
24943 
24944 /* SaveResetException */
24945  #if CYTHON_FAST_THREAD_STATE
24946 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24947  #if CYTHON_USE_EXC_INFO_STACK
24948  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24949  *type = exc_info->exc_type;
24950  *value = exc_info->exc_value;
24951  *tb = exc_info->exc_traceback;
24952  #else
24953  *type = tstate->exc_type;
24954  *value = tstate->exc_value;
24955  *tb = tstate->exc_traceback;
24956  #endif
24957  Py_XINCREF(*type);
24958  Py_XINCREF(*value);
24959  Py_XINCREF(*tb);
24960 }
24961 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24962  PyObject *tmp_type, *tmp_value, *tmp_tb;
24963  #if CYTHON_USE_EXC_INFO_STACK
24964  _PyErr_StackItem *exc_info = tstate->exc_info;
24965  tmp_type = exc_info->exc_type;
24966  tmp_value = exc_info->exc_value;
24967  tmp_tb = exc_info->exc_traceback;
24968  exc_info->exc_type = type;
24969  exc_info->exc_value = value;
24970  exc_info->exc_traceback = tb;
24971  #else
24972  tmp_type = tstate->exc_type;
24973  tmp_value = tstate->exc_value;
24974  tmp_tb = tstate->exc_traceback;
24975  tstate->exc_type = type;
24976  tstate->exc_value = value;
24977  tstate->exc_traceback = tb;
24978  #endif
24979  Py_XDECREF(tmp_type);
24980  Py_XDECREF(tmp_value);
24981  Py_XDECREF(tmp_tb);
24982 }
24983 #endif
24984 
24985 /* PyErrExceptionMatches */
24986  #if CYTHON_FAST_THREAD_STATE
24987 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24988  Py_ssize_t i, n;
24989  n = PyTuple_GET_SIZE(tuple);
24990 #if PY_MAJOR_VERSION >= 3
24991  for (i=0; i<n; i++) {
24992  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
24993  }
24994 #endif
24995  for (i=0; i<n; i++) {
24996  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
24997  }
24998  return 0;
24999 }
25000 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
25001  PyObject *exc_type = tstate->curexc_type;
25002  if (exc_type == err) return 1;
25003  if (unlikely(!exc_type)) return 0;
25004  if (unlikely(PyTuple_Check(err)))
25005  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
25006  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
25007 }
25008 #endif
25009 
25010 /* GetException */
25011  #if CYTHON_FAST_THREAD_STATE
25012 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
25013 #else
25014 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
25015 #endif
25016 {
25017  PyObject *local_type, *local_value, *local_tb;
25018 #if CYTHON_FAST_THREAD_STATE
25019  PyObject *tmp_type, *tmp_value, *tmp_tb;
25020  local_type = tstate->curexc_type;
25021  local_value = tstate->curexc_value;
25022  local_tb = tstate->curexc_traceback;
25023  tstate->curexc_type = 0;
25024  tstate->curexc_value = 0;
25025  tstate->curexc_traceback = 0;
25026 #else
25027  PyErr_Fetch(&local_type, &local_value, &local_tb);
25028 #endif
25029  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
25030 #if CYTHON_FAST_THREAD_STATE
25031  if (unlikely(tstate->curexc_type))
25032 #else
25033  if (unlikely(PyErr_Occurred()))
25034 #endif
25035  goto bad;
25036  #if PY_MAJOR_VERSION >= 3
25037  if (local_tb) {
25038  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
25039  goto bad;
25040  }
25041  #endif
25042  Py_XINCREF(local_tb);
25043  Py_XINCREF(local_type);
25044  Py_XINCREF(local_value);
25045  *type = local_type;
25046  *value = local_value;
25047  *tb = local_tb;
25048 #if CYTHON_FAST_THREAD_STATE
25049  #if CYTHON_USE_EXC_INFO_STACK
25050  {
25051  _PyErr_StackItem *exc_info = tstate->exc_info;
25052  tmp_type = exc_info->exc_type;
25053  tmp_value = exc_info->exc_value;
25054  tmp_tb = exc_info->exc_traceback;
25055  exc_info->exc_type = local_type;
25056  exc_info->exc_value = local_value;
25057  exc_info->exc_traceback = local_tb;
25058  }
25059  #else
25060  tmp_type = tstate->exc_type;
25061  tmp_value = tstate->exc_value;
25062  tmp_tb = tstate->exc_traceback;
25063  tstate->exc_type = local_type;
25064  tstate->exc_value = local_value;
25065  tstate->exc_traceback = local_tb;
25066  #endif
25067  Py_XDECREF(tmp_type);
25068  Py_XDECREF(tmp_value);
25069  Py_XDECREF(tmp_tb);
25070 #else
25071  PyErr_SetExcInfo(local_type, local_value, local_tb);
25072 #endif
25073  return 0;
25074 bad:
25075  *type = 0;
25076  *value = 0;
25077  *tb = 0;
25078  Py_XDECREF(local_type);
25079  Py_XDECREF(local_value);
25080  Py_XDECREF(local_tb);
25081  return -1;
25082 }
25083 
25084 /* RaiseException */
25085  #if PY_MAJOR_VERSION < 3
25086 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
25087  CYTHON_UNUSED PyObject *cause) {
25088  __Pyx_PyThreadState_declare
25089  Py_XINCREF(type);
25090  if (!value || value == Py_None)
25091  value = NULL;
25092  else
25093  Py_INCREF(value);
25094  if (!tb || tb == Py_None)
25095  tb = NULL;
25096  else {
25097  Py_INCREF(tb);
25098  if (!PyTraceBack_Check(tb)) {
25099  PyErr_SetString(PyExc_TypeError,
25100  "raise: arg 3 must be a traceback or None");
25101  goto raise_error;
25102  }
25103  }
25104  if (PyType_Check(type)) {
25105 #if CYTHON_COMPILING_IN_PYPY
25106  if (!value) {
25107  Py_INCREF(Py_None);
25108  value = Py_None;
25109  }
25110 #endif
25111  PyErr_NormalizeException(&type, &value, &tb);
25112  } else {
25113  if (value) {
25114  PyErr_SetString(PyExc_TypeError,
25115  "instance exception may not have a separate value");
25116  goto raise_error;
25117  }
25118  value = type;
25119  type = (PyObject*) Py_TYPE(type);
25120  Py_INCREF(type);
25121  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
25122  PyErr_SetString(PyExc_TypeError,
25123  "raise: exception class must be a subclass of BaseException");
25124  goto raise_error;
25125  }
25126  }
25127  __Pyx_PyThreadState_assign
25128  __Pyx_ErrRestore(type, value, tb);
25129  return;
25130 raise_error:
25131  Py_XDECREF(value);
25132  Py_XDECREF(type);
25133  Py_XDECREF(tb);
25134  return;
25135 }
25136 #else
25137 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
25138  PyObject* owned_instance = NULL;
25139  if (tb == Py_None) {
25140  tb = 0;
25141  } else if (tb && !PyTraceBack_Check(tb)) {
25142  PyErr_SetString(PyExc_TypeError,
25143  "raise: arg 3 must be a traceback or None");
25144  goto bad;
25145  }
25146  if (value == Py_None)
25147  value = 0;
25148  if (PyExceptionInstance_Check(type)) {
25149  if (value) {
25150  PyErr_SetString(PyExc_TypeError,
25151  "instance exception may not have a separate value");
25152  goto bad;
25153  }
25154  value = type;
25155  type = (PyObject*) Py_TYPE(value);
25156  } else if (PyExceptionClass_Check(type)) {
25157  PyObject *instance_class = NULL;
25158  if (value && PyExceptionInstance_Check(value)) {
25159  instance_class = (PyObject*) Py_TYPE(value);
25160  if (instance_class != type) {
25161  int is_subclass = PyObject_IsSubclass(instance_class, type);
25162  if (!is_subclass) {
25163  instance_class = NULL;
25164  } else if (unlikely(is_subclass == -1)) {
25165  goto bad;
25166  } else {
25167  type = instance_class;
25168  }
25169  }
25170  }
25171  if (!instance_class) {
25172  PyObject *args;
25173  if (!value)
25174  args = PyTuple_New(0);
25175  else if (PyTuple_Check(value)) {
25176  Py_INCREF(value);
25177  args = value;
25178  } else
25179  args = PyTuple_Pack(1, value);
25180  if (!args)
25181  goto bad;
25182  owned_instance = PyObject_Call(type, args, NULL);
25183  Py_DECREF(args);
25184  if (!owned_instance)
25185  goto bad;
25186  value = owned_instance;
25187  if (!PyExceptionInstance_Check(value)) {
25188  PyErr_Format(PyExc_TypeError,
25189  "calling %R should have returned an instance of "
25190  "BaseException, not %R",
25191  type, Py_TYPE(value));
25192  goto bad;
25193  }
25194  }
25195  } else {
25196  PyErr_SetString(PyExc_TypeError,
25197  "raise: exception class must be a subclass of BaseException");
25198  goto bad;
25199  }
25200  if (cause) {
25201  PyObject *fixed_cause;
25202  if (cause == Py_None) {
25203  fixed_cause = NULL;
25204  } else if (PyExceptionClass_Check(cause)) {
25205  fixed_cause = PyObject_CallObject(cause, NULL);
25206  if (fixed_cause == NULL)
25207  goto bad;
25208  } else if (PyExceptionInstance_Check(cause)) {
25209  fixed_cause = cause;
25210  Py_INCREF(fixed_cause);
25211  } else {
25212  PyErr_SetString(PyExc_TypeError,
25213  "exception causes must derive from "
25214  "BaseException");
25215  goto bad;
25216  }
25217  PyException_SetCause(value, fixed_cause);
25218  }
25219  PyErr_SetObject(type, value);
25220  if (tb) {
25221 #if CYTHON_COMPILING_IN_PYPY
25222  PyObject *tmp_type, *tmp_value, *tmp_tb;
25223  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
25224  Py_INCREF(tb);
25225  PyErr_Restore(tmp_type, tmp_value, tb);
25226  Py_XDECREF(tmp_tb);
25227 #else
25228  PyThreadState *tstate = __Pyx_PyThreadState_Current;
25229  PyObject* tmp_tb = tstate->curexc_traceback;
25230  if (tb != tmp_tb) {
25231  Py_INCREF(tb);
25232  tstate->curexc_traceback = tb;
25233  Py_XDECREF(tmp_tb);
25234  }
25235 #endif
25236  }
25237 bad:
25238  Py_XDECREF(owned_instance);
25239  return;
25240 }
25241 #endif
25242 
25243 /* TypeImport */
25244  #ifndef __PYX_HAVE_RT_ImportType
25245 #define __PYX_HAVE_RT_ImportType
25246 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
25247  size_t size, enum __Pyx_ImportType_CheckSize check_size)
25248 {
25249  PyObject *result = 0;
25250  char warning[200];
25251  Py_ssize_t basicsize;
25252 #ifdef Py_LIMITED_API
25253  PyObject *py_basicsize;
25254 #endif
25255  result = PyObject_GetAttrString(module, class_name);
25256  if (!result)
25257  goto bad;
25258  if (!PyType_Check(result)) {
25259  PyErr_Format(PyExc_TypeError,
25260  "%.200s.%.200s is not a type object",
25261  module_name, class_name);
25262  goto bad;
25263  }
25264 #ifndef Py_LIMITED_API
25265  basicsize = ((PyTypeObject *)result)->tp_basicsize;
25266 #else
25267  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
25268  if (!py_basicsize)
25269  goto bad;
25270  basicsize = PyLong_AsSsize_t(py_basicsize);
25271  Py_DECREF(py_basicsize);
25272  py_basicsize = 0;
25273  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25274  goto bad;
25275 #endif
25276  if ((size_t)basicsize < size) {
25277  PyErr_Format(PyExc_ValueError,
25278  "%.200s.%.200s size changed, may indicate binary incompatibility. "
25279  "Expected %zd from C header, got %zd from PyObject",
25280  module_name, class_name, size, basicsize);
25281  goto bad;
25282  }
25283  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
25284  PyErr_Format(PyExc_ValueError,
25285  "%.200s.%.200s size changed, may indicate binary incompatibility. "
25286  "Expected %zd from C header, got %zd from PyObject",
25287  module_name, class_name, size, basicsize);
25288  goto bad;
25289  }
25290  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
25291  PyOS_snprintf(warning, sizeof(warning),
25292  "%s.%s size changed, may indicate binary incompatibility. "
25293  "Expected %zd from C header, got %zd from PyObject",
25294  module_name, class_name, size, basicsize);
25295  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
25296  }
25297  return (PyTypeObject *)result;
25298 bad:
25299  Py_XDECREF(result);
25300  return NULL;
25301 }
25302 #endif
25303 
25304 /* Import */
25305  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
25306  PyObject *empty_list = 0;
25307  PyObject *module = 0;
25308  PyObject *global_dict = 0;
25309  PyObject *empty_dict = 0;
25310  PyObject *list;
25311  #if PY_MAJOR_VERSION < 3
25312  PyObject *py_import;
25313  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
25314  if (!py_import)
25315  goto bad;
25316  #endif
25317  if (from_list)
25318  list = from_list;
25319  else {
25320  empty_list = PyList_New(0);
25321  if (!empty_list)
25322  goto bad;
25323  list = empty_list;
25324  }
25325  global_dict = PyModule_GetDict(__pyx_m);
25326  if (!global_dict)
25327  goto bad;
25328  empty_dict = PyDict_New();
25329  if (!empty_dict)
25330  goto bad;
25331  {
25332  #if PY_MAJOR_VERSION >= 3
25333  if (level == -1) {
25334  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
25335  module = PyImport_ImportModuleLevelObject(
25336  name, global_dict, empty_dict, list, 1);
25337  if (!module) {
25338  if (!PyErr_ExceptionMatches(PyExc_ImportError))
25339  goto bad;
25340  PyErr_Clear();
25341  }
25342  }
25343  level = 0;
25344  }
25345  #endif
25346  if (!module) {
25347  #if PY_MAJOR_VERSION < 3
25348  PyObject *py_level = PyInt_FromLong(level);
25349  if (!py_level)
25350  goto bad;
25351  module = PyObject_CallFunctionObjArgs(py_import,
25352  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
25353  Py_DECREF(py_level);
25354  #else
25355  module = PyImport_ImportModuleLevelObject(
25356  name, global_dict, empty_dict, list, level);
25357  #endif
25358  }
25359  }
25360 bad:
25361  #if PY_MAJOR_VERSION < 3
25362  Py_XDECREF(py_import);
25363  #endif
25364  Py_XDECREF(empty_list);
25365  Py_XDECREF(empty_dict);
25366  return module;
25367 }
25368 
25369 /* CLineInTraceback */
25370  #ifndef CYTHON_CLINE_IN_TRACEBACK
25371 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
25372  PyObject *use_cline;
25373  PyObject *ptype, *pvalue, *ptraceback;
25374 #if CYTHON_COMPILING_IN_CPYTHON
25375  PyObject **cython_runtime_dict;
25376 #endif
25377  if (unlikely(!__pyx_cython_runtime)) {
25378  return c_line;
25379  }
25380  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25381 #if CYTHON_COMPILING_IN_CPYTHON
25382  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25383  if (likely(cython_runtime_dict)) {
25384  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25385  use_cline, *cython_runtime_dict,
25386  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25387  } else
25388 #endif
25389  {
25390  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25391  if (use_cline_obj) {
25392  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25393  Py_DECREF(use_cline_obj);
25394  } else {
25395  PyErr_Clear();
25396  use_cline = NULL;
25397  }
25398  }
25399  if (!use_cline) {
25400  c_line = 0;
25401  (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25402  }
25403  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25404  c_line = 0;
25405  }
25406  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25407  return c_line;
25408 }
25409 #endif
25410 
25411 /* CodeObjectCache */
25412  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
25413  int start = 0, mid = 0, end = count - 1;
25414  if (end >= 0 && code_line > entries[end].code_line) {
25415  return count;
25416  }
25417  while (start < end) {
25418  mid = start + (end - start) / 2;
25419  if (code_line < entries[mid].code_line) {
25420  end = mid;
25421  } else if (code_line > entries[mid].code_line) {
25422  start = mid + 1;
25423  } else {
25424  return mid;
25425  }
25426  }
25427  if (code_line <= entries[mid].code_line) {
25428  return mid;
25429  } else {
25430  return mid + 1;
25431  }
25432 }
25433 static PyCodeObject *__pyx_find_code_object(int code_line) {
25434  PyCodeObject* code_object;
25435  int pos;
25436  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25437  return NULL;
25438  }
25439  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25440  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25441  return NULL;
25442  }
25443  code_object = __pyx_code_cache.entries[pos].code_object;
25444  Py_INCREF(code_object);
25445  return code_object;
25446 }
25447 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
25448  int pos, i;
25449  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25450  if (unlikely(!code_line)) {
25451  return;
25452  }
25453  if (unlikely(!entries)) {
25454  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
25455  if (likely(entries)) {
25456  __pyx_code_cache.entries = entries;
25457  __pyx_code_cache.max_count = 64;
25458  __pyx_code_cache.count = 1;
25459  entries[0].code_line = code_line;
25460  entries[0].code_object = code_object;
25461  Py_INCREF(code_object);
25462  }
25463  return;
25464  }
25465  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25466  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25467  PyCodeObject* tmp = entries[pos].code_object;
25468  entries[pos].code_object = code_object;
25469  Py_DECREF(tmp);
25470  return;
25471  }
25472  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25473  int new_max = __pyx_code_cache.max_count + 64;
25474  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25475  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
25476  if (unlikely(!entries)) {
25477  return;
25478  }
25479  __pyx_code_cache.entries = entries;
25480  __pyx_code_cache.max_count = new_max;
25481  }
25482  for (i=__pyx_code_cache.count; i>pos; i--) {
25483  entries[i] = entries[i-1];
25484  }
25485  entries[pos].code_line = code_line;
25486  entries[pos].code_object = code_object;
25487  __pyx_code_cache.count++;
25488  Py_INCREF(code_object);
25489 }
25490 
25491 /* AddTraceback */
25492  #include "compile.h"
25493 #include "frameobject.h"
25494 #include "traceback.h"
25495 #if PY_VERSION_HEX >= 0x030b00a6
25496  #ifndef Py_BUILD_CORE
25497  #define Py_BUILD_CORE 1
25498  #endif
25499  #include "internal/pycore_frame.h"
25500 #endif
25501 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25502  const char *funcname, int c_line,
25503  int py_line, const char *filename) {
25504  PyCodeObject *py_code = NULL;
25505  PyObject *py_funcname = NULL;
25506  #if PY_MAJOR_VERSION < 3
25507  PyObject *py_srcfile = NULL;
25508  py_srcfile = PyString_FromString(filename);
25509  if (!py_srcfile) goto bad;
25510  #endif
25511  if (c_line) {
25512  #if PY_MAJOR_VERSION < 3
25513  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25514  if (!py_funcname) goto bad;
25515  #else
25516  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25517  if (!py_funcname) goto bad;
25518  funcname = PyUnicode_AsUTF8(py_funcname);
25519  if (!funcname) goto bad;
25520  #endif
25521  }
25522  else {
25523  #if PY_MAJOR_VERSION < 3
25524  py_funcname = PyString_FromString(funcname);
25525  if (!py_funcname) goto bad;
25526  #endif
25527  }
25528  #if PY_MAJOR_VERSION < 3
25529  py_code = __Pyx_PyCode_New(
25530  0,
25531  0,
25532  0,
25533  0,
25534  0,
25535  __pyx_empty_bytes, /*PyObject *code,*/
25536  __pyx_empty_tuple, /*PyObject *consts,*/
25537  __pyx_empty_tuple, /*PyObject *names,*/
25538  __pyx_empty_tuple, /*PyObject *varnames,*/
25539  __pyx_empty_tuple, /*PyObject *freevars,*/
25540  __pyx_empty_tuple, /*PyObject *cellvars,*/
25541  py_srcfile, /*PyObject *filename,*/
25542  py_funcname, /*PyObject *name,*/
25543  py_line,
25544  __pyx_empty_bytes /*PyObject *lnotab*/
25545  );
25546  Py_DECREF(py_srcfile);
25547  #else
25548  py_code = PyCode_NewEmpty(filename, funcname, py_line);
25549  #endif
25550  Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
25551  return py_code;
25552 bad:
25553  Py_XDECREF(py_funcname);
25554  #if PY_MAJOR_VERSION < 3
25555  Py_XDECREF(py_srcfile);
25556  #endif
25557  return NULL;
25558 }
25559 static void __Pyx_AddTraceback(const char *funcname, int c_line,
25560  int py_line, const char *filename) {
25561  PyCodeObject *py_code = 0;
25562  PyFrameObject *py_frame = 0;
25563  PyThreadState *tstate = __Pyx_PyThreadState_Current;
25564  PyObject *ptype, *pvalue, *ptraceback;
25565  if (c_line) {
25566  c_line = __Pyx_CLineForTraceback(tstate, c_line);
25567  }
25568  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25569  if (!py_code) {
25570  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25571  py_code = __Pyx_CreateCodeObjectForTraceback(
25572  funcname, c_line, py_line, filename);
25573  if (!py_code) {
25574  /* If the code object creation fails, then we should clear the
25575  fetched exception references and propagate the new exception */
25576  Py_XDECREF(ptype);
25577  Py_XDECREF(pvalue);
25578  Py_XDECREF(ptraceback);
25579  goto bad;
25580  }
25581  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25582  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25583  }
25584  py_frame = PyFrame_New(
25585  tstate, /*PyThreadState *tstate,*/
25586  py_code, /*PyCodeObject *code,*/
25587  __pyx_d, /*PyObject *globals,*/
25588  0 /*PyObject *locals*/
25589  );
25590  if (!py_frame) goto bad;
25591  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25592  PyTraceBack_Here(py_frame);
25593 bad:
25594  Py_XDECREF(py_code);
25595  Py_XDECREF(py_frame);
25596 }
25597 
25598 #if PY_MAJOR_VERSION < 3
25599 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
25600  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
25601  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
25602  return -1;
25603 }
25604 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
25605  PyObject *obj = view->obj;
25606  if (!obj) return;
25607  if (PyObject_CheckBuffer(obj)) {
25608  PyBuffer_Release(view);
25609  return;
25610  }
25611  if ((0)) {}
25612  view->obj = NULL;
25613  Py_DECREF(obj);
25614 }
25615 #endif
25616 
25617 
25618  /* CIntFromPyVerify */
25619  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25620  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25621 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25622  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25623 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25624  {\
25625  func_type value = func_value;\
25626  if (sizeof(target_type) < sizeof(func_type)) {\
25627  if (unlikely(value != (func_type) (target_type) value)) {\
25628  func_type zero = 0;\
25629  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25630  return (target_type) -1;\
25631  if (is_unsigned && unlikely(value < zero))\
25632  goto raise_neg_overflow;\
25633  else\
25634  goto raise_overflow;\
25635  }\
25636  }\
25637  return (target_type) value;\
25638  }
25639 
25640 /* Declarations */
25641  #if CYTHON_CCOMPLEX
25642  #ifdef __cplusplus
25643  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25644  return ::std::complex< float >(x, y);
25645  }
25646  #else
25647  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25648  return x + y*(__pyx_t_float_complex)_Complex_I;
25649  }
25650  #endif
25651 #else
25652  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25653  __pyx_t_float_complex z;
25654  z.real = x;
25655  z.imag = y;
25656  return z;
25657  }
25658 #endif
25659 
25660 /* Arithmetic */
25661  #if CYTHON_CCOMPLEX
25662 #else
25663  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25664  return (a.real == b.real) && (a.imag == b.imag);
25665  }
25666  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25667  __pyx_t_float_complex z;
25668  z.real = a.real + b.real;
25669  z.imag = a.imag + b.imag;
25670  return z;
25671  }
25672  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25673  __pyx_t_float_complex z;
25674  z.real = a.real - b.real;
25675  z.imag = a.imag - b.imag;
25676  return z;
25677  }
25678  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25679  __pyx_t_float_complex z;
25680  z.real = a.real * b.real - a.imag * b.imag;
25681  z.imag = a.real * b.imag + a.imag * b.real;
25682  return z;
25683  }
25684  #if 1
25685  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25686  if (b.imag == 0) {
25687  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25688  } else if (fabsf(b.real) >= fabsf(b.imag)) {
25689  if (b.real == 0 && b.imag == 0) {
25690  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
25691  } else {
25692  float r = b.imag / b.real;
25693  float s = (float)(1.0) / (b.real + b.imag * r);
25694  return __pyx_t_float_complex_from_parts(
25695  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25696  }
25697  } else {
25698  float r = b.real / b.imag;
25699  float s = (float)(1.0) / (b.imag + b.real * r);
25700  return __pyx_t_float_complex_from_parts(
25701  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25702  }
25703  }
25704  #else
25705  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25706  if (b.imag == 0) {
25707  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25708  } else {
25709  float denom = b.real * b.real + b.imag * b.imag;
25710  return __pyx_t_float_complex_from_parts(
25711  (a.real * b.real + a.imag * b.imag) / denom,
25712  (a.imag * b.real - a.real * b.imag) / denom);
25713  }
25714  }
25715  #endif
25716  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
25717  __pyx_t_float_complex z;
25718  z.real = -a.real;
25719  z.imag = -a.imag;
25720  return z;
25721  }
25722  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
25723  return (a.real == 0) && (a.imag == 0);
25724  }
25725  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
25726  __pyx_t_float_complex z;
25727  z.real = a.real;
25728  z.imag = -a.imag;
25729  return z;
25730  }
25731  #if 1
25732  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
25733  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25734  return sqrtf(z.real*z.real + z.imag*z.imag);
25735  #else
25736  return hypotf(z.real, z.imag);
25737  #endif
25738  }
25739  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25740  __pyx_t_float_complex z;
25741  float r, lnr, theta, z_r, z_theta;
25742  if (b.imag == 0 && b.real == (int)b.real) {
25743  if (b.real < 0) {
25744  float denom = a.real * a.real + a.imag * a.imag;
25745  a.real = a.real / denom;
25746  a.imag = -a.imag / denom;
25747  b.real = -b.real;
25748  }
25749  switch ((int)b.real) {
25750  case 0:
25751  z.real = 1;
25752  z.imag = 0;
25753  return z;
25754  case 1:
25755  return a;
25756  case 2:
25757  return __Pyx_c_prod_float(a, a);
25758  case 3:
25759  z = __Pyx_c_prod_float(a, a);
25760  return __Pyx_c_prod_float(z, a);
25761  case 4:
25762  z = __Pyx_c_prod_float(a, a);
25763  return __Pyx_c_prod_float(z, z);
25764  }
25765  }
25766  if (a.imag == 0) {
25767  if (a.real == 0) {
25768  return a;
25769  } else if (b.imag == 0) {
25770  z.real = powf(a.real, b.real);
25771  z.imag = 0;
25772  return z;
25773  } else if (a.real > 0) {
25774  r = a.real;
25775  theta = 0;
25776  } else {
25777  r = -a.real;
25778  theta = atan2f(0.0, -1.0);
25779  }
25780  } else {
25781  r = __Pyx_c_abs_float(a);
25782  theta = atan2f(a.imag, a.real);
25783  }
25784  lnr = logf(r);
25785  z_r = expf(lnr * b.real - theta * b.imag);
25786  z_theta = theta * b.real + lnr * b.imag;
25787  z.real = z_r * cosf(z_theta);
25788  z.imag = z_r * sinf(z_theta);
25789  return z;
25790  }
25791  #endif
25792 #endif
25793 
25794 /* Declarations */
25795  #if CYTHON_CCOMPLEX
25796  #ifdef __cplusplus
25797  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25798  return ::std::complex< double >(x, y);
25799  }
25800  #else
25801  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25802  return x + y*(__pyx_t_double_complex)_Complex_I;
25803  }
25804  #endif
25805 #else
25806  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25807  __pyx_t_double_complex z;
25808  z.real = x;
25809  z.imag = y;
25810  return z;
25811  }
25812 #endif
25813 
25814 /* Arithmetic */
25815  #if CYTHON_CCOMPLEX
25816 #else
25817  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25818  return (a.real == b.real) && (a.imag == b.imag);
25819  }
25820  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25821  __pyx_t_double_complex z;
25822  z.real = a.real + b.real;
25823  z.imag = a.imag + b.imag;
25824  return z;
25825  }
25826  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25827  __pyx_t_double_complex z;
25828  z.real = a.real - b.real;
25829  z.imag = a.imag - b.imag;
25830  return z;
25831  }
25832  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25833  __pyx_t_double_complex z;
25834  z.real = a.real * b.real - a.imag * b.imag;
25835  z.imag = a.real * b.imag + a.imag * b.real;
25836  return z;
25837  }
25838  #if 1
25839  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25840  if (b.imag == 0) {
25841  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25842  } else if (fabs(b.real) >= fabs(b.imag)) {
25843  if (b.real == 0 && b.imag == 0) {
25844  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
25845  } else {
25846  double r = b.imag / b.real;
25847  double s = (double)(1.0) / (b.real + b.imag * r);
25848  return __pyx_t_double_complex_from_parts(
25849  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25850  }
25851  } else {
25852  double r = b.real / b.imag;
25853  double s = (double)(1.0) / (b.imag + b.real * r);
25854  return __pyx_t_double_complex_from_parts(
25855  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25856  }
25857  }
25858  #else
25859  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25860  if (b.imag == 0) {
25861  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25862  } else {
25863  double denom = b.real * b.real + b.imag * b.imag;
25864  return __pyx_t_double_complex_from_parts(
25865  (a.real * b.real + a.imag * b.imag) / denom,
25866  (a.imag * b.real - a.real * b.imag) / denom);
25867  }
25868  }
25869  #endif
25870  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
25871  __pyx_t_double_complex z;
25872  z.real = -a.real;
25873  z.imag = -a.imag;
25874  return z;
25875  }
25876  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
25877  return (a.real == 0) && (a.imag == 0);
25878  }
25879  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
25880  __pyx_t_double_complex z;
25881  z.real = a.real;
25882  z.imag = -a.imag;
25883  return z;
25884  }
25885  #if 1
25886  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
25887  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25888  return sqrt(z.real*z.real + z.imag*z.imag);
25889  #else
25890  return hypot(z.real, z.imag);
25891  #endif
25892  }
25893  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25894  __pyx_t_double_complex z;
25895  double r, lnr, theta, z_r, z_theta;
25896  if (b.imag == 0 && b.real == (int)b.real) {
25897  if (b.real < 0) {
25898  double denom = a.real * a.real + a.imag * a.imag;
25899  a.real = a.real / denom;
25900  a.imag = -a.imag / denom;
25901  b.real = -b.real;
25902  }
25903  switch ((int)b.real) {
25904  case 0:
25905  z.real = 1;
25906  z.imag = 0;
25907  return z;
25908  case 1:
25909  return a;
25910  case 2:
25911  return __Pyx_c_prod_double(a, a);
25912  case 3:
25913  z = __Pyx_c_prod_double(a, a);
25914  return __Pyx_c_prod_double(z, a);
25915  case 4:
25916  z = __Pyx_c_prod_double(a, a);
25917  return __Pyx_c_prod_double(z, z);
25918  }
25919  }
25920  if (a.imag == 0) {
25921  if (a.real == 0) {
25922  return a;
25923  } else if (b.imag == 0) {
25924  z.real = pow(a.real, b.real);
25925  z.imag = 0;
25926  return z;
25927  } else if (a.real > 0) {
25928  r = a.real;
25929  theta = 0;
25930  } else {
25931  r = -a.real;
25932  theta = atan2(0.0, -1.0);
25933  }
25934  } else {
25935  r = __Pyx_c_abs_double(a);
25936  theta = atan2(a.imag, a.real);
25937  }
25938  lnr = log(r);
25939  z_r = exp(lnr * b.real - theta * b.imag);
25940  z_theta = theta * b.real + lnr * b.imag;
25941  z.real = z_r * cos(z_theta);
25942  z.imag = z_r * sin(z_theta);
25943  return z;
25944  }
25945  #endif
25946 #endif
25947 
25948 /* CIntFromPy */
25949  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
25950 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25951 #pragma GCC diagnostic push
25952 #pragma GCC diagnostic ignored "-Wconversion"
25953 #endif
25954  const int neg_one = (int) -1, const_zero = (int) 0;
25955 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25956 #pragma GCC diagnostic pop
25957 #endif
25958  const int is_unsigned = neg_one > const_zero;
25959 #if PY_MAJOR_VERSION < 3
25960  if (likely(PyInt_Check(x))) {
25961  if (sizeof(int) < sizeof(long)) {
25962  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
25963  } else {
25964  long val = PyInt_AS_LONG(x);
25965  if (is_unsigned && unlikely(val < 0)) {
25966  goto raise_neg_overflow;
25967  }
25968  return (int) val;
25969  }
25970  } else
25971 #endif
25972  if (likely(PyLong_Check(x))) {
25973  if (is_unsigned) {
25974 #if CYTHON_USE_PYLONG_INTERNALS
25975  const digit* digits = ((PyLongObject*)x)->ob_digit;
25976  switch (Py_SIZE(x)) {
25977  case 0: return (int) 0;
25978  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
25979  case 2:
25980  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25981  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25982  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25983  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
25984  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25985  }
25986  }
25987  break;
25988  case 3:
25989  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25990  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25991  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25992  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
25993  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25994  }
25995  }
25996  break;
25997  case 4:
25998  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25999  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26000  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26001  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
26002  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26003  }
26004  }
26005  break;
26006  }
26007 #endif
26008 #if CYTHON_COMPILING_IN_CPYTHON
26009  if (unlikely(Py_SIZE(x) < 0)) {
26010  goto raise_neg_overflow;
26011  }
26012 #else
26013  {
26014  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26015  if (unlikely(result < 0))
26016  return (int) -1;
26017  if (unlikely(result == 1))
26018  goto raise_neg_overflow;
26019  }
26020 #endif
26021  if (sizeof(int) <= sizeof(unsigned long)) {
26022  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
26023 #ifdef HAVE_LONG_LONG
26024  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26025  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26026 #endif
26027  }
26028  } else {
26029 #if CYTHON_USE_PYLONG_INTERNALS
26030  const digit* digits = ((PyLongObject*)x)->ob_digit;
26031  switch (Py_SIZE(x)) {
26032  case 0: return (int) 0;
26033  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
26034  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
26035  case -2:
26036  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
26037  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26038  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26039  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26040  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26041  }
26042  }
26043  break;
26044  case 2:
26045  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26046  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26047  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26048  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26049  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26050  }
26051  }
26052  break;
26053  case -3:
26054  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26055  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26056  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26057  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26058  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26059  }
26060  }
26061  break;
26062  case 3:
26063  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26064  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26065  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26066  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26067  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26068  }
26069  }
26070  break;
26071  case -4:
26072  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26073  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26074  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26075  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26076  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26077  }
26078  }
26079  break;
26080  case 4:
26081  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26082  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26083  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26084  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26085  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26086  }
26087  }
26088  break;
26089  }
26090 #endif
26091  if (sizeof(int) <= sizeof(long)) {
26092  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
26093 #ifdef HAVE_LONG_LONG
26094  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26095  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
26096 #endif
26097  }
26098  }
26099  {
26100 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26101  PyErr_SetString(PyExc_RuntimeError,
26102  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26103 #else
26104  int val;
26105  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26106  #if PY_MAJOR_VERSION < 3
26107  if (likely(v) && !PyLong_Check(v)) {
26108  PyObject *tmp = v;
26109  v = PyNumber_Long(tmp);
26110  Py_DECREF(tmp);
26111  }
26112  #endif
26113  if (likely(v)) {
26114  int one = 1; int is_little = (int)*(unsigned char *)&one;
26115  unsigned char *bytes = (unsigned char *)&val;
26116  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26117  bytes, sizeof(val),
26118  is_little, !is_unsigned);
26119  Py_DECREF(v);
26120  if (likely(!ret))
26121  return val;
26122  }
26123 #endif
26124  return (int) -1;
26125  }
26126  } else {
26127  int val;
26128  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26129  if (!tmp) return (int) -1;
26130  val = __Pyx_PyInt_As_int(tmp);
26131  Py_DECREF(tmp);
26132  return val;
26133  }
26134 raise_overflow:
26135  PyErr_SetString(PyExc_OverflowError,
26136  "value too large to convert to int");
26137  return (int) -1;
26138 raise_neg_overflow:
26139  PyErr_SetString(PyExc_OverflowError,
26140  "can't convert negative value to int");
26141  return (int) -1;
26142 }
26143 
26144 /* CIntToPy */
26145  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26146 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26147 #pragma GCC diagnostic push
26148 #pragma GCC diagnostic ignored "-Wconversion"
26149 #endif
26150  const int neg_one = (int) -1, const_zero = (int) 0;
26151 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26152 #pragma GCC diagnostic pop
26153 #endif
26154  const int is_unsigned = neg_one > const_zero;
26155  if (is_unsigned) {
26156  if (sizeof(int) < sizeof(long)) {
26157  return PyInt_FromLong((long) value);
26158  } else if (sizeof(int) <= sizeof(unsigned long)) {
26159  return PyLong_FromUnsignedLong((unsigned long) value);
26160 #ifdef HAVE_LONG_LONG
26161  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26162  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26163 #endif
26164  }
26165  } else {
26166  if (sizeof(int) <= sizeof(long)) {
26167  return PyInt_FromLong((long) value);
26168 #ifdef HAVE_LONG_LONG
26169  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26170  return PyLong_FromLongLong((PY_LONG_LONG) value);
26171 #endif
26172  }
26173  }
26174  {
26175  int one = 1; int little = (int)*(unsigned char *)&one;
26176  unsigned char *bytes = (unsigned char *)&value;
26177  return _PyLong_FromByteArray(bytes, sizeof(int),
26178  little, !is_unsigned);
26179  }
26180 }
26181 
26182 /* CIntToPy */
26183  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
26184 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26185 #pragma GCC diagnostic push
26186 #pragma GCC diagnostic ignored "-Wconversion"
26187 #endif
26188  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26189 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26190 #pragma GCC diagnostic pop
26191 #endif
26192  const int is_unsigned = neg_one > const_zero;
26193  if (is_unsigned) {
26194  if (sizeof(Py_intptr_t) < sizeof(long)) {
26195  return PyInt_FromLong((long) value);
26196  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26197  return PyLong_FromUnsignedLong((unsigned long) value);
26198 #ifdef HAVE_LONG_LONG
26199  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26200  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26201 #endif
26202  }
26203  } else {
26204  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26205  return PyInt_FromLong((long) value);
26206 #ifdef HAVE_LONG_LONG
26207  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26208  return PyLong_FromLongLong((PY_LONG_LONG) value);
26209 #endif
26210  }
26211  }
26212  {
26213  int one = 1; int little = (int)*(unsigned char *)&one;
26214  unsigned char *bytes = (unsigned char *)&value;
26215  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
26216  little, !is_unsigned);
26217  }
26218 }
26219 
26220 /* CIntFromPy */
26221  static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
26222 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26223 #pragma GCC diagnostic push
26224 #pragma GCC diagnostic ignored "-Wconversion"
26225 #endif
26226  const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26227 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26228 #pragma GCC diagnostic pop
26229 #endif
26230  const int is_unsigned = neg_one > const_zero;
26231 #if PY_MAJOR_VERSION < 3
26232  if (likely(PyInt_Check(x))) {
26233  if (sizeof(Py_intptr_t) < sizeof(long)) {
26234  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
26235  } else {
26236  long val = PyInt_AS_LONG(x);
26237  if (is_unsigned && unlikely(val < 0)) {
26238  goto raise_neg_overflow;
26239  }
26240  return (Py_intptr_t) val;
26241  }
26242  } else
26243 #endif
26244  if (likely(PyLong_Check(x))) {
26245  if (is_unsigned) {
26246 #if CYTHON_USE_PYLONG_INTERNALS
26247  const digit* digits = ((PyLongObject*)x)->ob_digit;
26248  switch (Py_SIZE(x)) {
26249  case 0: return (Py_intptr_t) 0;
26250  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
26251  case 2:
26252  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26253  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26254  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26255  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
26256  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26257  }
26258  }
26259  break;
26260  case 3:
26261  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26262  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26263  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26264  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
26265  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26266  }
26267  }
26268  break;
26269  case 4:
26270  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26271  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26272  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26273  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
26274  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26275  }
26276  }
26277  break;
26278  }
26279 #endif
26280 #if CYTHON_COMPILING_IN_CPYTHON
26281  if (unlikely(Py_SIZE(x) < 0)) {
26282  goto raise_neg_overflow;
26283  }
26284 #else
26285  {
26286  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26287  if (unlikely(result < 0))
26288  return (Py_intptr_t) -1;
26289  if (unlikely(result == 1))
26290  goto raise_neg_overflow;
26291  }
26292 #endif
26293  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26294  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
26295 #ifdef HAVE_LONG_LONG
26296  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26297  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26298 #endif
26299  }
26300  } else {
26301 #if CYTHON_USE_PYLONG_INTERNALS
26302  const digit* digits = ((PyLongObject*)x)->ob_digit;
26303  switch (Py_SIZE(x)) {
26304  case 0: return (Py_intptr_t) 0;
26305  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
26306  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
26307  case -2:
26308  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
26309  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26310  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26311  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26312  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26313  }
26314  }
26315  break;
26316  case 2:
26317  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26318  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26319  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26320  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26321  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26322  }
26323  }
26324  break;
26325  case -3:
26326  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26327  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26328  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26329  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26330  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26331  }
26332  }
26333  break;
26334  case 3:
26335  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26336  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26337  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26338  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26339  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26340  }
26341  }
26342  break;
26343  case -4:
26344  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26345  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26346  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26347  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26348  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26349  }
26350  }
26351  break;
26352  case 4:
26353  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26354  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26355  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26356  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26357  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26358  }
26359  }
26360  break;
26361  }
26362 #endif
26363  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26364  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
26365 #ifdef HAVE_LONG_LONG
26366  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26367  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
26368 #endif
26369  }
26370  }
26371  {
26372 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26373  PyErr_SetString(PyExc_RuntimeError,
26374  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26375 #else
26376  Py_intptr_t val;
26377  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26378  #if PY_MAJOR_VERSION < 3
26379  if (likely(v) && !PyLong_Check(v)) {
26380  PyObject *tmp = v;
26381  v = PyNumber_Long(tmp);
26382  Py_DECREF(tmp);
26383  }
26384  #endif
26385  if (likely(v)) {
26386  int one = 1; int is_little = (int)*(unsigned char *)&one;
26387  unsigned char *bytes = (unsigned char *)&val;
26388  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26389  bytes, sizeof(val),
26390  is_little, !is_unsigned);
26391  Py_DECREF(v);
26392  if (likely(!ret))
26393  return val;
26394  }
26395 #endif
26396  return (Py_intptr_t) -1;
26397  }
26398  } else {
26399  Py_intptr_t val;
26400  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26401  if (!tmp) return (Py_intptr_t) -1;
26402  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
26403  Py_DECREF(tmp);
26404  return val;
26405  }
26406 raise_overflow:
26407  PyErr_SetString(PyExc_OverflowError,
26408  "value too large to convert to Py_intptr_t");
26409  return (Py_intptr_t) -1;
26410 raise_neg_overflow:
26411  PyErr_SetString(PyExc_OverflowError,
26412  "can't convert negative value to Py_intptr_t");
26413  return (Py_intptr_t) -1;
26414 }
26415 
26416 /* CIntToPy */
26417  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26418 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26419 #pragma GCC diagnostic push
26420 #pragma GCC diagnostic ignored "-Wconversion"
26421 #endif
26422  const long neg_one = (long) -1, const_zero = (long) 0;
26423 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26424 #pragma GCC diagnostic pop
26425 #endif
26426  const int is_unsigned = neg_one > const_zero;
26427  if (is_unsigned) {
26428  if (sizeof(long) < sizeof(long)) {
26429  return PyInt_FromLong((long) value);
26430  } else if (sizeof(long) <= sizeof(unsigned long)) {
26431  return PyLong_FromUnsignedLong((unsigned long) value);
26432 #ifdef HAVE_LONG_LONG
26433  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26434  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26435 #endif
26436  }
26437  } else {
26438  if (sizeof(long) <= sizeof(long)) {
26439  return PyInt_FromLong((long) value);
26440 #ifdef HAVE_LONG_LONG
26441  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26442  return PyLong_FromLongLong((PY_LONG_LONG) value);
26443 #endif
26444  }
26445  }
26446  {
26447  int one = 1; int little = (int)*(unsigned char *)&one;
26448  unsigned char *bytes = (unsigned char *)&value;
26449  return _PyLong_FromByteArray(bytes, sizeof(long),
26450  little, !is_unsigned);
26451  }
26452 }
26453 
26454 /* CIntFromPy */
26455  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
26456 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26457 #pragma GCC diagnostic push
26458 #pragma GCC diagnostic ignored "-Wconversion"
26459 #endif
26460  const long neg_one = (long) -1, const_zero = (long) 0;
26461 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26462 #pragma GCC diagnostic pop
26463 #endif
26464  const int is_unsigned = neg_one > const_zero;
26465 #if PY_MAJOR_VERSION < 3
26466  if (likely(PyInt_Check(x))) {
26467  if (sizeof(long) < sizeof(long)) {
26468  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
26469  } else {
26470  long val = PyInt_AS_LONG(x);
26471  if (is_unsigned && unlikely(val < 0)) {
26472  goto raise_neg_overflow;
26473  }
26474  return (long) val;
26475  }
26476  } else
26477 #endif
26478  if (likely(PyLong_Check(x))) {
26479  if (is_unsigned) {
26480 #if CYTHON_USE_PYLONG_INTERNALS
26481  const digit* digits = ((PyLongObject*)x)->ob_digit;
26482  switch (Py_SIZE(x)) {
26483  case 0: return (long) 0;
26484  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
26485  case 2:
26486  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26487  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26488  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26489  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
26490  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26491  }
26492  }
26493  break;
26494  case 3:
26495  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26496  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26497  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26498  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
26499  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26500  }
26501  }
26502  break;
26503  case 4:
26504  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26505  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26506  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26507  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
26508  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26509  }
26510  }
26511  break;
26512  }
26513 #endif
26514 #if CYTHON_COMPILING_IN_CPYTHON
26515  if (unlikely(Py_SIZE(x) < 0)) {
26516  goto raise_neg_overflow;
26517  }
26518 #else
26519  {
26520  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26521  if (unlikely(result < 0))
26522  return (long) -1;
26523  if (unlikely(result == 1))
26524  goto raise_neg_overflow;
26525  }
26526 #endif
26527  if (sizeof(long) <= sizeof(unsigned long)) {
26528  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
26529 #ifdef HAVE_LONG_LONG
26530  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26531  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26532 #endif
26533  }
26534  } else {
26535 #if CYTHON_USE_PYLONG_INTERNALS
26536  const digit* digits = ((PyLongObject*)x)->ob_digit;
26537  switch (Py_SIZE(x)) {
26538  case 0: return (long) 0;
26539  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
26540  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
26541  case -2:
26542  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
26543  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26544  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26545  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26546  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26547  }
26548  }
26549  break;
26550  case 2:
26551  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26552  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26553  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26554  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26555  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26556  }
26557  }
26558  break;
26559  case -3:
26560  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26561  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26562  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26563  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26564  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26565  }
26566  }
26567  break;
26568  case 3:
26569  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26570  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26571  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26572  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26573  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26574  }
26575  }
26576  break;
26577  case -4:
26578  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26579  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26580  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26581  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26582  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26583  }
26584  }
26585  break;
26586  case 4:
26587  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26588  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26589  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26590  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26591  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26592  }
26593  }
26594  break;
26595  }
26596 #endif
26597  if (sizeof(long) <= sizeof(long)) {
26598  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
26599 #ifdef HAVE_LONG_LONG
26600  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26601  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
26602 #endif
26603  }
26604  }
26605  {
26606 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26607  PyErr_SetString(PyExc_RuntimeError,
26608  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26609 #else
26610  long val;
26611  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26612  #if PY_MAJOR_VERSION < 3
26613  if (likely(v) && !PyLong_Check(v)) {
26614  PyObject *tmp = v;
26615  v = PyNumber_Long(tmp);
26616  Py_DECREF(tmp);
26617  }
26618  #endif
26619  if (likely(v)) {
26620  int one = 1; int is_little = (int)*(unsigned char *)&one;
26621  unsigned char *bytes = (unsigned char *)&val;
26622  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26623  bytes, sizeof(val),
26624  is_little, !is_unsigned);
26625  Py_DECREF(v);
26626  if (likely(!ret))
26627  return val;
26628  }
26629 #endif
26630  return (long) -1;
26631  }
26632  } else {
26633  long val;
26634  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26635  if (!tmp) return (long) -1;
26636  val = __Pyx_PyInt_As_long(tmp);
26637  Py_DECREF(tmp);
26638  return val;
26639  }
26640 raise_overflow:
26641  PyErr_SetString(PyExc_OverflowError,
26642  "value too large to convert to long");
26643  return (long) -1;
26644 raise_neg_overflow:
26645  PyErr_SetString(PyExc_OverflowError,
26646  "can't convert negative value to long");
26647  return (long) -1;
26648 }
26649 
26650 /* FastTypeChecks */
26651  #if CYTHON_COMPILING_IN_CPYTHON
26652 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
26653  while (a) {
26654  a = a->tp_base;
26655  if (a == b)
26656  return 1;
26657  }
26658  return b == &PyBaseObject_Type;
26659 }
26660 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
26661  PyObject *mro;
26662  if (a == b) return 1;
26663  mro = a->tp_mro;
26664  if (likely(mro)) {
26665  Py_ssize_t i, n;
26666  n = PyTuple_GET_SIZE(mro);
26667  for (i = 0; i < n; i++) {
26668  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
26669  return 1;
26670  }
26671  return 0;
26672  }
26673  return __Pyx_InBases(a, b);
26674 }
26675 #if PY_MAJOR_VERSION == 2
26676 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
26677  PyObject *exception, *value, *tb;
26678  int res;
26679  __Pyx_PyThreadState_declare
26680  __Pyx_PyThreadState_assign
26681  __Pyx_ErrFetch(&exception, &value, &tb);
26682  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
26683  if (unlikely(res == -1)) {
26684  PyErr_WriteUnraisable(err);
26685  res = 0;
26686  }
26687  if (!res) {
26688  res = PyObject_IsSubclass(err, exc_type2);
26689  if (unlikely(res == -1)) {
26690  PyErr_WriteUnraisable(err);
26691  res = 0;
26692  }
26693  }
26694  __Pyx_ErrRestore(exception, value, tb);
26695  return res;
26696 }
26697 #else
26698 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
26699  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
26700  if (!res) {
26701  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
26702  }
26703  return res;
26704 }
26705 #endif
26706 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
26707  Py_ssize_t i, n;
26708  assert(PyExceptionClass_Check(exc_type));
26709  n = PyTuple_GET_SIZE(tuple);
26710 #if PY_MAJOR_VERSION >= 3
26711  for (i=0; i<n; i++) {
26712  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
26713  }
26714 #endif
26715  for (i=0; i<n; i++) {
26716  PyObject *t = PyTuple_GET_ITEM(tuple, i);
26717  #if PY_MAJOR_VERSION < 3
26718  if (likely(exc_type == t)) return 1;
26719  #endif
26720  if (likely(PyExceptionClass_Check(t))) {
26721  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
26722  } else {
26723  }
26724  }
26725  return 0;
26726 }
26727 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
26728  if (likely(err == exc_type)) return 1;
26729  if (likely(PyExceptionClass_Check(err))) {
26730  if (likely(PyExceptionClass_Check(exc_type))) {
26731  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
26732  } else if (likely(PyTuple_Check(exc_type))) {
26733  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
26734  } else {
26735  }
26736  }
26737  return PyErr_GivenExceptionMatches(err, exc_type);
26738 }
26739 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
26740  assert(PyExceptionClass_Check(exc_type1));
26741  assert(PyExceptionClass_Check(exc_type2));
26742  if (likely(err == exc_type1 || err == exc_type2)) return 1;
26743  if (likely(PyExceptionClass_Check(err))) {
26744  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
26745  }
26746  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
26747 }
26748 #endif
26749 
26750 /* CheckBinaryVersion */
26751  static int __Pyx_check_binary_version(void) {
26752  char ctversion[5];
26753  int same=1, i, found_dot;
26754  const char* rt_from_call = Py_GetVersion();
26755  PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
26756  found_dot = 0;
26757  for (i = 0; i < 4; i++) {
26758  if (!ctversion[i]) {
26759  same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
26760  break;
26761  }
26762  if (rt_from_call[i] != ctversion[i]) {
26763  same = 0;
26764  break;
26765  }
26766  }
26767  if (!same) {
26768  char rtversion[5] = {'\0'};
26769  char message[200];
26770  for (i=0; i<4; ++i) {
26771  if (rt_from_call[i] == '.') {
26772  if (found_dot) break;
26773  found_dot = 1;
26774  } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
26775  break;
26776  }
26777  rtversion[i] = rt_from_call[i];
26778  }
26779  PyOS_snprintf(message, sizeof(message),
26780  "compiletime version %s of module '%.100s' "
26781  "does not match runtime version %s",
26782  ctversion, __Pyx_MODULE_NAME, rtversion);
26783  return PyErr_WarnEx(NULL, message, 1);
26784  }
26785  return 0;
26786 }
26787 
26788 /* InitStrings */
26789  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
26790  while (t->p) {
26791  #if PY_MAJOR_VERSION < 3
26792  if (t->is_unicode) {
26793  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
26794  } else if (t->intern) {
26795  *t->p = PyString_InternFromString(t->s);
26796  } else {
26797  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
26798  }
26799  #else
26800  if (t->is_unicode | t->is_str) {
26801  if (t->intern) {
26802  *t->p = PyUnicode_InternFromString(t->s);
26803  } else if (t->encoding) {
26804  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
26805  } else {
26806  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
26807  }
26808  } else {
26809  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
26810  }
26811  #endif
26812  if (!*t->p)
26813  return -1;
26814  if (PyObject_Hash(*t->p) == -1)
26815  return -1;
26816  ++t;
26817  }
26818  return 0;
26819 }
26820 
26821 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
26822  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
26823 }
26824 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
26825  Py_ssize_t ignore;
26826  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
26827 }
26828 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26829 #if !CYTHON_PEP393_ENABLED
26830 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26831  char* defenc_c;
26832  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
26833  if (!defenc) return NULL;
26834  defenc_c = PyBytes_AS_STRING(defenc);
26835 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26836  {
26837  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
26838  char* c;
26839  for (c = defenc_c; c < end; c++) {
26840  if ((unsigned char) (*c) >= 128) {
26841  PyUnicode_AsASCIIString(o);
26842  return NULL;
26843  }
26844  }
26845  }
26846 #endif
26847  *length = PyBytes_GET_SIZE(defenc);
26848  return defenc_c;
26849 }
26850 #else
26851 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26852  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
26853 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26854  if (likely(PyUnicode_IS_ASCII(o))) {
26855  *length = PyUnicode_GET_LENGTH(o);
26856  return PyUnicode_AsUTF8(o);
26857  } else {
26858  PyUnicode_AsASCIIString(o);
26859  return NULL;
26860  }
26861 #else
26862  return PyUnicode_AsUTF8AndSize(o, length);
26863 #endif
26864 }
26865 #endif
26866 #endif
26867 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26868 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26869  if (
26870 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26871  __Pyx_sys_getdefaultencoding_not_ascii &&
26872 #endif
26873  PyUnicode_Check(o)) {
26874  return __Pyx_PyUnicode_AsStringAndSize(o, length);
26875  } else
26876 #endif
26877 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
26878  if (PyByteArray_Check(o)) {
26879  *length = PyByteArray_GET_SIZE(o);
26880  return PyByteArray_AS_STRING(o);
26881  } else
26882 #endif
26883  {
26884  char* result;
26885  int r = PyBytes_AsStringAndSize(o, &result, length);
26886  if (unlikely(r < 0)) {
26887  return NULL;
26888  } else {
26889  return result;
26890  }
26891  }
26892 }
26893 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
26894  int is_true = x == Py_True;
26895  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
26896  else return PyObject_IsTrue(x);
26897 }
26898 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
26899  int retval;
26900  if (unlikely(!x)) return -1;
26901  retval = __Pyx_PyObject_IsTrue(x);
26902  Py_DECREF(x);
26903  return retval;
26904 }
26905 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
26906 #if PY_MAJOR_VERSION >= 3
26907  if (PyLong_Check(result)) {
26908  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
26909  "__int__ returned non-int (type %.200s). "
26910  "The ability to return an instance of a strict subclass of int "
26911  "is deprecated, and may be removed in a future version of Python.",
26912  Py_TYPE(result)->tp_name)) {
26913  Py_DECREF(result);
26914  return NULL;
26915  }
26916  return result;
26917  }
26918 #endif
26919  PyErr_Format(PyExc_TypeError,
26920  "__%.4s__ returned non-%.4s (type %.200s)",
26921  type_name, type_name, Py_TYPE(result)->tp_name);
26922  Py_DECREF(result);
26923  return NULL;
26924 }
26925 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26926 #if CYTHON_USE_TYPE_SLOTS
26927  PyNumberMethods *m;
26928 #endif
26929  const char *name = NULL;
26930  PyObject *res = NULL;
26931 #if PY_MAJOR_VERSION < 3
26932  if (likely(PyInt_Check(x) || PyLong_Check(x)))
26933 #else
26934  if (likely(PyLong_Check(x)))
26935 #endif
26936  return __Pyx_NewRef(x);
26937 #if CYTHON_USE_TYPE_SLOTS
26938  m = Py_TYPE(x)->tp_as_number;
26939  #if PY_MAJOR_VERSION < 3
26940  if (m && m->nb_int) {
26941  name = "int";
26942  res = m->nb_int(x);
26943  }
26944  else if (m && m->nb_long) {
26945  name = "long";
26946  res = m->nb_long(x);
26947  }
26948  #else
26949  if (likely(m && m->nb_int)) {
26950  name = "int";
26951  res = m->nb_int(x);
26952  }
26953  #endif
26954 #else
26955  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26956  res = PyNumber_Int(x);
26957  }
26958 #endif
26959  if (likely(res)) {
26960 #if PY_MAJOR_VERSION < 3
26961  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26962 #else
26963  if (unlikely(!PyLong_CheckExact(res))) {
26964 #endif
26965  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26966  }
26967  }
26968  else if (!PyErr_Occurred()) {
26969  PyErr_SetString(PyExc_TypeError,
26970  "an integer is required");
26971  }
26972  return res;
26973 }
26974 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26975  Py_ssize_t ival;
26976  PyObject *x;
26977 #if PY_MAJOR_VERSION < 3
26978  if (likely(PyInt_CheckExact(b))) {
26979  if (sizeof(Py_ssize_t) >= sizeof(long))
26980  return PyInt_AS_LONG(b);
26981  else
26982  return PyInt_AsSsize_t(b);
26983  }
26984 #endif
26985  if (likely(PyLong_CheckExact(b))) {
26986  #if CYTHON_USE_PYLONG_INTERNALS
26987  const digit* digits = ((PyLongObject*)b)->ob_digit;
26988  const Py_ssize_t size = Py_SIZE(b);
26989  if (likely(__Pyx_sst_abs(size) <= 1)) {
26990  ival = likely(size) ? digits[0] : 0;
26991  if (size == -1) ival = -ival;
26992  return ival;
26993  } else {
26994  switch (size) {
26995  case 2:
26996  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26997  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26998  }
26999  break;
27000  case -2:
27001  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27002  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27003  }
27004  break;
27005  case 3:
27006  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27007  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27008  }
27009  break;
27010  case -3:
27011  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27012  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27013  }
27014  break;
27015  case 4:
27016  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27017  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27018  }
27019  break;
27020  case -4:
27021  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27022  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27023  }
27024  break;
27025  }
27026  }
27027  #endif
27028  return PyLong_AsSsize_t(b);
27029  }
27030  x = PyNumber_Index(b);
27031  if (!x) return -1;
27032  ival = PyInt_AsSsize_t(x);
27033  Py_DECREF(x);
27034  return ival;
27035 }
27036 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
27037  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
27038  return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
27039 #if PY_MAJOR_VERSION < 3
27040  } else if (likely(PyInt_CheckExact(o))) {
27041  return PyInt_AS_LONG(o);
27042 #endif
27043  } else {
27044  Py_ssize_t ival;
27045  PyObject *x;
27046  x = PyNumber_Index(o);
27047  if (!x) return -1;
27048  ival = PyInt_AsLong(x);
27049  Py_DECREF(x);
27050  return ival;
27051  }
27052 }
27053 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
27054  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
27055 }
27056 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
27057  return PyInt_FromSize_t(ival);
27058 }
27059 
27060 
27061 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
number
Int number
Definition: Headers.h:33
s
Double s
Definition: Headers.h:84
n
Int n
Definition: Headers.h:28
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8