proteus  1.8.1
C/C++/Fortran libraries
cshockCapturing.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__cshockCapturing
694 #define __PYX_HAVE_API__cshockCapturing
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 "subgridError.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/cshockCapturing.pyx",
939  "__init__.pxd",
940  "type.pxd",
941 };
942 
943 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":690
944  * # in Cython to enable them only on the right systems.
945  *
946  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
947  * ctypedef npy_int16 int16_t
948  * ctypedef npy_int32 int32_t
949  */
950 typedef npy_int8 __pyx_t_5numpy_int8_t;
951 
952 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":691
953  *
954  * ctypedef npy_int8 int8_t
955  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
956  * ctypedef npy_int32 int32_t
957  * ctypedef npy_int64 int64_t
958  */
959 typedef npy_int16 __pyx_t_5numpy_int16_t;
960 
961 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":692
962  * ctypedef npy_int8 int8_t
963  * ctypedef npy_int16 int16_t
964  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
965  * ctypedef npy_int64 int64_t
966  * #ctypedef npy_int96 int96_t
967  */
968 typedef npy_int32 __pyx_t_5numpy_int32_t;
969 
970 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":693
971  * ctypedef npy_int16 int16_t
972  * ctypedef npy_int32 int32_t
973  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
974  * #ctypedef npy_int96 int96_t
975  * #ctypedef npy_int128 int128_t
976  */
977 typedef npy_int64 __pyx_t_5numpy_int64_t;
978 
979 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":697
980  * #ctypedef npy_int128 int128_t
981  *
982  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
983  * ctypedef npy_uint16 uint16_t
984  * ctypedef npy_uint32 uint32_t
985  */
986 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
987 
988 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":698
989  *
990  * ctypedef npy_uint8 uint8_t
991  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
992  * ctypedef npy_uint32 uint32_t
993  * ctypedef npy_uint64 uint64_t
994  */
995 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
996 
997 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":699
998  * ctypedef npy_uint8 uint8_t
999  * ctypedef npy_uint16 uint16_t
1000  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1001  * ctypedef npy_uint64 uint64_t
1002  * #ctypedef npy_uint96 uint96_t
1003  */
1004 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1005 
1006 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":700
1007  * ctypedef npy_uint16 uint16_t
1008  * ctypedef npy_uint32 uint32_t
1009  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1010  * #ctypedef npy_uint96 uint96_t
1011  * #ctypedef npy_uint128 uint128_t
1012  */
1013 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1014 
1015 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":704
1016  * #ctypedef npy_uint128 uint128_t
1017  *
1018  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1019  * ctypedef npy_float64 float64_t
1020  * #ctypedef npy_float80 float80_t
1021  */
1022 typedef npy_float32 __pyx_t_5numpy_float32_t;
1023 
1024 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":705
1025  *
1026  * ctypedef npy_float32 float32_t
1027  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1028  * #ctypedef npy_float80 float80_t
1029  * #ctypedef npy_float128 float128_t
1030  */
1031 typedef npy_float64 __pyx_t_5numpy_float64_t;
1032 
1033 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":714
1034  * # The int types are mapped a bit surprising --
1035  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1036  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1037  * ctypedef npy_longlong long_t
1038  * ctypedef npy_longlong longlong_t
1039  */
1040 typedef npy_long __pyx_t_5numpy_int_t;
1041 
1042 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":715
1043  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1044  * ctypedef npy_long int_t
1045  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1046  * ctypedef npy_longlong longlong_t
1047  *
1048  */
1049 typedef npy_longlong __pyx_t_5numpy_long_t;
1050 
1051 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":716
1052  * ctypedef npy_long int_t
1053  * ctypedef npy_longlong long_t
1054  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1055  *
1056  * ctypedef npy_ulong uint_t
1057  */
1058 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1059 
1060 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":718
1061  * ctypedef npy_longlong longlong_t
1062  *
1063  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1064  * ctypedef npy_ulonglong ulong_t
1065  * ctypedef npy_ulonglong ulonglong_t
1066  */
1067 typedef npy_ulong __pyx_t_5numpy_uint_t;
1068 
1069 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":719
1070  *
1071  * ctypedef npy_ulong uint_t
1072  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1073  * ctypedef npy_ulonglong ulonglong_t
1074  *
1075  */
1076 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1077 
1078 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":720
1079  * ctypedef npy_ulong uint_t
1080  * ctypedef npy_ulonglong ulong_t
1081  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1082  *
1083  * ctypedef npy_intp intp_t
1084  */
1085 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1086 
1087 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":722
1088  * ctypedef npy_ulonglong ulonglong_t
1089  *
1090  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1091  * ctypedef npy_uintp uintp_t
1092  *
1093  */
1094 typedef npy_intp __pyx_t_5numpy_intp_t;
1095 
1096 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":723
1097  *
1098  * ctypedef npy_intp intp_t
1099  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1100  *
1101  * ctypedef npy_double float_t
1102  */
1103 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1104 
1105 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":725
1106  * ctypedef npy_uintp uintp_t
1107  *
1108  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1109  * ctypedef npy_double double_t
1110  * ctypedef npy_longdouble longdouble_t
1111  */
1112 typedef npy_double __pyx_t_5numpy_float_t;
1113 
1114 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":726
1115  *
1116  * ctypedef npy_double float_t
1117  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1118  * ctypedef npy_longdouble longdouble_t
1119  *
1120  */
1121 typedef npy_double __pyx_t_5numpy_double_t;
1122 
1123 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":727
1124  * ctypedef npy_double float_t
1125  * ctypedef npy_double double_t
1126  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1127  *
1128  * ctypedef npy_cfloat cfloat_t
1129  */
1130 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1131 /* Declarations.proto */
1132 #if CYTHON_CCOMPLEX
1133  #ifdef __cplusplus
1134  typedef ::std::complex< float > __pyx_t_float_complex;
1135  #else
1136  typedef float _Complex __pyx_t_float_complex;
1137  #endif
1138 #else
1139  typedef struct { float real, imag; } __pyx_t_float_complex;
1140 #endif
1141 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1142 
1143 /* Declarations.proto */
1144 #if CYTHON_CCOMPLEX
1145  #ifdef __cplusplus
1146  typedef ::std::complex< double > __pyx_t_double_complex;
1147  #else
1148  typedef double _Complex __pyx_t_double_complex;
1149  #endif
1150 #else
1151  typedef struct { double real, imag; } __pyx_t_double_complex;
1152 #endif
1153 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1154 
1155 
1156 /*--- Type declarations ---*/
1157 
1158 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":729
1159  * ctypedef npy_longdouble longdouble_t
1160  *
1161  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1162  * ctypedef npy_cdouble cdouble_t
1163  * ctypedef npy_clongdouble clongdouble_t
1164  */
1165 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1166 
1167 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":730
1168  *
1169  * ctypedef npy_cfloat cfloat_t
1170  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1171  * ctypedef npy_clongdouble clongdouble_t
1172  *
1173  */
1174 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1175 
1176 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":731
1177  * ctypedef npy_cfloat cfloat_t
1178  * ctypedef npy_cdouble cdouble_t
1179  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1180  *
1181  * ctypedef npy_cdouble complex_t
1182  */
1183 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1184 
1185 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":733
1186  * ctypedef npy_clongdouble clongdouble_t
1187  *
1188  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1189  *
1190  * cdef inline object PyArray_MultiIterNew1(a):
1191  */
1192 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1193 
1194 /* --- Runtime support code (head) --- */
1195 /* Refnanny.proto */
1196 #ifndef CYTHON_REFNANNY
1197  #define CYTHON_REFNANNY 0
1198 #endif
1199 #if CYTHON_REFNANNY
1200  typedef struct {
1201  void (*INCREF)(void*, PyObject*, int);
1202  void (*DECREF)(void*, PyObject*, int);
1203  void (*GOTREF)(void*, PyObject*, int);
1204  void (*GIVEREF)(void*, PyObject*, int);
1205  void* (*SetupContext)(const char*, int, const char*);
1206  void (*FinishContext)(void**);
1207  } __Pyx_RefNannyAPIStruct;
1208  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1209  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1210  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1211 #ifdef WITH_THREAD
1212  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1213  if (acquire_gil) {\
1214  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1215  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1216  PyGILState_Release(__pyx_gilstate_save);\
1217  } else {\
1218  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1219  }
1220 #else
1221  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1222  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1223 #endif
1224  #define __Pyx_RefNannyFinishContext()\
1225  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1226  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1227  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1228  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1229  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1230  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1231  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1232  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1233  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1234 #else
1235  #define __Pyx_RefNannyDeclarations
1236  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1237  #define __Pyx_RefNannyFinishContext()
1238  #define __Pyx_INCREF(r) Py_INCREF(r)
1239  #define __Pyx_DECREF(r) Py_DECREF(r)
1240  #define __Pyx_GOTREF(r)
1241  #define __Pyx_GIVEREF(r)
1242  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1243  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1244  #define __Pyx_XGOTREF(r)
1245  #define __Pyx_XGIVEREF(r)
1246 #endif
1247 #define __Pyx_XDECREF_SET(r, v) do {\
1248  PyObject *tmp = (PyObject *) r;\
1249  r = v; __Pyx_XDECREF(tmp);\
1250  } while (0)
1251 #define __Pyx_DECREF_SET(r, v) do {\
1252  PyObject *tmp = (PyObject *) r;\
1253  r = v; __Pyx_DECREF(tmp);\
1254  } while (0)
1255 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1256 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1257 
1258 /* RaiseArgTupleInvalid.proto */
1259 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1260  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1261 
1262 /* RaiseDoubleKeywords.proto */
1263 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1264 
1265 /* ParseKeywords.proto */
1266 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1267  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1268  const char* function_name);
1269 
1270 /* ArgTypeTest.proto */
1271 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1272  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1273  __Pyx__ArgTypeTest(obj, type, name, exact))
1274 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1275 
1276 /* PyObjectGetAttrStr.proto */
1277 #if CYTHON_USE_TYPE_SLOTS
1278 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1279 #else
1280 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1281 #endif
1282 
1283 /* GetBuiltinName.proto */
1284 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1285 
1286 /* GetTopmostException.proto */
1287 #if CYTHON_USE_EXC_INFO_STACK
1288 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1289 #endif
1290 
1291 /* PyThreadStateGet.proto */
1292 #if CYTHON_FAST_THREAD_STATE
1293 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1294 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1295 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1296 #else
1297 #define __Pyx_PyThreadState_declare
1298 #define __Pyx_PyThreadState_assign
1299 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1300 #endif
1301 
1302 /* SaveResetException.proto */
1303 #if CYTHON_FAST_THREAD_STATE
1304 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1305 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1306 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1307 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1308 #else
1309 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1310 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1311 #endif
1312 
1313 /* PyErrExceptionMatches.proto */
1314 #if CYTHON_FAST_THREAD_STATE
1315 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1316 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1317 #else
1318 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1319 #endif
1320 
1321 /* GetException.proto */
1322 #if CYTHON_FAST_THREAD_STATE
1323 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1324 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1325 #else
1326 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1327 #endif
1328 
1329 /* PyObjectCall.proto */
1330 #if CYTHON_COMPILING_IN_CPYTHON
1331 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1332 #else
1333 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1334 #endif
1335 
1336 /* PyErrFetchRestore.proto */
1337 #if CYTHON_FAST_THREAD_STATE
1338 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1339 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1340 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1341 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1342 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1343 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1344 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1345 #if CYTHON_COMPILING_IN_CPYTHON
1346 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1347 #else
1348 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1349 #endif
1350 #else
1351 #define __Pyx_PyErr_Clear() PyErr_Clear()
1352 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1353 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1354 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1355 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1356 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1357 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1358 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1359 #endif
1360 
1361 /* RaiseException.proto */
1362 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1363 
1364 /* TypeImport.proto */
1365 #ifndef __PYX_HAVE_RT_ImportType_proto
1366 #define __PYX_HAVE_RT_ImportType_proto
1367 enum __Pyx_ImportType_CheckSize {
1368  __Pyx_ImportType_CheckSize_Error = 0,
1369  __Pyx_ImportType_CheckSize_Warn = 1,
1370  __Pyx_ImportType_CheckSize_Ignore = 2
1371 };
1372 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1373 #endif
1374 
1375 /* Import.proto */
1376 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1377 
1378 /* PyDictVersioning.proto */
1379 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1380 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1381 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1382 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1383  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1384  (cache_var) = (value);
1385 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1386  static PY_UINT64_T __pyx_dict_version = 0;\
1387  static PyObject *__pyx_dict_cached_value = NULL;\
1388  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1389  (VAR) = __pyx_dict_cached_value;\
1390  } else {\
1391  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1392  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1393  }\
1394 }
1395 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1396 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1397 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1398 #else
1399 #define __PYX_GET_DICT_VERSION(dict) (0)
1400 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1401 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1402 #endif
1403 
1404 /* CLineInTraceback.proto */
1405 #ifdef CYTHON_CLINE_IN_TRACEBACK
1406 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1407 #else
1408 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1409 #endif
1410 
1411 /* CodeObjectCache.proto */
1412 typedef struct {
1413  PyCodeObject* code_object;
1414  int code_line;
1415 } __Pyx_CodeObjectCacheEntry;
1416 struct __Pyx_CodeObjectCache {
1417  int count;
1418  int max_count;
1419  __Pyx_CodeObjectCacheEntry* entries;
1420 };
1421 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1422 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1423 static PyCodeObject *__pyx_find_code_object(int code_line);
1424 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1425 
1426 /* AddTraceback.proto */
1427 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1428  int py_line, const char *filename);
1429 
1430 /* GCCDiagnostics.proto */
1431 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1432 #define __Pyx_HAS_GCC_DIAGNOSTIC
1433 #endif
1434 
1435 /* RealImag.proto */
1436 #if CYTHON_CCOMPLEX
1437  #ifdef __cplusplus
1438  #define __Pyx_CREAL(z) ((z).real())
1439  #define __Pyx_CIMAG(z) ((z).imag())
1440  #else
1441  #define __Pyx_CREAL(z) (__real__(z))
1442  #define __Pyx_CIMAG(z) (__imag__(z))
1443  #endif
1444 #else
1445  #define __Pyx_CREAL(z) ((z).real)
1446  #define __Pyx_CIMAG(z) ((z).imag)
1447 #endif
1448 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1449  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1450  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1451  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1452 #else
1453  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1454  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1455 #endif
1456 
1457 /* Arithmetic.proto */
1458 #if CYTHON_CCOMPLEX
1459  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1460  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1461  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1462  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1463  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1464  #define __Pyx_c_neg_float(a) (-(a))
1465  #ifdef __cplusplus
1466  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1467  #define __Pyx_c_conj_float(z) (::std::conj(z))
1468  #if 1
1469  #define __Pyx_c_abs_float(z) (::std::abs(z))
1470  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1471  #endif
1472  #else
1473  #define __Pyx_c_is_zero_float(z) ((z)==0)
1474  #define __Pyx_c_conj_float(z) (conjf(z))
1475  #if 1
1476  #define __Pyx_c_abs_float(z) (cabsf(z))
1477  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1478  #endif
1479  #endif
1480 #else
1481  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1482  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1483  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1484  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1485  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1486  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1487  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1488  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1489  #if 1
1490  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1491  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1492  #endif
1493 #endif
1494 
1495 /* Arithmetic.proto */
1496 #if CYTHON_CCOMPLEX
1497  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1498  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1499  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1500  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1501  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1502  #define __Pyx_c_neg_double(a) (-(a))
1503  #ifdef __cplusplus
1504  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1505  #define __Pyx_c_conj_double(z) (::std::conj(z))
1506  #if 1
1507  #define __Pyx_c_abs_double(z) (::std::abs(z))
1508  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1509  #endif
1510  #else
1511  #define __Pyx_c_is_zero_double(z) ((z)==0)
1512  #define __Pyx_c_conj_double(z) (conj(z))
1513  #if 1
1514  #define __Pyx_c_abs_double(z) (cabs(z))
1515  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1516  #endif
1517  #endif
1518 #else
1519  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1520  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1521  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1522  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1523  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1524  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1525  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1526  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1527  #if 1
1528  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1529  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1530  #endif
1531 #endif
1532 
1533 /* CIntFromPy.proto */
1534 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
1535 
1536 /* CIntToPy.proto */
1537 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1538 
1539 /* CIntFromPy.proto */
1540 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1541 
1542 /* CIntFromPy.proto */
1543 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1544 
1545 /* FastTypeChecks.proto */
1546 #if CYTHON_COMPILING_IN_CPYTHON
1547 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1548 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1549 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1550 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1551 #else
1552 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1553 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1554 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1555 #endif
1556 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1557 
1558 /* CheckBinaryVersion.proto */
1559 static int __Pyx_check_binary_version(void);
1560 
1561 /* InitStrings.proto */
1562 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1563 
1564 
1565 /* Module declarations from 'cpython.buffer' */
1566 
1567 /* Module declarations from 'libc.string' */
1568 
1569 /* Module declarations from 'libc.stdio' */
1570 
1571 /* Module declarations from '__builtin__' */
1572 
1573 /* Module declarations from 'cpython.type' */
1574 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1575 
1576 /* Module declarations from 'cpython' */
1577 
1578 /* Module declarations from 'cpython.object' */
1579 
1580 /* Module declarations from 'cpython.ref' */
1581 
1582 /* Module declarations from 'cpython.mem' */
1583 
1584 /* Module declarations from 'numpy' */
1585 
1586 /* Module declarations from 'numpy' */
1587 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1588 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1589 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1590 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1591 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
1592 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
1593 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
1594 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
1595 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
1596 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
1597 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
1598 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
1599 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
1600 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
1601 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1602 
1603 /* Module declarations from 'cshockCapturing' */
1604 #define __Pyx_MODULE_NAME "cshockCapturing"
1605 extern int __pyx_module_is_main_cshockCapturing;
1606 int __pyx_module_is_main_cshockCapturing = 0;
1607 
1608 /* Implementation of 'cshockCapturing' */
1609 static PyObject *__pyx_builtin_ImportError;
1610 static const char __pyx_k_H[] = "H";
1611 static const char __pyx_k_df[] = "df";
1612 static const char __pyx_k_mt[] = "mt";
1613 static const char __pyx_k_np[] = "np";
1614 static const char __pyx_k_uSC[] = "uSC";
1615 static const char __pyx_k_beta[] = "beta";
1616 static const char __pyx_k_main[] = "__main__";
1617 static const char __pyx_k_name[] = "__name__";
1618 static const char __pyx_k_test[] = "__test__";
1619 static const char __pyx_k_numpy[] = "numpy";
1620 static const char __pyx_k_grad_u[] = "grad_u";
1621 static const char __pyx_k_import[] = "__import__";
1622 static const char __pyx_k_numDiff[] = "numDiff";
1623 static const char __pyx_k_ImportError[] = "ImportError";
1624 static const char __pyx_k_shockCapturing[] = "shockCapturing";
1625 static const char __pyx_k_cshockCapturing[] = "cshockCapturing";
1626 static const char __pyx_k_elementDiameter[] = "elementDiameter";
1627 static const char __pyx_k_strong_residual[] = "strong_residual";
1628 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1629 static const char __pyx_k_shockCapturingFactor[] = "shockCapturingFactor";
1630 static const char __pyx_k_shockCapturingDiffusion[] = "shockCapturingDiffusion";
1631 static const char __pyx_k_proteus_cshockCapturing_pyx[] = "proteus/cshockCapturing.pyx";
1632 static const char __pyx_k_calculateNumericalDiffusionHJ[] = "calculateNumericalDiffusionHJ";
1633 static const char __pyx_k_calculateNumericalDiffusionHJV2[] = "calculateNumericalDiffusionHJV2";
1634 static const char __pyx_k_calculateNumericalDiffusion_A_1[] = "calculateNumericalDiffusion_A_1";
1635 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1636 static const char __pyx_k_calculateNumericalDiffusionEikon[] = "calculateNumericalDiffusionEikonal";
1637 static const char __pyx_k_calculateNumericalDiffusionJaffr[] = "calculateNumericalDiffusionJaffre";
1638 static const char __pyx_k_calculateNumericalDiffusionResGr[] = "calculateNumericalDiffusionResGrad";
1639 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1640 static const char __pyx_k_calculateNumericalDiffusionResGr_2[] = "calculateNumericalDiffusionResGradQuad";
1641 static const char __pyx_k_calculateNumericalDiffusionResGr_3[] = "calculateNumericalDiffusionResGradJuanes";
1642 static PyObject *__pyx_n_s_H;
1643 static PyObject *__pyx_n_s_ImportError;
1644 static PyObject *__pyx_n_s_beta;
1645 static PyObject *__pyx_n_s_calculateNumericalDiffusionEikon;
1646 static PyObject *__pyx_n_s_calculateNumericalDiffusionHJ;
1647 static PyObject *__pyx_n_s_calculateNumericalDiffusionHJV2;
1648 static PyObject *__pyx_n_s_calculateNumericalDiffusionJaffr;
1649 static PyObject *__pyx_n_s_calculateNumericalDiffusionResGr;
1650 static PyObject *__pyx_n_s_calculateNumericalDiffusionResGr_2;
1651 static PyObject *__pyx_n_s_calculateNumericalDiffusionResGr_3;
1652 static PyObject *__pyx_n_s_calculateNumericalDiffusion_A_1;
1653 static PyObject *__pyx_n_s_cline_in_traceback;
1654 static PyObject *__pyx_n_s_cshockCapturing;
1655 static PyObject *__pyx_n_s_df;
1656 static PyObject *__pyx_n_s_elementDiameter;
1657 static PyObject *__pyx_n_s_grad_u;
1658 static PyObject *__pyx_n_s_import;
1659 static PyObject *__pyx_n_s_main;
1660 static PyObject *__pyx_n_s_mt;
1661 static PyObject *__pyx_n_s_name;
1662 static PyObject *__pyx_n_s_np;
1663 static PyObject *__pyx_n_s_numDiff;
1664 static PyObject *__pyx_n_s_numpy;
1665 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1666 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1667 static PyObject *__pyx_kp_s_proteus_cshockCapturing_pyx;
1668 static PyObject *__pyx_n_s_shockCapturing;
1669 static PyObject *__pyx_n_s_shockCapturingDiffusion;
1670 static PyObject *__pyx_n_s_shockCapturingFactor;
1671 static PyObject *__pyx_n_s_strong_residual;
1672 static PyObject *__pyx_n_s_test;
1673 static PyObject *__pyx_n_s_uSC;
1674 static PyObject *__pyx_pf_15cshockCapturing_calculateNumericalDiffusionResGrad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff); /* proto */
1675 static PyObject *__pyx_pf_15cshockCapturing_2calculateNumericalDiffusionResGradQuad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff); /* proto */
1676 static PyObject *__pyx_pf_15cshockCapturing_4calculateNumericalDiffusionEikonal(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_numDiff); /* proto */
1677 static PyObject *__pyx_pf_15cshockCapturing_6calculateNumericalDiffusionHJ(CYTHON_UNUSED PyObject *__pyx_self, char __pyx_v_shockCapturing, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_H, PyArrayObject *__pyx_v_numDiff); /* proto */
1678 static PyObject *__pyx_pf_15cshockCapturing_8calculateNumericalDiffusionHJV2(CYTHON_UNUSED PyObject *__pyx_self, char __pyx_v_shockCapturing, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_H, PyArrayObject *__pyx_v_numDiff); /* proto */
1679 static PyObject *__pyx_pf_15cshockCapturing_10calculateNumericalDiffusion_A_1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingFactor, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_numDiff); /* proto */
1680 static PyObject *__pyx_pf_15cshockCapturing_12calculateNumericalDiffusionResGradJuanes(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, double __pyx_v_uSC, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff); /* proto */
1681 static PyObject *__pyx_pf_15cshockCapturing_14calculateNumericalDiffusionJaffre(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, double __pyx_v_beta, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff); /* proto */
1682 static PyObject *__pyx_tuple_;
1683 static PyObject *__pyx_tuple__2;
1684 static PyObject *__pyx_tuple__3;
1685 static PyObject *__pyx_tuple__5;
1686 static PyObject *__pyx_tuple__7;
1687 static PyObject *__pyx_tuple__9;
1688 static PyObject *__pyx_tuple__11;
1689 static PyObject *__pyx_tuple__13;
1690 static PyObject *__pyx_tuple__15;
1691 static PyObject *__pyx_tuple__17;
1692 static PyObject *__pyx_codeobj__4;
1693 static PyObject *__pyx_codeobj__6;
1694 static PyObject *__pyx_codeobj__8;
1695 static PyObject *__pyx_codeobj__10;
1696 static PyObject *__pyx_codeobj__12;
1697 static PyObject *__pyx_codeobj__14;
1698 static PyObject *__pyx_codeobj__16;
1699 static PyObject *__pyx_codeobj__18;
1700 /* Late includes */
1701 
1702 /* "cshockCapturing.pyx":73
1703  * double* numDiff)
1704  * ###11111111111
1705  * def calculateNumericalDiffusionResGrad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
1706  * np.ndarray elementDiameter,
1707  * np.ndarray strong_residual,
1708  */
1709 
1710 /* Python wrapper */
1711 static PyObject *__pyx_pw_15cshockCapturing_1calculateNumericalDiffusionResGrad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1712 static PyMethodDef __pyx_mdef_15cshockCapturing_1calculateNumericalDiffusionResGrad = {"calculateNumericalDiffusionResGrad", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_1calculateNumericalDiffusionResGrad, METH_VARARGS|METH_KEYWORDS, 0};
1713 static PyObject *__pyx_pw_15cshockCapturing_1calculateNumericalDiffusionResGrad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1714  double __pyx_v_shockCapturingDiffusion;
1715  PyArrayObject *__pyx_v_elementDiameter = 0;
1716  PyArrayObject *__pyx_v_strong_residual = 0;
1717  PyArrayObject *__pyx_v_grad_u = 0;
1718  PyArrayObject *__pyx_v_numDiff = 0;
1719  int __pyx_lineno = 0;
1720  const char *__pyx_filename = NULL;
1721  int __pyx_clineno = 0;
1722  PyObject *__pyx_r = 0;
1723  __Pyx_RefNannyDeclarations
1724  __Pyx_RefNannySetupContext("calculateNumericalDiffusionResGrad (wrapper)", 0);
1725  {
1726  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_grad_u,&__pyx_n_s_numDiff,0};
1727  PyObject* values[5] = {0,0,0,0,0};
1728  if (unlikely(__pyx_kwds)) {
1729  Py_ssize_t kw_args;
1730  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1731  switch (pos_args) {
1732  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1733  CYTHON_FALLTHROUGH;
1734  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1735  CYTHON_FALLTHROUGH;
1736  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1737  CYTHON_FALLTHROUGH;
1738  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1739  CYTHON_FALLTHROUGH;
1740  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1741  CYTHON_FALLTHROUGH;
1742  case 0: break;
1743  default: goto __pyx_L5_argtuple_error;
1744  }
1745  kw_args = PyDict_Size(__pyx_kwds);
1746  switch (pos_args) {
1747  case 0:
1748  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
1749  else goto __pyx_L5_argtuple_error;
1750  CYTHON_FALLTHROUGH;
1751  case 1:
1752  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
1753  else {
1754  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGrad", 1, 5, 5, 1); __PYX_ERR(0, 73, __pyx_L3_error)
1755  }
1756  CYTHON_FALLTHROUGH;
1757  case 2:
1758  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
1759  else {
1760  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGrad", 1, 5, 5, 2); __PYX_ERR(0, 73, __pyx_L3_error)
1761  }
1762  CYTHON_FALLTHROUGH;
1763  case 3:
1764  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
1765  else {
1766  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGrad", 1, 5, 5, 3); __PYX_ERR(0, 73, __pyx_L3_error)
1767  }
1768  CYTHON_FALLTHROUGH;
1769  case 4:
1770  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
1771  else {
1772  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGrad", 1, 5, 5, 4); __PYX_ERR(0, 73, __pyx_L3_error)
1773  }
1774  }
1775  if (unlikely(kw_args > 0)) {
1776  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionResGrad") < 0)) __PYX_ERR(0, 73, __pyx_L3_error)
1777  }
1778  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
1779  goto __pyx_L5_argtuple_error;
1780  } else {
1781  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1782  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1783  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1784  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1785  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1786  }
1787  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error)
1788  __pyx_v_elementDiameter = ((PyArrayObject *)values[1]);
1789  __pyx_v_strong_residual = ((PyArrayObject *)values[2]);
1790  __pyx_v_grad_u = ((PyArrayObject *)values[3]);
1791  __pyx_v_numDiff = ((PyArrayObject *)values[4]);
1792  }
1793  goto __pyx_L4_argument_unpacking_done;
1794  __pyx_L5_argtuple_error:;
1795  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGrad", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 73, __pyx_L3_error)
1796  __pyx_L3_error:;
1797  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionResGrad", __pyx_clineno, __pyx_lineno, __pyx_filename);
1798  __Pyx_RefNannyFinishContext();
1799  return NULL;
1800  __pyx_L4_argument_unpacking_done:;
1801  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 74, __pyx_L1_error)
1802  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 75, __pyx_L1_error)
1803  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grad_u), __pyx_ptype_5numpy_ndarray, 1, "grad_u", 0))) __PYX_ERR(0, 76, __pyx_L1_error)
1804  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 77, __pyx_L1_error)
1805  __pyx_r = __pyx_pf_15cshockCapturing_calculateNumericalDiffusionResGrad(__pyx_self, __pyx_v_shockCapturingDiffusion, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_grad_u, __pyx_v_numDiff);
1806 
1807  /* function exit code */
1808  goto __pyx_L0;
1809  __pyx_L1_error:;
1810  __pyx_r = NULL;
1811  __pyx_L0:;
1812  __Pyx_RefNannyFinishContext();
1813  return __pyx_r;
1814 }
1815 
1816 static PyObject *__pyx_pf_15cshockCapturing_calculateNumericalDiffusionResGrad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff) {
1817  PyObject *__pyx_r = NULL;
1818  __Pyx_RefNannyDeclarations
1819  __Pyx_RefNannySetupContext("calculateNumericalDiffusionResGrad", 0);
1820 
1821  /* "cshockCapturing.pyx":78
1822  * np.ndarray grad_u,
1823  * np.ndarray numDiff):
1824  * ccalculateNumericalDiffusionResGrad(grad_u.shape[0], # <<<<<<<<<<<<<<
1825  * grad_u.shape[1],
1826  * grad_u.shape[2],
1827  */
1828  calculateNumericalDiffusionResGrad((__pyx_v_grad_u->dimensions[0]), (__pyx_v_grad_u->dimensions[1]), (__pyx_v_grad_u->dimensions[2]), __pyx_v_shockCapturingDiffusion, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_grad_u->data), ((double *)__pyx_v_numDiff->data));
1829 
1830  /* "cshockCapturing.pyx":73
1831  * double* numDiff)
1832  * ###11111111111
1833  * def calculateNumericalDiffusionResGrad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
1834  * np.ndarray elementDiameter,
1835  * np.ndarray strong_residual,
1836  */
1837 
1838  /* function exit code */
1839  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1840  __Pyx_XGIVEREF(__pyx_r);
1841  __Pyx_RefNannyFinishContext();
1842  return __pyx_r;
1843 }
1844 
1845 /* "cshockCapturing.pyx":86
1846  * <double*> grad_u.data,
1847  * <double*> numDiff.data)
1848  * def calculateNumericalDiffusionResGradQuad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
1849  * np.ndarray elementDiameter,
1850  * np.ndarray strong_residual,
1851  */
1852 
1853 /* Python wrapper */
1854 static PyObject *__pyx_pw_15cshockCapturing_3calculateNumericalDiffusionResGradQuad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1855 static PyMethodDef __pyx_mdef_15cshockCapturing_3calculateNumericalDiffusionResGradQuad = {"calculateNumericalDiffusionResGradQuad", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_3calculateNumericalDiffusionResGradQuad, METH_VARARGS|METH_KEYWORDS, 0};
1856 static PyObject *__pyx_pw_15cshockCapturing_3calculateNumericalDiffusionResGradQuad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1857  double __pyx_v_shockCapturingDiffusion;
1858  PyArrayObject *__pyx_v_elementDiameter = 0;
1859  PyArrayObject *__pyx_v_strong_residual = 0;
1860  PyArrayObject *__pyx_v_grad_u = 0;
1861  PyArrayObject *__pyx_v_numDiff = 0;
1862  int __pyx_lineno = 0;
1863  const char *__pyx_filename = NULL;
1864  int __pyx_clineno = 0;
1865  PyObject *__pyx_r = 0;
1866  __Pyx_RefNannyDeclarations
1867  __Pyx_RefNannySetupContext("calculateNumericalDiffusionResGradQuad (wrapper)", 0);
1868  {
1869  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_grad_u,&__pyx_n_s_numDiff,0};
1870  PyObject* values[5] = {0,0,0,0,0};
1871  if (unlikely(__pyx_kwds)) {
1872  Py_ssize_t kw_args;
1873  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1874  switch (pos_args) {
1875  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1876  CYTHON_FALLTHROUGH;
1877  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1878  CYTHON_FALLTHROUGH;
1879  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1880  CYTHON_FALLTHROUGH;
1881  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1882  CYTHON_FALLTHROUGH;
1883  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1884  CYTHON_FALLTHROUGH;
1885  case 0: break;
1886  default: goto __pyx_L5_argtuple_error;
1887  }
1888  kw_args = PyDict_Size(__pyx_kwds);
1889  switch (pos_args) {
1890  case 0:
1891  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
1892  else goto __pyx_L5_argtuple_error;
1893  CYTHON_FALLTHROUGH;
1894  case 1:
1895  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
1896  else {
1897  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradQuad", 1, 5, 5, 1); __PYX_ERR(0, 86, __pyx_L3_error)
1898  }
1899  CYTHON_FALLTHROUGH;
1900  case 2:
1901  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
1902  else {
1903  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradQuad", 1, 5, 5, 2); __PYX_ERR(0, 86, __pyx_L3_error)
1904  }
1905  CYTHON_FALLTHROUGH;
1906  case 3:
1907  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
1908  else {
1909  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradQuad", 1, 5, 5, 3); __PYX_ERR(0, 86, __pyx_L3_error)
1910  }
1911  CYTHON_FALLTHROUGH;
1912  case 4:
1913  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
1914  else {
1915  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradQuad", 1, 5, 5, 4); __PYX_ERR(0, 86, __pyx_L3_error)
1916  }
1917  }
1918  if (unlikely(kw_args > 0)) {
1919  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionResGradQuad") < 0)) __PYX_ERR(0, 86, __pyx_L3_error)
1920  }
1921  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
1922  goto __pyx_L5_argtuple_error;
1923  } else {
1924  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1925  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1926  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1927  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1928  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1929  }
1930  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L3_error)
1931  __pyx_v_elementDiameter = ((PyArrayObject *)values[1]);
1932  __pyx_v_strong_residual = ((PyArrayObject *)values[2]);
1933  __pyx_v_grad_u = ((PyArrayObject *)values[3]);
1934  __pyx_v_numDiff = ((PyArrayObject *)values[4]);
1935  }
1936  goto __pyx_L4_argument_unpacking_done;
1937  __pyx_L5_argtuple_error:;
1938  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradQuad", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 86, __pyx_L3_error)
1939  __pyx_L3_error:;
1940  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionResGradQuad", __pyx_clineno, __pyx_lineno, __pyx_filename);
1941  __Pyx_RefNannyFinishContext();
1942  return NULL;
1943  __pyx_L4_argument_unpacking_done:;
1944  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 87, __pyx_L1_error)
1945  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
1946  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grad_u), __pyx_ptype_5numpy_ndarray, 1, "grad_u", 0))) __PYX_ERR(0, 89, __pyx_L1_error)
1947  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 90, __pyx_L1_error)
1948  __pyx_r = __pyx_pf_15cshockCapturing_2calculateNumericalDiffusionResGradQuad(__pyx_self, __pyx_v_shockCapturingDiffusion, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_grad_u, __pyx_v_numDiff);
1949 
1950  /* function exit code */
1951  goto __pyx_L0;
1952  __pyx_L1_error:;
1953  __pyx_r = NULL;
1954  __pyx_L0:;
1955  __Pyx_RefNannyFinishContext();
1956  return __pyx_r;
1957 }
1958 
1959 static PyObject *__pyx_pf_15cshockCapturing_2calculateNumericalDiffusionResGradQuad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff) {
1960  PyObject *__pyx_r = NULL;
1961  __Pyx_RefNannyDeclarations
1962  __Pyx_RefNannySetupContext("calculateNumericalDiffusionResGradQuad", 0);
1963 
1964  /* "cshockCapturing.pyx":91
1965  * np.ndarray grad_u,
1966  * np.ndarray numDiff):
1967  * ccalculateNumericalDiffusionResGradQuad(grad_u.shape[0], # <<<<<<<<<<<<<<
1968  * grad_u.shape[1],
1969  * grad_u.shape[2],
1970  */
1971  calculateNumericalDiffusionResGradQuad((__pyx_v_grad_u->dimensions[0]), (__pyx_v_grad_u->dimensions[1]), (__pyx_v_grad_u->dimensions[2]), __pyx_v_shockCapturingDiffusion, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_grad_u->data), ((double *)__pyx_v_numDiff->data));
1972 
1973  /* "cshockCapturing.pyx":86
1974  * <double*> grad_u.data,
1975  * <double*> numDiff.data)
1976  * def calculateNumericalDiffusionResGradQuad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
1977  * np.ndarray elementDiameter,
1978  * np.ndarray strong_residual,
1979  */
1980 
1981  /* function exit code */
1982  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1983  __Pyx_XGIVEREF(__pyx_r);
1984  __Pyx_RefNannyFinishContext();
1985  return __pyx_r;
1986 }
1987 
1988 /* "cshockCapturing.pyx":99
1989  * <double*> grad_u.data,
1990  * <double*> numDiff.data)
1991  * def calculateNumericalDiffusionEikonal(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
1992  * np.ndarray elementDiameter,
1993  * np.ndarray strong_residual,
1994  */
1995 
1996 /* Python wrapper */
1997 static PyObject *__pyx_pw_15cshockCapturing_5calculateNumericalDiffusionEikonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1998 static PyMethodDef __pyx_mdef_15cshockCapturing_5calculateNumericalDiffusionEikonal = {"calculateNumericalDiffusionEikonal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_5calculateNumericalDiffusionEikonal, METH_VARARGS|METH_KEYWORDS, 0};
1999 static PyObject *__pyx_pw_15cshockCapturing_5calculateNumericalDiffusionEikonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2000  double __pyx_v_shockCapturingDiffusion;
2001  PyArrayObject *__pyx_v_elementDiameter = 0;
2002  PyArrayObject *__pyx_v_strong_residual = 0;
2003  PyArrayObject *__pyx_v_numDiff = 0;
2004  int __pyx_lineno = 0;
2005  const char *__pyx_filename = NULL;
2006  int __pyx_clineno = 0;
2007  PyObject *__pyx_r = 0;
2008  __Pyx_RefNannyDeclarations
2009  __Pyx_RefNannySetupContext("calculateNumericalDiffusionEikonal (wrapper)", 0);
2010  {
2011  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_numDiff,0};
2012  PyObject* values[4] = {0,0,0,0};
2013  if (unlikely(__pyx_kwds)) {
2014  Py_ssize_t kw_args;
2015  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2016  switch (pos_args) {
2017  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2018  CYTHON_FALLTHROUGH;
2019  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2020  CYTHON_FALLTHROUGH;
2021  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2022  CYTHON_FALLTHROUGH;
2023  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2024  CYTHON_FALLTHROUGH;
2025  case 0: break;
2026  default: goto __pyx_L5_argtuple_error;
2027  }
2028  kw_args = PyDict_Size(__pyx_kwds);
2029  switch (pos_args) {
2030  case 0:
2031  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2032  else goto __pyx_L5_argtuple_error;
2033  CYTHON_FALLTHROUGH;
2034  case 1:
2035  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2036  else {
2037  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionEikonal", 1, 4, 4, 1); __PYX_ERR(0, 99, __pyx_L3_error)
2038  }
2039  CYTHON_FALLTHROUGH;
2040  case 2:
2041  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2042  else {
2043  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionEikonal", 1, 4, 4, 2); __PYX_ERR(0, 99, __pyx_L3_error)
2044  }
2045  CYTHON_FALLTHROUGH;
2046  case 3:
2047  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2048  else {
2049  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionEikonal", 1, 4, 4, 3); __PYX_ERR(0, 99, __pyx_L3_error)
2050  }
2051  }
2052  if (unlikely(kw_args > 0)) {
2053  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionEikonal") < 0)) __PYX_ERR(0, 99, __pyx_L3_error)
2054  }
2055  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2056  goto __pyx_L5_argtuple_error;
2057  } else {
2058  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2059  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2060  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2061  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2062  }
2063  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error)
2064  __pyx_v_elementDiameter = ((PyArrayObject *)values[1]);
2065  __pyx_v_strong_residual = ((PyArrayObject *)values[2]);
2066  __pyx_v_numDiff = ((PyArrayObject *)values[3]);
2067  }
2068  goto __pyx_L4_argument_unpacking_done;
2069  __pyx_L5_argtuple_error:;
2070  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionEikonal", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 99, __pyx_L3_error)
2071  __pyx_L3_error:;
2072  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionEikonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
2073  __Pyx_RefNannyFinishContext();
2074  return NULL;
2075  __pyx_L4_argument_unpacking_done:;
2076  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 100, __pyx_L1_error)
2077  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 101, __pyx_L1_error)
2078  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 102, __pyx_L1_error)
2079  __pyx_r = __pyx_pf_15cshockCapturing_4calculateNumericalDiffusionEikonal(__pyx_self, __pyx_v_shockCapturingDiffusion, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_numDiff);
2080 
2081  /* function exit code */
2082  goto __pyx_L0;
2083  __pyx_L1_error:;
2084  __pyx_r = NULL;
2085  __pyx_L0:;
2086  __Pyx_RefNannyFinishContext();
2087  return __pyx_r;
2088 }
2089 
2090 static PyObject *__pyx_pf_15cshockCapturing_4calculateNumericalDiffusionEikonal(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_numDiff) {
2091  PyObject *__pyx_r = NULL;
2092  __Pyx_RefNannyDeclarations
2093  __Pyx_RefNannySetupContext("calculateNumericalDiffusionEikonal", 0);
2094 
2095  /* "cshockCapturing.pyx":103
2096  * np.ndarray strong_residual,
2097  * np.ndarray numDiff):
2098  * ccalculateNumericalDiffusionEikonal(numDiff.shape[0], # <<<<<<<<<<<<<<
2099  * numDiff.shape[1],
2100  * shockCapturingDiffusion,
2101  */
2102  calculateNumericalDiffusionEikonal((__pyx_v_numDiff->dimensions[0]), (__pyx_v_numDiff->dimensions[1]), __pyx_v_shockCapturingDiffusion, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_numDiff->data));
2103 
2104  /* "cshockCapturing.pyx":99
2105  * <double*> grad_u.data,
2106  * <double*> numDiff.data)
2107  * def calculateNumericalDiffusionEikonal(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
2108  * np.ndarray elementDiameter,
2109  * np.ndarray strong_residual,
2110  */
2111 
2112  /* function exit code */
2113  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2114  __Pyx_XGIVEREF(__pyx_r);
2115  __Pyx_RefNannyFinishContext();
2116  return __pyx_r;
2117 }
2118 
2119 /* "cshockCapturing.pyx":109
2120  * <double*> strong_residual.data,
2121  * <double*> numDiff.data)
2122  * def calculateNumericalDiffusionHJ(char shockCapturing, # <<<<<<<<<<<<<<
2123  * double shockCapturingDiffusion,
2124  * np.ndarray elementDiameter,
2125  */
2126 
2127 /* Python wrapper */
2128 static PyObject *__pyx_pw_15cshockCapturing_7calculateNumericalDiffusionHJ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2129 static PyMethodDef __pyx_mdef_15cshockCapturing_7calculateNumericalDiffusionHJ = {"calculateNumericalDiffusionHJ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_7calculateNumericalDiffusionHJ, METH_VARARGS|METH_KEYWORDS, 0};
2130 static PyObject *__pyx_pw_15cshockCapturing_7calculateNumericalDiffusionHJ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2131  char __pyx_v_shockCapturing;
2132  double __pyx_v_shockCapturingDiffusion;
2133  PyArrayObject *__pyx_v_elementDiameter = 0;
2134  PyArrayObject *__pyx_v_strong_residual = 0;
2135  PyArrayObject *__pyx_v_mt = 0;
2136  PyArrayObject *__pyx_v_H = 0;
2137  PyArrayObject *__pyx_v_numDiff = 0;
2138  int __pyx_lineno = 0;
2139  const char *__pyx_filename = NULL;
2140  int __pyx_clineno = 0;
2141  PyObject *__pyx_r = 0;
2142  __Pyx_RefNannyDeclarations
2143  __Pyx_RefNannySetupContext("calculateNumericalDiffusionHJ (wrapper)", 0);
2144  {
2145  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturing,&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_mt,&__pyx_n_s_H,&__pyx_n_s_numDiff,0};
2146  PyObject* values[7] = {0,0,0,0,0,0,0};
2147  if (unlikely(__pyx_kwds)) {
2148  Py_ssize_t kw_args;
2149  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2150  switch (pos_args) {
2151  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2152  CYTHON_FALLTHROUGH;
2153  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2154  CYTHON_FALLTHROUGH;
2155  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2156  CYTHON_FALLTHROUGH;
2157  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2158  CYTHON_FALLTHROUGH;
2159  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2160  CYTHON_FALLTHROUGH;
2161  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2162  CYTHON_FALLTHROUGH;
2163  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2164  CYTHON_FALLTHROUGH;
2165  case 0: break;
2166  default: goto __pyx_L5_argtuple_error;
2167  }
2168  kw_args = PyDict_Size(__pyx_kwds);
2169  switch (pos_args) {
2170  case 0:
2171  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturing)) != 0)) kw_args--;
2172  else goto __pyx_L5_argtuple_error;
2173  CYTHON_FALLTHROUGH;
2174  case 1:
2175  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2176  else {
2177  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, 1); __PYX_ERR(0, 109, __pyx_L3_error)
2178  }
2179  CYTHON_FALLTHROUGH;
2180  case 2:
2181  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2182  else {
2183  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, 2); __PYX_ERR(0, 109, __pyx_L3_error)
2184  }
2185  CYTHON_FALLTHROUGH;
2186  case 3:
2187  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2188  else {
2189  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, 3); __PYX_ERR(0, 109, __pyx_L3_error)
2190  }
2191  CYTHON_FALLTHROUGH;
2192  case 4:
2193  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
2194  else {
2195  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, 4); __PYX_ERR(0, 109, __pyx_L3_error)
2196  }
2197  CYTHON_FALLTHROUGH;
2198  case 5:
2199  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
2200  else {
2201  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, 5); __PYX_ERR(0, 109, __pyx_L3_error)
2202  }
2203  CYTHON_FALLTHROUGH;
2204  case 6:
2205  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2206  else {
2207  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, 6); __PYX_ERR(0, 109, __pyx_L3_error)
2208  }
2209  }
2210  if (unlikely(kw_args > 0)) {
2211  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionHJ") < 0)) __PYX_ERR(0, 109, __pyx_L3_error)
2212  }
2213  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2214  goto __pyx_L5_argtuple_error;
2215  } else {
2216  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2217  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2218  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2219  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2220  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2221  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2222  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2223  }
2224  __pyx_v_shockCapturing = __Pyx_PyInt_As_char(values[0]); if (unlikely((__pyx_v_shockCapturing == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error)
2225  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error)
2226  __pyx_v_elementDiameter = ((PyArrayObject *)values[2]);
2227  __pyx_v_strong_residual = ((PyArrayObject *)values[3]);
2228  __pyx_v_mt = ((PyArrayObject *)values[4]);
2229  __pyx_v_H = ((PyArrayObject *)values[5]);
2230  __pyx_v_numDiff = ((PyArrayObject *)values[6]);
2231  }
2232  goto __pyx_L4_argument_unpacking_done;
2233  __pyx_L5_argtuple_error:;
2234  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJ", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 109, __pyx_L3_error)
2235  __pyx_L3_error:;
2236  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionHJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
2237  __Pyx_RefNannyFinishContext();
2238  return NULL;
2239  __pyx_L4_argument_unpacking_done:;
2240  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 111, __pyx_L1_error)
2241  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 112, __pyx_L1_error)
2242  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 113, __pyx_L1_error)
2243  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_5numpy_ndarray, 1, "H", 0))) __PYX_ERR(0, 114, __pyx_L1_error)
2244  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 115, __pyx_L1_error)
2245  __pyx_r = __pyx_pf_15cshockCapturing_6calculateNumericalDiffusionHJ(__pyx_self, __pyx_v_shockCapturing, __pyx_v_shockCapturingDiffusion, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_mt, __pyx_v_H, __pyx_v_numDiff);
2246 
2247  /* function exit code */
2248  goto __pyx_L0;
2249  __pyx_L1_error:;
2250  __pyx_r = NULL;
2251  __pyx_L0:;
2252  __Pyx_RefNannyFinishContext();
2253  return __pyx_r;
2254 }
2255 
2256 static PyObject *__pyx_pf_15cshockCapturing_6calculateNumericalDiffusionHJ(CYTHON_UNUSED PyObject *__pyx_self, char __pyx_v_shockCapturing, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_H, PyArrayObject *__pyx_v_numDiff) {
2257  PyObject *__pyx_r = NULL;
2258  __Pyx_RefNannyDeclarations
2259  __Pyx_RefNannySetupContext("calculateNumericalDiffusionHJ", 0);
2260 
2261  /* "cshockCapturing.pyx":116
2262  * np.ndarray H,
2263  * np.ndarray numDiff):
2264  * ccalculateNumericalDiffusionHJ(H.shape[0], # <<<<<<<<<<<<<<
2265  * H.shape[1],
2266  * shockCapturing,
2267  */
2268  calculateNumericalDiffusionHJ((__pyx_v_H->dimensions[0]), (__pyx_v_H->dimensions[1]), __pyx_v_shockCapturing, __pyx_v_shockCapturingDiffusion, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_mt->data), ((double *)__pyx_v_H->data), ((double *)__pyx_v_numDiff->data));
2269 
2270  /* "cshockCapturing.pyx":109
2271  * <double*> strong_residual.data,
2272  * <double*> numDiff.data)
2273  * def calculateNumericalDiffusionHJ(char shockCapturing, # <<<<<<<<<<<<<<
2274  * double shockCapturingDiffusion,
2275  * np.ndarray elementDiameter,
2276  */
2277 
2278  /* function exit code */
2279  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2280  __Pyx_XGIVEREF(__pyx_r);
2281  __Pyx_RefNannyFinishContext();
2282  return __pyx_r;
2283 }
2284 
2285 /* "cshockCapturing.pyx":125
2286  * <double*> H.data,
2287  * <double*> numDiff.data)
2288  * def calculateNumericalDiffusionHJV2(char shockCapturing, # <<<<<<<<<<<<<<
2289  * double shockCapturingDiffusion,
2290  * np.ndarray elementDiameter,
2291  */
2292 
2293 /* Python wrapper */
2294 static PyObject *__pyx_pw_15cshockCapturing_9calculateNumericalDiffusionHJV2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2295 static PyMethodDef __pyx_mdef_15cshockCapturing_9calculateNumericalDiffusionHJV2 = {"calculateNumericalDiffusionHJV2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_9calculateNumericalDiffusionHJV2, METH_VARARGS|METH_KEYWORDS, 0};
2296 static PyObject *__pyx_pw_15cshockCapturing_9calculateNumericalDiffusionHJV2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2297  char __pyx_v_shockCapturing;
2298  double __pyx_v_shockCapturingDiffusion;
2299  PyArrayObject *__pyx_v_elementDiameter = 0;
2300  PyArrayObject *__pyx_v_strong_residual = 0;
2301  PyArrayObject *__pyx_v_mt = 0;
2302  PyArrayObject *__pyx_v_H = 0;
2303  PyArrayObject *__pyx_v_numDiff = 0;
2304  int __pyx_lineno = 0;
2305  const char *__pyx_filename = NULL;
2306  int __pyx_clineno = 0;
2307  PyObject *__pyx_r = 0;
2308  __Pyx_RefNannyDeclarations
2309  __Pyx_RefNannySetupContext("calculateNumericalDiffusionHJV2 (wrapper)", 0);
2310  {
2311  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturing,&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_mt,&__pyx_n_s_H,&__pyx_n_s_numDiff,0};
2312  PyObject* values[7] = {0,0,0,0,0,0,0};
2313  if (unlikely(__pyx_kwds)) {
2314  Py_ssize_t kw_args;
2315  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2316  switch (pos_args) {
2317  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2318  CYTHON_FALLTHROUGH;
2319  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2320  CYTHON_FALLTHROUGH;
2321  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2322  CYTHON_FALLTHROUGH;
2323  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2324  CYTHON_FALLTHROUGH;
2325  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2326  CYTHON_FALLTHROUGH;
2327  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2328  CYTHON_FALLTHROUGH;
2329  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2330  CYTHON_FALLTHROUGH;
2331  case 0: break;
2332  default: goto __pyx_L5_argtuple_error;
2333  }
2334  kw_args = PyDict_Size(__pyx_kwds);
2335  switch (pos_args) {
2336  case 0:
2337  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturing)) != 0)) kw_args--;
2338  else goto __pyx_L5_argtuple_error;
2339  CYTHON_FALLTHROUGH;
2340  case 1:
2341  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2342  else {
2343  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, 1); __PYX_ERR(0, 125, __pyx_L3_error)
2344  }
2345  CYTHON_FALLTHROUGH;
2346  case 2:
2347  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2348  else {
2349  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, 2); __PYX_ERR(0, 125, __pyx_L3_error)
2350  }
2351  CYTHON_FALLTHROUGH;
2352  case 3:
2353  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2354  else {
2355  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, 3); __PYX_ERR(0, 125, __pyx_L3_error)
2356  }
2357  CYTHON_FALLTHROUGH;
2358  case 4:
2359  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
2360  else {
2361  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, 4); __PYX_ERR(0, 125, __pyx_L3_error)
2362  }
2363  CYTHON_FALLTHROUGH;
2364  case 5:
2365  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
2366  else {
2367  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, 5); __PYX_ERR(0, 125, __pyx_L3_error)
2368  }
2369  CYTHON_FALLTHROUGH;
2370  case 6:
2371  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2372  else {
2373  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, 6); __PYX_ERR(0, 125, __pyx_L3_error)
2374  }
2375  }
2376  if (unlikely(kw_args > 0)) {
2377  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionHJV2") < 0)) __PYX_ERR(0, 125, __pyx_L3_error)
2378  }
2379  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2380  goto __pyx_L5_argtuple_error;
2381  } else {
2382  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2383  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2384  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2385  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2386  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2387  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2388  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2389  }
2390  __pyx_v_shockCapturing = __Pyx_PyInt_As_char(values[0]); if (unlikely((__pyx_v_shockCapturing == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L3_error)
2391  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L3_error)
2392  __pyx_v_elementDiameter = ((PyArrayObject *)values[2]);
2393  __pyx_v_strong_residual = ((PyArrayObject *)values[3]);
2394  __pyx_v_mt = ((PyArrayObject *)values[4]);
2395  __pyx_v_H = ((PyArrayObject *)values[5]);
2396  __pyx_v_numDiff = ((PyArrayObject *)values[6]);
2397  }
2398  goto __pyx_L4_argument_unpacking_done;
2399  __pyx_L5_argtuple_error:;
2400  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionHJV2", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 125, __pyx_L3_error)
2401  __pyx_L3_error:;
2402  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionHJV2", __pyx_clineno, __pyx_lineno, __pyx_filename);
2403  __Pyx_RefNannyFinishContext();
2404  return NULL;
2405  __pyx_L4_argument_unpacking_done:;
2406  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 127, __pyx_L1_error)
2407  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 128, __pyx_L1_error)
2408  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 129, __pyx_L1_error)
2409  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_5numpy_ndarray, 1, "H", 0))) __PYX_ERR(0, 130, __pyx_L1_error)
2410  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 131, __pyx_L1_error)
2411  __pyx_r = __pyx_pf_15cshockCapturing_8calculateNumericalDiffusionHJV2(__pyx_self, __pyx_v_shockCapturing, __pyx_v_shockCapturingDiffusion, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_mt, __pyx_v_H, __pyx_v_numDiff);
2412 
2413  /* function exit code */
2414  goto __pyx_L0;
2415  __pyx_L1_error:;
2416  __pyx_r = NULL;
2417  __pyx_L0:;
2418  __Pyx_RefNannyFinishContext();
2419  return __pyx_r;
2420 }
2421 
2422 static PyObject *__pyx_pf_15cshockCapturing_8calculateNumericalDiffusionHJV2(CYTHON_UNUSED PyObject *__pyx_self, char __pyx_v_shockCapturing, double __pyx_v_shockCapturingDiffusion, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_H, PyArrayObject *__pyx_v_numDiff) {
2423  PyObject *__pyx_r = NULL;
2424  __Pyx_RefNannyDeclarations
2425  __Pyx_RefNannySetupContext("calculateNumericalDiffusionHJV2", 0);
2426 
2427  /* "cshockCapturing.pyx":132
2428  * np.ndarray H,
2429  * np.ndarray numDiff):
2430  * ccalculateNumericalDiffusionHJV2(H.shape[0], # <<<<<<<<<<<<<<
2431  * H.shape[1],
2432  * shockCapturing,
2433  */
2434  calculateNumericalDiffusionHJV2((__pyx_v_H->dimensions[0]), (__pyx_v_H->dimensions[1]), __pyx_v_shockCapturing, __pyx_v_shockCapturingDiffusion, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_mt->data), ((double *)__pyx_v_H->data), ((double *)__pyx_v_numDiff->data));
2435 
2436  /* "cshockCapturing.pyx":125
2437  * <double*> H.data,
2438  * <double*> numDiff.data)
2439  * def calculateNumericalDiffusionHJV2(char shockCapturing, # <<<<<<<<<<<<<<
2440  * double shockCapturingDiffusion,
2441  * np.ndarray elementDiameter,
2442  */
2443 
2444  /* function exit code */
2445  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2446  __Pyx_XGIVEREF(__pyx_r);
2447  __Pyx_RefNannyFinishContext();
2448  return __pyx_r;
2449 }
2450 
2451 /* "cshockCapturing.pyx":141
2452  * <double*> H.data,
2453  * <double*> numDiff.data)
2454  * def calculateNumericalDiffusion_A_1(double shockCapturingFactor, # <<<<<<<<<<<<<<
2455  * np.ndarray elementDiameter,
2456  * np.ndarray strong_residual,
2457  */
2458 
2459 /* Python wrapper */
2460 static PyObject *__pyx_pw_15cshockCapturing_11calculateNumericalDiffusion_A_1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2461 static PyMethodDef __pyx_mdef_15cshockCapturing_11calculateNumericalDiffusion_A_1 = {"calculateNumericalDiffusion_A_1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_11calculateNumericalDiffusion_A_1, METH_VARARGS|METH_KEYWORDS, 0};
2462 static PyObject *__pyx_pw_15cshockCapturing_11calculateNumericalDiffusion_A_1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2463  double __pyx_v_shockCapturingFactor;
2464  PyArrayObject *__pyx_v_elementDiameter = 0;
2465  PyArrayObject *__pyx_v_strong_residual = 0;
2466  PyArrayObject *__pyx_v_mt = 0;
2467  PyArrayObject *__pyx_v_df = 0;
2468  PyArrayObject *__pyx_v_numDiff = 0;
2469  int __pyx_lineno = 0;
2470  const char *__pyx_filename = NULL;
2471  int __pyx_clineno = 0;
2472  PyObject *__pyx_r = 0;
2473  __Pyx_RefNannyDeclarations
2474  __Pyx_RefNannySetupContext("calculateNumericalDiffusion_A_1 (wrapper)", 0);
2475  {
2476  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturingFactor,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_mt,&__pyx_n_s_df,&__pyx_n_s_numDiff,0};
2477  PyObject* values[6] = {0,0,0,0,0,0};
2478  if (unlikely(__pyx_kwds)) {
2479  Py_ssize_t kw_args;
2480  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2481  switch (pos_args) {
2482  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2483  CYTHON_FALLTHROUGH;
2484  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2485  CYTHON_FALLTHROUGH;
2486  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2487  CYTHON_FALLTHROUGH;
2488  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2489  CYTHON_FALLTHROUGH;
2490  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2491  CYTHON_FALLTHROUGH;
2492  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2493  CYTHON_FALLTHROUGH;
2494  case 0: break;
2495  default: goto __pyx_L5_argtuple_error;
2496  }
2497  kw_args = PyDict_Size(__pyx_kwds);
2498  switch (pos_args) {
2499  case 0:
2500  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingFactor)) != 0)) kw_args--;
2501  else goto __pyx_L5_argtuple_error;
2502  CYTHON_FALLTHROUGH;
2503  case 1:
2504  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2505  else {
2506  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusion_A_1", 1, 6, 6, 1); __PYX_ERR(0, 141, __pyx_L3_error)
2507  }
2508  CYTHON_FALLTHROUGH;
2509  case 2:
2510  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2511  else {
2512  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusion_A_1", 1, 6, 6, 2); __PYX_ERR(0, 141, __pyx_L3_error)
2513  }
2514  CYTHON_FALLTHROUGH;
2515  case 3:
2516  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
2517  else {
2518  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusion_A_1", 1, 6, 6, 3); __PYX_ERR(0, 141, __pyx_L3_error)
2519  }
2520  CYTHON_FALLTHROUGH;
2521  case 4:
2522  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
2523  else {
2524  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusion_A_1", 1, 6, 6, 4); __PYX_ERR(0, 141, __pyx_L3_error)
2525  }
2526  CYTHON_FALLTHROUGH;
2527  case 5:
2528  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2529  else {
2530  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusion_A_1", 1, 6, 6, 5); __PYX_ERR(0, 141, __pyx_L3_error)
2531  }
2532  }
2533  if (unlikely(kw_args > 0)) {
2534  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusion_A_1") < 0)) __PYX_ERR(0, 141, __pyx_L3_error)
2535  }
2536  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2537  goto __pyx_L5_argtuple_error;
2538  } else {
2539  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2540  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2541  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2542  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2543  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2544  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2545  }
2546  __pyx_v_shockCapturingFactor = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_shockCapturingFactor == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error)
2547  __pyx_v_elementDiameter = ((PyArrayObject *)values[1]);
2548  __pyx_v_strong_residual = ((PyArrayObject *)values[2]);
2549  __pyx_v_mt = ((PyArrayObject *)values[3]);
2550  __pyx_v_df = ((PyArrayObject *)values[4]);
2551  __pyx_v_numDiff = ((PyArrayObject *)values[5]);
2552  }
2553  goto __pyx_L4_argument_unpacking_done;
2554  __pyx_L5_argtuple_error:;
2555  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusion_A_1", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error)
2556  __pyx_L3_error:;
2557  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusion_A_1", __pyx_clineno, __pyx_lineno, __pyx_filename);
2558  __Pyx_RefNannyFinishContext();
2559  return NULL;
2560  __pyx_L4_argument_unpacking_done:;
2561  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
2562  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 143, __pyx_L1_error)
2563  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 144, __pyx_L1_error)
2564  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 145, __pyx_L1_error)
2565  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 146, __pyx_L1_error)
2566  __pyx_r = __pyx_pf_15cshockCapturing_10calculateNumericalDiffusion_A_1(__pyx_self, __pyx_v_shockCapturingFactor, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_mt, __pyx_v_df, __pyx_v_numDiff);
2567 
2568  /* function exit code */
2569  goto __pyx_L0;
2570  __pyx_L1_error:;
2571  __pyx_r = NULL;
2572  __pyx_L0:;
2573  __Pyx_RefNannyFinishContext();
2574  return __pyx_r;
2575 }
2576 
2577 static PyObject *__pyx_pf_15cshockCapturing_10calculateNumericalDiffusion_A_1(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingFactor, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_numDiff) {
2578  PyObject *__pyx_r = NULL;
2579  __Pyx_RefNannyDeclarations
2580  __Pyx_RefNannySetupContext("calculateNumericalDiffusion_A_1", 0);
2581 
2582  /* "cshockCapturing.pyx":147
2583  * np.ndarray df,
2584  * np.ndarray numDiff):
2585  * ccalculateNumericalDiffusion_A_1(df.shape[0], # <<<<<<<<<<<<<<
2586  * df.shape[1],
2587  * df.shape[2],
2588  */
2589  calculateNumericalDiffusion_A_1((__pyx_v_df->dimensions[0]), (__pyx_v_df->dimensions[1]), (__pyx_v_df->dimensions[2]), __pyx_v_shockCapturingFactor, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_mt->data), ((double *)__pyx_v_df->data), ((double *)__pyx_v_numDiff->data));
2590 
2591  /* "cshockCapturing.pyx":141
2592  * <double*> H.data,
2593  * <double*> numDiff.data)
2594  * def calculateNumericalDiffusion_A_1(double shockCapturingFactor, # <<<<<<<<<<<<<<
2595  * np.ndarray elementDiameter,
2596  * np.ndarray strong_residual,
2597  */
2598 
2599  /* function exit code */
2600  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2601  __Pyx_XGIVEREF(__pyx_r);
2602  __Pyx_RefNannyFinishContext();
2603  return __pyx_r;
2604 }
2605 
2606 /* "cshockCapturing.pyx":156
2607  * <double*> df.data,
2608  * <double*> numDiff.data)
2609  * def calculateNumericalDiffusionResGradJuanes(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
2610  * double uSC,
2611  * np.ndarray elementDiameter,
2612  */
2613 
2614 /* Python wrapper */
2615 static PyObject *__pyx_pw_15cshockCapturing_13calculateNumericalDiffusionResGradJuanes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2616 static PyMethodDef __pyx_mdef_15cshockCapturing_13calculateNumericalDiffusionResGradJuanes = {"calculateNumericalDiffusionResGradJuanes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_13calculateNumericalDiffusionResGradJuanes, METH_VARARGS|METH_KEYWORDS, 0};
2617 static PyObject *__pyx_pw_15cshockCapturing_13calculateNumericalDiffusionResGradJuanes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2618  double __pyx_v_shockCapturingDiffusion;
2619  double __pyx_v_uSC;
2620  PyArrayObject *__pyx_v_elementDiameter = 0;
2621  PyArrayObject *__pyx_v_strong_residual = 0;
2622  PyArrayObject *__pyx_v_grad_u = 0;
2623  PyArrayObject *__pyx_v_numDiff = 0;
2624  int __pyx_lineno = 0;
2625  const char *__pyx_filename = NULL;
2626  int __pyx_clineno = 0;
2627  PyObject *__pyx_r = 0;
2628  __Pyx_RefNannyDeclarations
2629  __Pyx_RefNannySetupContext("calculateNumericalDiffusionResGradJuanes (wrapper)", 0);
2630  {
2631  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_uSC,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_grad_u,&__pyx_n_s_numDiff,0};
2632  PyObject* values[6] = {0,0,0,0,0,0};
2633  if (unlikely(__pyx_kwds)) {
2634  Py_ssize_t kw_args;
2635  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2636  switch (pos_args) {
2637  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2638  CYTHON_FALLTHROUGH;
2639  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2640  CYTHON_FALLTHROUGH;
2641  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2642  CYTHON_FALLTHROUGH;
2643  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2644  CYTHON_FALLTHROUGH;
2645  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2646  CYTHON_FALLTHROUGH;
2647  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2648  CYTHON_FALLTHROUGH;
2649  case 0: break;
2650  default: goto __pyx_L5_argtuple_error;
2651  }
2652  kw_args = PyDict_Size(__pyx_kwds);
2653  switch (pos_args) {
2654  case 0:
2655  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2656  else goto __pyx_L5_argtuple_error;
2657  CYTHON_FALLTHROUGH;
2658  case 1:
2659  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uSC)) != 0)) kw_args--;
2660  else {
2661  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 1); __PYX_ERR(0, 156, __pyx_L3_error)
2662  }
2663  CYTHON_FALLTHROUGH;
2664  case 2:
2665  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2666  else {
2667  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 2); __PYX_ERR(0, 156, __pyx_L3_error)
2668  }
2669  CYTHON_FALLTHROUGH;
2670  case 3:
2671  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2672  else {
2673  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 3); __PYX_ERR(0, 156, __pyx_L3_error)
2674  }
2675  CYTHON_FALLTHROUGH;
2676  case 4:
2677  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
2678  else {
2679  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 4); __PYX_ERR(0, 156, __pyx_L3_error)
2680  }
2681  CYTHON_FALLTHROUGH;
2682  case 5:
2683  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2684  else {
2685  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 5); __PYX_ERR(0, 156, __pyx_L3_error)
2686  }
2687  }
2688  if (unlikely(kw_args > 0)) {
2689  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionResGradJuanes") < 0)) __PYX_ERR(0, 156, __pyx_L3_error)
2690  }
2691  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2692  goto __pyx_L5_argtuple_error;
2693  } else {
2694  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2695  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2696  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2697  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2698  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2699  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2700  }
2701  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error)
2702  __pyx_v_uSC = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_uSC == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L3_error)
2703  __pyx_v_elementDiameter = ((PyArrayObject *)values[2]);
2704  __pyx_v_strong_residual = ((PyArrayObject *)values[3]);
2705  __pyx_v_grad_u = ((PyArrayObject *)values[4]);
2706  __pyx_v_numDiff = ((PyArrayObject *)values[5]);
2707  }
2708  goto __pyx_L4_argument_unpacking_done;
2709  __pyx_L5_argtuple_error:;
2710  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionResGradJuanes", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __pyx_L3_error)
2711  __pyx_L3_error:;
2712  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionResGradJuanes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2713  __Pyx_RefNannyFinishContext();
2714  return NULL;
2715  __pyx_L4_argument_unpacking_done:;
2716  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 158, __pyx_L1_error)
2717  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 159, __pyx_L1_error)
2718  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grad_u), __pyx_ptype_5numpy_ndarray, 1, "grad_u", 0))) __PYX_ERR(0, 160, __pyx_L1_error)
2719  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 161, __pyx_L1_error)
2720  __pyx_r = __pyx_pf_15cshockCapturing_12calculateNumericalDiffusionResGradJuanes(__pyx_self, __pyx_v_shockCapturingDiffusion, __pyx_v_uSC, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_grad_u, __pyx_v_numDiff);
2721 
2722  /* function exit code */
2723  goto __pyx_L0;
2724  __pyx_L1_error:;
2725  __pyx_r = NULL;
2726  __pyx_L0:;
2727  __Pyx_RefNannyFinishContext();
2728  return __pyx_r;
2729 }
2730 
2731 static PyObject *__pyx_pf_15cshockCapturing_12calculateNumericalDiffusionResGradJuanes(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, double __pyx_v_uSC, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff) {
2732  PyObject *__pyx_r = NULL;
2733  __Pyx_RefNannyDeclarations
2734  __Pyx_RefNannySetupContext("calculateNumericalDiffusionResGradJuanes", 0);
2735 
2736  /* "cshockCapturing.pyx":162
2737  * np.ndarray grad_u,
2738  * np.ndarray numDiff):
2739  * ccalculateNumericalDiffusionResGradJuanes(grad_u.shape[0], # <<<<<<<<<<<<<<
2740  * grad_u.shape[1],
2741  * grad_u.shape[2],
2742  */
2743  calculateNumericalDiffusionResGradJuanes((__pyx_v_grad_u->dimensions[0]), (__pyx_v_grad_u->dimensions[1]), (__pyx_v_grad_u->dimensions[2]), __pyx_v_shockCapturingDiffusion, __pyx_v_uSC, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_grad_u->data), ((double *)__pyx_v_numDiff->data));
2744 
2745  /* "cshockCapturing.pyx":156
2746  * <double*> df.data,
2747  * <double*> numDiff.data)
2748  * def calculateNumericalDiffusionResGradJuanes(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
2749  * double uSC,
2750  * np.ndarray elementDiameter,
2751  */
2752 
2753  /* function exit code */
2754  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2755  __Pyx_XGIVEREF(__pyx_r);
2756  __Pyx_RefNannyFinishContext();
2757  return __pyx_r;
2758 }
2759 
2760 /* "cshockCapturing.pyx":171
2761  * <double*> grad_u.data,
2762  * <double*> numDiff.data)
2763  * def calculateNumericalDiffusionJaffre(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
2764  * double beta,
2765  * np.ndarray elementDiameter,
2766  */
2767 
2768 /* Python wrapper */
2769 static PyObject *__pyx_pw_15cshockCapturing_15calculateNumericalDiffusionJaffre(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2770 static PyMethodDef __pyx_mdef_15cshockCapturing_15calculateNumericalDiffusionJaffre = {"calculateNumericalDiffusionJaffre", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15cshockCapturing_15calculateNumericalDiffusionJaffre, METH_VARARGS|METH_KEYWORDS, 0};
2771 static PyObject *__pyx_pw_15cshockCapturing_15calculateNumericalDiffusionJaffre(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2772  double __pyx_v_shockCapturingDiffusion;
2773  double __pyx_v_beta;
2774  PyArrayObject *__pyx_v_elementDiameter = 0;
2775  PyArrayObject *__pyx_v_strong_residual = 0;
2776  PyArrayObject *__pyx_v_grad_u = 0;
2777  PyArrayObject *__pyx_v_numDiff = 0;
2778  int __pyx_lineno = 0;
2779  const char *__pyx_filename = NULL;
2780  int __pyx_clineno = 0;
2781  PyObject *__pyx_r = 0;
2782  __Pyx_RefNannyDeclarations
2783  __Pyx_RefNannySetupContext("calculateNumericalDiffusionJaffre (wrapper)", 0);
2784  {
2785  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shockCapturingDiffusion,&__pyx_n_s_beta,&__pyx_n_s_elementDiameter,&__pyx_n_s_strong_residual,&__pyx_n_s_grad_u,&__pyx_n_s_numDiff,0};
2786  PyObject* values[6] = {0,0,0,0,0,0};
2787  if (unlikely(__pyx_kwds)) {
2788  Py_ssize_t kw_args;
2789  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2790  switch (pos_args) {
2791  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2792  CYTHON_FALLTHROUGH;
2793  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2794  CYTHON_FALLTHROUGH;
2795  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2796  CYTHON_FALLTHROUGH;
2797  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2798  CYTHON_FALLTHROUGH;
2799  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2800  CYTHON_FALLTHROUGH;
2801  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2802  CYTHON_FALLTHROUGH;
2803  case 0: break;
2804  default: goto __pyx_L5_argtuple_error;
2805  }
2806  kw_args = PyDict_Size(__pyx_kwds);
2807  switch (pos_args) {
2808  case 0:
2809  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2810  else goto __pyx_L5_argtuple_error;
2811  CYTHON_FALLTHROUGH;
2812  case 1:
2813  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
2814  else {
2815  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionJaffre", 1, 6, 6, 1); __PYX_ERR(0, 171, __pyx_L3_error)
2816  }
2817  CYTHON_FALLTHROUGH;
2818  case 2:
2819  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2820  else {
2821  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionJaffre", 1, 6, 6, 2); __PYX_ERR(0, 171, __pyx_L3_error)
2822  }
2823  CYTHON_FALLTHROUGH;
2824  case 3:
2825  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2826  else {
2827  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionJaffre", 1, 6, 6, 3); __PYX_ERR(0, 171, __pyx_L3_error)
2828  }
2829  CYTHON_FALLTHROUGH;
2830  case 4:
2831  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
2832  else {
2833  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionJaffre", 1, 6, 6, 4); __PYX_ERR(0, 171, __pyx_L3_error)
2834  }
2835  CYTHON_FALLTHROUGH;
2836  case 5:
2837  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2838  else {
2839  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionJaffre", 1, 6, 6, 5); __PYX_ERR(0, 171, __pyx_L3_error)
2840  }
2841  }
2842  if (unlikely(kw_args > 0)) {
2843  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNumericalDiffusionJaffre") < 0)) __PYX_ERR(0, 171, __pyx_L3_error)
2844  }
2845  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2846  goto __pyx_L5_argtuple_error;
2847  } else {
2848  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2849  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2850  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2851  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2852  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2853  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2854  }
2855  __pyx_v_shockCapturingDiffusion = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_shockCapturingDiffusion == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L3_error)
2856  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L3_error)
2857  __pyx_v_elementDiameter = ((PyArrayObject *)values[2]);
2858  __pyx_v_strong_residual = ((PyArrayObject *)values[3]);
2859  __pyx_v_grad_u = ((PyArrayObject *)values[4]);
2860  __pyx_v_numDiff = ((PyArrayObject *)values[5]);
2861  }
2862  goto __pyx_L4_argument_unpacking_done;
2863  __pyx_L5_argtuple_error:;
2864  __Pyx_RaiseArgtupleInvalid("calculateNumericalDiffusionJaffre", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 171, __pyx_L3_error)
2865  __pyx_L3_error:;
2866  __Pyx_AddTraceback("cshockCapturing.calculateNumericalDiffusionJaffre", __pyx_clineno, __pyx_lineno, __pyx_filename);
2867  __Pyx_RefNannyFinishContext();
2868  return NULL;
2869  __pyx_L4_argument_unpacking_done:;
2870  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementDiameter), __pyx_ptype_5numpy_ndarray, 1, "elementDiameter", 0))) __PYX_ERR(0, 173, __pyx_L1_error)
2871  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strong_residual), __pyx_ptype_5numpy_ndarray, 1, "strong_residual", 0))) __PYX_ERR(0, 174, __pyx_L1_error)
2872  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grad_u), __pyx_ptype_5numpy_ndarray, 1, "grad_u", 0))) __PYX_ERR(0, 175, __pyx_L1_error)
2873  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_numDiff), __pyx_ptype_5numpy_ndarray, 1, "numDiff", 0))) __PYX_ERR(0, 176, __pyx_L1_error)
2874  __pyx_r = __pyx_pf_15cshockCapturing_14calculateNumericalDiffusionJaffre(__pyx_self, __pyx_v_shockCapturingDiffusion, __pyx_v_beta, __pyx_v_elementDiameter, __pyx_v_strong_residual, __pyx_v_grad_u, __pyx_v_numDiff);
2875 
2876  /* function exit code */
2877  goto __pyx_L0;
2878  __pyx_L1_error:;
2879  __pyx_r = NULL;
2880  __pyx_L0:;
2881  __Pyx_RefNannyFinishContext();
2882  return __pyx_r;
2883 }
2884 
2885 static PyObject *__pyx_pf_15cshockCapturing_14calculateNumericalDiffusionJaffre(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_shockCapturingDiffusion, double __pyx_v_beta, PyArrayObject *__pyx_v_elementDiameter, PyArrayObject *__pyx_v_strong_residual, PyArrayObject *__pyx_v_grad_u, PyArrayObject *__pyx_v_numDiff) {
2886  PyObject *__pyx_r = NULL;
2887  __Pyx_RefNannyDeclarations
2888  __Pyx_RefNannySetupContext("calculateNumericalDiffusionJaffre", 0);
2889 
2890  /* "cshockCapturing.pyx":177
2891  * np.ndarray grad_u,
2892  * np.ndarray numDiff):
2893  * ccalculateNumericalDiffusionJaffre(grad_u.shape[0], # <<<<<<<<<<<<<<
2894  * grad_u.shape[1],
2895  * grad_u.shape[2],
2896  */
2897  calculateNumericalDiffusionJaffre((__pyx_v_grad_u->dimensions[0]), (__pyx_v_grad_u->dimensions[1]), (__pyx_v_grad_u->dimensions[2]), __pyx_v_shockCapturingDiffusion, __pyx_v_beta, ((double *)__pyx_v_elementDiameter->data), ((double *)__pyx_v_strong_residual->data), ((double *)__pyx_v_grad_u->data), ((double *)__pyx_v_numDiff->data));
2898 
2899  /* "cshockCapturing.pyx":171
2900  * <double*> grad_u.data,
2901  * <double*> numDiff.data)
2902  * def calculateNumericalDiffusionJaffre(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
2903  * double beta,
2904  * np.ndarray elementDiameter,
2905  */
2906 
2907  /* function exit code */
2908  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2909  __Pyx_XGIVEREF(__pyx_r);
2910  __Pyx_RefNannyFinishContext();
2911  return __pyx_r;
2912 }
2913 
2914 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
2915  * ctypedef npy_cdouble complex_t
2916  *
2917  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
2918  * return PyArray_MultiIterNew(1, <void*>a)
2919  *
2920  */
2921 
2922 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
2923  PyObject *__pyx_r = NULL;
2924  __Pyx_RefNannyDeclarations
2925  PyObject *__pyx_t_1 = NULL;
2926  int __pyx_lineno = 0;
2927  const char *__pyx_filename = NULL;
2928  int __pyx_clineno = 0;
2929  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
2930 
2931  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":736
2932  *
2933  * cdef inline object PyArray_MultiIterNew1(a):
2934  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
2935  *
2936  * cdef inline object PyArray_MultiIterNew2(a, b):
2937  */
2938  __Pyx_XDECREF(__pyx_r);
2939  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
2940  __Pyx_GOTREF(__pyx_t_1);
2941  __pyx_r = __pyx_t_1;
2942  __pyx_t_1 = 0;
2943  goto __pyx_L0;
2944 
2945  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
2946  * ctypedef npy_cdouble complex_t
2947  *
2948  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
2949  * return PyArray_MultiIterNew(1, <void*>a)
2950  *
2951  */
2952 
2953  /* function exit code */
2954  __pyx_L1_error:;
2955  __Pyx_XDECREF(__pyx_t_1);
2956  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
2957  __pyx_r = 0;
2958  __pyx_L0:;
2959  __Pyx_XGIVEREF(__pyx_r);
2960  __Pyx_RefNannyFinishContext();
2961  return __pyx_r;
2962 }
2963 
2964 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
2965  * return PyArray_MultiIterNew(1, <void*>a)
2966  *
2967  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
2968  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
2969  *
2970  */
2971 
2972 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
2973  PyObject *__pyx_r = NULL;
2974  __Pyx_RefNannyDeclarations
2975  PyObject *__pyx_t_1 = NULL;
2976  int __pyx_lineno = 0;
2977  const char *__pyx_filename = NULL;
2978  int __pyx_clineno = 0;
2979  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
2980 
2981  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":739
2982  *
2983  * cdef inline object PyArray_MultiIterNew2(a, b):
2984  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
2985  *
2986  * cdef inline object PyArray_MultiIterNew3(a, b, c):
2987  */
2988  __Pyx_XDECREF(__pyx_r);
2989  __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)
2990  __Pyx_GOTREF(__pyx_t_1);
2991  __pyx_r = __pyx_t_1;
2992  __pyx_t_1 = 0;
2993  goto __pyx_L0;
2994 
2995  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
2996  * return PyArray_MultiIterNew(1, <void*>a)
2997  *
2998  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
2999  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3000  *
3001  */
3002 
3003  /* function exit code */
3004  __pyx_L1_error:;
3005  __Pyx_XDECREF(__pyx_t_1);
3006  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
3007  __pyx_r = 0;
3008  __pyx_L0:;
3009  __Pyx_XGIVEREF(__pyx_r);
3010  __Pyx_RefNannyFinishContext();
3011  return __pyx_r;
3012 }
3013 
3014 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
3015  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3016  *
3017  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
3018  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3019  *
3020  */
3021 
3022 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
3023  PyObject *__pyx_r = NULL;
3024  __Pyx_RefNannyDeclarations
3025  PyObject *__pyx_t_1 = NULL;
3026  int __pyx_lineno = 0;
3027  const char *__pyx_filename = NULL;
3028  int __pyx_clineno = 0;
3029  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
3030 
3031  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":742
3032  *
3033  * cdef inline object PyArray_MultiIterNew3(a, b, c):
3034  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
3035  *
3036  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
3037  */
3038  __Pyx_XDECREF(__pyx_r);
3039  __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)
3040  __Pyx_GOTREF(__pyx_t_1);
3041  __pyx_r = __pyx_t_1;
3042  __pyx_t_1 = 0;
3043  goto __pyx_L0;
3044 
3045  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
3046  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
3047  *
3048  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
3049  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3050  *
3051  */
3052 
3053  /* function exit code */
3054  __pyx_L1_error:;
3055  __Pyx_XDECREF(__pyx_t_1);
3056  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
3057  __pyx_r = 0;
3058  __pyx_L0:;
3059  __Pyx_XGIVEREF(__pyx_r);
3060  __Pyx_RefNannyFinishContext();
3061  return __pyx_r;
3062 }
3063 
3064 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
3065  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3066  *
3067  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
3068  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3069  *
3070  */
3071 
3072 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) {
3073  PyObject *__pyx_r = NULL;
3074  __Pyx_RefNannyDeclarations
3075  PyObject *__pyx_t_1 = NULL;
3076  int __pyx_lineno = 0;
3077  const char *__pyx_filename = NULL;
3078  int __pyx_clineno = 0;
3079  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
3080 
3081  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":745
3082  *
3083  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
3084  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
3085  *
3086  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
3087  */
3088  __Pyx_XDECREF(__pyx_r);
3089  __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)
3090  __Pyx_GOTREF(__pyx_t_1);
3091  __pyx_r = __pyx_t_1;
3092  __pyx_t_1 = 0;
3093  goto __pyx_L0;
3094 
3095  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
3096  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
3097  *
3098  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
3099  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3100  *
3101  */
3102 
3103  /* function exit code */
3104  __pyx_L1_error:;
3105  __Pyx_XDECREF(__pyx_t_1);
3106  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
3107  __pyx_r = 0;
3108  __pyx_L0:;
3109  __Pyx_XGIVEREF(__pyx_r);
3110  __Pyx_RefNannyFinishContext();
3111  return __pyx_r;
3112 }
3113 
3114 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
3115  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3116  *
3117  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
3118  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3119  *
3120  */
3121 
3122 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) {
3123  PyObject *__pyx_r = NULL;
3124  __Pyx_RefNannyDeclarations
3125  PyObject *__pyx_t_1 = NULL;
3126  int __pyx_lineno = 0;
3127  const char *__pyx_filename = NULL;
3128  int __pyx_clineno = 0;
3129  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
3130 
3131  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":748
3132  *
3133  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
3134  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
3135  *
3136  * cdef inline tuple PyDataType_SHAPE(dtype d):
3137  */
3138  __Pyx_XDECREF(__pyx_r);
3139  __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)
3140  __Pyx_GOTREF(__pyx_t_1);
3141  __pyx_r = __pyx_t_1;
3142  __pyx_t_1 = 0;
3143  goto __pyx_L0;
3144 
3145  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
3146  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
3147  *
3148  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
3149  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3150  *
3151  */
3152 
3153  /* function exit code */
3154  __pyx_L1_error:;
3155  __Pyx_XDECREF(__pyx_t_1);
3156  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
3157  __pyx_r = 0;
3158  __pyx_L0:;
3159  __Pyx_XGIVEREF(__pyx_r);
3160  __Pyx_RefNannyFinishContext();
3161  return __pyx_r;
3162 }
3163 
3164 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
3165  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3166  *
3167  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
3168  * if PyDataType_HASSUBARRAY(d):
3169  * return <tuple>d.subarray.shape
3170  */
3171 
3172 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
3173  PyObject *__pyx_r = NULL;
3174  __Pyx_RefNannyDeclarations
3175  int __pyx_t_1;
3176  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
3177 
3178  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
3179  *
3180  * cdef inline tuple PyDataType_SHAPE(dtype d):
3181  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
3182  * return <tuple>d.subarray.shape
3183  * else:
3184  */
3185  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
3186  if (__pyx_t_1) {
3187 
3188  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":752
3189  * cdef inline tuple PyDataType_SHAPE(dtype d):
3190  * if PyDataType_HASSUBARRAY(d):
3191  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
3192  * else:
3193  * return ()
3194  */
3195  __Pyx_XDECREF(__pyx_r);
3196  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
3197  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
3198  goto __pyx_L0;
3199 
3200  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
3201  *
3202  * cdef inline tuple PyDataType_SHAPE(dtype d):
3203  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
3204  * return <tuple>d.subarray.shape
3205  * else:
3206  */
3207  }
3208 
3209  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":754
3210  * return <tuple>d.subarray.shape
3211  * else:
3212  * return () # <<<<<<<<<<<<<<
3213  *
3214  *
3215  */
3216  /*else*/ {
3217  __Pyx_XDECREF(__pyx_r);
3218  __Pyx_INCREF(__pyx_empty_tuple);
3219  __pyx_r = __pyx_empty_tuple;
3220  goto __pyx_L0;
3221  }
3222 
3223  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
3224  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
3225  *
3226  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
3227  * if PyDataType_HASSUBARRAY(d):
3228  * return <tuple>d.subarray.shape
3229  */
3230 
3231  /* function exit code */
3232  __pyx_L0:;
3233  __Pyx_XGIVEREF(__pyx_r);
3234  __Pyx_RefNannyFinishContext();
3235  return __pyx_r;
3236 }
3237 
3238 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
3239  * int _import_umath() except -1
3240  *
3241  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
3242  * Py_INCREF(base) # important to do this before stealing the reference below!
3243  * PyArray_SetBaseObject(arr, base)
3244  */
3245 
3246 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
3247  __Pyx_RefNannyDeclarations
3248  __Pyx_RefNannySetupContext("set_array_base", 0);
3249 
3250  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":930
3251  *
3252  * cdef inline void set_array_base(ndarray arr, object base):
3253  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
3254  * PyArray_SetBaseObject(arr, base)
3255  *
3256  */
3257  Py_INCREF(__pyx_v_base);
3258 
3259  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":931
3260  * cdef inline void set_array_base(ndarray arr, object base):
3261  * Py_INCREF(base) # important to do this before stealing the reference below!
3262  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
3263  *
3264  * cdef inline object get_array_base(ndarray arr):
3265  */
3266  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
3267 
3268  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
3269  * int _import_umath() except -1
3270  *
3271  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
3272  * Py_INCREF(base) # important to do this before stealing the reference below!
3273  * PyArray_SetBaseObject(arr, base)
3274  */
3275 
3276  /* function exit code */
3277  __Pyx_RefNannyFinishContext();
3278 }
3279 
3280 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
3281  * PyArray_SetBaseObject(arr, base)
3282  *
3283  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
3284  * base = PyArray_BASE(arr)
3285  * if base is NULL:
3286  */
3287 
3288 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
3289  PyObject *__pyx_v_base;
3290  PyObject *__pyx_r = NULL;
3291  __Pyx_RefNannyDeclarations
3292  int __pyx_t_1;
3293  __Pyx_RefNannySetupContext("get_array_base", 0);
3294 
3295  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":934
3296  *
3297  * cdef inline object get_array_base(ndarray arr):
3298  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
3299  * if base is NULL:
3300  * return None
3301  */
3302  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
3303 
3304  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
3305  * cdef inline object get_array_base(ndarray arr):
3306  * base = PyArray_BASE(arr)
3307  * if base is NULL: # <<<<<<<<<<<<<<
3308  * return None
3309  * return <object>base
3310  */
3311  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
3312  if (__pyx_t_1) {
3313 
3314  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":936
3315  * base = PyArray_BASE(arr)
3316  * if base is NULL:
3317  * return None # <<<<<<<<<<<<<<
3318  * return <object>base
3319  *
3320  */
3321  __Pyx_XDECREF(__pyx_r);
3322  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3323  goto __pyx_L0;
3324 
3325  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
3326  * cdef inline object get_array_base(ndarray arr):
3327  * base = PyArray_BASE(arr)
3328  * if base is NULL: # <<<<<<<<<<<<<<
3329  * return None
3330  * return <object>base
3331  */
3332  }
3333 
3334  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":937
3335  * if base is NULL:
3336  * return None
3337  * return <object>base # <<<<<<<<<<<<<<
3338  *
3339  * # Versions of the import_* functions which are more suitable for
3340  */
3341  __Pyx_XDECREF(__pyx_r);
3342  __Pyx_INCREF(((PyObject *)__pyx_v_base));
3343  __pyx_r = ((PyObject *)__pyx_v_base);
3344  goto __pyx_L0;
3345 
3346  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
3347  * PyArray_SetBaseObject(arr, base)
3348  *
3349  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
3350  * base = PyArray_BASE(arr)
3351  * if base is NULL:
3352  */
3353 
3354  /* function exit code */
3355  __pyx_L0:;
3356  __Pyx_XGIVEREF(__pyx_r);
3357  __Pyx_RefNannyFinishContext();
3358  return __pyx_r;
3359 }
3360 
3361 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
3362  * # Versions of the import_* functions which are more suitable for
3363  * # Cython code.
3364  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
3365  * try:
3366  * __pyx_import_array()
3367  */
3368 
3369 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
3370  int __pyx_r;
3371  __Pyx_RefNannyDeclarations
3372  PyObject *__pyx_t_1 = NULL;
3373  PyObject *__pyx_t_2 = NULL;
3374  PyObject *__pyx_t_3 = NULL;
3375  int __pyx_t_4;
3376  PyObject *__pyx_t_5 = NULL;
3377  PyObject *__pyx_t_6 = NULL;
3378  PyObject *__pyx_t_7 = NULL;
3379  PyObject *__pyx_t_8 = NULL;
3380  int __pyx_lineno = 0;
3381  const char *__pyx_filename = NULL;
3382  int __pyx_clineno = 0;
3383  __Pyx_RefNannySetupContext("import_array", 0);
3384 
3385  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
3386  * # Cython code.
3387  * cdef inline int import_array() except -1:
3388  * try: # <<<<<<<<<<<<<<
3389  * __pyx_import_array()
3390  * except Exception:
3391  */
3392  {
3393  __Pyx_PyThreadState_declare
3394  __Pyx_PyThreadState_assign
3395  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3396  __Pyx_XGOTREF(__pyx_t_1);
3397  __Pyx_XGOTREF(__pyx_t_2);
3398  __Pyx_XGOTREF(__pyx_t_3);
3399  /*try:*/ {
3400 
3401  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":943
3402  * cdef inline int import_array() except -1:
3403  * try:
3404  * __pyx_import_array() # <<<<<<<<<<<<<<
3405  * except Exception:
3406  * raise ImportError("numpy.core.multiarray failed to import")
3407  */
3408  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
3409 
3410  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
3411  * # Cython code.
3412  * cdef inline int import_array() except -1:
3413  * try: # <<<<<<<<<<<<<<
3414  * __pyx_import_array()
3415  * except Exception:
3416  */
3417  }
3418  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3419  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3420  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3421  goto __pyx_L8_try_end;
3422  __pyx_L3_error:;
3423 
3424  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":944
3425  * try:
3426  * __pyx_import_array()
3427  * except Exception: # <<<<<<<<<<<<<<
3428  * raise ImportError("numpy.core.multiarray failed to import")
3429  *
3430  */
3431  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3432  if (__pyx_t_4) {
3433  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
3434  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
3435  __Pyx_GOTREF(__pyx_t_5);
3436  __Pyx_GOTREF(__pyx_t_6);
3437  __Pyx_GOTREF(__pyx_t_7);
3438 
3439  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
3440  * __pyx_import_array()
3441  * except Exception:
3442  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
3443  *
3444  * cdef inline int import_umath() except -1:
3445  */
3446  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
3447  __Pyx_GOTREF(__pyx_t_8);
3448  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3449  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3450  __PYX_ERR(1, 945, __pyx_L5_except_error)
3451  }
3452  goto __pyx_L5_except_error;
3453  __pyx_L5_except_error:;
3454 
3455  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
3456  * # Cython code.
3457  * cdef inline int import_array() except -1:
3458  * try: # <<<<<<<<<<<<<<
3459  * __pyx_import_array()
3460  * except Exception:
3461  */
3462  __Pyx_XGIVEREF(__pyx_t_1);
3463  __Pyx_XGIVEREF(__pyx_t_2);
3464  __Pyx_XGIVEREF(__pyx_t_3);
3465  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3466  goto __pyx_L1_error;
3467  __pyx_L8_try_end:;
3468  }
3469 
3470  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
3471  * # Versions of the import_* functions which are more suitable for
3472  * # Cython code.
3473  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
3474  * try:
3475  * __pyx_import_array()
3476  */
3477 
3478  /* function exit code */
3479  __pyx_r = 0;
3480  goto __pyx_L0;
3481  __pyx_L1_error:;
3482  __Pyx_XDECREF(__pyx_t_5);
3483  __Pyx_XDECREF(__pyx_t_6);
3484  __Pyx_XDECREF(__pyx_t_7);
3485  __Pyx_XDECREF(__pyx_t_8);
3486  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
3487  __pyx_r = -1;
3488  __pyx_L0:;
3489  __Pyx_RefNannyFinishContext();
3490  return __pyx_r;
3491 }
3492 
3493 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
3494  * raise ImportError("numpy.core.multiarray failed to import")
3495  *
3496  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
3497  * try:
3498  * _import_umath()
3499  */
3500 
3501 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
3502  int __pyx_r;
3503  __Pyx_RefNannyDeclarations
3504  PyObject *__pyx_t_1 = NULL;
3505  PyObject *__pyx_t_2 = NULL;
3506  PyObject *__pyx_t_3 = NULL;
3507  int __pyx_t_4;
3508  PyObject *__pyx_t_5 = NULL;
3509  PyObject *__pyx_t_6 = NULL;
3510  PyObject *__pyx_t_7 = NULL;
3511  PyObject *__pyx_t_8 = NULL;
3512  int __pyx_lineno = 0;
3513  const char *__pyx_filename = NULL;
3514  int __pyx_clineno = 0;
3515  __Pyx_RefNannySetupContext("import_umath", 0);
3516 
3517  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
3518  *
3519  * cdef inline int import_umath() except -1:
3520  * try: # <<<<<<<<<<<<<<
3521  * _import_umath()
3522  * except Exception:
3523  */
3524  {
3525  __Pyx_PyThreadState_declare
3526  __Pyx_PyThreadState_assign
3527  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3528  __Pyx_XGOTREF(__pyx_t_1);
3529  __Pyx_XGOTREF(__pyx_t_2);
3530  __Pyx_XGOTREF(__pyx_t_3);
3531  /*try:*/ {
3532 
3533  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":949
3534  * cdef inline int import_umath() except -1:
3535  * try:
3536  * _import_umath() # <<<<<<<<<<<<<<
3537  * except Exception:
3538  * raise ImportError("numpy.core.umath failed to import")
3539  */
3540  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
3541 
3542  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
3543  *
3544  * cdef inline int import_umath() except -1:
3545  * try: # <<<<<<<<<<<<<<
3546  * _import_umath()
3547  * except Exception:
3548  */
3549  }
3550  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3551  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3552  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3553  goto __pyx_L8_try_end;
3554  __pyx_L3_error:;
3555 
3556  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":950
3557  * try:
3558  * _import_umath()
3559  * except Exception: # <<<<<<<<<<<<<<
3560  * raise ImportError("numpy.core.umath failed to import")
3561  *
3562  */
3563  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3564  if (__pyx_t_4) {
3565  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
3566  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
3567  __Pyx_GOTREF(__pyx_t_5);
3568  __Pyx_GOTREF(__pyx_t_6);
3569  __Pyx_GOTREF(__pyx_t_7);
3570 
3571  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
3572  * _import_umath()
3573  * except Exception:
3574  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
3575  *
3576  * cdef inline int import_ufunc() except -1:
3577  */
3578  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
3579  __Pyx_GOTREF(__pyx_t_8);
3580  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3581  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3582  __PYX_ERR(1, 951, __pyx_L5_except_error)
3583  }
3584  goto __pyx_L5_except_error;
3585  __pyx_L5_except_error:;
3586 
3587  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
3588  *
3589  * cdef inline int import_umath() except -1:
3590  * try: # <<<<<<<<<<<<<<
3591  * _import_umath()
3592  * except Exception:
3593  */
3594  __Pyx_XGIVEREF(__pyx_t_1);
3595  __Pyx_XGIVEREF(__pyx_t_2);
3596  __Pyx_XGIVEREF(__pyx_t_3);
3597  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3598  goto __pyx_L1_error;
3599  __pyx_L8_try_end:;
3600  }
3601 
3602  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
3603  * raise ImportError("numpy.core.multiarray failed to import")
3604  *
3605  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
3606  * try:
3607  * _import_umath()
3608  */
3609 
3610  /* function exit code */
3611  __pyx_r = 0;
3612  goto __pyx_L0;
3613  __pyx_L1_error:;
3614  __Pyx_XDECREF(__pyx_t_5);
3615  __Pyx_XDECREF(__pyx_t_6);
3616  __Pyx_XDECREF(__pyx_t_7);
3617  __Pyx_XDECREF(__pyx_t_8);
3618  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
3619  __pyx_r = -1;
3620  __pyx_L0:;
3621  __Pyx_RefNannyFinishContext();
3622  return __pyx_r;
3623 }
3624 
3625 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
3626  * raise ImportError("numpy.core.umath failed to import")
3627  *
3628  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
3629  * try:
3630  * _import_umath()
3631  */
3632 
3633 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
3634  int __pyx_r;
3635  __Pyx_RefNannyDeclarations
3636  PyObject *__pyx_t_1 = NULL;
3637  PyObject *__pyx_t_2 = NULL;
3638  PyObject *__pyx_t_3 = NULL;
3639  int __pyx_t_4;
3640  PyObject *__pyx_t_5 = NULL;
3641  PyObject *__pyx_t_6 = NULL;
3642  PyObject *__pyx_t_7 = NULL;
3643  PyObject *__pyx_t_8 = NULL;
3644  int __pyx_lineno = 0;
3645  const char *__pyx_filename = NULL;
3646  int __pyx_clineno = 0;
3647  __Pyx_RefNannySetupContext("import_ufunc", 0);
3648 
3649  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
3650  *
3651  * cdef inline int import_ufunc() except -1:
3652  * try: # <<<<<<<<<<<<<<
3653  * _import_umath()
3654  * except Exception:
3655  */
3656  {
3657  __Pyx_PyThreadState_declare
3658  __Pyx_PyThreadState_assign
3659  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3660  __Pyx_XGOTREF(__pyx_t_1);
3661  __Pyx_XGOTREF(__pyx_t_2);
3662  __Pyx_XGOTREF(__pyx_t_3);
3663  /*try:*/ {
3664 
3665  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":955
3666  * cdef inline int import_ufunc() except -1:
3667  * try:
3668  * _import_umath() # <<<<<<<<<<<<<<
3669  * except Exception:
3670  * raise ImportError("numpy.core.umath failed to import")
3671  */
3672  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
3673 
3674  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
3675  *
3676  * cdef inline int import_ufunc() except -1:
3677  * try: # <<<<<<<<<<<<<<
3678  * _import_umath()
3679  * except Exception:
3680  */
3681  }
3682  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3683  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3684  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3685  goto __pyx_L8_try_end;
3686  __pyx_L3_error:;
3687 
3688  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":956
3689  * try:
3690  * _import_umath()
3691  * except Exception: # <<<<<<<<<<<<<<
3692  * raise ImportError("numpy.core.umath failed to import")
3693  *
3694  */
3695  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
3696  if (__pyx_t_4) {
3697  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
3698  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
3699  __Pyx_GOTREF(__pyx_t_5);
3700  __Pyx_GOTREF(__pyx_t_6);
3701  __Pyx_GOTREF(__pyx_t_7);
3702 
3703  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":957
3704  * _import_umath()
3705  * except Exception:
3706  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
3707  *
3708  * cdef extern from *:
3709  */
3710  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
3711  __Pyx_GOTREF(__pyx_t_8);
3712  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3713  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3714  __PYX_ERR(1, 957, __pyx_L5_except_error)
3715  }
3716  goto __pyx_L5_except_error;
3717  __pyx_L5_except_error:;
3718 
3719  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
3720  *
3721  * cdef inline int import_ufunc() except -1:
3722  * try: # <<<<<<<<<<<<<<
3723  * _import_umath()
3724  * except Exception:
3725  */
3726  __Pyx_XGIVEREF(__pyx_t_1);
3727  __Pyx_XGIVEREF(__pyx_t_2);
3728  __Pyx_XGIVEREF(__pyx_t_3);
3729  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
3730  goto __pyx_L1_error;
3731  __pyx_L8_try_end:;
3732  }
3733 
3734  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
3735  * raise ImportError("numpy.core.umath failed to import")
3736  *
3737  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
3738  * try:
3739  * _import_umath()
3740  */
3741 
3742  /* function exit code */
3743  __pyx_r = 0;
3744  goto __pyx_L0;
3745  __pyx_L1_error:;
3746  __Pyx_XDECREF(__pyx_t_5);
3747  __Pyx_XDECREF(__pyx_t_6);
3748  __Pyx_XDECREF(__pyx_t_7);
3749  __Pyx_XDECREF(__pyx_t_8);
3750  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
3751  __pyx_r = -1;
3752  __pyx_L0:;
3753  __Pyx_RefNannyFinishContext();
3754  return __pyx_r;
3755 }
3756 
3757 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
3758  *
3759  *
3760  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
3761  * """
3762  * Cython equivalent of `isinstance(obj, np.timedelta64)`
3763  */
3764 
3765 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
3766  int __pyx_r;
3767  __Pyx_RefNannyDeclarations
3768  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
3769 
3770  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":979
3771  * bool
3772  * """
3773  * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
3774  *
3775  *
3776  */
3777  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
3778  goto __pyx_L0;
3779 
3780  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
3781  *
3782  *
3783  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
3784  * """
3785  * Cython equivalent of `isinstance(obj, np.timedelta64)`
3786  */
3787 
3788  /* function exit code */
3789  __pyx_L0:;
3790  __Pyx_RefNannyFinishContext();
3791  return __pyx_r;
3792 }
3793 
3794 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
3795  *
3796  *
3797  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
3798  * """
3799  * Cython equivalent of `isinstance(obj, np.datetime64)`
3800  */
3801 
3802 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
3803  int __pyx_r;
3804  __Pyx_RefNannyDeclarations
3805  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
3806 
3807  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":994
3808  * bool
3809  * """
3810  * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
3811  *
3812  *
3813  */
3814  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
3815  goto __pyx_L0;
3816 
3817  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
3818  *
3819  *
3820  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
3821  * """
3822  * Cython equivalent of `isinstance(obj, np.datetime64)`
3823  */
3824 
3825  /* function exit code */
3826  __pyx_L0:;
3827  __Pyx_RefNannyFinishContext();
3828  return __pyx_r;
3829 }
3830 
3831 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
3832  *
3833  *
3834  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
3835  * """
3836  * returns the int64 value underlying scalar numpy datetime64 object
3837  */
3838 
3839 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
3840  npy_datetime __pyx_r;
3841 
3842  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1004
3843  * also needed. That can be found using `get_datetime64_unit`.
3844  * """
3845  * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
3846  *
3847  *
3848  */
3849  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
3850  goto __pyx_L0;
3851 
3852  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
3853  *
3854  *
3855  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
3856  * """
3857  * returns the int64 value underlying scalar numpy datetime64 object
3858  */
3859 
3860  /* function exit code */
3861  __pyx_L0:;
3862  return __pyx_r;
3863 }
3864 
3865 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
3866  *
3867  *
3868  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
3869  * """
3870  * returns the int64 value underlying scalar numpy timedelta64 object
3871  */
3872 
3873 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
3874  npy_timedelta __pyx_r;
3875 
3876  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1011
3877  * returns the int64 value underlying scalar numpy timedelta64 object
3878  * """
3879  * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
3880  *
3881  *
3882  */
3883  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
3884  goto __pyx_L0;
3885 
3886  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
3887  *
3888  *
3889  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
3890  * """
3891  * returns the int64 value underlying scalar numpy timedelta64 object
3892  */
3893 
3894  /* function exit code */
3895  __pyx_L0:;
3896  return __pyx_r;
3897 }
3898 
3899 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
3900  *
3901  *
3902  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
3903  * """
3904  * returns the unit part of the dtype for a numpy datetime64 object.
3905  */
3906 
3907 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
3908  NPY_DATETIMEUNIT __pyx_r;
3909 
3910  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1018
3911  * returns the unit part of the dtype for a numpy datetime64 object.
3912  * """
3913  * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
3914  */
3915  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
3916  goto __pyx_L0;
3917 
3918  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
3919  *
3920  *
3921  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
3922  * """
3923  * returns the unit part of the dtype for a numpy datetime64 object.
3924  */
3925 
3926  /* function exit code */
3927  __pyx_L0:;
3928  return __pyx_r;
3929 }
3930 
3931 static PyMethodDef __pyx_methods[] = {
3932  {0, 0, 0, 0}
3933 };
3934 
3935 #if PY_MAJOR_VERSION >= 3
3936 #if CYTHON_PEP489_MULTI_PHASE_INIT
3937 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
3938 static int __pyx_pymod_exec_cshockCapturing(PyObject* module); /*proto*/
3939 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
3940  {Py_mod_create, (void*)__pyx_pymod_create},
3941  {Py_mod_exec, (void*)__pyx_pymod_exec_cshockCapturing},
3942  {0, NULL}
3943 };
3944 #endif
3945 
3946 static struct PyModuleDef __pyx_moduledef = {
3947  PyModuleDef_HEAD_INIT,
3948  "cshockCapturing",
3949  0, /* m_doc */
3950  #if CYTHON_PEP489_MULTI_PHASE_INIT
3951  0, /* m_size */
3952  #else
3953  -1, /* m_size */
3954  #endif
3955  __pyx_methods /* m_methods */,
3956  #if CYTHON_PEP489_MULTI_PHASE_INIT
3957  __pyx_moduledef_slots, /* m_slots */
3958  #else
3959  NULL, /* m_reload */
3960  #endif
3961  NULL, /* m_traverse */
3962  NULL, /* m_clear */
3963  NULL /* m_free */
3964 };
3965 #endif
3966 #ifndef CYTHON_SMALL_CODE
3967 #if defined(__clang__)
3968  #define CYTHON_SMALL_CODE
3969 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
3970  #define CYTHON_SMALL_CODE __attribute__((cold))
3971 #else
3972  #define CYTHON_SMALL_CODE
3973 #endif
3974 #endif
3975 
3976 static __Pyx_StringTabEntry __pyx_string_tab[] = {
3977  {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
3978  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
3979  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
3980  {&__pyx_n_s_calculateNumericalDiffusionEikon, __pyx_k_calculateNumericalDiffusionEikon, sizeof(__pyx_k_calculateNumericalDiffusionEikon), 0, 0, 1, 1},
3981  {&__pyx_n_s_calculateNumericalDiffusionHJ, __pyx_k_calculateNumericalDiffusionHJ, sizeof(__pyx_k_calculateNumericalDiffusionHJ), 0, 0, 1, 1},
3982  {&__pyx_n_s_calculateNumericalDiffusionHJV2, __pyx_k_calculateNumericalDiffusionHJV2, sizeof(__pyx_k_calculateNumericalDiffusionHJV2), 0, 0, 1, 1},
3983  {&__pyx_n_s_calculateNumericalDiffusionJaffr, __pyx_k_calculateNumericalDiffusionJaffr, sizeof(__pyx_k_calculateNumericalDiffusionJaffr), 0, 0, 1, 1},
3984  {&__pyx_n_s_calculateNumericalDiffusionResGr, __pyx_k_calculateNumericalDiffusionResGr, sizeof(__pyx_k_calculateNumericalDiffusionResGr), 0, 0, 1, 1},
3985  {&__pyx_n_s_calculateNumericalDiffusionResGr_2, __pyx_k_calculateNumericalDiffusionResGr_2, sizeof(__pyx_k_calculateNumericalDiffusionResGr_2), 0, 0, 1, 1},
3986  {&__pyx_n_s_calculateNumericalDiffusionResGr_3, __pyx_k_calculateNumericalDiffusionResGr_3, sizeof(__pyx_k_calculateNumericalDiffusionResGr_3), 0, 0, 1, 1},
3987  {&__pyx_n_s_calculateNumericalDiffusion_A_1, __pyx_k_calculateNumericalDiffusion_A_1, sizeof(__pyx_k_calculateNumericalDiffusion_A_1), 0, 0, 1, 1},
3988  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
3989  {&__pyx_n_s_cshockCapturing, __pyx_k_cshockCapturing, sizeof(__pyx_k_cshockCapturing), 0, 0, 1, 1},
3990  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
3991  {&__pyx_n_s_elementDiameter, __pyx_k_elementDiameter, sizeof(__pyx_k_elementDiameter), 0, 0, 1, 1},
3992  {&__pyx_n_s_grad_u, __pyx_k_grad_u, sizeof(__pyx_k_grad_u), 0, 0, 1, 1},
3993  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
3994  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
3995  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
3996  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
3997  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
3998  {&__pyx_n_s_numDiff, __pyx_k_numDiff, sizeof(__pyx_k_numDiff), 0, 0, 1, 1},
3999  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
4000  {&__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},
4001  {&__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},
4002  {&__pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_k_proteus_cshockCapturing_pyx, sizeof(__pyx_k_proteus_cshockCapturing_pyx), 0, 0, 1, 0},
4003  {&__pyx_n_s_shockCapturing, __pyx_k_shockCapturing, sizeof(__pyx_k_shockCapturing), 0, 0, 1, 1},
4004  {&__pyx_n_s_shockCapturingDiffusion, __pyx_k_shockCapturingDiffusion, sizeof(__pyx_k_shockCapturingDiffusion), 0, 0, 1, 1},
4005  {&__pyx_n_s_shockCapturingFactor, __pyx_k_shockCapturingFactor, sizeof(__pyx_k_shockCapturingFactor), 0, 0, 1, 1},
4006  {&__pyx_n_s_strong_residual, __pyx_k_strong_residual, sizeof(__pyx_k_strong_residual), 0, 0, 1, 1},
4007  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4008  {&__pyx_n_s_uSC, __pyx_k_uSC, sizeof(__pyx_k_uSC), 0, 0, 1, 1},
4009  {0, 0, 0, 0, 0, 0, 0}
4010 };
4011 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
4012  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
4013  return 0;
4014  __pyx_L1_error:;
4015  return -1;
4016 }
4017 
4018 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
4019  __Pyx_RefNannyDeclarations
4020  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4021 
4022  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
4023  * __pyx_import_array()
4024  * except Exception:
4025  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
4026  *
4027  * cdef inline int import_umath() except -1:
4028  */
4029  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 945, __pyx_L1_error)
4030  __Pyx_GOTREF(__pyx_tuple_);
4031  __Pyx_GIVEREF(__pyx_tuple_);
4032 
4033  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
4034  * _import_umath()
4035  * except Exception:
4036  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
4037  *
4038  * cdef inline int import_ufunc() except -1:
4039  */
4040  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 951, __pyx_L1_error)
4041  __Pyx_GOTREF(__pyx_tuple__2);
4042  __Pyx_GIVEREF(__pyx_tuple__2);
4043 
4044  /* "cshockCapturing.pyx":73
4045  * double* numDiff)
4046  * ###11111111111
4047  * def calculateNumericalDiffusionResGrad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4048  * np.ndarray elementDiameter,
4049  * np.ndarray strong_residual,
4050  */
4051  __pyx_tuple__3 = PyTuple_Pack(5, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_grad_u, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 73, __pyx_L1_error)
4052  __Pyx_GOTREF(__pyx_tuple__3);
4053  __Pyx_GIVEREF(__pyx_tuple__3);
4054  __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionResGr, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 73, __pyx_L1_error)
4055 
4056  /* "cshockCapturing.pyx":86
4057  * <double*> grad_u.data,
4058  * <double*> numDiff.data)
4059  * def calculateNumericalDiffusionResGradQuad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4060  * np.ndarray elementDiameter,
4061  * np.ndarray strong_residual,
4062  */
4063  __pyx_tuple__5 = PyTuple_Pack(5, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_grad_u, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 86, __pyx_L1_error)
4064  __Pyx_GOTREF(__pyx_tuple__5);
4065  __Pyx_GIVEREF(__pyx_tuple__5);
4066  __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionResGr_2, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 86, __pyx_L1_error)
4067 
4068  /* "cshockCapturing.pyx":99
4069  * <double*> grad_u.data,
4070  * <double*> numDiff.data)
4071  * def calculateNumericalDiffusionEikonal(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4072  * np.ndarray elementDiameter,
4073  * np.ndarray strong_residual,
4074  */
4075  __pyx_tuple__7 = PyTuple_Pack(4, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 99, __pyx_L1_error)
4076  __Pyx_GOTREF(__pyx_tuple__7);
4077  __Pyx_GIVEREF(__pyx_tuple__7);
4078  __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionEikon, 99, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 99, __pyx_L1_error)
4079 
4080  /* "cshockCapturing.pyx":109
4081  * <double*> strong_residual.data,
4082  * <double*> numDiff.data)
4083  * def calculateNumericalDiffusionHJ(char shockCapturing, # <<<<<<<<<<<<<<
4084  * double shockCapturingDiffusion,
4085  * np.ndarray elementDiameter,
4086  */
4087  __pyx_tuple__9 = PyTuple_Pack(7, __pyx_n_s_shockCapturing, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_mt, __pyx_n_s_H, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 109, __pyx_L1_error)
4088  __Pyx_GOTREF(__pyx_tuple__9);
4089  __Pyx_GIVEREF(__pyx_tuple__9);
4090  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionHJ, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 109, __pyx_L1_error)
4091 
4092  /* "cshockCapturing.pyx":125
4093  * <double*> H.data,
4094  * <double*> numDiff.data)
4095  * def calculateNumericalDiffusionHJV2(char shockCapturing, # <<<<<<<<<<<<<<
4096  * double shockCapturingDiffusion,
4097  * np.ndarray elementDiameter,
4098  */
4099  __pyx_tuple__11 = PyTuple_Pack(7, __pyx_n_s_shockCapturing, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_mt, __pyx_n_s_H, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 125, __pyx_L1_error)
4100  __Pyx_GOTREF(__pyx_tuple__11);
4101  __Pyx_GIVEREF(__pyx_tuple__11);
4102  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionHJV2, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 125, __pyx_L1_error)
4103 
4104  /* "cshockCapturing.pyx":141
4105  * <double*> H.data,
4106  * <double*> numDiff.data)
4107  * def calculateNumericalDiffusion_A_1(double shockCapturingFactor, # <<<<<<<<<<<<<<
4108  * np.ndarray elementDiameter,
4109  * np.ndarray strong_residual,
4110  */
4111  __pyx_tuple__13 = PyTuple_Pack(6, __pyx_n_s_shockCapturingFactor, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_mt, __pyx_n_s_df, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 141, __pyx_L1_error)
4112  __Pyx_GOTREF(__pyx_tuple__13);
4113  __Pyx_GIVEREF(__pyx_tuple__13);
4114  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusion_A_1, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 141, __pyx_L1_error)
4115 
4116  /* "cshockCapturing.pyx":156
4117  * <double*> df.data,
4118  * <double*> numDiff.data)
4119  * def calculateNumericalDiffusionResGradJuanes(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4120  * double uSC,
4121  * np.ndarray elementDiameter,
4122  */
4123  __pyx_tuple__15 = PyTuple_Pack(6, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_uSC, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_grad_u, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 156, __pyx_L1_error)
4124  __Pyx_GOTREF(__pyx_tuple__15);
4125  __Pyx_GIVEREF(__pyx_tuple__15);
4126  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionResGr_3, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 156, __pyx_L1_error)
4127 
4128  /* "cshockCapturing.pyx":171
4129  * <double*> grad_u.data,
4130  * <double*> numDiff.data)
4131  * def calculateNumericalDiffusionJaffre(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4132  * double beta,
4133  * np.ndarray elementDiameter,
4134  */
4135  __pyx_tuple__17 = PyTuple_Pack(6, __pyx_n_s_shockCapturingDiffusion, __pyx_n_s_beta, __pyx_n_s_elementDiameter, __pyx_n_s_strong_residual, __pyx_n_s_grad_u, __pyx_n_s_numDiff); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 171, __pyx_L1_error)
4136  __Pyx_GOTREF(__pyx_tuple__17);
4137  __Pyx_GIVEREF(__pyx_tuple__17);
4138  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_cshockCapturing_pyx, __pyx_n_s_calculateNumericalDiffusionJaffr, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 171, __pyx_L1_error)
4139  __Pyx_RefNannyFinishContext();
4140  return 0;
4141  __pyx_L1_error:;
4142  __Pyx_RefNannyFinishContext();
4143  return -1;
4144 }
4145 
4146 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
4147  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4148  return 0;
4149  __pyx_L1_error:;
4150  return -1;
4151 }
4152 
4153 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
4154 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
4155 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
4156 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
4157 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
4158 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
4159 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
4160 
4161 static int __Pyx_modinit_global_init_code(void) {
4162  __Pyx_RefNannyDeclarations
4163  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
4164  /*--- Global init code ---*/
4165  __Pyx_RefNannyFinishContext();
4166  return 0;
4167 }
4168 
4169 static int __Pyx_modinit_variable_export_code(void) {
4170  __Pyx_RefNannyDeclarations
4171  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
4172  /*--- Variable export code ---*/
4173  __Pyx_RefNannyFinishContext();
4174  return 0;
4175 }
4176 
4177 static int __Pyx_modinit_function_export_code(void) {
4178  __Pyx_RefNannyDeclarations
4179  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
4180  /*--- Function export code ---*/
4181  __Pyx_RefNannyFinishContext();
4182  return 0;
4183 }
4184 
4185 static int __Pyx_modinit_type_init_code(void) {
4186  __Pyx_RefNannyDeclarations
4187  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
4188  /*--- Type init code ---*/
4189  __Pyx_RefNannyFinishContext();
4190  return 0;
4191 }
4192 
4193 static int __Pyx_modinit_type_import_code(void) {
4194  __Pyx_RefNannyDeclarations
4195  PyObject *__pyx_t_1 = NULL;
4196  int __pyx_lineno = 0;
4197  const char *__pyx_filename = NULL;
4198  int __pyx_clineno = 0;
4199  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
4200  /*--- Type import code ---*/
4201  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
4202  __Pyx_GOTREF(__pyx_t_1);
4203  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
4204  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
4205  sizeof(PyTypeObject),
4206  #else
4207  sizeof(PyHeapTypeObject),
4208  #endif
4209  __Pyx_ImportType_CheckSize_Warn);
4210  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
4211  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4212  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
4213  __Pyx_GOTREF(__pyx_t_1);
4214  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
4215  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
4216  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
4217  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
4218  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
4219  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
4220  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
4221  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
4222  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4223  if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
4224  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4225  if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
4226  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4227  if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
4228  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4229  if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
4230  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4231  if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
4232  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4233  if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
4234  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4235  if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
4236  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4237  if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
4238  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4239  if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
4240  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
4241  if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
4242  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
4243  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
4244  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4245  __Pyx_RefNannyFinishContext();
4246  return 0;
4247  __pyx_L1_error:;
4248  __Pyx_XDECREF(__pyx_t_1);
4249  __Pyx_RefNannyFinishContext();
4250  return -1;
4251 }
4252 
4253 static int __Pyx_modinit_variable_import_code(void) {
4254  __Pyx_RefNannyDeclarations
4255  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
4256  /*--- Variable import code ---*/
4257  __Pyx_RefNannyFinishContext();
4258  return 0;
4259 }
4260 
4261 static int __Pyx_modinit_function_import_code(void) {
4262  __Pyx_RefNannyDeclarations
4263  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
4264  /*--- Function import code ---*/
4265  __Pyx_RefNannyFinishContext();
4266  return 0;
4267 }
4268 
4269 
4270 #ifndef CYTHON_NO_PYINIT_EXPORT
4271 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4272 #elif PY_MAJOR_VERSION < 3
4273 #ifdef __cplusplus
4274 #define __Pyx_PyMODINIT_FUNC extern "C" void
4275 #else
4276 #define __Pyx_PyMODINIT_FUNC void
4277 #endif
4278 #else
4279 #ifdef __cplusplus
4280 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
4281 #else
4282 #define __Pyx_PyMODINIT_FUNC PyObject *
4283 #endif
4284 #endif
4285 
4286 
4287 #if PY_MAJOR_VERSION < 3
4288 __Pyx_PyMODINIT_FUNC initcshockCapturing(void) CYTHON_SMALL_CODE; /*proto*/
4289 __Pyx_PyMODINIT_FUNC initcshockCapturing(void)
4290 #else
4291 __Pyx_PyMODINIT_FUNC PyInit_cshockCapturing(void) CYTHON_SMALL_CODE; /*proto*/
4292 __Pyx_PyMODINIT_FUNC PyInit_cshockCapturing(void)
4293 #if CYTHON_PEP489_MULTI_PHASE_INIT
4294 {
4295  return PyModuleDef_Init(&__pyx_moduledef);
4296 }
4297 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
4298  #if PY_VERSION_HEX >= 0x030700A1
4299  static PY_INT64_T main_interpreter_id = -1;
4300  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
4301  if (main_interpreter_id == -1) {
4302  main_interpreter_id = current_id;
4303  return (unlikely(current_id == -1)) ? -1 : 0;
4304  } else if (unlikely(main_interpreter_id != current_id))
4305  #else
4306  static PyInterpreterState *main_interpreter = NULL;
4307  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
4308  if (!main_interpreter) {
4309  main_interpreter = current_interpreter;
4310  } else if (unlikely(main_interpreter != current_interpreter))
4311  #endif
4312  {
4313  PyErr_SetString(
4314  PyExc_ImportError,
4315  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
4316  return -1;
4317  }
4318  return 0;
4319 }
4320 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) {
4321  PyObject *value = PyObject_GetAttrString(spec, from_name);
4322  int result = 0;
4323  if (likely(value)) {
4324  if (allow_none || value != Py_None) {
4325  result = PyDict_SetItemString(moddict, to_name, value);
4326  }
4327  Py_DECREF(value);
4328  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
4329  PyErr_Clear();
4330  } else {
4331  result = -1;
4332  }
4333  return result;
4334 }
4335 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
4336  PyObject *module = NULL, *moddict, *modname;
4337  if (__Pyx_check_single_interpreter())
4338  return NULL;
4339  if (__pyx_m)
4340  return __Pyx_NewRef(__pyx_m);
4341  modname = PyObject_GetAttrString(spec, "name");
4342  if (unlikely(!modname)) goto bad;
4343  module = PyModule_NewObject(modname);
4344  Py_DECREF(modname);
4345  if (unlikely(!module)) goto bad;
4346  moddict = PyModule_GetDict(module);
4347  if (unlikely(!moddict)) goto bad;
4348  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
4349  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
4350  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
4351  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
4352  return module;
4353 bad:
4354  Py_XDECREF(module);
4355  return NULL;
4356 }
4357 
4358 
4359 static CYTHON_SMALL_CODE int __pyx_pymod_exec_cshockCapturing(PyObject *__pyx_pyinit_module)
4360 #endif
4361 #endif
4362 {
4363  PyObject *__pyx_t_1 = NULL;
4364  int __pyx_lineno = 0;
4365  const char *__pyx_filename = NULL;
4366  int __pyx_clineno = 0;
4367  __Pyx_RefNannyDeclarations
4368  #if CYTHON_PEP489_MULTI_PHASE_INIT
4369  if (__pyx_m) {
4370  if (__pyx_m == __pyx_pyinit_module) return 0;
4371  PyErr_SetString(PyExc_RuntimeError, "Module 'cshockCapturing' has already been imported. Re-initialisation is not supported.");
4372  return -1;
4373  }
4374  #elif PY_MAJOR_VERSION >= 3
4375  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
4376  #endif
4377  #if CYTHON_REFNANNY
4378 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4379 if (!__Pyx_RefNanny) {
4380  PyErr_Clear();
4381  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4382  if (!__Pyx_RefNanny)
4383  Py_FatalError("failed to import 'refnanny' module");
4384 }
4385 #endif
4386  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cshockCapturing(void)", 0);
4387  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4388  #ifdef __Pxy_PyFrame_Initialize_Offsets
4389  __Pxy_PyFrame_Initialize_Offsets();
4390  #endif
4391  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
4392  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
4393  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
4394  #ifdef __Pyx_CyFunction_USED
4395  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4396  #endif
4397  #ifdef __Pyx_FusedFunction_USED
4398  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4399  #endif
4400  #ifdef __Pyx_Coroutine_USED
4401  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4402  #endif
4403  #ifdef __Pyx_Generator_USED
4404  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4405  #endif
4406  #ifdef __Pyx_AsyncGen_USED
4407  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4408  #endif
4409  #ifdef __Pyx_StopAsyncIteration_USED
4410  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4411  #endif
4412  /*--- Library function declarations ---*/
4413  /*--- Threads initialization code ---*/
4414  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4415  PyEval_InitThreads();
4416  #endif
4417  /*--- Module creation code ---*/
4418  #if CYTHON_PEP489_MULTI_PHASE_INIT
4419  __pyx_m = __pyx_pyinit_module;
4420  Py_INCREF(__pyx_m);
4421  #else
4422  #if PY_MAJOR_VERSION < 3
4423  __pyx_m = Py_InitModule4("cshockCapturing", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4424  #else
4425  __pyx_m = PyModule_Create(&__pyx_moduledef);
4426  #endif
4427  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4428  #endif
4429  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4430  Py_INCREF(__pyx_d);
4431  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
4432  Py_INCREF(__pyx_b);
4433  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
4434  Py_INCREF(__pyx_cython_runtime);
4435  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4436  /*--- Initialize various global constants etc. ---*/
4437  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4438  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4439  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4440  #endif
4441  if (__pyx_module_is_main_cshockCapturing) {
4442  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4443  }
4444  #if PY_MAJOR_VERSION >= 3
4445  {
4446  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
4447  if (!PyDict_GetItemString(modules, "cshockCapturing")) {
4448  if (unlikely(PyDict_SetItemString(modules, "cshockCapturing", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4449  }
4450  }
4451  #endif
4452  /*--- Builtin init code ---*/
4453  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4454  /*--- Constants init code ---*/
4455  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4456  /*--- Global type/function init code ---*/
4457  (void)__Pyx_modinit_global_init_code();
4458  (void)__Pyx_modinit_variable_export_code();
4459  (void)__Pyx_modinit_function_export_code();
4460  (void)__Pyx_modinit_type_init_code();
4461  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
4462  (void)__Pyx_modinit_variable_import_code();
4463  (void)__Pyx_modinit_function_import_code();
4464  /*--- Execution code ---*/
4465  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4466  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4467  #endif
4468 
4469  /* "cshockCapturing.pyx":2
4470  * # A type of -*- python -*- file
4471  * import numpy as np # <<<<<<<<<<<<<<
4472  * cimport numpy as np
4473  * cdef extern from "subgridError.h":
4474  */
4475  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
4476  __Pyx_GOTREF(__pyx_t_1);
4477  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
4478  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4479 
4480  /* "cshockCapturing.pyx":73
4481  * double* numDiff)
4482  * ###11111111111
4483  * def calculateNumericalDiffusionResGrad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4484  * np.ndarray elementDiameter,
4485  * np.ndarray strong_residual,
4486  */
4487  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_1calculateNumericalDiffusionResGrad, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
4488  __Pyx_GOTREF(__pyx_t_1);
4489  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionResGr, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
4490  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4491 
4492  /* "cshockCapturing.pyx":86
4493  * <double*> grad_u.data,
4494  * <double*> numDiff.data)
4495  * def calculateNumericalDiffusionResGradQuad(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4496  * np.ndarray elementDiameter,
4497  * np.ndarray strong_residual,
4498  */
4499  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_3calculateNumericalDiffusionResGradQuad, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
4500  __Pyx_GOTREF(__pyx_t_1);
4501  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionResGr_2, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
4502  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4503 
4504  /* "cshockCapturing.pyx":99
4505  * <double*> grad_u.data,
4506  * <double*> numDiff.data)
4507  * def calculateNumericalDiffusionEikonal(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4508  * np.ndarray elementDiameter,
4509  * np.ndarray strong_residual,
4510  */
4511  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_5calculateNumericalDiffusionEikonal, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
4512  __Pyx_GOTREF(__pyx_t_1);
4513  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionEikon, __pyx_t_1) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
4514  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4515 
4516  /* "cshockCapturing.pyx":109
4517  * <double*> strong_residual.data,
4518  * <double*> numDiff.data)
4519  * def calculateNumericalDiffusionHJ(char shockCapturing, # <<<<<<<<<<<<<<
4520  * double shockCapturingDiffusion,
4521  * np.ndarray elementDiameter,
4522  */
4523  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_7calculateNumericalDiffusionHJ, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
4524  __Pyx_GOTREF(__pyx_t_1);
4525  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionHJ, __pyx_t_1) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
4526  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4527 
4528  /* "cshockCapturing.pyx":125
4529  * <double*> H.data,
4530  * <double*> numDiff.data)
4531  * def calculateNumericalDiffusionHJV2(char shockCapturing, # <<<<<<<<<<<<<<
4532  * double shockCapturingDiffusion,
4533  * np.ndarray elementDiameter,
4534  */
4535  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_9calculateNumericalDiffusionHJV2, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
4536  __Pyx_GOTREF(__pyx_t_1);
4537  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionHJV2, __pyx_t_1) < 0) __PYX_ERR(0, 125, __pyx_L1_error)
4538  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4539 
4540  /* "cshockCapturing.pyx":141
4541  * <double*> H.data,
4542  * <double*> numDiff.data)
4543  * def calculateNumericalDiffusion_A_1(double shockCapturingFactor, # <<<<<<<<<<<<<<
4544  * np.ndarray elementDiameter,
4545  * np.ndarray strong_residual,
4546  */
4547  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_11calculateNumericalDiffusion_A_1, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
4548  __Pyx_GOTREF(__pyx_t_1);
4549  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusion_A_1, __pyx_t_1) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
4550  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4551 
4552  /* "cshockCapturing.pyx":156
4553  * <double*> df.data,
4554  * <double*> numDiff.data)
4555  * def calculateNumericalDiffusionResGradJuanes(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4556  * double uSC,
4557  * np.ndarray elementDiameter,
4558  */
4559  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_13calculateNumericalDiffusionResGradJuanes, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
4560  __Pyx_GOTREF(__pyx_t_1);
4561  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionResGr_3, __pyx_t_1) < 0) __PYX_ERR(0, 156, __pyx_L1_error)
4562  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4563 
4564  /* "cshockCapturing.pyx":171
4565  * <double*> grad_u.data,
4566  * <double*> numDiff.data)
4567  * def calculateNumericalDiffusionJaffre(double shockCapturingDiffusion, # <<<<<<<<<<<<<<
4568  * double beta,
4569  * np.ndarray elementDiameter,
4570  */
4571  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15cshockCapturing_15calculateNumericalDiffusionJaffre, NULL, __pyx_n_s_cshockCapturing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
4572  __Pyx_GOTREF(__pyx_t_1);
4573  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNumericalDiffusionJaffr, __pyx_t_1) < 0) __PYX_ERR(0, 171, __pyx_L1_error)
4574  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4575 
4576  /* "cshockCapturing.pyx":1
4577  * # A type of -*- python -*- file # <<<<<<<<<<<<<<
4578  * import numpy as np
4579  * cimport numpy as np
4580  */
4581  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4582  __Pyx_GOTREF(__pyx_t_1);
4583  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4584  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4585 
4586  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
4587  *
4588  *
4589  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
4590  * """
4591  * returns the unit part of the dtype for a numpy datetime64 object.
4592  */
4593 
4594  /*--- Wrapped vars code ---*/
4595 
4596  goto __pyx_L0;
4597  __pyx_L1_error:;
4598  __Pyx_XDECREF(__pyx_t_1);
4599  if (__pyx_m) {
4600  if (__pyx_d) {
4601  __Pyx_AddTraceback("init cshockCapturing", __pyx_clineno, __pyx_lineno, __pyx_filename);
4602  }
4603  Py_CLEAR(__pyx_m);
4604  } else if (!PyErr_Occurred()) {
4605  PyErr_SetString(PyExc_ImportError, "init cshockCapturing");
4606  }
4607  __pyx_L0:;
4608  __Pyx_RefNannyFinishContext();
4609  #if CYTHON_PEP489_MULTI_PHASE_INIT
4610  return (__pyx_m != NULL) ? 0 : -1;
4611  #elif PY_MAJOR_VERSION >= 3
4612  return __pyx_m;
4613  #else
4614  return;
4615  #endif
4616 }
4617 
4618 /* --- Runtime support code --- */
4619 /* Refnanny */
4620 #if CYTHON_REFNANNY
4621 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
4622  PyObject *m = NULL, *p = NULL;
4623  void *r = NULL;
4624  m = PyImport_ImportModule(modname);
4625  if (!m) goto end;
4626  p = PyObject_GetAttrString(m, "RefNannyAPI");
4627  if (!p) goto end;
4628  r = PyLong_AsVoidPtr(p);
4629 end:
4630  Py_XDECREF(p);
4631  Py_XDECREF(m);
4632  return (__Pyx_RefNannyAPIStruct *)r;
4633 }
4634 #endif
4635 
4636 /* RaiseArgTupleInvalid */
4637 static void __Pyx_RaiseArgtupleInvalid(
4638  const char* func_name,
4639  int exact,
4640  Py_ssize_t num_min,
4641  Py_ssize_t num_max,
4642  Py_ssize_t num_found)
4643 {
4644  Py_ssize_t num_expected;
4645  const char *more_or_less;
4646  if (num_found < num_min) {
4647  num_expected = num_min;
4648  more_or_less = "at least";
4649  } else {
4650  num_expected = num_max;
4651  more_or_less = "at most";
4652  }
4653  if (exact) {
4654  more_or_less = "exactly";
4655  }
4656  PyErr_Format(PyExc_TypeError,
4657  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
4658  func_name, more_or_less, num_expected,
4659  (num_expected == 1) ? "" : "s", num_found);
4660 }
4661 
4662 /* RaiseDoubleKeywords */
4663 static void __Pyx_RaiseDoubleKeywordsError(
4664  const char* func_name,
4665  PyObject* kw_name)
4666 {
4667  PyErr_Format(PyExc_TypeError,
4668  #if PY_MAJOR_VERSION >= 3
4669  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
4670  #else
4671  "%s() got multiple values for keyword argument '%s'", func_name,
4672  PyString_AsString(kw_name));
4673  #endif
4674 }
4675 
4676 /* ParseKeywords */
4677 static int __Pyx_ParseOptionalKeywords(
4678  PyObject *kwds,
4679  PyObject **argnames[],
4680  PyObject *kwds2,
4681  PyObject *values[],
4682  Py_ssize_t num_pos_args,
4683  const char* function_name)
4684 {
4685  PyObject *key = 0, *value = 0;
4686  Py_ssize_t pos = 0;
4687  PyObject*** name;
4688  PyObject*** first_kw_arg = argnames + num_pos_args;
4689  while (PyDict_Next(kwds, &pos, &key, &value)) {
4690  name = first_kw_arg;
4691  while (*name && (**name != key)) name++;
4692  if (*name) {
4693  values[name-argnames] = value;
4694  continue;
4695  }
4696  name = first_kw_arg;
4697  #if PY_MAJOR_VERSION < 3
4698  if (likely(PyString_Check(key))) {
4699  while (*name) {
4700  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
4701  && _PyString_Eq(**name, key)) {
4702  values[name-argnames] = value;
4703  break;
4704  }
4705  name++;
4706  }
4707  if (*name) continue;
4708  else {
4709  PyObject*** argname = argnames;
4710  while (argname != first_kw_arg) {
4711  if ((**argname == key) || (
4712  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
4713  && _PyString_Eq(**argname, key))) {
4714  goto arg_passed_twice;
4715  }
4716  argname++;
4717  }
4718  }
4719  } else
4720  #endif
4721  if (likely(PyUnicode_Check(key))) {
4722  while (*name) {
4723  int cmp = (**name == key) ? 0 :
4724  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
4725  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
4726  #endif
4727  PyUnicode_Compare(**name, key);
4728  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
4729  if (cmp == 0) {
4730  values[name-argnames] = value;
4731  break;
4732  }
4733  name++;
4734  }
4735  if (*name) continue;
4736  else {
4737  PyObject*** argname = argnames;
4738  while (argname != first_kw_arg) {
4739  int cmp = (**argname == key) ? 0 :
4740  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
4741  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
4742  #endif
4743  PyUnicode_Compare(**argname, key);
4744  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
4745  if (cmp == 0) goto arg_passed_twice;
4746  argname++;
4747  }
4748  }
4749  } else
4750  goto invalid_keyword_type;
4751  if (kwds2) {
4752  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
4753  } else {
4754  goto invalid_keyword;
4755  }
4756  }
4757  return 0;
4758 arg_passed_twice:
4759  __Pyx_RaiseDoubleKeywordsError(function_name, key);
4760  goto bad;
4761 invalid_keyword_type:
4762  PyErr_Format(PyExc_TypeError,
4763  "%.200s() keywords must be strings", function_name);
4764  goto bad;
4765 invalid_keyword:
4766  PyErr_Format(PyExc_TypeError,
4767  #if PY_MAJOR_VERSION < 3
4768  "%.200s() got an unexpected keyword argument '%.200s'",
4769  function_name, PyString_AsString(key));
4770  #else
4771  "%s() got an unexpected keyword argument '%U'",
4772  function_name, key);
4773  #endif
4774 bad:
4775  return -1;
4776 }
4777 
4778 /* ArgTypeTest */
4779 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
4780 {
4781  if (unlikely(!type)) {
4782  PyErr_SetString(PyExc_SystemError, "Missing type object");
4783  return 0;
4784  }
4785  else if (exact) {
4786  #if PY_MAJOR_VERSION == 2
4787  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
4788  #endif
4789  }
4790  else {
4791  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
4792  }
4793  PyErr_Format(PyExc_TypeError,
4794  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
4795  name, type->tp_name, Py_TYPE(obj)->tp_name);
4796  return 0;
4797 }
4798 
4799 /* PyObjectGetAttrStr */
4800 #if CYTHON_USE_TYPE_SLOTS
4801 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
4802  PyTypeObject* tp = Py_TYPE(obj);
4803  if (likely(tp->tp_getattro))
4804  return tp->tp_getattro(obj, attr_name);
4805 #if PY_MAJOR_VERSION < 3
4806  if (likely(tp->tp_getattr))
4807  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
4808 #endif
4809  return PyObject_GetAttr(obj, attr_name);
4810 }
4811 #endif
4812 
4813 /* GetBuiltinName */
4814 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
4815  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
4816  if (unlikely(!result)) {
4817  PyErr_Format(PyExc_NameError,
4818 #if PY_MAJOR_VERSION >= 3
4819  "name '%U' is not defined", name);
4820 #else
4821  "name '%.200s' is not defined", PyString_AS_STRING(name));
4822 #endif
4823  }
4824  return result;
4825 }
4826 
4827 /* GetTopmostException */
4828 #if CYTHON_USE_EXC_INFO_STACK
4829 static _PyErr_StackItem *
4830 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
4831 {
4832  _PyErr_StackItem *exc_info = tstate->exc_info;
4833  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
4834  exc_info->previous_item != NULL)
4835  {
4836  exc_info = exc_info->previous_item;
4837  }
4838  return exc_info;
4839 }
4840 #endif
4841 
4842 /* SaveResetException */
4843 #if CYTHON_FAST_THREAD_STATE
4844 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
4845  #if CYTHON_USE_EXC_INFO_STACK
4846  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
4847  *type = exc_info->exc_type;
4848  *value = exc_info->exc_value;
4849  *tb = exc_info->exc_traceback;
4850  #else
4851  *type = tstate->exc_type;
4852  *value = tstate->exc_value;
4853  *tb = tstate->exc_traceback;
4854  #endif
4855  Py_XINCREF(*type);
4856  Py_XINCREF(*value);
4857  Py_XINCREF(*tb);
4858 }
4859 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
4860  PyObject *tmp_type, *tmp_value, *tmp_tb;
4861  #if CYTHON_USE_EXC_INFO_STACK
4862  _PyErr_StackItem *exc_info = tstate->exc_info;
4863  tmp_type = exc_info->exc_type;
4864  tmp_value = exc_info->exc_value;
4865  tmp_tb = exc_info->exc_traceback;
4866  exc_info->exc_type = type;
4867  exc_info->exc_value = value;
4868  exc_info->exc_traceback = tb;
4869  #else
4870  tmp_type = tstate->exc_type;
4871  tmp_value = tstate->exc_value;
4872  tmp_tb = tstate->exc_traceback;
4873  tstate->exc_type = type;
4874  tstate->exc_value = value;
4875  tstate->exc_traceback = tb;
4876  #endif
4877  Py_XDECREF(tmp_type);
4878  Py_XDECREF(tmp_value);
4879  Py_XDECREF(tmp_tb);
4880 }
4881 #endif
4882 
4883 /* PyErrExceptionMatches */
4884 #if CYTHON_FAST_THREAD_STATE
4885 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4886  Py_ssize_t i, n;
4887  n = PyTuple_GET_SIZE(tuple);
4888 #if PY_MAJOR_VERSION >= 3
4889  for (i=0; i<n; i++) {
4890  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
4891  }
4892 #endif
4893  for (i=0; i<n; i++) {
4894  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
4895  }
4896  return 0;
4897 }
4898 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
4899  PyObject *exc_type = tstate->curexc_type;
4900  if (exc_type == err) return 1;
4901  if (unlikely(!exc_type)) return 0;
4902  if (unlikely(PyTuple_Check(err)))
4903  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
4904  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
4905 }
4906 #endif
4907 
4908 /* GetException */
4909 #if CYTHON_FAST_THREAD_STATE
4910 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
4911 #else
4912 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
4913 #endif
4914 {
4915  PyObject *local_type, *local_value, *local_tb;
4916 #if CYTHON_FAST_THREAD_STATE
4917  PyObject *tmp_type, *tmp_value, *tmp_tb;
4918  local_type = tstate->curexc_type;
4919  local_value = tstate->curexc_value;
4920  local_tb = tstate->curexc_traceback;
4921  tstate->curexc_type = 0;
4922  tstate->curexc_value = 0;
4923  tstate->curexc_traceback = 0;
4924 #else
4925  PyErr_Fetch(&local_type, &local_value, &local_tb);
4926 #endif
4927  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
4928 #if CYTHON_FAST_THREAD_STATE
4929  if (unlikely(tstate->curexc_type))
4930 #else
4931  if (unlikely(PyErr_Occurred()))
4932 #endif
4933  goto bad;
4934  #if PY_MAJOR_VERSION >= 3
4935  if (local_tb) {
4936  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
4937  goto bad;
4938  }
4939  #endif
4940  Py_XINCREF(local_tb);
4941  Py_XINCREF(local_type);
4942  Py_XINCREF(local_value);
4943  *type = local_type;
4944  *value = local_value;
4945  *tb = local_tb;
4946 #if CYTHON_FAST_THREAD_STATE
4947  #if CYTHON_USE_EXC_INFO_STACK
4948  {
4949  _PyErr_StackItem *exc_info = tstate->exc_info;
4950  tmp_type = exc_info->exc_type;
4951  tmp_value = exc_info->exc_value;
4952  tmp_tb = exc_info->exc_traceback;
4953  exc_info->exc_type = local_type;
4954  exc_info->exc_value = local_value;
4955  exc_info->exc_traceback = local_tb;
4956  }
4957  #else
4958  tmp_type = tstate->exc_type;
4959  tmp_value = tstate->exc_value;
4960  tmp_tb = tstate->exc_traceback;
4961  tstate->exc_type = local_type;
4962  tstate->exc_value = local_value;
4963  tstate->exc_traceback = local_tb;
4964  #endif
4965  Py_XDECREF(tmp_type);
4966  Py_XDECREF(tmp_value);
4967  Py_XDECREF(tmp_tb);
4968 #else
4969  PyErr_SetExcInfo(local_type, local_value, local_tb);
4970 #endif
4971  return 0;
4972 bad:
4973  *type = 0;
4974  *value = 0;
4975  *tb = 0;
4976  Py_XDECREF(local_type);
4977  Py_XDECREF(local_value);
4978  Py_XDECREF(local_tb);
4979  return -1;
4980 }
4981 
4982 /* PyObjectCall */
4983 #if CYTHON_COMPILING_IN_CPYTHON
4984 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
4985  PyObject *result;
4986  ternaryfunc call = Py_TYPE(func)->tp_call;
4987  if (unlikely(!call))
4988  return PyObject_Call(func, arg, kw);
4989  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4990  return NULL;
4991  result = (*call)(func, arg, kw);
4992  Py_LeaveRecursiveCall();
4993  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4994  PyErr_SetString(
4995  PyExc_SystemError,
4996  "NULL result without error in PyObject_Call");
4997  }
4998  return result;
4999 }
5000 #endif
5001 
5002 /* PyErrFetchRestore */
5003 #if CYTHON_FAST_THREAD_STATE
5004 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5005  PyObject *tmp_type, *tmp_value, *tmp_tb;
5006  tmp_type = tstate->curexc_type;
5007  tmp_value = tstate->curexc_value;
5008  tmp_tb = tstate->curexc_traceback;
5009  tstate->curexc_type = type;
5010  tstate->curexc_value = value;
5011  tstate->curexc_traceback = tb;
5012  Py_XDECREF(tmp_type);
5013  Py_XDECREF(tmp_value);
5014  Py_XDECREF(tmp_tb);
5015 }
5016 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5017  *type = tstate->curexc_type;
5018  *value = tstate->curexc_value;
5019  *tb = tstate->curexc_traceback;
5020  tstate->curexc_type = 0;
5021  tstate->curexc_value = 0;
5022  tstate->curexc_traceback = 0;
5023 }
5024 #endif
5025 
5026 /* RaiseException */
5027 #if PY_MAJOR_VERSION < 3
5028 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
5029  CYTHON_UNUSED PyObject *cause) {
5030  __Pyx_PyThreadState_declare
5031  Py_XINCREF(type);
5032  if (!value || value == Py_None)
5033  value = NULL;
5034  else
5035  Py_INCREF(value);
5036  if (!tb || tb == Py_None)
5037  tb = NULL;
5038  else {
5039  Py_INCREF(tb);
5040  if (!PyTraceBack_Check(tb)) {
5041  PyErr_SetString(PyExc_TypeError,
5042  "raise: arg 3 must be a traceback or None");
5043  goto raise_error;
5044  }
5045  }
5046  if (PyType_Check(type)) {
5047 #if CYTHON_COMPILING_IN_PYPY
5048  if (!value) {
5049  Py_INCREF(Py_None);
5050  value = Py_None;
5051  }
5052 #endif
5053  PyErr_NormalizeException(&type, &value, &tb);
5054  } else {
5055  if (value) {
5056  PyErr_SetString(PyExc_TypeError,
5057  "instance exception may not have a separate value");
5058  goto raise_error;
5059  }
5060  value = type;
5061  type = (PyObject*) Py_TYPE(type);
5062  Py_INCREF(type);
5063  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
5064  PyErr_SetString(PyExc_TypeError,
5065  "raise: exception class must be a subclass of BaseException");
5066  goto raise_error;
5067  }
5068  }
5069  __Pyx_PyThreadState_assign
5070  __Pyx_ErrRestore(type, value, tb);
5071  return;
5072 raise_error:
5073  Py_XDECREF(value);
5074  Py_XDECREF(type);
5075  Py_XDECREF(tb);
5076  return;
5077 }
5078 #else
5079 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5080  PyObject* owned_instance = NULL;
5081  if (tb == Py_None) {
5082  tb = 0;
5083  } else if (tb && !PyTraceBack_Check(tb)) {
5084  PyErr_SetString(PyExc_TypeError,
5085  "raise: arg 3 must be a traceback or None");
5086  goto bad;
5087  }
5088  if (value == Py_None)
5089  value = 0;
5090  if (PyExceptionInstance_Check(type)) {
5091  if (value) {
5092  PyErr_SetString(PyExc_TypeError,
5093  "instance exception may not have a separate value");
5094  goto bad;
5095  }
5096  value = type;
5097  type = (PyObject*) Py_TYPE(value);
5098  } else if (PyExceptionClass_Check(type)) {
5099  PyObject *instance_class = NULL;
5100  if (value && PyExceptionInstance_Check(value)) {
5101  instance_class = (PyObject*) Py_TYPE(value);
5102  if (instance_class != type) {
5103  int is_subclass = PyObject_IsSubclass(instance_class, type);
5104  if (!is_subclass) {
5105  instance_class = NULL;
5106  } else if (unlikely(is_subclass == -1)) {
5107  goto bad;
5108  } else {
5109  type = instance_class;
5110  }
5111  }
5112  }
5113  if (!instance_class) {
5114  PyObject *args;
5115  if (!value)
5116  args = PyTuple_New(0);
5117  else if (PyTuple_Check(value)) {
5118  Py_INCREF(value);
5119  args = value;
5120  } else
5121  args = PyTuple_Pack(1, value);
5122  if (!args)
5123  goto bad;
5124  owned_instance = PyObject_Call(type, args, NULL);
5125  Py_DECREF(args);
5126  if (!owned_instance)
5127  goto bad;
5128  value = owned_instance;
5129  if (!PyExceptionInstance_Check(value)) {
5130  PyErr_Format(PyExc_TypeError,
5131  "calling %R should have returned an instance of "
5132  "BaseException, not %R",
5133  type, Py_TYPE(value));
5134  goto bad;
5135  }
5136  }
5137  } else {
5138  PyErr_SetString(PyExc_TypeError,
5139  "raise: exception class must be a subclass of BaseException");
5140  goto bad;
5141  }
5142  if (cause) {
5143  PyObject *fixed_cause;
5144  if (cause == Py_None) {
5145  fixed_cause = NULL;
5146  } else if (PyExceptionClass_Check(cause)) {
5147  fixed_cause = PyObject_CallObject(cause, NULL);
5148  if (fixed_cause == NULL)
5149  goto bad;
5150  } else if (PyExceptionInstance_Check(cause)) {
5151  fixed_cause = cause;
5152  Py_INCREF(fixed_cause);
5153  } else {
5154  PyErr_SetString(PyExc_TypeError,
5155  "exception causes must derive from "
5156  "BaseException");
5157  goto bad;
5158  }
5159  PyException_SetCause(value, fixed_cause);
5160  }
5161  PyErr_SetObject(type, value);
5162  if (tb) {
5163 #if CYTHON_COMPILING_IN_PYPY
5164  PyObject *tmp_type, *tmp_value, *tmp_tb;
5165  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
5166  Py_INCREF(tb);
5167  PyErr_Restore(tmp_type, tmp_value, tb);
5168  Py_XDECREF(tmp_tb);
5169 #else
5170  PyThreadState *tstate = __Pyx_PyThreadState_Current;
5171  PyObject* tmp_tb = tstate->curexc_traceback;
5172  if (tb != tmp_tb) {
5173  Py_INCREF(tb);
5174  tstate->curexc_traceback = tb;
5175  Py_XDECREF(tmp_tb);
5176  }
5177 #endif
5178  }
5179 bad:
5180  Py_XDECREF(owned_instance);
5181  return;
5182 }
5183 #endif
5184 
5185 /* TypeImport */
5186 #ifndef __PYX_HAVE_RT_ImportType
5187 #define __PYX_HAVE_RT_ImportType
5188 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
5189  size_t size, enum __Pyx_ImportType_CheckSize check_size)
5190 {
5191  PyObject *result = 0;
5192  char warning[200];
5193  Py_ssize_t basicsize;
5194 #ifdef Py_LIMITED_API
5195  PyObject *py_basicsize;
5196 #endif
5197  result = PyObject_GetAttrString(module, class_name);
5198  if (!result)
5199  goto bad;
5200  if (!PyType_Check(result)) {
5201  PyErr_Format(PyExc_TypeError,
5202  "%.200s.%.200s is not a type object",
5203  module_name, class_name);
5204  goto bad;
5205  }
5206 #ifndef Py_LIMITED_API
5207  basicsize = ((PyTypeObject *)result)->tp_basicsize;
5208 #else
5209  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
5210  if (!py_basicsize)
5211  goto bad;
5212  basicsize = PyLong_AsSsize_t(py_basicsize);
5213  Py_DECREF(py_basicsize);
5214  py_basicsize = 0;
5215  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
5216  goto bad;
5217 #endif
5218  if ((size_t)basicsize < size) {
5219  PyErr_Format(PyExc_ValueError,
5220  "%.200s.%.200s size changed, may indicate binary incompatibility. "
5221  "Expected %zd from C header, got %zd from PyObject",
5222  module_name, class_name, size, basicsize);
5223  goto bad;
5224  }
5225  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
5226  PyErr_Format(PyExc_ValueError,
5227  "%.200s.%.200s size changed, may indicate binary incompatibility. "
5228  "Expected %zd from C header, got %zd from PyObject",
5229  module_name, class_name, size, basicsize);
5230  goto bad;
5231  }
5232  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
5233  PyOS_snprintf(warning, sizeof(warning),
5234  "%s.%s size changed, may indicate binary incompatibility. "
5235  "Expected %zd from C header, got %zd from PyObject",
5236  module_name, class_name, size, basicsize);
5237  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
5238  }
5239  return (PyTypeObject *)result;
5240 bad:
5241  Py_XDECREF(result);
5242  return NULL;
5243 }
5244 #endif
5245 
5246 /* Import */
5247 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
5248  PyObject *empty_list = 0;
5249  PyObject *module = 0;
5250  PyObject *global_dict = 0;
5251  PyObject *empty_dict = 0;
5252  PyObject *list;
5253  #if PY_MAJOR_VERSION < 3
5254  PyObject *py_import;
5255  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5256  if (!py_import)
5257  goto bad;
5258  #endif
5259  if (from_list)
5260  list = from_list;
5261  else {
5262  empty_list = PyList_New(0);
5263  if (!empty_list)
5264  goto bad;
5265  list = empty_list;
5266  }
5267  global_dict = PyModule_GetDict(__pyx_m);
5268  if (!global_dict)
5269  goto bad;
5270  empty_dict = PyDict_New();
5271  if (!empty_dict)
5272  goto bad;
5273  {
5274  #if PY_MAJOR_VERSION >= 3
5275  if (level == -1) {
5276  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
5277  module = PyImport_ImportModuleLevelObject(
5278  name, global_dict, empty_dict, list, 1);
5279  if (!module) {
5280  if (!PyErr_ExceptionMatches(PyExc_ImportError))
5281  goto bad;
5282  PyErr_Clear();
5283  }
5284  }
5285  level = 0;
5286  }
5287  #endif
5288  if (!module) {
5289  #if PY_MAJOR_VERSION < 3
5290  PyObject *py_level = PyInt_FromLong(level);
5291  if (!py_level)
5292  goto bad;
5293  module = PyObject_CallFunctionObjArgs(py_import,
5294  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
5295  Py_DECREF(py_level);
5296  #else
5297  module = PyImport_ImportModuleLevelObject(
5298  name, global_dict, empty_dict, list, level);
5299  #endif
5300  }
5301  }
5302 bad:
5303  #if PY_MAJOR_VERSION < 3
5304  Py_XDECREF(py_import);
5305  #endif
5306  Py_XDECREF(empty_list);
5307  Py_XDECREF(empty_dict);
5308  return module;
5309 }
5310 
5311 /* PyDictVersioning */
5312 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
5313 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5314  PyObject *dict = Py_TYPE(obj)->tp_dict;
5315  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5316 }
5317 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5318  PyObject **dictptr = NULL;
5319  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5320  if (offset) {
5321 #if CYTHON_COMPILING_IN_CPYTHON
5322  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
5323 #else
5324  dictptr = _PyObject_GetDictPtr(obj);
5325 #endif
5326  }
5327  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5328 }
5329 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5330  PyObject *dict = Py_TYPE(obj)->tp_dict;
5331  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5332  return 0;
5333  return obj_dict_version == __Pyx_get_object_dict_version(obj);
5334 }
5335 #endif
5336 
5337 /* CLineInTraceback */
5338 #ifndef CYTHON_CLINE_IN_TRACEBACK
5339 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
5340  PyObject *use_cline;
5341  PyObject *ptype, *pvalue, *ptraceback;
5342 #if CYTHON_COMPILING_IN_CPYTHON
5343  PyObject **cython_runtime_dict;
5344 #endif
5345  if (unlikely(!__pyx_cython_runtime)) {
5346  return c_line;
5347  }
5348  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5349 #if CYTHON_COMPILING_IN_CPYTHON
5350  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
5351  if (likely(cython_runtime_dict)) {
5352  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
5353  use_cline, *cython_runtime_dict,
5354  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
5355  } else
5356 #endif
5357  {
5358  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
5359  if (use_cline_obj) {
5360  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
5361  Py_DECREF(use_cline_obj);
5362  } else {
5363  PyErr_Clear();
5364  use_cline = NULL;
5365  }
5366  }
5367  if (!use_cline) {
5368  c_line = 0;
5369  (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
5370  }
5371  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
5372  c_line = 0;
5373  }
5374  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5375  return c_line;
5376 }
5377 #endif
5378 
5379 /* CodeObjectCache */
5380 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
5381  int start = 0, mid = 0, end = count - 1;
5382  if (end >= 0 && code_line > entries[end].code_line) {
5383  return count;
5384  }
5385  while (start < end) {
5386  mid = start + (end - start) / 2;
5387  if (code_line < entries[mid].code_line) {
5388  end = mid;
5389  } else if (code_line > entries[mid].code_line) {
5390  start = mid + 1;
5391  } else {
5392  return mid;
5393  }
5394  }
5395  if (code_line <= entries[mid].code_line) {
5396  return mid;
5397  } else {
5398  return mid + 1;
5399  }
5400 }
5401 static PyCodeObject *__pyx_find_code_object(int code_line) {
5402  PyCodeObject* code_object;
5403  int pos;
5404  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
5405  return NULL;
5406  }
5407  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5408  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
5409  return NULL;
5410  }
5411  code_object = __pyx_code_cache.entries[pos].code_object;
5412  Py_INCREF(code_object);
5413  return code_object;
5414 }
5415 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
5416  int pos, i;
5417  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5418  if (unlikely(!code_line)) {
5419  return;
5420  }
5421  if (unlikely(!entries)) {
5422  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
5423  if (likely(entries)) {
5424  __pyx_code_cache.entries = entries;
5425  __pyx_code_cache.max_count = 64;
5426  __pyx_code_cache.count = 1;
5427  entries[0].code_line = code_line;
5428  entries[0].code_object = code_object;
5429  Py_INCREF(code_object);
5430  }
5431  return;
5432  }
5433  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5434  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
5435  PyCodeObject* tmp = entries[pos].code_object;
5436  entries[pos].code_object = code_object;
5437  Py_DECREF(tmp);
5438  return;
5439  }
5440  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
5441  int new_max = __pyx_code_cache.max_count + 64;
5442  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
5443  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
5444  if (unlikely(!entries)) {
5445  return;
5446  }
5447  __pyx_code_cache.entries = entries;
5448  __pyx_code_cache.max_count = new_max;
5449  }
5450  for (i=__pyx_code_cache.count; i>pos; i--) {
5451  entries[i] = entries[i-1];
5452  }
5453  entries[pos].code_line = code_line;
5454  entries[pos].code_object = code_object;
5455  __pyx_code_cache.count++;
5456  Py_INCREF(code_object);
5457 }
5458 
5459 /* AddTraceback */
5460 #include "compile.h"
5461 #include "frameobject.h"
5462 #include "traceback.h"
5463 #if PY_VERSION_HEX >= 0x030b00a6
5464  #ifndef Py_BUILD_CORE
5465  #define Py_BUILD_CORE 1
5466  #endif
5467  #include "internal/pycore_frame.h"
5468 #endif
5469 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
5470  const char *funcname, int c_line,
5471  int py_line, const char *filename) {
5472  PyCodeObject *py_code = NULL;
5473  PyObject *py_funcname = NULL;
5474  #if PY_MAJOR_VERSION < 3
5475  PyObject *py_srcfile = NULL;
5476  py_srcfile = PyString_FromString(filename);
5477  if (!py_srcfile) goto bad;
5478  #endif
5479  if (c_line) {
5480  #if PY_MAJOR_VERSION < 3
5481  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5482  if (!py_funcname) goto bad;
5483  #else
5484  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5485  if (!py_funcname) goto bad;
5486  funcname = PyUnicode_AsUTF8(py_funcname);
5487  if (!funcname) goto bad;
5488  #endif
5489  }
5490  else {
5491  #if PY_MAJOR_VERSION < 3
5492  py_funcname = PyString_FromString(funcname);
5493  if (!py_funcname) goto bad;
5494  #endif
5495  }
5496  #if PY_MAJOR_VERSION < 3
5497  py_code = __Pyx_PyCode_New(
5498  0,
5499  0,
5500  0,
5501  0,
5502  0,
5503  __pyx_empty_bytes, /*PyObject *code,*/
5504  __pyx_empty_tuple, /*PyObject *consts,*/
5505  __pyx_empty_tuple, /*PyObject *names,*/
5506  __pyx_empty_tuple, /*PyObject *varnames,*/
5507  __pyx_empty_tuple, /*PyObject *freevars,*/
5508  __pyx_empty_tuple, /*PyObject *cellvars,*/
5509  py_srcfile, /*PyObject *filename,*/
5510  py_funcname, /*PyObject *name,*/
5511  py_line,
5512  __pyx_empty_bytes /*PyObject *lnotab*/
5513  );
5514  Py_DECREF(py_srcfile);
5515  #else
5516  py_code = PyCode_NewEmpty(filename, funcname, py_line);
5517  #endif
5518  Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
5519  return py_code;
5520 bad:
5521  Py_XDECREF(py_funcname);
5522  #if PY_MAJOR_VERSION < 3
5523  Py_XDECREF(py_srcfile);
5524  #endif
5525  return NULL;
5526 }
5527 static void __Pyx_AddTraceback(const char *funcname, int c_line,
5528  int py_line, const char *filename) {
5529  PyCodeObject *py_code = 0;
5530  PyFrameObject *py_frame = 0;
5531  PyThreadState *tstate = __Pyx_PyThreadState_Current;
5532  PyObject *ptype, *pvalue, *ptraceback;
5533  if (c_line) {
5534  c_line = __Pyx_CLineForTraceback(tstate, c_line);
5535  }
5536  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
5537  if (!py_code) {
5538  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5539  py_code = __Pyx_CreateCodeObjectForTraceback(
5540  funcname, c_line, py_line, filename);
5541  if (!py_code) {
5542  /* If the code object creation fails, then we should clear the
5543  fetched exception references and propagate the new exception */
5544  Py_XDECREF(ptype);
5545  Py_XDECREF(pvalue);
5546  Py_XDECREF(ptraceback);
5547  goto bad;
5548  }
5549  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5550  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
5551  }
5552  py_frame = PyFrame_New(
5553  tstate, /*PyThreadState *tstate,*/
5554  py_code, /*PyCodeObject *code,*/
5555  __pyx_d, /*PyObject *globals,*/
5556  0 /*PyObject *locals*/
5557  );
5558  if (!py_frame) goto bad;
5559  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
5560  PyTraceBack_Here(py_frame);
5561 bad:
5562  Py_XDECREF(py_code);
5563  Py_XDECREF(py_frame);
5564 }
5565 
5566 /* CIntFromPyVerify */
5567 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
5568  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
5569 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
5570  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
5571 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
5572  {\
5573  func_type value = func_value;\
5574  if (sizeof(target_type) < sizeof(func_type)) {\
5575  if (unlikely(value != (func_type) (target_type) value)) {\
5576  func_type zero = 0;\
5577  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
5578  return (target_type) -1;\
5579  if (is_unsigned && unlikely(value < zero))\
5580  goto raise_neg_overflow;\
5581  else\
5582  goto raise_overflow;\
5583  }\
5584  }\
5585  return (target_type) value;\
5586  }
5587 
5588 /* Declarations */
5589 #if CYTHON_CCOMPLEX
5590  #ifdef __cplusplus
5591  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
5592  return ::std::complex< float >(x, y);
5593  }
5594  #else
5595  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
5596  return x + y*(__pyx_t_float_complex)_Complex_I;
5597  }
5598  #endif
5599 #else
5600  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
5601  __pyx_t_float_complex z;
5602  z.real = x;
5603  z.imag = y;
5604  return z;
5605  }
5606 #endif
5607 
5608 /* Arithmetic */
5609 #if CYTHON_CCOMPLEX
5610 #else
5611  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5612  return (a.real == b.real) && (a.imag == b.imag);
5613  }
5614  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5615  __pyx_t_float_complex z;
5616  z.real = a.real + b.real;
5617  z.imag = a.imag + b.imag;
5618  return z;
5619  }
5620  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5621  __pyx_t_float_complex z;
5622  z.real = a.real - b.real;
5623  z.imag = a.imag - b.imag;
5624  return z;
5625  }
5626  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5627  __pyx_t_float_complex z;
5628  z.real = a.real * b.real - a.imag * b.imag;
5629  z.imag = a.real * b.imag + a.imag * b.real;
5630  return z;
5631  }
5632  #if 1
5633  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5634  if (b.imag == 0) {
5635  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
5636  } else if (fabsf(b.real) >= fabsf(b.imag)) {
5637  if (b.real == 0 && b.imag == 0) {
5638  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
5639  } else {
5640  float r = b.imag / b.real;
5641  float s = (float)(1.0) / (b.real + b.imag * r);
5642  return __pyx_t_float_complex_from_parts(
5643  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
5644  }
5645  } else {
5646  float r = b.real / b.imag;
5647  float s = (float)(1.0) / (b.imag + b.real * r);
5648  return __pyx_t_float_complex_from_parts(
5649  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
5650  }
5651  }
5652  #else
5653  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5654  if (b.imag == 0) {
5655  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
5656  } else {
5657  float denom = b.real * b.real + b.imag * b.imag;
5658  return __pyx_t_float_complex_from_parts(
5659  (a.real * b.real + a.imag * b.imag) / denom,
5660  (a.imag * b.real - a.real * b.imag) / denom);
5661  }
5662  }
5663  #endif
5664  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
5665  __pyx_t_float_complex z;
5666  z.real = -a.real;
5667  z.imag = -a.imag;
5668  return z;
5669  }
5670  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
5671  return (a.real == 0) && (a.imag == 0);
5672  }
5673  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
5674  __pyx_t_float_complex z;
5675  z.real = a.real;
5676  z.imag = -a.imag;
5677  return z;
5678  }
5679  #if 1
5680  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
5681  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
5682  return sqrtf(z.real*z.real + z.imag*z.imag);
5683  #else
5684  return hypotf(z.real, z.imag);
5685  #endif
5686  }
5687  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5688  __pyx_t_float_complex z;
5689  float r, lnr, theta, z_r, z_theta;
5690  if (b.imag == 0 && b.real == (int)b.real) {
5691  if (b.real < 0) {
5692  float denom = a.real * a.real + a.imag * a.imag;
5693  a.real = a.real / denom;
5694  a.imag = -a.imag / denom;
5695  b.real = -b.real;
5696  }
5697  switch ((int)b.real) {
5698  case 0:
5699  z.real = 1;
5700  z.imag = 0;
5701  return z;
5702  case 1:
5703  return a;
5704  case 2:
5705  return __Pyx_c_prod_float(a, a);
5706  case 3:
5707  z = __Pyx_c_prod_float(a, a);
5708  return __Pyx_c_prod_float(z, a);
5709  case 4:
5710  z = __Pyx_c_prod_float(a, a);
5711  return __Pyx_c_prod_float(z, z);
5712  }
5713  }
5714  if (a.imag == 0) {
5715  if (a.real == 0) {
5716  return a;
5717  } else if (b.imag == 0) {
5718  z.real = powf(a.real, b.real);
5719  z.imag = 0;
5720  return z;
5721  } else if (a.real > 0) {
5722  r = a.real;
5723  theta = 0;
5724  } else {
5725  r = -a.real;
5726  theta = atan2f(0.0, -1.0);
5727  }
5728  } else {
5729  r = __Pyx_c_abs_float(a);
5730  theta = atan2f(a.imag, a.real);
5731  }
5732  lnr = logf(r);
5733  z_r = expf(lnr * b.real - theta * b.imag);
5734  z_theta = theta * b.real + lnr * b.imag;
5735  z.real = z_r * cosf(z_theta);
5736  z.imag = z_r * sinf(z_theta);
5737  return z;
5738  }
5739  #endif
5740 #endif
5741 
5742 /* Declarations */
5743 #if CYTHON_CCOMPLEX
5744  #ifdef __cplusplus
5745  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
5746  return ::std::complex< double >(x, y);
5747  }
5748  #else
5749  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
5750  return x + y*(__pyx_t_double_complex)_Complex_I;
5751  }
5752  #endif
5753 #else
5754  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
5755  __pyx_t_double_complex z;
5756  z.real = x;
5757  z.imag = y;
5758  return z;
5759  }
5760 #endif
5761 
5762 /* Arithmetic */
5763 #if CYTHON_CCOMPLEX
5764 #else
5765  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5766  return (a.real == b.real) && (a.imag == b.imag);
5767  }
5768  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5769  __pyx_t_double_complex z;
5770  z.real = a.real + b.real;
5771  z.imag = a.imag + b.imag;
5772  return z;
5773  }
5774  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5775  __pyx_t_double_complex z;
5776  z.real = a.real - b.real;
5777  z.imag = a.imag - b.imag;
5778  return z;
5779  }
5780  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5781  __pyx_t_double_complex z;
5782  z.real = a.real * b.real - a.imag * b.imag;
5783  z.imag = a.real * b.imag + a.imag * b.real;
5784  return z;
5785  }
5786  #if 1
5787  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5788  if (b.imag == 0) {
5789  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
5790  } else if (fabs(b.real) >= fabs(b.imag)) {
5791  if (b.real == 0 && b.imag == 0) {
5792  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
5793  } else {
5794  double r = b.imag / b.real;
5795  double s = (double)(1.0) / (b.real + b.imag * r);
5796  return __pyx_t_double_complex_from_parts(
5797  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
5798  }
5799  } else {
5800  double r = b.real / b.imag;
5801  double s = (double)(1.0) / (b.imag + b.real * r);
5802  return __pyx_t_double_complex_from_parts(
5803  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
5804  }
5805  }
5806  #else
5807  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5808  if (b.imag == 0) {
5809  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
5810  } else {
5811  double denom = b.real * b.real + b.imag * b.imag;
5812  return __pyx_t_double_complex_from_parts(
5813  (a.real * b.real + a.imag * b.imag) / denom,
5814  (a.imag * b.real - a.real * b.imag) / denom);
5815  }
5816  }
5817  #endif
5818  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
5819  __pyx_t_double_complex z;
5820  z.real = -a.real;
5821  z.imag = -a.imag;
5822  return z;
5823  }
5824  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
5825  return (a.real == 0) && (a.imag == 0);
5826  }
5827  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
5828  __pyx_t_double_complex z;
5829  z.real = a.real;
5830  z.imag = -a.imag;
5831  return z;
5832  }
5833  #if 1
5834  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
5835  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
5836  return sqrt(z.real*z.real + z.imag*z.imag);
5837  #else
5838  return hypot(z.real, z.imag);
5839  #endif
5840  }
5841  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5842  __pyx_t_double_complex z;
5843  double r, lnr, theta, z_r, z_theta;
5844  if (b.imag == 0 && b.real == (int)b.real) {
5845  if (b.real < 0) {
5846  double denom = a.real * a.real + a.imag * a.imag;
5847  a.real = a.real / denom;
5848  a.imag = -a.imag / denom;
5849  b.real = -b.real;
5850  }
5851  switch ((int)b.real) {
5852  case 0:
5853  z.real = 1;
5854  z.imag = 0;
5855  return z;
5856  case 1:
5857  return a;
5858  case 2:
5859  return __Pyx_c_prod_double(a, a);
5860  case 3:
5861  z = __Pyx_c_prod_double(a, a);
5862  return __Pyx_c_prod_double(z, a);
5863  case 4:
5864  z = __Pyx_c_prod_double(a, a);
5865  return __Pyx_c_prod_double(z, z);
5866  }
5867  }
5868  if (a.imag == 0) {
5869  if (a.real == 0) {
5870  return a;
5871  } else if (b.imag == 0) {
5872  z.real = pow(a.real, b.real);
5873  z.imag = 0;
5874  return z;
5875  } else if (a.real > 0) {
5876  r = a.real;
5877  theta = 0;
5878  } else {
5879  r = -a.real;
5880  theta = atan2(0.0, -1.0);
5881  }
5882  } else {
5883  r = __Pyx_c_abs_double(a);
5884  theta = atan2(a.imag, a.real);
5885  }
5886  lnr = log(r);
5887  z_r = exp(lnr * b.real - theta * b.imag);
5888  z_theta = theta * b.real + lnr * b.imag;
5889  z.real = z_r * cos(z_theta);
5890  z.imag = z_r * sin(z_theta);
5891  return z;
5892  }
5893  #endif
5894 #endif
5895 
5896 /* CIntFromPy */
5897 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
5898 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5899 #pragma GCC diagnostic push
5900 #pragma GCC diagnostic ignored "-Wconversion"
5901 #endif
5902  const char neg_one = (char) -1, const_zero = (char) 0;
5903 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5904 #pragma GCC diagnostic pop
5905 #endif
5906  const int is_unsigned = neg_one > const_zero;
5907 #if PY_MAJOR_VERSION < 3
5908  if (likely(PyInt_Check(x))) {
5909  if (sizeof(char) < sizeof(long)) {
5910  __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
5911  } else {
5912  long val = PyInt_AS_LONG(x);
5913  if (is_unsigned && unlikely(val < 0)) {
5914  goto raise_neg_overflow;
5915  }
5916  return (char) val;
5917  }
5918  } else
5919 #endif
5920  if (likely(PyLong_Check(x))) {
5921  if (is_unsigned) {
5922 #if CYTHON_USE_PYLONG_INTERNALS
5923  const digit* digits = ((PyLongObject*)x)->ob_digit;
5924  switch (Py_SIZE(x)) {
5925  case 0: return (char) 0;
5926  case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
5927  case 2:
5928  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
5929  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5930  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5931  } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
5932  return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
5933  }
5934  }
5935  break;
5936  case 3:
5937  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
5938  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5939  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5940  } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
5941  return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
5942  }
5943  }
5944  break;
5945  case 4:
5946  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
5947  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5948  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5949  } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
5950  return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
5951  }
5952  }
5953  break;
5954  }
5955 #endif
5956 #if CYTHON_COMPILING_IN_CPYTHON
5957  if (unlikely(Py_SIZE(x) < 0)) {
5958  goto raise_neg_overflow;
5959  }
5960 #else
5961  {
5962  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5963  if (unlikely(result < 0))
5964  return (char) -1;
5965  if (unlikely(result == 1))
5966  goto raise_neg_overflow;
5967  }
5968 #endif
5969  if (sizeof(char) <= sizeof(unsigned long)) {
5970  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
5971 #ifdef HAVE_LONG_LONG
5972  } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
5973  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
5974 #endif
5975  }
5976  } else {
5977 #if CYTHON_USE_PYLONG_INTERNALS
5978  const digit* digits = ((PyLongObject*)x)->ob_digit;
5979  switch (Py_SIZE(x)) {
5980  case 0: return (char) 0;
5981  case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
5982  case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
5983  case -2:
5984  if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
5985  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5986  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5987  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
5988  return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
5989  }
5990  }
5991  break;
5992  case 2:
5993  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
5994  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5995  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5996  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
5997  return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
5998  }
5999  }
6000  break;
6001  case -3:
6002  if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
6003  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6004  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6005  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
6006  return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
6007  }
6008  }
6009  break;
6010  case 3:
6011  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
6012  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6013  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6014  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
6015  return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
6016  }
6017  }
6018  break;
6019  case -4:
6020  if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
6021  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6022  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6023  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
6024  return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
6025  }
6026  }
6027  break;
6028  case 4:
6029  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
6030  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6031  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6032  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
6033  return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
6034  }
6035  }
6036  break;
6037  }
6038 #endif
6039  if (sizeof(char) <= sizeof(long)) {
6040  __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
6041 #ifdef HAVE_LONG_LONG
6042  } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
6043  __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
6044 #endif
6045  }
6046  }
6047  {
6048 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6049  PyErr_SetString(PyExc_RuntimeError,
6050  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6051 #else
6052  char val;
6053  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6054  #if PY_MAJOR_VERSION < 3
6055  if (likely(v) && !PyLong_Check(v)) {
6056  PyObject *tmp = v;
6057  v = PyNumber_Long(tmp);
6058  Py_DECREF(tmp);
6059  }
6060  #endif
6061  if (likely(v)) {
6062  int one = 1; int is_little = (int)*(unsigned char *)&one;
6063  unsigned char *bytes = (unsigned char *)&val;
6064  int ret = _PyLong_AsByteArray((PyLongObject *)v,
6065  bytes, sizeof(val),
6066  is_little, !is_unsigned);
6067  Py_DECREF(v);
6068  if (likely(!ret))
6069  return val;
6070  }
6071 #endif
6072  return (char) -1;
6073  }
6074  } else {
6075  char val;
6076  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6077  if (!tmp) return (char) -1;
6078  val = __Pyx_PyInt_As_char(tmp);
6079  Py_DECREF(tmp);
6080  return val;
6081  }
6082 raise_overflow:
6083  PyErr_SetString(PyExc_OverflowError,
6084  "value too large to convert to char");
6085  return (char) -1;
6086 raise_neg_overflow:
6087  PyErr_SetString(PyExc_OverflowError,
6088  "can't convert negative value to char");
6089  return (char) -1;
6090 }
6091 
6092 /* CIntToPy */
6093 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
6094 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6095 #pragma GCC diagnostic push
6096 #pragma GCC diagnostic ignored "-Wconversion"
6097 #endif
6098  const long neg_one = (long) -1, const_zero = (long) 0;
6099 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6100 #pragma GCC diagnostic pop
6101 #endif
6102  const int is_unsigned = neg_one > const_zero;
6103  if (is_unsigned) {
6104  if (sizeof(long) < sizeof(long)) {
6105  return PyInt_FromLong((long) value);
6106  } else if (sizeof(long) <= sizeof(unsigned long)) {
6107  return PyLong_FromUnsignedLong((unsigned long) value);
6108 #ifdef HAVE_LONG_LONG
6109  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6110  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6111 #endif
6112  }
6113  } else {
6114  if (sizeof(long) <= sizeof(long)) {
6115  return PyInt_FromLong((long) value);
6116 #ifdef HAVE_LONG_LONG
6117  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6118  return PyLong_FromLongLong((PY_LONG_LONG) value);
6119 #endif
6120  }
6121  }
6122  {
6123  int one = 1; int little = (int)*(unsigned char *)&one;
6124  unsigned char *bytes = (unsigned char *)&value;
6125  return _PyLong_FromByteArray(bytes, sizeof(long),
6126  little, !is_unsigned);
6127  }
6128 }
6129 
6130 /* CIntFromPy */
6131 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
6132 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6133 #pragma GCC diagnostic push
6134 #pragma GCC diagnostic ignored "-Wconversion"
6135 #endif
6136  const long neg_one = (long) -1, const_zero = (long) 0;
6137 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6138 #pragma GCC diagnostic pop
6139 #endif
6140  const int is_unsigned = neg_one > const_zero;
6141 #if PY_MAJOR_VERSION < 3
6142  if (likely(PyInt_Check(x))) {
6143  if (sizeof(long) < sizeof(long)) {
6144  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
6145  } else {
6146  long val = PyInt_AS_LONG(x);
6147  if (is_unsigned && unlikely(val < 0)) {
6148  goto raise_neg_overflow;
6149  }
6150  return (long) val;
6151  }
6152  } else
6153 #endif
6154  if (likely(PyLong_Check(x))) {
6155  if (is_unsigned) {
6156 #if CYTHON_USE_PYLONG_INTERNALS
6157  const digit* digits = ((PyLongObject*)x)->ob_digit;
6158  switch (Py_SIZE(x)) {
6159  case 0: return (long) 0;
6160  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
6161  case 2:
6162  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6163  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6164  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6165  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
6166  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6167  }
6168  }
6169  break;
6170  case 3:
6171  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6172  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6173  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6174  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
6175  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6176  }
6177  }
6178  break;
6179  case 4:
6180  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6181  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6182  __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])))
6183  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
6184  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6185  }
6186  }
6187  break;
6188  }
6189 #endif
6190 #if CYTHON_COMPILING_IN_CPYTHON
6191  if (unlikely(Py_SIZE(x) < 0)) {
6192  goto raise_neg_overflow;
6193  }
6194 #else
6195  {
6196  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6197  if (unlikely(result < 0))
6198  return (long) -1;
6199  if (unlikely(result == 1))
6200  goto raise_neg_overflow;
6201  }
6202 #endif
6203  if (sizeof(long) <= sizeof(unsigned long)) {
6204  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
6205 #ifdef HAVE_LONG_LONG
6206  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6207  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6208 #endif
6209  }
6210  } else {
6211 #if CYTHON_USE_PYLONG_INTERNALS
6212  const digit* digits = ((PyLongObject*)x)->ob_digit;
6213  switch (Py_SIZE(x)) {
6214  case 0: return (long) 0;
6215  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
6216  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
6217  case -2:
6218  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
6219  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6220  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6221  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6222  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6223  }
6224  }
6225  break;
6226  case 2:
6227  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6228  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6229  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6230  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6231  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6232  }
6233  }
6234  break;
6235  case -3:
6236  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6237  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6238  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6239  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6240  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6241  }
6242  }
6243  break;
6244  case 3:
6245  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6246  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6247  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6248  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6249  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6250  }
6251  }
6252  break;
6253  case -4:
6254  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6255  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6256  __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])))
6257  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6258  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6259  }
6260  }
6261  break;
6262  case 4:
6263  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6264  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6265  __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])))
6266  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6267  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6268  }
6269  }
6270  break;
6271  }
6272 #endif
6273  if (sizeof(long) <= sizeof(long)) {
6274  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
6275 #ifdef HAVE_LONG_LONG
6276  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6277  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
6278 #endif
6279  }
6280  }
6281  {
6282 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6283  PyErr_SetString(PyExc_RuntimeError,
6284  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6285 #else
6286  long val;
6287  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6288  #if PY_MAJOR_VERSION < 3
6289  if (likely(v) && !PyLong_Check(v)) {
6290  PyObject *tmp = v;
6291  v = PyNumber_Long(tmp);
6292  Py_DECREF(tmp);
6293  }
6294  #endif
6295  if (likely(v)) {
6296  int one = 1; int is_little = (int)*(unsigned char *)&one;
6297  unsigned char *bytes = (unsigned char *)&val;
6298  int ret = _PyLong_AsByteArray((PyLongObject *)v,
6299  bytes, sizeof(val),
6300  is_little, !is_unsigned);
6301  Py_DECREF(v);
6302  if (likely(!ret))
6303  return val;
6304  }
6305 #endif
6306  return (long) -1;
6307  }
6308  } else {
6309  long val;
6310  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6311  if (!tmp) return (long) -1;
6312  val = __Pyx_PyInt_As_long(tmp);
6313  Py_DECREF(tmp);
6314  return val;
6315  }
6316 raise_overflow:
6317  PyErr_SetString(PyExc_OverflowError,
6318  "value too large to convert to long");
6319  return (long) -1;
6320 raise_neg_overflow:
6321  PyErr_SetString(PyExc_OverflowError,
6322  "can't convert negative value to long");
6323  return (long) -1;
6324 }
6325 
6326 /* CIntFromPy */
6327 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
6328 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6329 #pragma GCC diagnostic push
6330 #pragma GCC diagnostic ignored "-Wconversion"
6331 #endif
6332  const int neg_one = (int) -1, const_zero = (int) 0;
6333 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6334 #pragma GCC diagnostic pop
6335 #endif
6336  const int is_unsigned = neg_one > const_zero;
6337 #if PY_MAJOR_VERSION < 3
6338  if (likely(PyInt_Check(x))) {
6339  if (sizeof(int) < sizeof(long)) {
6340  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
6341  } else {
6342  long val = PyInt_AS_LONG(x);
6343  if (is_unsigned && unlikely(val < 0)) {
6344  goto raise_neg_overflow;
6345  }
6346  return (int) val;
6347  }
6348  } else
6349 #endif
6350  if (likely(PyLong_Check(x))) {
6351  if (is_unsigned) {
6352 #if CYTHON_USE_PYLONG_INTERNALS
6353  const digit* digits = ((PyLongObject*)x)->ob_digit;
6354  switch (Py_SIZE(x)) {
6355  case 0: return (int) 0;
6356  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
6357  case 2:
6358  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6359  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6360  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6361  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
6362  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6363  }
6364  }
6365  break;
6366  case 3:
6367  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6368  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6369  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6370  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
6371  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6372  }
6373  }
6374  break;
6375  case 4:
6376  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6377  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6378  __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])))
6379  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
6380  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6381  }
6382  }
6383  break;
6384  }
6385 #endif
6386 #if CYTHON_COMPILING_IN_CPYTHON
6387  if (unlikely(Py_SIZE(x) < 0)) {
6388  goto raise_neg_overflow;
6389  }
6390 #else
6391  {
6392  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6393  if (unlikely(result < 0))
6394  return (int) -1;
6395  if (unlikely(result == 1))
6396  goto raise_neg_overflow;
6397  }
6398 #endif
6399  if (sizeof(int) <= sizeof(unsigned long)) {
6400  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
6401 #ifdef HAVE_LONG_LONG
6402  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6403  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6404 #endif
6405  }
6406  } else {
6407 #if CYTHON_USE_PYLONG_INTERNALS
6408  const digit* digits = ((PyLongObject*)x)->ob_digit;
6409  switch (Py_SIZE(x)) {
6410  case 0: return (int) 0;
6411  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
6412  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
6413  case -2:
6414  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
6415  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6416  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6417  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6418  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6419  }
6420  }
6421  break;
6422  case 2:
6423  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6424  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6425  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6426  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6427  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6428  }
6429  }
6430  break;
6431  case -3:
6432  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6433  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6434  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6435  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6436  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6437  }
6438  }
6439  break;
6440  case 3:
6441  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6442  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6443  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6444  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6445  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6446  }
6447  }
6448  break;
6449  case -4:
6450  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6451  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6452  __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])))
6453  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6454  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6455  }
6456  }
6457  break;
6458  case 4:
6459  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6460  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6461  __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])))
6462  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6463  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6464  }
6465  }
6466  break;
6467  }
6468 #endif
6469  if (sizeof(int) <= sizeof(long)) {
6470  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
6471 #ifdef HAVE_LONG_LONG
6472  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6473  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
6474 #endif
6475  }
6476  }
6477  {
6478 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6479  PyErr_SetString(PyExc_RuntimeError,
6480  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6481 #else
6482  int val;
6483  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6484  #if PY_MAJOR_VERSION < 3
6485  if (likely(v) && !PyLong_Check(v)) {
6486  PyObject *tmp = v;
6487  v = PyNumber_Long(tmp);
6488  Py_DECREF(tmp);
6489  }
6490  #endif
6491  if (likely(v)) {
6492  int one = 1; int is_little = (int)*(unsigned char *)&one;
6493  unsigned char *bytes = (unsigned char *)&val;
6494  int ret = _PyLong_AsByteArray((PyLongObject *)v,
6495  bytes, sizeof(val),
6496  is_little, !is_unsigned);
6497  Py_DECREF(v);
6498  if (likely(!ret))
6499  return val;
6500  }
6501 #endif
6502  return (int) -1;
6503  }
6504  } else {
6505  int val;
6506  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6507  if (!tmp) return (int) -1;
6508  val = __Pyx_PyInt_As_int(tmp);
6509  Py_DECREF(tmp);
6510  return val;
6511  }
6512 raise_overflow:
6513  PyErr_SetString(PyExc_OverflowError,
6514  "value too large to convert to int");
6515  return (int) -1;
6516 raise_neg_overflow:
6517  PyErr_SetString(PyExc_OverflowError,
6518  "can't convert negative value to int");
6519  return (int) -1;
6520 }
6521 
6522 /* FastTypeChecks */
6523 #if CYTHON_COMPILING_IN_CPYTHON
6524 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
6525  while (a) {
6526  a = a->tp_base;
6527  if (a == b)
6528  return 1;
6529  }
6530  return b == &PyBaseObject_Type;
6531 }
6532 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
6533  PyObject *mro;
6534  if (a == b) return 1;
6535  mro = a->tp_mro;
6536  if (likely(mro)) {
6537  Py_ssize_t i, n;
6538  n = PyTuple_GET_SIZE(mro);
6539  for (i = 0; i < n; i++) {
6540  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
6541  return 1;
6542  }
6543  return 0;
6544  }
6545  return __Pyx_InBases(a, b);
6546 }
6547 #if PY_MAJOR_VERSION == 2
6548 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
6549  PyObject *exception, *value, *tb;
6550  int res;
6551  __Pyx_PyThreadState_declare
6552  __Pyx_PyThreadState_assign
6553  __Pyx_ErrFetch(&exception, &value, &tb);
6554  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
6555  if (unlikely(res == -1)) {
6556  PyErr_WriteUnraisable(err);
6557  res = 0;
6558  }
6559  if (!res) {
6560  res = PyObject_IsSubclass(err, exc_type2);
6561  if (unlikely(res == -1)) {
6562  PyErr_WriteUnraisable(err);
6563  res = 0;
6564  }
6565  }
6566  __Pyx_ErrRestore(exception, value, tb);
6567  return res;
6568 }
6569 #else
6570 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
6571  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
6572  if (!res) {
6573  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
6574  }
6575  return res;
6576 }
6577 #endif
6578 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6579  Py_ssize_t i, n;
6580  assert(PyExceptionClass_Check(exc_type));
6581  n = PyTuple_GET_SIZE(tuple);
6582 #if PY_MAJOR_VERSION >= 3
6583  for (i=0; i<n; i++) {
6584  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6585  }
6586 #endif
6587  for (i=0; i<n; i++) {
6588  PyObject *t = PyTuple_GET_ITEM(tuple, i);
6589  #if PY_MAJOR_VERSION < 3
6590  if (likely(exc_type == t)) return 1;
6591  #endif
6592  if (likely(PyExceptionClass_Check(t))) {
6593  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
6594  } else {
6595  }
6596  }
6597  return 0;
6598 }
6599 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
6600  if (likely(err == exc_type)) return 1;
6601  if (likely(PyExceptionClass_Check(err))) {
6602  if (likely(PyExceptionClass_Check(exc_type))) {
6603  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
6604  } else if (likely(PyTuple_Check(exc_type))) {
6605  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
6606  } else {
6607  }
6608  }
6609  return PyErr_GivenExceptionMatches(err, exc_type);
6610 }
6611 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
6612  assert(PyExceptionClass_Check(exc_type1));
6613  assert(PyExceptionClass_Check(exc_type2));
6614  if (likely(err == exc_type1 || err == exc_type2)) return 1;
6615  if (likely(PyExceptionClass_Check(err))) {
6616  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
6617  }
6618  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
6619 }
6620 #endif
6621 
6622 /* CheckBinaryVersion */
6623 static int __Pyx_check_binary_version(void) {
6624  char ctversion[5];
6625  int same=1, i, found_dot;
6626  const char* rt_from_call = Py_GetVersion();
6627  PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
6628  found_dot = 0;
6629  for (i = 0; i < 4; i++) {
6630  if (!ctversion[i]) {
6631  same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
6632  break;
6633  }
6634  if (rt_from_call[i] != ctversion[i]) {
6635  same = 0;
6636  break;
6637  }
6638  }
6639  if (!same) {
6640  char rtversion[5] = {'\0'};
6641  char message[200];
6642  for (i=0; i<4; ++i) {
6643  if (rt_from_call[i] == '.') {
6644  if (found_dot) break;
6645  found_dot = 1;
6646  } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
6647  break;
6648  }
6649  rtversion[i] = rt_from_call[i];
6650  }
6651  PyOS_snprintf(message, sizeof(message),
6652  "compiletime version %s of module '%.100s' "
6653  "does not match runtime version %s",
6654  ctversion, __Pyx_MODULE_NAME, rtversion);
6655  return PyErr_WarnEx(NULL, message, 1);
6656  }
6657  return 0;
6658 }
6659 
6660 /* InitStrings */
6661 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
6662  while (t->p) {
6663  #if PY_MAJOR_VERSION < 3
6664  if (t->is_unicode) {
6665  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
6666  } else if (t->intern) {
6667  *t->p = PyString_InternFromString(t->s);
6668  } else {
6669  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
6670  }
6671  #else
6672  if (t->is_unicode | t->is_str) {
6673  if (t->intern) {
6674  *t->p = PyUnicode_InternFromString(t->s);
6675  } else if (t->encoding) {
6676  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
6677  } else {
6678  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
6679  }
6680  } else {
6681  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
6682  }
6683  #endif
6684  if (!*t->p)
6685  return -1;
6686  if (PyObject_Hash(*t->p) == -1)
6687  return -1;
6688  ++t;
6689  }
6690  return 0;
6691 }
6692 
6693 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
6694  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
6695 }
6696 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
6697  Py_ssize_t ignore;
6698  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
6699 }
6700 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6701 #if !CYTHON_PEP393_ENABLED
6702 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6703  char* defenc_c;
6704  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
6705  if (!defenc) return NULL;
6706  defenc_c = PyBytes_AS_STRING(defenc);
6707 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6708  {
6709  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
6710  char* c;
6711  for (c = defenc_c; c < end; c++) {
6712  if ((unsigned char) (*c) >= 128) {
6713  PyUnicode_AsASCIIString(o);
6714  return NULL;
6715  }
6716  }
6717  }
6718 #endif
6719  *length = PyBytes_GET_SIZE(defenc);
6720  return defenc_c;
6721 }
6722 #else
6723 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6724  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
6725 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6726  if (likely(PyUnicode_IS_ASCII(o))) {
6727  *length = PyUnicode_GET_LENGTH(o);
6728  return PyUnicode_AsUTF8(o);
6729  } else {
6730  PyUnicode_AsASCIIString(o);
6731  return NULL;
6732  }
6733 #else
6734  return PyUnicode_AsUTF8AndSize(o, length);
6735 #endif
6736 }
6737 #endif
6738 #endif
6739 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6740 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6741  if (
6742 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6743  __Pyx_sys_getdefaultencoding_not_ascii &&
6744 #endif
6745  PyUnicode_Check(o)) {
6746  return __Pyx_PyUnicode_AsStringAndSize(o, length);
6747  } else
6748 #endif
6749 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
6750  if (PyByteArray_Check(o)) {
6751  *length = PyByteArray_GET_SIZE(o);
6752  return PyByteArray_AS_STRING(o);
6753  } else
6754 #endif
6755  {
6756  char* result;
6757  int r = PyBytes_AsStringAndSize(o, &result, length);
6758  if (unlikely(r < 0)) {
6759  return NULL;
6760  } else {
6761  return result;
6762  }
6763  }
6764 }
6765 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
6766  int is_true = x == Py_True;
6767  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
6768  else return PyObject_IsTrue(x);
6769 }
6770 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
6771  int retval;
6772  if (unlikely(!x)) return -1;
6773  retval = __Pyx_PyObject_IsTrue(x);
6774  Py_DECREF(x);
6775  return retval;
6776 }
6777 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
6778 #if PY_MAJOR_VERSION >= 3
6779  if (PyLong_Check(result)) {
6780  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
6781  "__int__ returned non-int (type %.200s). "
6782  "The ability to return an instance of a strict subclass of int "
6783  "is deprecated, and may be removed in a future version of Python.",
6784  Py_TYPE(result)->tp_name)) {
6785  Py_DECREF(result);
6786  return NULL;
6787  }
6788  return result;
6789  }
6790 #endif
6791  PyErr_Format(PyExc_TypeError,
6792  "__%.4s__ returned non-%.4s (type %.200s)",
6793  type_name, type_name, Py_TYPE(result)->tp_name);
6794  Py_DECREF(result);
6795  return NULL;
6796 }
6797 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
6798 #if CYTHON_USE_TYPE_SLOTS
6799  PyNumberMethods *m;
6800 #endif
6801  const char *name = NULL;
6802  PyObject *res = NULL;
6803 #if PY_MAJOR_VERSION < 3
6804  if (likely(PyInt_Check(x) || PyLong_Check(x)))
6805 #else
6806  if (likely(PyLong_Check(x)))
6807 #endif
6808  return __Pyx_NewRef(x);
6809 #if CYTHON_USE_TYPE_SLOTS
6810  m = Py_TYPE(x)->tp_as_number;
6811  #if PY_MAJOR_VERSION < 3
6812  if (m && m->nb_int) {
6813  name = "int";
6814  res = m->nb_int(x);
6815  }
6816  else if (m && m->nb_long) {
6817  name = "long";
6818  res = m->nb_long(x);
6819  }
6820  #else
6821  if (likely(m && m->nb_int)) {
6822  name = "int";
6823  res = m->nb_int(x);
6824  }
6825  #endif
6826 #else
6827  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
6828  res = PyNumber_Int(x);
6829  }
6830 #endif
6831  if (likely(res)) {
6832 #if PY_MAJOR_VERSION < 3
6833  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
6834 #else
6835  if (unlikely(!PyLong_CheckExact(res))) {
6836 #endif
6837  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
6838  }
6839  }
6840  else if (!PyErr_Occurred()) {
6841  PyErr_SetString(PyExc_TypeError,
6842  "an integer is required");
6843  }
6844  return res;
6845 }
6846 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
6847  Py_ssize_t ival;
6848  PyObject *x;
6849 #if PY_MAJOR_VERSION < 3
6850  if (likely(PyInt_CheckExact(b))) {
6851  if (sizeof(Py_ssize_t) >= sizeof(long))
6852  return PyInt_AS_LONG(b);
6853  else
6854  return PyInt_AsSsize_t(b);
6855  }
6856 #endif
6857  if (likely(PyLong_CheckExact(b))) {
6858  #if CYTHON_USE_PYLONG_INTERNALS
6859  const digit* digits = ((PyLongObject*)b)->ob_digit;
6860  const Py_ssize_t size = Py_SIZE(b);
6861  if (likely(__Pyx_sst_abs(size) <= 1)) {
6862  ival = likely(size) ? digits[0] : 0;
6863  if (size == -1) ival = -ival;
6864  return ival;
6865  } else {
6866  switch (size) {
6867  case 2:
6868  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
6869  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6870  }
6871  break;
6872  case -2:
6873  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
6874  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6875  }
6876  break;
6877  case 3:
6878  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
6879  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6880  }
6881  break;
6882  case -3:
6883  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
6884  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6885  }
6886  break;
6887  case 4:
6888  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
6889  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]));
6890  }
6891  break;
6892  case -4:
6893  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
6894  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]));
6895  }
6896  break;
6897  }
6898  }
6899  #endif
6900  return PyLong_AsSsize_t(b);
6901  }
6902  x = PyNumber_Index(b);
6903  if (!x) return -1;
6904  ival = PyInt_AsSsize_t(x);
6905  Py_DECREF(x);
6906  return ival;
6907 }
6908 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
6909  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
6910  return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
6911 #if PY_MAJOR_VERSION < 3
6912  } else if (likely(PyInt_CheckExact(o))) {
6913  return PyInt_AS_LONG(o);
6914 #endif
6915  } else {
6916  Py_ssize_t ival;
6917  PyObject *x;
6918  x = PyNumber_Index(o);
6919  if (!x) return -1;
6920  ival = PyInt_AsLong(x);
6921  Py_DECREF(x);
6922  return ival;
6923  }
6924 }
6925 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
6926  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
6927 }
6928 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
6929  return PyInt_FromSize_t(ival);
6930 }
6931 
6932 
6933 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
s
Double s
Definition: Headers.h:84
n
Int n
Definition: Headers.h:28
calculateNumericalDiffusionEikonal
void calculateNumericalDiffusionEikonal(int nElements_global, int nQuadraturePoints_element, double shockCapturingDiffusion, double *elementDiameter, double *strong_residual, double *numDiff)
Definition: shockCapturing.c:91
subgridError.h
C implementations of subgrid error calculations.
calculateNumericalDiffusionHJ
void calculateNumericalDiffusionHJ(int nElements_global, int nQuadraturePoints_element, char shockCapturing, double shockCapturingDiffusion, double *elementDiameter, double *strong_residual, double *mt, double *H, double *numDiff)
Calculate the shock capturing diffusion for a Hamilton-Jacobi equation at the quadrature points.
Definition: shockCapturing.c:114
calculateNumericalDiffusionResGradQuad
void calculateNumericalDiffusionResGradQuad(int nElements_global, int nQuadraturePoints_element, int nSpace, double shockCapturingDiffusion, double *elementDiameter, double *strong_residual, double *grad_u, double *numDiff)
Definition: shockCapturing.c:60
v
Double v
Definition: Headers.h:95
calculateNumericalDiffusionResGradJuanes
void calculateNumericalDiffusionResGradJuanes(int nElements_global, int nQuadraturePoints_element, int nSpace, double shockCapturingDiffusion, double uSC, double *elementDiameter, double *strong_residual, double *grad_u, double *numDiff)
Definition: shockCapturing.c:249
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
calculateNumericalDiffusion_A_1
void calculateNumericalDiffusion_A_1(int nElements_global, int nQuadraturePoints_element, int nSpace, double shockCapturingFactor, double *elementDiameter, double *strong_residual, double *mt, double *df, double *numDiff)
Definition: shockCapturing.c:207
calculateNumericalDiffusionResGrad
void calculateNumericalDiffusionResGrad(int nElements_global, int nQuadraturePoints_element, int nSpace, double shockCapturingDiffusion, double *elementDiameter, double *strong_residual, double *grad_u, double *numDiff)
Definition: shockCapturing.c:8
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8
calculateNumericalDiffusionJaffre
void calculateNumericalDiffusionJaffre(int nElements_global, int nQuadraturePoints_element, int nSpace, double shockCapturingDiffusion, double beta, double *elementDiameter, double *strong_residual, double *grad_u, double *numDiff)
Definition: shockCapturing.c:299
calculateNumericalDiffusionHJV2
void calculateNumericalDiffusionHJV2(int nElements_global, int nQuadraturePoints_element, char shockCapturing, double shockCapturingDiffusion, double *elementDiameter, double *strong_residual, double *mt, double *H, double *numDiff)
Calculate the shock capturing diffusion for a Hamilton-Jacobi equation at the quadrature points mwf t...
Definition: shockCapturing.c:166