3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
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+.
12 #define CYTHON_ABI "0_29_30"
13 #define CYTHON_HEX_VERSION 0x001D1EF0
14 #define CYTHON_FUTURE_DIVISION 0
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
31 #define DL_IMPORT(t) t
34 #define DL_EXPORT(t) t
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
46 #define Py_HUGE_VAL HUGE_VAL
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
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)
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
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
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
114 #ifndef CYTHON_ASSUME_SAFE_MACROS
115 #define CYTHON_ASSUME_SAFE_MACROS 1
117 #ifndef CYTHON_UNPACK_METHODS
118 #define CYTHON_UNPACK_METHODS 1
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
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
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
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
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
160 #ifndef CYTHON_USE_PYLIST_INTERNALS
161 #define CYTHON_USE_PYLIST_INTERNALS 1
163 #ifndef CYTHON_USE_UNICODE_INTERNALS
164 #define CYTHON_USE_UNICODE_INTERNALS 1
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
172 #ifndef CYTHON_AVOID_BORROWED_REFS
173 #define CYTHON_AVOID_BORROWED_REFS 0
175 #ifndef CYTHON_ASSUME_SAFE_MACROS
176 #define CYTHON_ASSUME_SAFE_MACROS 1
178 #ifndef CYTHON_UNPACK_METHODS
179 #define CYTHON_UNPACK_METHODS 1
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
187 #ifndef CYTHON_FAST_PYCALL
188 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
190 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
191 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
193 #ifndef CYTHON_USE_TP_FINALIZE
194 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
196 #ifndef CYTHON_USE_DICT_VERSIONS
197 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
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)
205 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
206 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
209 #if !defined(CYTHON_FAST_PYCCALL)
210 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
212 #if CYTHON_USE_PYLONG_INTERNALS
213 #if PY_MAJOR_VERSION < 3
214 #include "longintrepr.h"
220 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
223 #ifndef __has_attribute
224 #define __has_attribute(x) 0
226 #ifndef __has_cpp_attribute
227 #define __has_cpp_attribute(x) 0
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
237 #define CYTHON_RESTRICT
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__))
245 # define CYTHON_UNUSED
247 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
248 # define CYTHON_UNUSED __attribute__ ((__unused__))
250 # define CYTHON_UNUSED
253 #ifndef CYTHON_MAYBE_UNUSED_VAR
254 # if defined(__cplusplus)
255 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
257 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
260 #ifndef CYTHON_NCP_UNUSED
261 # if CYTHON_COMPILING_IN_CPYTHON
262 # define CYTHON_NCP_UNUSED
264 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
267 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
269 #ifndef _MSC_STDINT_H_
271 typedef unsigned char uint8_t;
272 typedef unsigned int uint32_t;
274 typedef unsigned __int8 uint8_t;
275 typedef unsigned __int32 uint32_t;
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]]
291 #ifndef CYTHON_FALLTHROUGH
292 #if __has_attribute(fallthrough)
293 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
295 #define CYTHON_FALLTHROUGH
298 #if defined(__clang__ ) && defined(__apple_build_version__)
299 #if __apple_build_version__ < 7000000
300 #undef CYTHON_FALLTHROUGH
301 #define CYTHON_FALLTHROUGH
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
316 #define CYTHON_INLINE
320 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
321 #define Py_OptimizeFlag 0
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
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;
370 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
371 Py_XDECREF((PyObject*)co);
372 co = (PyCodeObject*)call_result;
376 Py_XDECREF((PyObject*)co);
381 Py_XDECREF(argcount);
382 Py_XDECREF(posonlyargcount);
383 Py_XDECREF(kwonlyargcount);
385 Py_XDECREF(stacksize);
387 Py_XDECREF(call_result);
390 PyErr_Restore(type, value, traceback);
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)
398 #define __Pyx_DefaultClassType PyType_Type
400 #ifndef Py_TPFLAGS_CHECKTYPES
401 #define Py_TPFLAGS_CHECKTYPES 0
403 #ifndef Py_TPFLAGS_HAVE_INDEX
404 #define Py_TPFLAGS_HAVE_INDEX 0
406 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
407 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
409 #ifndef Py_TPFLAGS_HAVE_FINALIZE
410 #define Py_TPFLAGS_HAVE_FINALIZE 0
412 #ifndef METH_STACKLESS
413 #define METH_STACKLESS 0
415 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
416 #ifndef METH_FASTCALL
417 #define METH_FASTCALL 0x80
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);
423 #define __Pyx_PyCFunctionFast _PyCFunctionFast
424 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
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)))))
430 #define __Pyx_PyFastCFunction_Check(func) 0
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)
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)
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)
446 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
447 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
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()
456 #define __Pyx_PyThreadState_Current _PyThreadState_Current
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();
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;
471 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
474 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
475 return *key != Py_tss_NEEDS_INIT;
477 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
478 PyThread_delete_key(*key);
479 *key = Py_tss_NEEDS_INIT;
481 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
482 return PyThread_set_key_value(*key, value);
484 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
485 return PyThread_get_key_value(*key);
488 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
489 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
491 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
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)
497 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
498 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
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)
503 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
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)))
511 #define __Pyx_PyUnicode_READY(op) (0)
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))
524 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
527 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
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))
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)
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))
552 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
553 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
555 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
556 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
558 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
559 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
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)
566 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
568 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
569 #define PyObject_ASCII(o) PyObject_Repr(o)
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
581 #if PY_MAJOR_VERSION >= 3
582 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
583 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
585 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
586 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
588 #ifndef PySet_CheckExact
589 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
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)
595 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
596 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
598 #if CYTHON_ASSUME_SAFE_MACROS
599 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
601 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
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
620 #if PY_MAJOR_VERSION >= 3
621 #define PyBoolObject PyLongObject
623 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
624 #ifndef PyUnicode_InternFromString
625 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
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
633 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
634 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
636 #if PY_MAJOR_VERSION >= 3
637 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
639 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
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)
646 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
649 #define __Pyx_PyType_AsAsync(obj) NULL
651 #ifndef __Pyx_PyAsyncMethodsStruct
656 } __Pyx_PyAsyncMethodsStruct;
659 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
660 #if !defined(_USE_MATH_DEFINES)
661 #define _USE_MATH_DEFINES
666 #define __PYX_NAN() ((float) NAN)
668 static CYTHON_INLINE
float __PYX_NAN() {
670 memset(&value, 0xFF,
sizeof(value));
674 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
675 #define __Pyx_truncl trunc
677 #define __Pyx_truncl truncl
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; }
685 #ifndef __PYX_EXTERN_C
687 #define __PYX_EXTERN_C extern "C"
689 #define __PYX_EXTERN_C extern
693 #define __PYX_HAVE__cshockCapturing
694 #define __PYX_HAVE_API__cshockCapturing
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"
711 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
712 #define CYTHON_WITHOUT_ASSERTIONS
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;
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;
739 #if defined (__cplusplus) && __cplusplus >= 201103L
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)
753 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
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
766 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
767 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
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;
788 return (
size_t)(u_end -
u - 1);
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))
807 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
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))
813 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
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) {
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");
826 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
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;
834 char ascii_chars[128];
836 for (
c = 0;
c < 128;
c++) {
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) {
846 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
850 Py_DECREF(ascii_chars_u);
851 Py_DECREF(ascii_chars_b);
853 Py_DECREF(default_encoding);
856 Py_XDECREF(default_encoding);
857 Py_XDECREF(ascii_chars_u);
858 Py_XDECREF(ascii_chars_b);
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)
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) {
870 PyObject* default_encoding = NULL;
871 char* default_encoding_c;
872 sys = PyImport_ImportModule(
"sys");
874 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
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);
885 Py_XDECREF(default_encoding);
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)
897 #define likely(x) (x)
898 #define unlikely(x) (x)
900 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
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;
915 #if !defined(CYTHON_CCOMPLEX)
916 #if defined(__cplusplus)
917 #define CYTHON_CCOMPLEX 1
918 #elif defined(_Complex_I)
919 #define CYTHON_CCOMPLEX 1
921 #define CYTHON_CCOMPLEX 0
931 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
933 #define _Complex_I 1.0fj
937 static const char *__pyx_f[] = {
938 "proteus/cshockCapturing.pyx",
950 typedef npy_int8 __pyx_t_5numpy_int8_t;
959 typedef npy_int16 __pyx_t_5numpy_int16_t;
968 typedef npy_int32 __pyx_t_5numpy_int32_t;
977 typedef npy_int64 __pyx_t_5numpy_int64_t;
986 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
995 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1004 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1013 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1022 typedef npy_float32 __pyx_t_5numpy_float32_t;
1031 typedef npy_float64 __pyx_t_5numpy_float64_t;
1040 typedef npy_long __pyx_t_5numpy_int_t;
1049 typedef npy_longlong __pyx_t_5numpy_long_t;
1058 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1067 typedef npy_ulong __pyx_t_5numpy_uint_t;
1076 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1085 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1094 typedef npy_intp __pyx_t_5numpy_intp_t;
1103 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1112 typedef npy_double __pyx_t_5numpy_float_t;
1121 typedef npy_double __pyx_t_5numpy_double_t;
1130 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1134 typedef ::std::complex< float > __pyx_t_float_complex;
1136 typedef float _Complex __pyx_t_float_complex;
1139 typedef struct {
float real, imag; } __pyx_t_float_complex;
1141 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1146 typedef ::std::complex< double > __pyx_t_double_complex;
1148 typedef double _Complex __pyx_t_double_complex;
1151 typedef struct {
double real, imag; } __pyx_t_double_complex;
1153 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1165 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1174 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1183 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1192 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1196 #ifndef CYTHON_REFNANNY
1197 #define CYTHON_REFNANNY 0
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;
1212 #define __Pyx_RefNannySetupContext(name, 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);\
1218 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1221 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1222 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
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)
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)
1247 #define __Pyx_XDECREF_SET(r, v) do {\
1248 PyObject *tmp = (PyObject *) r;\
1249 r = v; __Pyx_XDECREF(tmp);\
1251 #define __Pyx_DECREF_SET(r, v) do {\
1252 PyObject *tmp = (PyObject *) r;\
1253 r = v; __Pyx_DECREF(tmp);\
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)
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);
1263 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
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);
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);
1277 #if CYTHON_USE_TYPE_SLOTS
1278 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1280 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1284 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1287 #if CYTHON_USE_EXC_INFO_STACK
1288 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
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
1297 #define __Pyx_PyThreadState_declare
1298 #define __Pyx_PyThreadState_assign
1299 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
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);
1309 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1310 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
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);
1318 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
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);
1326 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1330 #if CYTHON_COMPILING_IN_CPYTHON
1331 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1333 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
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))
1348 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
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)
1362 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
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
1372 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
1376 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
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;\
1391 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1392 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
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);
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);
1405 #ifdef CYTHON_CLINE_IN_TRACEBACK
1406 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1408 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
1413 PyCodeObject* code_object;
1415 } __Pyx_CodeObjectCacheEntry;
1416 struct __Pyx_CodeObjectCache {
1419 __Pyx_CodeObjectCacheEntry* entries;
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);
1427 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
1428 int py_line,
const char *filename);
1431 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1432 #define __Pyx_HAS_GCC_DIAGNOSTIC
1438 #define __Pyx_CREAL(z) ((z).real())
1439 #define __Pyx_CIMAG(z) ((z).imag())
1441 #define __Pyx_CREAL(z) (__real__(z))
1442 #define __Pyx_CIMAG(z) (__imag__(z))
1445 #define __Pyx_CREAL(z) ((z).real)
1446 #define __Pyx_CIMAG(z) ((z).imag)
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))
1453 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1454 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
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))
1466 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1467 #define __Pyx_c_conj_float(z) (::std::conj(z))
1469 #define __Pyx_c_abs_float(z) (::std::abs(z))
1470 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1473 #define __Pyx_c_is_zero_float(z) ((z)==0)
1474 #define __Pyx_c_conj_float(z) (conjf(z))
1476 #define __Pyx_c_abs_float(z) (cabsf(z))
1477 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
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);
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);
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))
1504 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1505 #define __Pyx_c_conj_double(z) (::std::conj(z))
1507 #define __Pyx_c_abs_double(z) (::std::abs(z))
1508 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1511 #define __Pyx_c_is_zero_double(z) ((z)==0)
1512 #define __Pyx_c_conj_double(z) (conj(z))
1514 #define __Pyx_c_abs_double(z) (cabs(z))
1515 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
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);
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);
1534 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
1537 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
1540 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
1543 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
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);
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))
1556 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1559 static int __Pyx_check_binary_version(
void);
1562 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1574 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
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;
1604 #define __Pyx_MODULE_NAME "cshockCapturing"
1605 extern int __pyx_module_is_main_cshockCapturing;
1606 int __pyx_module_is_main_cshockCapturing = 0;
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);
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);
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);
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);
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);
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);
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);
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);
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;
1711 static PyObject *__pyx_pw_15cshockCapturing_1calculateNumericalDiffusionResGrad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
1730 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1732 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1734 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1736 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1738 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1740 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1743 default:
goto __pyx_L5_argtuple_error;
1745 kw_args = PyDict_Size(__pyx_kwds);
1748 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
1749 else goto __pyx_L5_argtuple_error;
1752 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
1754 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGrad", 1, 5, 5, 1); __PYX_ERR(0, 73, __pyx_L3_error)
1758 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
1760 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGrad", 1, 5, 5, 2); __PYX_ERR(0, 73, __pyx_L3_error)
1764 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
1766 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGrad", 1, 5, 5, 3); __PYX_ERR(0, 73, __pyx_L3_error)
1770 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
1772 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGrad", 1, 5, 5, 4); __PYX_ERR(0, 73, __pyx_L3_error)
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)
1778 }
else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
1779 goto __pyx_L5_argtuple_error;
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);
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]);
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)
1797 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionResGrad", __pyx_clineno, __pyx_lineno, __pyx_filename);
1798 __Pyx_RefNannyFinishContext();
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);
1812 __Pyx_RefNannyFinishContext();
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);
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));
1839 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1840 __Pyx_XGIVEREF(__pyx_r);
1841 __Pyx_RefNannyFinishContext();
1854 static PyObject *__pyx_pw_15cshockCapturing_3calculateNumericalDiffusionResGradQuad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
1873 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1875 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1877 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1879 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1881 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1883 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1886 default:
goto __pyx_L5_argtuple_error;
1888 kw_args = PyDict_Size(__pyx_kwds);
1891 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
1892 else goto __pyx_L5_argtuple_error;
1895 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
1897 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradQuad", 1, 5, 5, 1); __PYX_ERR(0, 86, __pyx_L3_error)
1901 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
1903 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradQuad", 1, 5, 5, 2); __PYX_ERR(0, 86, __pyx_L3_error)
1907 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
1909 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradQuad", 1, 5, 5, 3); __PYX_ERR(0, 86, __pyx_L3_error)
1913 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
1915 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradQuad", 1, 5, 5, 4); __PYX_ERR(0, 86, __pyx_L3_error)
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)
1921 }
else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
1922 goto __pyx_L5_argtuple_error;
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);
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]);
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)
1940 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionResGradQuad", __pyx_clineno, __pyx_lineno, __pyx_filename);
1941 __Pyx_RefNannyFinishContext();
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);
1955 __Pyx_RefNannyFinishContext();
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);
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));
1982 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1983 __Pyx_XGIVEREF(__pyx_r);
1984 __Pyx_RefNannyFinishContext();
1997 static PyObject *__pyx_pw_15cshockCapturing_5calculateNumericalDiffusionEikonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
2015 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2017 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2019 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2021 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2023 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2026 default:
goto __pyx_L5_argtuple_error;
2028 kw_args = PyDict_Size(__pyx_kwds);
2031 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2032 else goto __pyx_L5_argtuple_error;
2035 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2037 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionEikonal", 1, 4, 4, 1); __PYX_ERR(0, 99, __pyx_L3_error)
2041 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2043 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionEikonal", 1, 4, 4, 2); __PYX_ERR(0, 99, __pyx_L3_error)
2047 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2049 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionEikonal", 1, 4, 4, 3); __PYX_ERR(0, 99, __pyx_L3_error)
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)
2055 }
else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2056 goto __pyx_L5_argtuple_error;
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);
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]);
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)
2072 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionEikonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
2073 __Pyx_RefNannyFinishContext();
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);
2086 __Pyx_RefNannyFinishContext();
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);
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));
2113 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2114 __Pyx_XGIVEREF(__pyx_r);
2115 __Pyx_RefNannyFinishContext();
2128 static PyObject *__pyx_pw_15cshockCapturing_7calculateNumericalDiffusionHJ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
2149 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2151 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2153 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2155 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2157 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2159 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2161 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2163 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2166 default:
goto __pyx_L5_argtuple_error;
2168 kw_args = PyDict_Size(__pyx_kwds);
2171 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturing)) != 0)) kw_args--;
2172 else goto __pyx_L5_argtuple_error;
2175 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2177 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJ", 1, 7, 7, 1); __PYX_ERR(0, 109, __pyx_L3_error)
2181 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2183 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJ", 1, 7, 7, 2); __PYX_ERR(0, 109, __pyx_L3_error)
2187 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2189 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJ", 1, 7, 7, 3); __PYX_ERR(0, 109, __pyx_L3_error)
2193 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
2195 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJ", 1, 7, 7, 4); __PYX_ERR(0, 109, __pyx_L3_error)
2199 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
2201 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJ", 1, 7, 7, 5); __PYX_ERR(0, 109, __pyx_L3_error)
2205 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2207 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJ", 1, 7, 7, 6); __PYX_ERR(0, 109, __pyx_L3_error)
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)
2213 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2214 goto __pyx_L5_argtuple_error;
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);
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]);
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)
2236 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionHJ", __pyx_clineno, __pyx_lineno, __pyx_filename);
2237 __Pyx_RefNannyFinishContext();
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);
2252 __Pyx_RefNannyFinishContext();
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);
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));
2279 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2280 __Pyx_XGIVEREF(__pyx_r);
2281 __Pyx_RefNannyFinishContext();
2294 static PyObject *__pyx_pw_15cshockCapturing_9calculateNumericalDiffusionHJV2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
2315 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2317 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2319 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2321 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2323 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2325 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2327 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2329 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2332 default:
goto __pyx_L5_argtuple_error;
2334 kw_args = PyDict_Size(__pyx_kwds);
2337 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturing)) != 0)) kw_args--;
2338 else goto __pyx_L5_argtuple_error;
2341 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2343 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJV2", 1, 7, 7, 1); __PYX_ERR(0, 125, __pyx_L3_error)
2347 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2349 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJV2", 1, 7, 7, 2); __PYX_ERR(0, 125, __pyx_L3_error)
2353 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2355 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJV2", 1, 7, 7, 3); __PYX_ERR(0, 125, __pyx_L3_error)
2359 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
2361 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJV2", 1, 7, 7, 4); __PYX_ERR(0, 125, __pyx_L3_error)
2365 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
2367 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJV2", 1, 7, 7, 5); __PYX_ERR(0, 125, __pyx_L3_error)
2371 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2373 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionHJV2", 1, 7, 7, 6); __PYX_ERR(0, 125, __pyx_L3_error)
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)
2379 }
else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2380 goto __pyx_L5_argtuple_error;
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);
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]);
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)
2402 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionHJV2", __pyx_clineno, __pyx_lineno, __pyx_filename);
2403 __Pyx_RefNannyFinishContext();
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);
2418 __Pyx_RefNannyFinishContext();
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);
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));
2445 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2446 __Pyx_XGIVEREF(__pyx_r);
2447 __Pyx_RefNannyFinishContext();
2460 static PyObject *__pyx_pw_15cshockCapturing_11calculateNumericalDiffusion_A_1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
2480 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2482 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2484 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2486 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2488 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2490 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2492 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2495 default:
goto __pyx_L5_argtuple_error;
2497 kw_args = PyDict_Size(__pyx_kwds);
2500 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingFactor)) != 0)) kw_args--;
2501 else goto __pyx_L5_argtuple_error;
2504 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2506 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusion_A_1", 1, 6, 6, 1); __PYX_ERR(0, 141, __pyx_L3_error)
2510 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2512 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusion_A_1", 1, 6, 6, 2); __PYX_ERR(0, 141, __pyx_L3_error)
2516 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
2518 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusion_A_1", 1, 6, 6, 3); __PYX_ERR(0, 141, __pyx_L3_error)
2522 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
2524 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusion_A_1", 1, 6, 6, 4); __PYX_ERR(0, 141, __pyx_L3_error)
2528 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2530 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusion_A_1", 1, 6, 6, 5); __PYX_ERR(0, 141, __pyx_L3_error)
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)
2536 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2537 goto __pyx_L5_argtuple_error;
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);
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]);
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)
2557 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusion_A_1", __pyx_clineno, __pyx_lineno, __pyx_filename);
2558 __Pyx_RefNannyFinishContext();
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);
2573 __Pyx_RefNannyFinishContext();
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);
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));
2600 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2601 __Pyx_XGIVEREF(__pyx_r);
2602 __Pyx_RefNannyFinishContext();
2615 static PyObject *__pyx_pw_15cshockCapturing_13calculateNumericalDiffusionResGradJuanes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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;
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);
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)) {
2635 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2637 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2639 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2641 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2643 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2645 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2647 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2650 default:
goto __pyx_L5_argtuple_error;
2652 kw_args = PyDict_Size(__pyx_kwds);
2655 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2656 else goto __pyx_L5_argtuple_error;
2659 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uSC)) != 0)) kw_args--;
2661 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 1); __PYX_ERR(0, 156, __pyx_L3_error)
2665 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2667 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 2); __PYX_ERR(0, 156, __pyx_L3_error)
2671 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2673 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 3); __PYX_ERR(0, 156, __pyx_L3_error)
2677 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
2679 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 4); __PYX_ERR(0, 156, __pyx_L3_error)
2683 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2685 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionResGradJuanes", 1, 6, 6, 5); __PYX_ERR(0, 156, __pyx_L3_error)
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)
2691 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2692 goto __pyx_L5_argtuple_error;
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);
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]);
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)
2712 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionResGradJuanes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2713 __Pyx_RefNannyFinishContext();
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);
2727 __Pyx_RefNannyFinishContext();
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);
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));
2754 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2755 __Pyx_XGIVEREF(__pyx_r);
2756 __Pyx_RefNannyFinishContext();
2769 static PyObject *__pyx_pw_15cshockCapturing_15calculateNumericalDiffusionJaffre(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
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);
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)) {
2789 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2791 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2793 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2795 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2797 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2799 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2801 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2804 default:
goto __pyx_L5_argtuple_error;
2806 kw_args = PyDict_Size(__pyx_kwds);
2809 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shockCapturingDiffusion)) != 0)) kw_args--;
2810 else goto __pyx_L5_argtuple_error;
2813 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
2815 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionJaffre", 1, 6, 6, 1); __PYX_ERR(0, 171, __pyx_L3_error)
2819 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDiameter)) != 0)) kw_args--;
2821 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionJaffre", 1, 6, 6, 2); __PYX_ERR(0, 171, __pyx_L3_error)
2825 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_strong_residual)) != 0)) kw_args--;
2827 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionJaffre", 1, 6, 6, 3); __PYX_ERR(0, 171, __pyx_L3_error)
2831 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grad_u)) != 0)) kw_args--;
2833 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionJaffre", 1, 6, 6, 4); __PYX_ERR(0, 171, __pyx_L3_error)
2837 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numDiff)) != 0)) kw_args--;
2839 __Pyx_RaiseArgtupleInvalid(
"calculateNumericalDiffusionJaffre", 1, 6, 6, 5); __PYX_ERR(0, 171, __pyx_L3_error)
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)
2845 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2846 goto __pyx_L5_argtuple_error;
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);
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]);
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)
2866 __Pyx_AddTraceback(
"cshockCapturing.calculateNumericalDiffusionJaffre", __pyx_clineno, __pyx_lineno, __pyx_filename);
2867 __Pyx_RefNannyFinishContext();
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);
2881 __Pyx_RefNannyFinishContext();
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);
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));
2908 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2909 __Pyx_XGIVEREF(__pyx_r);
2910 __Pyx_RefNannyFinishContext();
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);
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;
2955 __Pyx_XDECREF(__pyx_t_1);
2956 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
2959 __Pyx_XGIVEREF(__pyx_r);
2960 __Pyx_RefNannyFinishContext();
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);
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;
3005 __Pyx_XDECREF(__pyx_t_1);
3006 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
3009 __Pyx_XGIVEREF(__pyx_r);
3010 __Pyx_RefNannyFinishContext();
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);
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;
3055 __Pyx_XDECREF(__pyx_t_1);
3056 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
3059 __Pyx_XGIVEREF(__pyx_r);
3060 __Pyx_RefNannyFinishContext();
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);
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;
3105 __Pyx_XDECREF(__pyx_t_1);
3106 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
3109 __Pyx_XGIVEREF(__pyx_r);
3110 __Pyx_RefNannyFinishContext();
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);
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;
3155 __Pyx_XDECREF(__pyx_t_1);
3156 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
3159 __Pyx_XGIVEREF(__pyx_r);
3160 __Pyx_RefNannyFinishContext();
3172 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
3173 PyObject *__pyx_r = NULL;
3174 __Pyx_RefNannyDeclarations
3176 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
3185 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
3195 __Pyx_XDECREF(__pyx_r);
3196 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
3197 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
3217 __Pyx_XDECREF(__pyx_r);
3218 __Pyx_INCREF(__pyx_empty_tuple);
3219 __pyx_r = __pyx_empty_tuple;
3233 __Pyx_XGIVEREF(__pyx_r);
3234 __Pyx_RefNannyFinishContext();
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);
3257 Py_INCREF(__pyx_v_base);
3266 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
3277 __Pyx_RefNannyFinishContext();
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
3293 __Pyx_RefNannySetupContext(
"get_array_base", 0);
3302 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
3311 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
3321 __Pyx_XDECREF(__pyx_r);
3322 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3341 __Pyx_XDECREF(__pyx_r);
3342 __Pyx_INCREF(((PyObject *)__pyx_v_base));
3343 __pyx_r = ((PyObject *)__pyx_v_base);
3356 __Pyx_XGIVEREF(__pyx_r);
3357 __Pyx_RefNannyFinishContext();
3369 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
3371 __Pyx_RefNannyDeclarations
3372 PyObject *__pyx_t_1 = NULL;
3373 PyObject *__pyx_t_2 = NULL;
3374 PyObject *__pyx_t_3 = NULL;
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);
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);
3408 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
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;
3431 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
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);
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)
3452 goto __pyx_L5_except_error;
3453 __pyx_L5_except_error:;
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;
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);
3489 __Pyx_RefNannyFinishContext();
3501 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
3503 __Pyx_RefNannyDeclarations
3504 PyObject *__pyx_t_1 = NULL;
3505 PyObject *__pyx_t_2 = NULL;
3506 PyObject *__pyx_t_3 = NULL;
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);
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);
3540 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
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;
3563 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
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);
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)
3584 goto __pyx_L5_except_error;
3585 __pyx_L5_except_error:;
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;
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);
3621 __Pyx_RefNannyFinishContext();
3633 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
3635 __Pyx_RefNannyDeclarations
3636 PyObject *__pyx_t_1 = NULL;
3637 PyObject *__pyx_t_2 = NULL;
3638 PyObject *__pyx_t_3 = NULL;
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);
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);
3672 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
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;
3695 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
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);
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)
3716 goto __pyx_L5_except_error;
3717 __pyx_L5_except_error:;
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;
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);
3753 __Pyx_RefNannyFinishContext();
3765 static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
3767 __Pyx_RefNannyDeclarations
3768 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
3777 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
3790 __Pyx_RefNannyFinishContext();
3802 static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
3804 __Pyx_RefNannyDeclarations
3805 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
3814 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
3827 __Pyx_RefNannyFinishContext();
3839 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
3840 npy_datetime __pyx_r;
3849 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
3873 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
3874 npy_timedelta __pyx_r;
3883 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
3907 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
3908 NPY_DATETIMEUNIT __pyx_r;
3915 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
3931 static PyMethodDef __pyx_methods[] = {
3935 #if PY_MAJOR_VERSION >= 3
3936 #if CYTHON_PEP489_MULTI_PHASE_INIT
3937 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
3938 static int __pyx_pymod_exec_cshockCapturing(PyObject* module);
3939 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
3940 {Py_mod_create, (
void*)__pyx_pymod_create},
3941 {Py_mod_exec, (
void*)__pyx_pymod_exec_cshockCapturing},
3946 static struct PyModuleDef __pyx_moduledef = {
3947 PyModuleDef_HEAD_INIT,
3950 #if CYTHON_PEP489_MULTI_PHASE_INIT
3956 #if CYTHON_PEP489_MULTI_PHASE_INIT
3957 __pyx_moduledef_slots,
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))
3972 #define CYTHON_SMALL_CODE
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}
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)
4018 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
4019 __Pyx_RefNannyDeclarations
4020 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
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_);
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);
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)
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)
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)
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)
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)
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)
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)
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();
4142 __Pyx_RefNannyFinishContext();
4146 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
4147 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4153 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
4154 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
4155 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
4156 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
4157 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
4158 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
4159 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
4161 static int __Pyx_modinit_global_init_code(
void) {
4162 __Pyx_RefNannyDeclarations
4163 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
4165 __Pyx_RefNannyFinishContext();
4169 static int __Pyx_modinit_variable_export_code(
void) {
4170 __Pyx_RefNannyDeclarations
4171 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
4173 __Pyx_RefNannyFinishContext();
4177 static int __Pyx_modinit_function_export_code(
void) {
4178 __Pyx_RefNannyDeclarations
4179 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
4181 __Pyx_RefNannyFinishContext();
4185 static int __Pyx_modinit_type_init_code(
void) {
4186 __Pyx_RefNannyDeclarations
4187 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
4189 __Pyx_RefNannyFinishContext();
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);
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),
4207 sizeof(PyHeapTypeObject),
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();
4248 __Pyx_XDECREF(__pyx_t_1);
4249 __Pyx_RefNannyFinishContext();
4253 static int __Pyx_modinit_variable_import_code(
void) {
4254 __Pyx_RefNannyDeclarations
4255 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
4257 __Pyx_RefNannyFinishContext();
4261 static int __Pyx_modinit_function_import_code(
void) {
4262 __Pyx_RefNannyDeclarations
4263 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
4265 __Pyx_RefNannyFinishContext();
4270 #ifndef CYTHON_NO_PYINIT_EXPORT
4271 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4272 #elif PY_MAJOR_VERSION < 3
4274 #define __Pyx_PyMODINIT_FUNC extern "C" void
4276 #define __Pyx_PyMODINIT_FUNC void
4280 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
4282 #define __Pyx_PyMODINIT_FUNC PyObject *
4287 #if PY_MAJOR_VERSION < 3
4288 __Pyx_PyMODINIT_FUNC initcshockCapturing(
void) CYTHON_SMALL_CODE;
4289 __Pyx_PyMODINIT_FUNC initcshockCapturing(
void)
4291 __Pyx_PyMODINIT_FUNC PyInit_cshockCapturing(
void) CYTHON_SMALL_CODE;
4292 __Pyx_PyMODINIT_FUNC PyInit_cshockCapturing(
void)
4293 #if CYTHON_PEP489_MULTI_PHASE_INIT
4295 return PyModuleDef_Init(&__pyx_moduledef);
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))
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))
4315 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
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);
4323 if (likely(value)) {
4324 if (allow_none || value != Py_None) {
4325 result = PyDict_SetItemString(moddict, to_name, value);
4328 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
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())
4340 return __Pyx_NewRef(__pyx_m);
4341 modname = PyObject_GetAttrString(spec,
"name");
4342 if (unlikely(!modname))
goto bad;
4343 module = PyModule_NewObject(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;
4359 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_cshockCapturing(PyObject *__pyx_pyinit_module)
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
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.");
4374 #elif PY_MAJOR_VERSION >= 3
4375 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
4378 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
4379 if (!__Pyx_RefNanny) {
4381 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
4382 if (!__Pyx_RefNanny)
4383 Py_FatalError(
"failed to import 'refnanny' module");
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();
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)
4397 #ifdef __Pyx_FusedFunction_USED
4398 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4400 #ifdef __Pyx_Coroutine_USED
4401 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4403 #ifdef __Pyx_Generator_USED
4404 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4406 #ifdef __Pyx_AsyncGen_USED
4407 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4409 #ifdef __Pyx_StopAsyncIteration_USED
4410 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4414 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4415 PyEval_InitThreads();
4418 #if CYTHON_PEP489_MULTI_PHASE_INIT
4419 __pyx_m = __pyx_pyinit_module;
4422 #if PY_MAJOR_VERSION < 3
4423 __pyx_m = Py_InitModule4(
"cshockCapturing", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4425 __pyx_m = PyModule_Create(&__pyx_moduledef);
4427 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4429 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4431 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
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);
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)
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)
4444 #if PY_MAJOR_VERSION >= 3
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)
4453 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4455 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
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();
4465 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4466 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
4598 __Pyx_XDECREF(__pyx_t_1);
4601 __Pyx_AddTraceback(
"init cshockCapturing", __pyx_clineno, __pyx_lineno, __pyx_filename);
4604 }
else if (!PyErr_Occurred()) {
4605 PyErr_SetString(PyExc_ImportError,
"init cshockCapturing");
4608 __Pyx_RefNannyFinishContext();
4609 #if CYTHON_PEP489_MULTI_PHASE_INIT
4610 return (__pyx_m != NULL) ? 0 : -1;
4611 #elif PY_MAJOR_VERSION >= 3
4621 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
4622 PyObject *m = NULL, *p = NULL;
4624 m = PyImport_ImportModule(modname);
4626 p = PyObject_GetAttrString(m,
"RefNannyAPI");
4628 r = PyLong_AsVoidPtr(p);
4632 return (__Pyx_RefNannyAPIStruct *)
r;
4637 static void __Pyx_RaiseArgtupleInvalid(
4638 const char* func_name,
4642 Py_ssize_t num_found)
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";
4650 num_expected = num_max;
4651 more_or_less =
"at most";
4654 more_or_less =
"exactly";
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);
4663 static void __Pyx_RaiseDoubleKeywordsError(
4664 const char* func_name,
4667 PyErr_Format(PyExc_TypeError,
4668 #
if PY_MAJOR_VERSION >= 3
4669 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
4671 "%s() got multiple values for keyword argument '%s'", func_name,
4672 PyString_AsString(kw_name));
4677 static int __Pyx_ParseOptionalKeywords(
4679 PyObject **argnames[],
4682 Py_ssize_t num_pos_args,
4683 const char* function_name)
4685 PyObject *key = 0, *value = 0;
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++;
4693 values[name-argnames] = value;
4696 name = first_kw_arg;
4697 #if PY_MAJOR_VERSION < 3
4698 if (likely(PyString_Check(key))) {
4700 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
4701 && _PyString_Eq(**name, key)) {
4702 values[name-argnames] = value;
4707 if (*name)
continue;
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;
4721 if (likely(PyUnicode_Check(key))) {
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 :
4727 PyUnicode_Compare(**name, key);
4728 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
4730 values[name-argnames] = value;
4735 if (*name)
continue;
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 :
4743 PyUnicode_Compare(**argname, key);
4744 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
4745 if (cmp == 0)
goto arg_passed_twice;
4750 goto invalid_keyword_type;
4752 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
4754 goto invalid_keyword;
4759 __Pyx_RaiseDoubleKeywordsError(function_name, key);
4761 invalid_keyword_type:
4762 PyErr_Format(PyExc_TypeError,
4763 "%.200s() keywords must be strings", function_name);
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));
4771 "%s() got an unexpected keyword argument '%U'",
4772 function_name, key);
4779 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
4781 if (unlikely(!type)) {
4782 PyErr_SetString(PyExc_SystemError,
"Missing type object");
4786 #if PY_MAJOR_VERSION == 2
4787 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
4791 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
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);
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));
4809 return PyObject_GetAttr(obj, attr_name);
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);
4821 "name '%.200s' is not defined", PyString_AS_STRING(name));
4828 #if CYTHON_USE_EXC_INFO_STACK
4829 static _PyErr_StackItem *
4830 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
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)
4836 exc_info = exc_info->previous_item;
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;
4851 *type = tstate->exc_type;
4852 *value = tstate->exc_value;
4853 *tb = tstate->exc_traceback;
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;
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;
4877 Py_XDECREF(tmp_type);
4878 Py_XDECREF(tmp_value);
4884 #if CYTHON_FAST_THREAD_STATE
4885 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
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;
4893 for (i=0; i<
n; i++) {
4894 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
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);
4909 #if CYTHON_FAST_THREAD_STATE
4910 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
4912 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
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;
4925 PyErr_Fetch(&local_type, &local_value, &local_tb);
4927 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
4928 #if CYTHON_FAST_THREAD_STATE
4929 if (unlikely(tstate->curexc_type))
4931 if (unlikely(PyErr_Occurred()))
4934 #if PY_MAJOR_VERSION >= 3
4936 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
4940 Py_XINCREF(local_tb);
4941 Py_XINCREF(local_type);
4942 Py_XINCREF(local_value);
4944 *value = local_value;
4946 #if CYTHON_FAST_THREAD_STATE
4947 #if CYTHON_USE_EXC_INFO_STACK
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;
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;
4965 Py_XDECREF(tmp_type);
4966 Py_XDECREF(tmp_value);
4969 PyErr_SetExcInfo(local_type, local_value, local_tb);
4976 Py_XDECREF(local_type);
4977 Py_XDECREF(local_value);
4978 Py_XDECREF(local_tb);
4983 #if CYTHON_COMPILING_IN_CPYTHON
4984 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
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")))
4991 result = (*call)(func, arg, kw);
4992 Py_LeaveRecursiveCall();
4993 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4996 "NULL result without error in PyObject_Call");
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);
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;
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
5032 if (!value || value == Py_None)
5036 if (!tb || tb == Py_None)
5040 if (!PyTraceBack_Check(tb)) {
5041 PyErr_SetString(PyExc_TypeError,
5042 "raise: arg 3 must be a traceback or None");
5046 if (PyType_Check(type)) {
5047 #if CYTHON_COMPILING_IN_PYPY
5053 PyErr_NormalizeException(&type, &value, &tb);
5056 PyErr_SetString(PyExc_TypeError,
5057 "instance exception may not have a separate value");
5061 type = (PyObject*) Py_TYPE(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");
5069 __Pyx_PyThreadState_assign
5070 __Pyx_ErrRestore(type, value, tb);
5079 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5080 PyObject* owned_instance = NULL;
5081 if (tb == Py_None) {
5083 }
else if (tb && !PyTraceBack_Check(tb)) {
5084 PyErr_SetString(PyExc_TypeError,
5085 "raise: arg 3 must be a traceback or None");
5088 if (value == Py_None)
5090 if (PyExceptionInstance_Check(type)) {
5092 PyErr_SetString(PyExc_TypeError,
5093 "instance exception may not have a separate value");
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);
5105 instance_class = NULL;
5106 }
else if (unlikely(is_subclass == -1)) {
5109 type = instance_class;
5113 if (!instance_class) {
5116 args = PyTuple_New(0);
5117 else if (PyTuple_Check(value)) {
5121 args = PyTuple_Pack(1, value);
5124 owned_instance = PyObject_Call(type, args, NULL);
5126 if (!owned_instance)
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));
5138 PyErr_SetString(PyExc_TypeError,
5139 "raise: exception class must be a subclass of BaseException");
5143 PyObject *fixed_cause;
5144 if (cause == Py_None) {
5146 }
else if (PyExceptionClass_Check(cause)) {
5147 fixed_cause = PyObject_CallObject(cause, NULL);
5148 if (fixed_cause == NULL)
5150 }
else if (PyExceptionInstance_Check(cause)) {
5151 fixed_cause = cause;
5152 Py_INCREF(fixed_cause);
5154 PyErr_SetString(PyExc_TypeError,
5155 "exception causes must derive from "
5159 PyException_SetCause(value, fixed_cause);
5161 PyErr_SetObject(type, value);
5163 #if CYTHON_COMPILING_IN_PYPY
5164 PyObject *tmp_type, *tmp_value, *tmp_tb;
5165 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
5167 PyErr_Restore(tmp_type, tmp_value, tb);
5170 PyThreadState *tstate = __Pyx_PyThreadState_Current;
5171 PyObject* tmp_tb = tstate->curexc_traceback;
5174 tstate->curexc_traceback = tb;
5180 Py_XDECREF(owned_instance);
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)
5191 PyObject *result = 0;
5193 Py_ssize_t basicsize;
5194 #ifdef Py_LIMITED_API
5195 PyObject *py_basicsize;
5197 result = PyObject_GetAttrString(module, class_name);
5200 if (!PyType_Check(result)) {
5201 PyErr_Format(PyExc_TypeError,
5202 "%.200s.%.200s is not a type object",
5203 module_name, class_name);
5206 #ifndef Py_LIMITED_API
5207 basicsize = ((PyTypeObject *)result)->tp_basicsize;
5209 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
5212 basicsize = PyLong_AsSsize_t(py_basicsize);
5213 Py_DECREF(py_basicsize);
5215 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
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);
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);
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;
5239 return (PyTypeObject *)result;
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;
5253 #if PY_MAJOR_VERSION < 3
5254 PyObject *py_import;
5255 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5262 empty_list = PyList_New(0);
5267 global_dict = PyModule_GetDict(__pyx_m);
5270 empty_dict = PyDict_New();
5274 #if PY_MAJOR_VERSION >= 3
5276 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
5277 module = PyImport_ImportModuleLevelObject(
5278 name, global_dict, empty_dict, list, 1);
5280 if (!PyErr_ExceptionMatches(PyExc_ImportError))
5289 #if PY_MAJOR_VERSION < 3
5290 PyObject *py_level = PyInt_FromLong(level);
5293 module = PyObject_CallFunctionObjArgs(py_import,
5294 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
5295 Py_DECREF(py_level);
5297 module = PyImport_ImportModuleLevelObject(
5298 name, global_dict, empty_dict, list, level);
5303 #if PY_MAJOR_VERSION < 3
5304 Py_XDECREF(py_import);
5306 Py_XDECREF(empty_list);
5307 Py_XDECREF(empty_dict);
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;
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;
5321 #if CYTHON_COMPILING_IN_CPYTHON
5322 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
5324 dictptr = _PyObject_GetDictPtr(obj);
5327 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
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)))
5333 return obj_dict_version == __Pyx_get_object_dict_version(obj);
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;
5345 if (unlikely(!__pyx_cython_runtime)) {
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))
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);
5369 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
5371 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
5374 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
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) {
5385 while (start < end) {
5386 mid = start + (end - start) / 2;
5387 if (code_line < entries[mid].code_line) {
5389 }
else if (code_line > entries[mid].code_line) {
5395 if (code_line <= entries[mid].code_line) {
5401 static PyCodeObject *__pyx_find_code_object(
int code_line) {
5402 PyCodeObject* code_object;
5404 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
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)) {
5411 code_object = __pyx_code_cache.entries[
pos].code_object;
5412 Py_INCREF(code_object);
5415 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
5417 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5418 if (unlikely(!code_line)) {
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);
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;
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)) {
5447 __pyx_code_cache.entries = entries;
5448 __pyx_code_cache.max_count = new_max;
5450 for (i=__pyx_code_cache.count; i>
pos; i--) {
5451 entries[i] = entries[i-1];
5453 entries[
pos].code_line = code_line;
5454 entries[
pos].code_object = code_object;
5455 __pyx_code_cache.count++;
5456 Py_INCREF(code_object);
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
5467 #include "internal/pycore_frame.h"
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;
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;
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;
5491 #if PY_MAJOR_VERSION < 3
5492 py_funcname = PyString_FromString(funcname);
5493 if (!py_funcname)
goto bad;
5496 #if PY_MAJOR_VERSION < 3
5497 py_code = __Pyx_PyCode_New(
5514 Py_DECREF(py_srcfile);
5516 py_code = PyCode_NewEmpty(filename, funcname, py_line);
5518 Py_XDECREF(py_funcname);
5521 Py_XDECREF(py_funcname);
5522 #if PY_MAJOR_VERSION < 3
5523 Py_XDECREF(py_srcfile);
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;
5534 c_line = __Pyx_CLineForTraceback(tstate, c_line);
5536 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
5538 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5539 py_code = __Pyx_CreateCodeObjectForTraceback(
5540 funcname, c_line, py_line, filename);
5546 Py_XDECREF(ptraceback);
5549 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5550 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
5552 py_frame = PyFrame_New(
5558 if (!py_frame)
goto bad;
5559 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
5560 PyTraceBack_Here(py_frame);
5562 Py_XDECREF(py_code);
5563 Py_XDECREF(py_frame);
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)\
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;\
5582 goto raise_overflow;\
5585 return (target_type) value;\
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);
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;
5600 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
5601 __pyx_t_float_complex
z;
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);
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;
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;
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;
5633 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
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);
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);
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);
5653 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5655 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
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);
5664 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
5665 __pyx_t_float_complex
z;
5670 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
5671 return (a.real == 0) && (a.imag == 0);
5673 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
5674 __pyx_t_float_complex
z;
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);
5684 return hypotf(
z.real,
z.imag);
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) {
5692 float denom = a.real * a.real + a.imag * a.imag;
5693 a.real = a.real / denom;
5694 a.imag = -a.imag / denom;
5697 switch ((
int)b.real) {
5705 return __Pyx_c_prod_float(a, a);
5707 z = __Pyx_c_prod_float(a, a);
5708 return __Pyx_c_prod_float(
z, a);
5710 z = __Pyx_c_prod_float(a, a);
5711 return __Pyx_c_prod_float(
z,
z);
5717 }
else if (b.imag == 0) {
5718 z.real = powf(a.real, b.real);
5721 }
else if (a.real > 0) {
5726 theta = atan2f(0.0, -1.0);
5729 r = __Pyx_c_abs_float(a);
5730 theta = atan2f(a.imag, a.real);
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);
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);
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;
5754 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
5755 __pyx_t_double_complex
z;
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);
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;
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;
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;
5787 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
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);
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);
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);
5807 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
5809 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
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);
5818 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
5819 __pyx_t_double_complex
z;
5824 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
5825 return (a.real == 0) && (a.imag == 0);
5827 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
5828 __pyx_t_double_complex
z;
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);
5838 return hypot(
z.real,
z.imag);
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) {
5846 double denom = a.real * a.real + a.imag * a.imag;
5847 a.real = a.real / denom;
5848 a.imag = -a.imag / denom;
5851 switch ((
int)b.real) {
5859 return __Pyx_c_prod_double(a, a);
5861 z = __Pyx_c_prod_double(a, a);
5862 return __Pyx_c_prod_double(
z, a);
5864 z = __Pyx_c_prod_double(a, a);
5865 return __Pyx_c_prod_double(
z,
z);
5871 }
else if (b.imag == 0) {
5872 z.real = pow(a.real, b.real);
5875 }
else if (a.real > 0) {
5880 theta = atan2(0.0, -1.0);
5883 r = __Pyx_c_abs_double(a);
5884 theta = atan2(a.imag, a.real);
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);
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"
5902 const char neg_one = (char) -1, const_zero = (
char) 0;
5903 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5904 #pragma GCC diagnostic pop
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))
5912 long val = PyInt_AS_LONG(x);
5913 if (is_unsigned && unlikely(val < 0)) {
5914 goto raise_neg_overflow;
5920 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
5956 #if CYTHON_COMPILING_IN_CPYTHON
5957 if (unlikely(Py_SIZE(x) < 0)) {
5958 goto raise_neg_overflow;
5962 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5963 if (unlikely(result < 0))
5965 if (unlikely(result == 1))
5966 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
6053 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
6054 #if PY_MAJOR_VERSION < 3
6055 if (likely(
v) && !PyLong_Check(
v)) {
6057 v = PyNumber_Long(tmp);
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,
6066 is_little, !is_unsigned);
6076 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6077 if (!tmp)
return (
char) -1;
6078 val = __Pyx_PyInt_As_char(tmp);
6083 PyErr_SetString(PyExc_OverflowError,
6084 "value too large to convert to char");
6087 PyErr_SetString(PyExc_OverflowError,
6088 "can't convert negative value to char");
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"
6098 const long neg_one = (long) -1, const_zero = (
long) 0;
6099 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6100 #pragma GCC diagnostic pop
6102 const int is_unsigned = neg_one > const_zero;
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);
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);
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);
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"
6136 const long neg_one = (long) -1, const_zero = (
long) 0;
6137 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6138 #pragma GCC diagnostic pop
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))
6146 long val = PyInt_AS_LONG(x);
6147 if (is_unsigned && unlikely(val < 0)) {
6148 goto raise_neg_overflow;
6154 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
6190 #if CYTHON_COMPILING_IN_CPYTHON
6191 if (unlikely(Py_SIZE(x) < 0)) {
6192 goto raise_neg_overflow;
6196 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6197 if (unlikely(result < 0))
6199 if (unlikely(result == 1))
6200 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
6287 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
6288 #if PY_MAJOR_VERSION < 3
6289 if (likely(
v) && !PyLong_Check(
v)) {
6291 v = PyNumber_Long(tmp);
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,
6300 is_little, !is_unsigned);
6310 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6311 if (!tmp)
return (
long) -1;
6312 val = __Pyx_PyInt_As_long(tmp);
6317 PyErr_SetString(PyExc_OverflowError,
6318 "value too large to convert to long");
6321 PyErr_SetString(PyExc_OverflowError,
6322 "can't convert negative value to long");
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"
6332 const int neg_one = (int) -1, const_zero = (
int) 0;
6333 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6334 #pragma GCC diagnostic pop
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))
6342 long val = PyInt_AS_LONG(x);
6343 if (is_unsigned && unlikely(val < 0)) {
6344 goto raise_neg_overflow;
6350 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
6386 #if CYTHON_COMPILING_IN_CPYTHON
6387 if (unlikely(Py_SIZE(x) < 0)) {
6388 goto raise_neg_overflow;
6392 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6393 if (unlikely(result < 0))
6395 if (unlikely(result == 1))
6396 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
6483 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
6484 #if PY_MAJOR_VERSION < 3
6485 if (likely(
v) && !PyLong_Check(
v)) {
6487 v = PyNumber_Long(tmp);
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,
6496 is_little, !is_unsigned);
6506 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6507 if (!tmp)
return (
int) -1;
6508 val = __Pyx_PyInt_As_int(tmp);
6513 PyErr_SetString(PyExc_OverflowError,
6514 "value too large to convert to int");
6517 PyErr_SetString(PyExc_OverflowError,
6518 "can't convert negative value to int");
6523 #if CYTHON_COMPILING_IN_CPYTHON
6524 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
6530 return b == &PyBaseObject_Type;
6532 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
6534 if (a == b)
return 1;
6538 n = PyTuple_GET_SIZE(mro);
6539 for (i = 0; i <
n; i++) {
6540 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
6545 return __Pyx_InBases(a, b);
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;
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);
6560 res = PyObject_IsSubclass(err, exc_type2);
6561 if (unlikely(res == -1)) {
6562 PyErr_WriteUnraisable(err);
6566 __Pyx_ErrRestore(exception, value, tb);
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;
6573 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
6578 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
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;
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;
6592 if (likely(PyExceptionClass_Check(t))) {
6593 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
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);
6609 return PyErr_GivenExceptionMatches(err, exc_type);
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);
6618 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
6623 static int __Pyx_check_binary_version(
void) {
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);
6629 for (i = 0; i < 4; i++) {
6630 if (!ctversion[i]) {
6631 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
6634 if (rt_from_call[i] != ctversion[i]) {
6640 char rtversion[5] = {
'\0'};
6642 for (i=0; i<4; ++i) {
6643 if (rt_from_call[i] ==
'.') {
6644 if (found_dot)
break;
6646 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
6649 rtversion[i] = rt_from_call[i];
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);
6661 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
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);
6669 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
6672 if (t->is_unicode | t->is_str) {
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);
6678 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
6681 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
6686 if (PyObject_Hash(*t->p) == -1)
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));
6696 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
6698 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
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) {
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
6709 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
6711 for (
c = defenc_c;
c < end;
c++) {
6712 if ((
unsigned char) (*
c) >= 128) {
6713 PyUnicode_AsASCIIString(o);
6719 *length = PyBytes_GET_SIZE(defenc);
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);
6730 PyUnicode_AsASCIIString(o);
6734 return PyUnicode_AsUTF8AndSize(o, length);
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
6742 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6743 __Pyx_sys_getdefaultencoding_not_ascii &&
6745 PyUnicode_Check(o)) {
6746 return __Pyx_PyUnicode_AsStringAndSize(o, length);
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);
6757 int r = PyBytes_AsStringAndSize(o, &result, length);
6758 if (unlikely(
r < 0)) {
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);
6770 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
6772 if (unlikely(!x))
return -1;
6773 retval = __Pyx_PyObject_IsTrue(x);
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)) {
6791 PyErr_Format(PyExc_TypeError,
6792 "__%.4s__ returned non-%.4s (type %.200s)",
6793 type_name, type_name, Py_TYPE(result)->tp_name);
6797 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
6798 #if CYTHON_USE_TYPE_SLOTS
6801 const char *name = NULL;
6802 PyObject *res = NULL;
6803 #if PY_MAJOR_VERSION < 3
6804 if (likely(PyInt_Check(x) || PyLong_Check(x)))
6806 if (likely(PyLong_Check(x)))
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) {
6816 else if (m && m->nb_long) {
6818 res = m->nb_long(x);
6821 if (likely(m && m->nb_int)) {
6827 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
6828 res = PyNumber_Int(x);
6832 #if PY_MAJOR_VERSION < 3
6833 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
6835 if (unlikely(!PyLong_CheckExact(res))) {
6837 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
6840 else if (!PyErr_Occurred()) {
6841 PyErr_SetString(PyExc_TypeError,
6842 "an integer is required");
6846 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
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);
6854 return PyInt_AsSsize_t(b);
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;
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]));
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]));
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]));
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]));
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]));
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]));
6900 return PyLong_AsSsize_t(b);
6902 x = PyNumber_Index(b);
6904 ival = PyInt_AsSsize_t(x);
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);
6918 x = PyNumber_Index(o);
6920 ival = PyInt_AsLong(x);
6925 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
6926 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
6928 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
6929 return PyInt_FromSize_t(ival);