1 /* Generated by Cython 0.29.12 */
2
3 /* BEGIN: Cython Metadata
4 {
5 "distutils": {
6 "depends": [
7 "yt/utilities/lib/endian_swap.h",
8 "yt/utilities/lib/platform_dep.h"
9 ],
10 "include_dirs": [
11 "yt/utilities/lib"
12 ],
13 "libraries": [
14 "m"
15 ],
16 "name": "yt.utilities.lib.fortran_reader",
17 "sources": [
18 "yt/utilities/lib/fortran_reader.pyx"
19 ]
20 },
21 "module_name": "yt.utilities.lib.fortran_reader"
22 }
23 END: Cython Metadata */
24
25 #define PY_SSIZE_T_CLEAN
26 #include "Python.h"
27 #ifndef Py_PYTHON_H
28 #error Python headers needed to compile C extensions, please install development version of Python.
29 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
30 #error Cython requires Python 2.6+ or Python 3.3+.
31 #else
32 #define CYTHON_ABI "0_29_12"
33 #define CYTHON_HEX_VERSION 0x001D0CF0
34 #define CYTHON_FUTURE_DIVISION 0
35 #include <stddef.h>
36 #ifndef offsetof
37 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
38 #endif
39 #if !defined(WIN32) && !defined(MS_WINDOWS)
40 #ifndef __stdcall
41 #define __stdcall
42 #endif
43 #ifndef __cdecl
44 #define __cdecl
45 #endif
46 #ifndef __fastcall
47 #define __fastcall
48 #endif
49 #endif
50 #ifndef DL_IMPORT
51 #define DL_IMPORT(t) t
52 #endif
53 #ifndef DL_EXPORT
54 #define DL_EXPORT(t) t
55 #endif
56 #define __PYX_COMMA ,
57 #ifndef HAVE_LONG_LONG
58 #if PY_VERSION_HEX >= 0x02070000
59 #define HAVE_LONG_LONG
60 #endif
61 #endif
62 #ifndef PY_LONG_LONG
63 #define PY_LONG_LONG LONG_LONG
64 #endif
65 #ifndef Py_HUGE_VAL
66 #define Py_HUGE_VAL HUGE_VAL
67 #endif
68 #ifdef PYPY_VERSION
69 #define CYTHON_COMPILING_IN_PYPY 1
70 #define CYTHON_COMPILING_IN_PYSTON 0
71 #define CYTHON_COMPILING_IN_CPYTHON 0
72 #undef CYTHON_USE_TYPE_SLOTS
73 #define CYTHON_USE_TYPE_SLOTS 0
74 #undef CYTHON_USE_PYTYPE_LOOKUP
75 #define CYTHON_USE_PYTYPE_LOOKUP 0
76 #if PY_VERSION_HEX < 0x03050000
77 #undef CYTHON_USE_ASYNC_SLOTS
78 #define CYTHON_USE_ASYNC_SLOTS 0
79 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
80 #define CYTHON_USE_ASYNC_SLOTS 1
81 #endif
82 #undef CYTHON_USE_PYLIST_INTERNALS
83 #define CYTHON_USE_PYLIST_INTERNALS 0
84 #undef CYTHON_USE_UNICODE_INTERNALS
85 #define CYTHON_USE_UNICODE_INTERNALS 0
86 #undef CYTHON_USE_UNICODE_WRITER
87 #define CYTHON_USE_UNICODE_WRITER 0
88 #undef CYTHON_USE_PYLONG_INTERNALS
89 #define CYTHON_USE_PYLONG_INTERNALS 0
90 #undef CYTHON_AVOID_BORROWED_REFS
91 #define CYTHON_AVOID_BORROWED_REFS 1
92 #undef CYTHON_ASSUME_SAFE_MACROS
93 #define CYTHON_ASSUME_SAFE_MACROS 0
94 #undef CYTHON_UNPACK_METHODS
95 #define CYTHON_UNPACK_METHODS 0
96 #undef CYTHON_FAST_THREAD_STATE
97 #define CYTHON_FAST_THREAD_STATE 0
98 #undef CYTHON_FAST_PYCALL
99 #define CYTHON_FAST_PYCALL 0
100 #undef CYTHON_PEP489_MULTI_PHASE_INIT
101 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
102 #undef CYTHON_USE_TP_FINALIZE
103 #define CYTHON_USE_TP_FINALIZE 0
104 #undef CYTHON_USE_DICT_VERSIONS
105 #define CYTHON_USE_DICT_VERSIONS 0
106 #undef CYTHON_USE_EXC_INFO_STACK
107 #define CYTHON_USE_EXC_INFO_STACK 0
108 #elif defined(PYSTON_VERSION)
109 #define CYTHON_COMPILING_IN_PYPY 0
110 #define CYTHON_COMPILING_IN_PYSTON 1
111 #define CYTHON_COMPILING_IN_CPYTHON 0
112 #ifndef CYTHON_USE_TYPE_SLOTS
113 #define CYTHON_USE_TYPE_SLOTS 1
114 #endif
115 #undef CYTHON_USE_PYTYPE_LOOKUP
116 #define CYTHON_USE_PYTYPE_LOOKUP 0
117 #undef CYTHON_USE_ASYNC_SLOTS
118 #define CYTHON_USE_ASYNC_SLOTS 0
119 #undef CYTHON_USE_PYLIST_INTERNALS
120 #define CYTHON_USE_PYLIST_INTERNALS 0
121 #ifndef CYTHON_USE_UNICODE_INTERNALS
122 #define CYTHON_USE_UNICODE_INTERNALS 1
123 #endif
124 #undef CYTHON_USE_UNICODE_WRITER
125 #define CYTHON_USE_UNICODE_WRITER 0
126 #undef CYTHON_USE_PYLONG_INTERNALS
127 #define CYTHON_USE_PYLONG_INTERNALS 0
128 #ifndef CYTHON_AVOID_BORROWED_REFS
129 #define CYTHON_AVOID_BORROWED_REFS 0
130 #endif
131 #ifndef CYTHON_ASSUME_SAFE_MACROS
132 #define CYTHON_ASSUME_SAFE_MACROS 1
133 #endif
134 #ifndef CYTHON_UNPACK_METHODS
135 #define CYTHON_UNPACK_METHODS 1
136 #endif
137 #undef CYTHON_FAST_THREAD_STATE
138 #define CYTHON_FAST_THREAD_STATE 0
139 #undef CYTHON_FAST_PYCALL
140 #define CYTHON_FAST_PYCALL 0
141 #undef CYTHON_PEP489_MULTI_PHASE_INIT
142 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
143 #undef CYTHON_USE_TP_FINALIZE
144 #define CYTHON_USE_TP_FINALIZE 0
145 #undef CYTHON_USE_DICT_VERSIONS
146 #define CYTHON_USE_DICT_VERSIONS 0
147 #undef CYTHON_USE_EXC_INFO_STACK
148 #define CYTHON_USE_EXC_INFO_STACK 0
149 #else
150 #define CYTHON_COMPILING_IN_PYPY 0
151 #define CYTHON_COMPILING_IN_PYSTON 0
152 #define CYTHON_COMPILING_IN_CPYTHON 1
153 #ifndef CYTHON_USE_TYPE_SLOTS
154 #define CYTHON_USE_TYPE_SLOTS 1
155 #endif
156 #if PY_VERSION_HEX < 0x02070000
157 #undef CYTHON_USE_PYTYPE_LOOKUP
158 #define CYTHON_USE_PYTYPE_LOOKUP 0
159 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
160 #define CYTHON_USE_PYTYPE_LOOKUP 1
161 #endif
162 #if PY_MAJOR_VERSION < 3
163 #undef CYTHON_USE_ASYNC_SLOTS
164 #define CYTHON_USE_ASYNC_SLOTS 0
165 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
166 #define CYTHON_USE_ASYNC_SLOTS 1
167 #endif
168 #if PY_VERSION_HEX < 0x02070000
169 #undef CYTHON_USE_PYLONG_INTERNALS
170 #define CYTHON_USE_PYLONG_INTERNALS 0
171 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
172 #define CYTHON_USE_PYLONG_INTERNALS 1
173 #endif
174 #ifndef CYTHON_USE_PYLIST_INTERNALS
175 #define CYTHON_USE_PYLIST_INTERNALS 1
176 #endif
177 #ifndef CYTHON_USE_UNICODE_INTERNALS
178 #define CYTHON_USE_UNICODE_INTERNALS 1
179 #endif
180 #if PY_VERSION_HEX < 0x030300F0
181 #undef CYTHON_USE_UNICODE_WRITER
182 #define CYTHON_USE_UNICODE_WRITER 0
183 #elif !defined(CYTHON_USE_UNICODE_WRITER)
184 #define CYTHON_USE_UNICODE_WRITER 1
185 #endif
186 #ifndef CYTHON_AVOID_BORROWED_REFS
187 #define CYTHON_AVOID_BORROWED_REFS 0
188 #endif
189 #ifndef CYTHON_ASSUME_SAFE_MACROS
190 #define CYTHON_ASSUME_SAFE_MACROS 1
191 #endif
192 #ifndef CYTHON_UNPACK_METHODS
193 #define CYTHON_UNPACK_METHODS 1
194 #endif
195 #ifndef CYTHON_FAST_THREAD_STATE
196 #define CYTHON_FAST_THREAD_STATE 1
197 #endif
198 #ifndef CYTHON_FAST_PYCALL
199 #define CYTHON_FAST_PYCALL 1
200 #endif
201 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
202 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
203 #endif
204 #ifndef CYTHON_USE_TP_FINALIZE
205 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
206 #endif
207 #ifndef CYTHON_USE_DICT_VERSIONS
208 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
209 #endif
210 #ifndef CYTHON_USE_EXC_INFO_STACK
211 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
212 #endif
213 #endif
214 #if !defined(CYTHON_FAST_PYCCALL)
215 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
216 #endif
217 #if CYTHON_USE_PYLONG_INTERNALS
218 #include "longintrepr.h"
219 #undef SHIFT
220 #undef BASE
221 #undef MASK
222 #ifdef SIZEOF_VOID_P
223 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
224 #endif
225 #endif
226 #ifndef __has_attribute
227 #define __has_attribute(x) 0
228 #endif
229 #ifndef __has_cpp_attribute
230 #define __has_cpp_attribute(x) 0
231 #endif
232 #ifndef CYTHON_RESTRICT
233 #if defined(__GNUC__)
234 #define CYTHON_RESTRICT __restrict__
235 #elif defined(_MSC_VER) && _MSC_VER >= 1400
236 #define CYTHON_RESTRICT __restrict
237 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
238 #define CYTHON_RESTRICT restrict
239 #else
240 #define CYTHON_RESTRICT
241 #endif
242 #endif
243 #ifndef CYTHON_UNUSED
244 # if defined(__GNUC__)
245 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
246 # define CYTHON_UNUSED __attribute__ ((__unused__))
247 # else
248 # define CYTHON_UNUSED
249 # endif
250 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
251 # define CYTHON_UNUSED __attribute__ ((__unused__))
252 # else
253 # define CYTHON_UNUSED
254 # endif
255 #endif
256 #ifndef CYTHON_MAYBE_UNUSED_VAR
257 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)258 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
259 # else
260 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
261 # endif
262 #endif
263 #ifndef CYTHON_NCP_UNUSED
264 # if CYTHON_COMPILING_IN_CPYTHON
265 # define CYTHON_NCP_UNUSED
266 # else
267 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
268 # endif
269 #endif
270 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
271 #ifdef _MSC_VER
272 #ifndef _MSC_STDINT_H_
273 #if _MSC_VER < 1300
274 typedef unsigned char uint8_t;
275 typedef unsigned int uint32_t;
276 #else
277 typedef unsigned __int8 uint8_t;
278 typedef unsigned __int32 uint32_t;
279 #endif
280 #endif
281 #else
282 #include <stdint.h>
283 #endif
284 #ifndef CYTHON_FALLTHROUGH
285 #if defined(__cplusplus) && __cplusplus >= 201103L
286 #if __has_cpp_attribute(fallthrough)
287 #define CYTHON_FALLTHROUGH [[fallthrough]]
288 #elif __has_cpp_attribute(clang::fallthrough)
289 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
290 #elif __has_cpp_attribute(gnu::fallthrough)
291 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
292 #endif
293 #endif
294 #ifndef CYTHON_FALLTHROUGH
295 #if __has_attribute(fallthrough)
296 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
297 #else
298 #define CYTHON_FALLTHROUGH
299 #endif
300 #endif
301 #if defined(__clang__ ) && defined(__apple_build_version__)
302 #if __apple_build_version__ < 7000000
303 #undef CYTHON_FALLTHROUGH
304 #define CYTHON_FALLTHROUGH
305 #endif
306 #endif
307 #endif
308
309 #ifndef CYTHON_INLINE
310 #if defined(__clang__)
311 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
312 #elif defined(__GNUC__)
313 #define CYTHON_INLINE __inline__
314 #elif defined(_MSC_VER)
315 #define CYTHON_INLINE __inline
316 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
317 #define CYTHON_INLINE inline
318 #else
319 #define CYTHON_INLINE
320 #endif
321 #endif
322
323 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
324 #define Py_OptimizeFlag 0
325 #endif
326 #define __PYX_BUILD_PY_SSIZE_T "n"
327 #define CYTHON_FORMAT_SSIZE_T "z"
328 #if PY_MAJOR_VERSION < 3
329 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
330 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
331 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
332 #define __Pyx_DefaultClassType PyClass_Type
333 #else
334 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
335 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
336 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
337 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
338 #else
339 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
340 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
341 #endif
342 #define __Pyx_DefaultClassType PyType_Type
343 #endif
344 #ifndef Py_TPFLAGS_CHECKTYPES
345 #define Py_TPFLAGS_CHECKTYPES 0
346 #endif
347 #ifndef Py_TPFLAGS_HAVE_INDEX
348 #define Py_TPFLAGS_HAVE_INDEX 0
349 #endif
350 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
351 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
352 #endif
353 #ifndef Py_TPFLAGS_HAVE_FINALIZE
354 #define Py_TPFLAGS_HAVE_FINALIZE 0
355 #endif
356 #ifndef METH_STACKLESS
357 #define METH_STACKLESS 0
358 #endif
359 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
360 #ifndef METH_FASTCALL
361 #define METH_FASTCALL 0x80
362 #endif
363 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
364 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
365 Py_ssize_t nargs, PyObject *kwnames);
366 #else
367 #define __Pyx_PyCFunctionFast _PyCFunctionFast
368 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
369 #endif
370 #if CYTHON_FAST_PYCCALL
371 #define __Pyx_PyFastCFunction_Check(func)\
372 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
373 #else
374 #define __Pyx_PyFastCFunction_Check(func) 0
375 #endif
376 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
377 #define PyObject_Malloc(s) PyMem_Malloc(s)
378 #define PyObject_Free(p) PyMem_Free(p)
379 #define PyObject_Realloc(p) PyMem_Realloc(p)
380 #endif
381 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
382 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
383 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
384 #define PyMem_RawFree(p) PyMem_Free(p)
385 #endif
386 #if CYTHON_COMPILING_IN_PYSTON
387 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
388 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
389 #else
390 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
391 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
392 #endif
393 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
394 #define __Pyx_PyThreadState_Current PyThreadState_GET()
395 #elif PY_VERSION_HEX >= 0x03060000
396 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
397 #elif PY_VERSION_HEX >= 0x03000000
398 #define __Pyx_PyThreadState_Current PyThreadState_GET()
399 #else
400 #define __Pyx_PyThreadState_Current _PyThreadState_Current
401 #endif
402 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
403 #include "pythread.h"
404 #define Py_tss_NEEDS_INIT 0
405 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)406 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
407 *key = PyThread_create_key();
408 return 0;
409 }
PyThread_tss_alloc(void)410 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
411 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
412 *key = Py_tss_NEEDS_INIT;
413 return key;
414 }
PyThread_tss_free(Py_tss_t * key)415 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
416 PyObject_Free(key);
417 }
PyThread_tss_is_created(Py_tss_t * key)418 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
419 return *key != Py_tss_NEEDS_INIT;
420 }
PyThread_tss_delete(Py_tss_t * key)421 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
422 PyThread_delete_key(*key);
423 *key = Py_tss_NEEDS_INIT;
424 }
PyThread_tss_set(Py_tss_t * key,void * value)425 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
426 return PyThread_set_key_value(*key, value);
427 }
PyThread_tss_get(Py_tss_t * key)428 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
429 return PyThread_get_key_value(*key);
430 }
431 #endif
432 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
433 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
434 #else
435 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
436 #endif
437 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
438 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
439 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
440 #else
441 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
442 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
443 #endif
444 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
445 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
446 #else
447 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
448 #endif
449 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
450 #define CYTHON_PEP393_ENABLED 1
451 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
452 0 : _PyUnicode_Ready((PyObject *)(op)))
453 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
454 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
455 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
456 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
457 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
458 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
459 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
460 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
461 #else
462 #define CYTHON_PEP393_ENABLED 0
463 #define PyUnicode_1BYTE_KIND 1
464 #define PyUnicode_2BYTE_KIND 2
465 #define PyUnicode_4BYTE_KIND 4
466 #define __Pyx_PyUnicode_READY(op) (0)
467 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
468 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
469 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
470 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
471 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
472 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
473 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
474 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
475 #endif
476 #if CYTHON_COMPILING_IN_PYPY
477 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
478 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
479 #else
480 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
481 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
482 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
483 #endif
484 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
485 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
486 #endif
487 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
488 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
489 #endif
490 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
491 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
492 #endif
493 #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))
494 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
495 #if PY_MAJOR_VERSION >= 3
496 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
497 #else
498 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
499 #endif
500 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
501 #define PyObject_ASCII(o) PyObject_Repr(o)
502 #endif
503 #if PY_MAJOR_VERSION >= 3
504 #define PyBaseString_Type PyUnicode_Type
505 #define PyStringObject PyUnicodeObject
506 #define PyString_Type PyUnicode_Type
507 #define PyString_Check PyUnicode_Check
508 #define PyString_CheckExact PyUnicode_CheckExact
509 #define PyObject_Unicode PyObject_Str
510 #endif
511 #if PY_MAJOR_VERSION >= 3
512 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
513 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
514 #else
515 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
516 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
517 #endif
518 #ifndef PySet_CheckExact
519 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
520 #endif
521 #if CYTHON_ASSUME_SAFE_MACROS
522 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
523 #else
524 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
525 #endif
526 #if PY_MAJOR_VERSION >= 3
527 #define PyIntObject PyLongObject
528 #define PyInt_Type PyLong_Type
529 #define PyInt_Check(op) PyLong_Check(op)
530 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
531 #define PyInt_FromString PyLong_FromString
532 #define PyInt_FromUnicode PyLong_FromUnicode
533 #define PyInt_FromLong PyLong_FromLong
534 #define PyInt_FromSize_t PyLong_FromSize_t
535 #define PyInt_FromSsize_t PyLong_FromSsize_t
536 #define PyInt_AsLong PyLong_AsLong
537 #define PyInt_AS_LONG PyLong_AS_LONG
538 #define PyInt_AsSsize_t PyLong_AsSsize_t
539 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
540 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
541 #define PyNumber_Int PyNumber_Long
542 #endif
543 #if PY_MAJOR_VERSION >= 3
544 #define PyBoolObject PyLongObject
545 #endif
546 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
547 #ifndef PyUnicode_InternFromString
548 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
549 #endif
550 #endif
551 #if PY_VERSION_HEX < 0x030200A4
552 typedef long Py_hash_t;
553 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
554 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
555 #else
556 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
557 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
558 #endif
559 #if PY_MAJOR_VERSION >= 3
560 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
561 #else
562 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
563 #endif
564 #if CYTHON_USE_ASYNC_SLOTS
565 #if PY_VERSION_HEX >= 0x030500B1
566 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
567 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
568 #else
569 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
570 #endif
571 #else
572 #define __Pyx_PyType_AsAsync(obj) NULL
573 #endif
574 #ifndef __Pyx_PyAsyncMethodsStruct
575 typedef struct {
576 unaryfunc am_await;
577 unaryfunc am_aiter;
578 unaryfunc am_anext;
579 } __Pyx_PyAsyncMethodsStruct;
580 #endif
581
582 #if defined(WIN32) || defined(MS_WINDOWS)
583 #define _USE_MATH_DEFINES
584 #endif
585 #include <math.h>
586 #ifdef NAN
587 #define __PYX_NAN() ((float) NAN)
588 #else
__PYX_NAN()589 static CYTHON_INLINE float __PYX_NAN() {
590 float value;
591 memset(&value, 0xFF, sizeof(value));
592 return value;
593 }
594 #endif
595 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
596 #define __Pyx_truncl trunc
597 #else
598 #define __Pyx_truncl truncl
599 #endif
600
601
602 #define __PYX_ERR(f_index, lineno, Ln_error) \
603 { \
604 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
605 }
606
607 #ifndef __PYX_EXTERN_C
608 #ifdef __cplusplus
609 #define __PYX_EXTERN_C extern "C"
610 #else
611 #define __PYX_EXTERN_C extern
612 #endif
613 #endif
614
615 #define __PYX_HAVE__yt__utilities__lib__fortran_reader
616 #define __PYX_HAVE_API__yt__utilities__lib__fortran_reader
617 /* Early includes */
618 #include <string.h>
619 #include <stdlib.h>
620 #include <stdio.h>
621 #include "numpy/arrayobject.h"
622 #include "numpy/ufuncobject.h"
623 #include "endian_swap.h"
624 #include "platform_dep.h"
625 #include "stdio.h"
626 #ifdef _OPENMP
627 #include <omp.h>
628 #endif /* _OPENMP */
629
630 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
631 #define CYTHON_WITHOUT_ASSERTIONS
632 #endif
633
634 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
635 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
636
637 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
638 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
639 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
640 #define __PYX_DEFAULT_STRING_ENCODING ""
641 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
642 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
643 #define __Pyx_uchar_cast(c) ((unsigned char)c)
644 #define __Pyx_long_cast(x) ((long)x)
645 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
646 (sizeof(type) < sizeof(Py_ssize_t)) ||\
647 (sizeof(type) > sizeof(Py_ssize_t) &&\
648 likely(v < (type)PY_SSIZE_T_MAX ||\
649 v == (type)PY_SSIZE_T_MAX) &&\
650 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
651 v == (type)PY_SSIZE_T_MIN))) ||\
652 (sizeof(type) == sizeof(Py_ssize_t) &&\
653 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
654 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)655 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
656 return (size_t) i < (size_t) limit;
657 }
658 #if defined (__cplusplus) && __cplusplus >= 201103L
659 #include <cstdlib>
660 #define __Pyx_sst_abs(value) std::abs(value)
661 #elif SIZEOF_INT >= SIZEOF_SIZE_T
662 #define __Pyx_sst_abs(value) abs(value)
663 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
664 #define __Pyx_sst_abs(value) labs(value)
665 #elif defined (_MSC_VER)
666 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
667 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
668 #define __Pyx_sst_abs(value) llabs(value)
669 #elif defined (__GNUC__)
670 #define __Pyx_sst_abs(value) __builtin_llabs(value)
671 #else
672 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
673 #endif
674 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
675 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
676 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
677 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
678 #define __Pyx_PyBytes_FromString PyBytes_FromString
679 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
680 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
681 #if PY_MAJOR_VERSION < 3
682 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
683 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
684 #else
685 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
686 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
687 #endif
688 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
692 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
693 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
694 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
697 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
698 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
699 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
700 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
701 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
702 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
703 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)704 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
705 const Py_UNICODE *u_end = u;
706 while (*u_end++) ;
707 return (size_t)(u_end - u - 1);
708 }
709 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
710 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
711 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
712 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
713 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
714 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
715 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
716 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
717 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
718 #define __Pyx_PySequence_Tuple(obj)\
719 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
720 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
721 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
722 #if CYTHON_ASSUME_SAFE_MACROS
723 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
724 #else
725 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
726 #endif
727 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
728 #if PY_MAJOR_VERSION >= 3
729 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
730 #else
731 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
732 #endif
733 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
734 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
735 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)736 static int __Pyx_init_sys_getdefaultencoding_params(void) {
737 PyObject* sys;
738 PyObject* default_encoding = NULL;
739 PyObject* ascii_chars_u = NULL;
740 PyObject* ascii_chars_b = NULL;
741 const char* default_encoding_c;
742 sys = PyImport_ImportModule("sys");
743 if (!sys) goto bad;
744 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
745 Py_DECREF(sys);
746 if (!default_encoding) goto bad;
747 default_encoding_c = PyBytes_AsString(default_encoding);
748 if (!default_encoding_c) goto bad;
749 if (strcmp(default_encoding_c, "ascii") == 0) {
750 __Pyx_sys_getdefaultencoding_not_ascii = 0;
751 } else {
752 char ascii_chars[128];
753 int c;
754 for (c = 0; c < 128; c++) {
755 ascii_chars[c] = c;
756 }
757 __Pyx_sys_getdefaultencoding_not_ascii = 1;
758 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
759 if (!ascii_chars_u) goto bad;
760 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
761 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
762 PyErr_Format(
763 PyExc_ValueError,
764 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
765 default_encoding_c);
766 goto bad;
767 }
768 Py_DECREF(ascii_chars_u);
769 Py_DECREF(ascii_chars_b);
770 }
771 Py_DECREF(default_encoding);
772 return 0;
773 bad:
774 Py_XDECREF(default_encoding);
775 Py_XDECREF(ascii_chars_u);
776 Py_XDECREF(ascii_chars_b);
777 return -1;
778 }
779 #endif
780 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
781 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
782 #else
783 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
784 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
785 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)786 static int __Pyx_init_sys_getdefaultencoding_params(void) {
787 PyObject* sys;
788 PyObject* default_encoding = NULL;
789 char* default_encoding_c;
790 sys = PyImport_ImportModule("sys");
791 if (!sys) goto bad;
792 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
793 Py_DECREF(sys);
794 if (!default_encoding) goto bad;
795 default_encoding_c = PyBytes_AsString(default_encoding);
796 if (!default_encoding_c) goto bad;
797 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
798 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
799 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
800 Py_DECREF(default_encoding);
801 return 0;
802 bad:
803 Py_XDECREF(default_encoding);
804 return -1;
805 }
806 #endif
807 #endif
808
809
810 /* Test for GCC > 2.95 */
811 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
812 #define likely(x) __builtin_expect(!!(x), 1)
813 #define unlikely(x) __builtin_expect(!!(x), 0)
814 #else /* !__GNUC__ or GCC < 2.95 */
815 #define likely(x) (x)
816 #define unlikely(x) (x)
817 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)818 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
819
820 static PyObject *__pyx_m = NULL;
821 static PyObject *__pyx_d;
822 static PyObject *__pyx_b;
823 static PyObject *__pyx_cython_runtime = NULL;
824 static PyObject *__pyx_empty_tuple;
825 static PyObject *__pyx_empty_bytes;
826 static PyObject *__pyx_empty_unicode;
827 static int __pyx_lineno;
828 static int __pyx_clineno = 0;
829 static const char * __pyx_cfilenm= __FILE__;
830 static const char *__pyx_filename;
831
832 /* Header.proto */
833 #if !defined(CYTHON_CCOMPLEX)
834 #if defined(__cplusplus)
835 #define CYTHON_CCOMPLEX 1
836 #elif defined(_Complex_I)
837 #define CYTHON_CCOMPLEX 1
838 #else
839 #define CYTHON_CCOMPLEX 0
840 #endif
841 #endif
842 #if CYTHON_CCOMPLEX
843 #ifdef __cplusplus
844 #include <complex>
845 #else
846 #include <complex.h>
847 #endif
848 #endif
849 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
850 #undef _Complex_I
851 #define _Complex_I 1.0fj
852 #endif
853
854
855 static const char *__pyx_f[] = {
856 "yt/utilities/lib/fortran_reader.pyx",
857 "__init__.pxd",
858 "type.pxd",
859 };
860 /* BufferFormatStructs.proto */
861 #define IS_UNSIGNED(type) (((type) -1) > 0)
862 struct __Pyx_StructField_;
863 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
864 typedef struct {
865 const char* name;
866 struct __Pyx_StructField_* fields;
867 size_t size;
868 size_t arraysize[8];
869 int ndim;
870 char typegroup;
871 char is_unsigned;
872 int flags;
873 } __Pyx_TypeInfo;
874 typedef struct __Pyx_StructField_ {
875 __Pyx_TypeInfo* type;
876 const char* name;
877 size_t offset;
878 } __Pyx_StructField;
879 typedef struct {
880 __Pyx_StructField* field;
881 size_t parent_offset;
882 } __Pyx_BufFmt_StackElem;
883 typedef struct {
884 __Pyx_StructField root;
885 __Pyx_BufFmt_StackElem* head;
886 size_t fmt_offset;
887 size_t new_count, enc_count;
888 size_t struct_alignment;
889 int is_complex;
890 char enc_type;
891 char new_packmode;
892 char enc_packmode;
893 char is_valid_array;
894 } __Pyx_BufFmt_Context;
895
896
897 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
898 * # in Cython to enable them only on the right systems.
899 *
900 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
901 * ctypedef npy_int16 int16_t
902 * ctypedef npy_int32 int32_t
903 */
904 typedef npy_int8 __pyx_t_5numpy_int8_t;
905
906 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
907 *
908 * ctypedef npy_int8 int8_t
909 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
910 * ctypedef npy_int32 int32_t
911 * ctypedef npy_int64 int64_t
912 */
913 typedef npy_int16 __pyx_t_5numpy_int16_t;
914
915 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
916 * ctypedef npy_int8 int8_t
917 * ctypedef npy_int16 int16_t
918 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
919 * ctypedef npy_int64 int64_t
920 * #ctypedef npy_int96 int96_t
921 */
922 typedef npy_int32 __pyx_t_5numpy_int32_t;
923
924 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
925 * ctypedef npy_int16 int16_t
926 * ctypedef npy_int32 int32_t
927 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
928 * #ctypedef npy_int96 int96_t
929 * #ctypedef npy_int128 int128_t
930 */
931 typedef npy_int64 __pyx_t_5numpy_int64_t;
932
933 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
934 * #ctypedef npy_int128 int128_t
935 *
936 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
937 * ctypedef npy_uint16 uint16_t
938 * ctypedef npy_uint32 uint32_t
939 */
940 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
941
942 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
943 *
944 * ctypedef npy_uint8 uint8_t
945 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
946 * ctypedef npy_uint32 uint32_t
947 * ctypedef npy_uint64 uint64_t
948 */
949 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
950
951 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
952 * ctypedef npy_uint8 uint8_t
953 * ctypedef npy_uint16 uint16_t
954 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
955 * ctypedef npy_uint64 uint64_t
956 * #ctypedef npy_uint96 uint96_t
957 */
958 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
959
960 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
961 * ctypedef npy_uint16 uint16_t
962 * ctypedef npy_uint32 uint32_t
963 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
964 * #ctypedef npy_uint96 uint96_t
965 * #ctypedef npy_uint128 uint128_t
966 */
967 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
968
969 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
970 * #ctypedef npy_uint128 uint128_t
971 *
972 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
973 * ctypedef npy_float64 float64_t
974 * #ctypedef npy_float80 float80_t
975 */
976 typedef npy_float32 __pyx_t_5numpy_float32_t;
977
978 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
979 *
980 * ctypedef npy_float32 float32_t
981 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
982 * #ctypedef npy_float80 float80_t
983 * #ctypedef npy_float128 float128_t
984 */
985 typedef npy_float64 __pyx_t_5numpy_float64_t;
986
987 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
988 * # The int types are mapped a bit surprising --
989 * # numpy.int corresponds to 'l' and numpy.long to 'q'
990 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
991 * ctypedef npy_longlong long_t
992 * ctypedef npy_longlong longlong_t
993 */
994 typedef npy_long __pyx_t_5numpy_int_t;
995
996 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
997 * # numpy.int corresponds to 'l' and numpy.long to 'q'
998 * ctypedef npy_long int_t
999 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1000 * ctypedef npy_longlong longlong_t
1001 *
1002 */
1003 typedef npy_longlong __pyx_t_5numpy_long_t;
1004
1005 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1006 * ctypedef npy_long int_t
1007 * ctypedef npy_longlong long_t
1008 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1009 *
1010 * ctypedef npy_ulong uint_t
1011 */
1012 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1013
1014 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1015 * ctypedef npy_longlong longlong_t
1016 *
1017 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1018 * ctypedef npy_ulonglong ulong_t
1019 * ctypedef npy_ulonglong ulonglong_t
1020 */
1021 typedef npy_ulong __pyx_t_5numpy_uint_t;
1022
1023 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1024 *
1025 * ctypedef npy_ulong uint_t
1026 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1027 * ctypedef npy_ulonglong ulonglong_t
1028 *
1029 */
1030 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1031
1032 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1033 * ctypedef npy_ulong uint_t
1034 * ctypedef npy_ulonglong ulong_t
1035 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1036 *
1037 * ctypedef npy_intp intp_t
1038 */
1039 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1040
1041 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1042 * ctypedef npy_ulonglong ulonglong_t
1043 *
1044 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1045 * ctypedef npy_uintp uintp_t
1046 *
1047 */
1048 typedef npy_intp __pyx_t_5numpy_intp_t;
1049
1050 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1051 *
1052 * ctypedef npy_intp intp_t
1053 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1054 *
1055 * ctypedef npy_double float_t
1056 */
1057 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1058
1059 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1060 * ctypedef npy_uintp uintp_t
1061 *
1062 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1063 * ctypedef npy_double double_t
1064 * ctypedef npy_longdouble longdouble_t
1065 */
1066 typedef npy_double __pyx_t_5numpy_float_t;
1067
1068 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1069 *
1070 * ctypedef npy_double float_t
1071 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1072 * ctypedef npy_longdouble longdouble_t
1073 *
1074 */
1075 typedef npy_double __pyx_t_5numpy_double_t;
1076
1077 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1078 * ctypedef npy_double float_t
1079 * ctypedef npy_double double_t
1080 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1081 *
1082 * ctypedef npy_cfloat cfloat_t
1083 */
1084 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1085 /* Declarations.proto */
1086 #if CYTHON_CCOMPLEX
1087 #ifdef __cplusplus
1088 typedef ::std::complex< float > __pyx_t_float_complex;
1089 #else
1090 typedef float _Complex __pyx_t_float_complex;
1091 #endif
1092 #else
1093 typedef struct { float real, imag; } __pyx_t_float_complex;
1094 #endif
1095 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1096
1097 /* Declarations.proto */
1098 #if CYTHON_CCOMPLEX
1099 #ifdef __cplusplus
1100 typedef ::std::complex< double > __pyx_t_double_complex;
1101 #else
1102 typedef double _Complex __pyx_t_double_complex;
1103 #endif
1104 #else
1105 typedef struct { double real, imag; } __pyx_t_double_complex;
1106 #endif
1107 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1108
1109
1110 /*--- Type declarations ---*/
1111
1112 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1113 * ctypedef npy_longdouble longdouble_t
1114 *
1115 * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1116 * ctypedef npy_cdouble cdouble_t
1117 * ctypedef npy_clongdouble clongdouble_t
1118 */
1119 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1120
1121 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1122 *
1123 * ctypedef npy_cfloat cfloat_t
1124 * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1125 * ctypedef npy_clongdouble clongdouble_t
1126 *
1127 */
1128 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1129
1130 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1131 * ctypedef npy_cfloat cfloat_t
1132 * ctypedef npy_cdouble cdouble_t
1133 * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1134 *
1135 * ctypedef npy_cdouble complex_t
1136 */
1137 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1138
1139 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1140 * ctypedef npy_clongdouble clongdouble_t
1141 *
1142 * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1143 *
1144 * cdef inline object PyArray_MultiIterNew1(a):
1145 */
1146 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1147
1148 /* --- Runtime support code (head) --- */
1149 /* Refnanny.proto */
1150 #ifndef CYTHON_REFNANNY
1151 #define CYTHON_REFNANNY 0
1152 #endif
1153 #if CYTHON_REFNANNY
1154 typedef struct {
1155 void (*INCREF)(void*, PyObject*, int);
1156 void (*DECREF)(void*, PyObject*, int);
1157 void (*GOTREF)(void*, PyObject*, int);
1158 void (*GIVEREF)(void*, PyObject*, int);
1159 void* (*SetupContext)(const char*, int, const char*);
1160 void (*FinishContext)(void**);
1161 } __Pyx_RefNannyAPIStruct;
1162 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1163 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1164 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1165 #ifdef WITH_THREAD
1166 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1167 if (acquire_gil) {\
1168 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1169 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1170 PyGILState_Release(__pyx_gilstate_save);\
1171 } else {\
1172 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1173 }
1174 #else
1175 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1176 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1177 #endif
1178 #define __Pyx_RefNannyFinishContext()\
1179 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1180 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1181 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1182 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1183 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1184 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1185 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1186 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1187 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1188 #else
1189 #define __Pyx_RefNannyDeclarations
1190 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1191 #define __Pyx_RefNannyFinishContext()
1192 #define __Pyx_INCREF(r) Py_INCREF(r)
1193 #define __Pyx_DECREF(r) Py_DECREF(r)
1194 #define __Pyx_GOTREF(r)
1195 #define __Pyx_GIVEREF(r)
1196 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1197 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1198 #define __Pyx_XGOTREF(r)
1199 #define __Pyx_XGIVEREF(r)
1200 #endif
1201 #define __Pyx_XDECREF_SET(r, v) do {\
1202 PyObject *tmp = (PyObject *) r;\
1203 r = v; __Pyx_XDECREF(tmp);\
1204 } while (0)
1205 #define __Pyx_DECREF_SET(r, v) do {\
1206 PyObject *tmp = (PyObject *) r;\
1207 r = v; __Pyx_DECREF(tmp);\
1208 } while (0)
1209 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1210 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1211
1212 /* PyObjectGetAttrStr.proto */
1213 #if CYTHON_USE_TYPE_SLOTS
1214 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1215 #else
1216 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1217 #endif
1218
1219 /* GetBuiltinName.proto */
1220 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1221
1222 /* RaiseArgTupleInvalid.proto */
1223 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1224 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1225
1226 /* RaiseDoubleKeywords.proto */
1227 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1228
1229 /* ParseKeywords.proto */
1230 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1231 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1232 const char* function_name);
1233
1234 /* ArgTypeTest.proto */
1235 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1236 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1237 __Pyx__ArgTypeTest(obj, type, name, exact))
1238 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1239
1240 /* ListAppend.proto */
1241 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1242 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1243 PyListObject* L = (PyListObject*) list;
1244 Py_ssize_t len = Py_SIZE(list);
1245 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1246 Py_INCREF(x);
1247 PyList_SET_ITEM(list, len, x);
1248 Py_SIZE(list) = len+1;
1249 return 0;
1250 }
1251 return PyList_Append(list, x);
1252 }
1253 #else
1254 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1255 #endif
1256
1257 /* PyCFunctionFastCall.proto */
1258 #if CYTHON_FAST_PYCCALL
1259 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1260 #else
1261 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1262 #endif
1263
1264 /* PyFunctionFastCall.proto */
1265 #if CYTHON_FAST_PYCALL
1266 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1267 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1268 #if 1 || PY_VERSION_HEX < 0x030600B1
1269 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1270 #else
1271 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1272 #endif
1273 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1274 (sizeof(char [1 - 2*!(cond)]) - 1)
1275 #ifndef Py_MEMBER_SIZE
1276 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1277 #endif
1278 static size_t __pyx_pyframe_localsplus_offset = 0;
1279 #include "frameobject.h"
1280 #define __Pxy_PyFrame_Initialize_Offsets()\
1281 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1282 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1283 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1284 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1285 #endif
1286
1287 /* PyObjectCall.proto */
1288 #if CYTHON_COMPILING_IN_CPYTHON
1289 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1290 #else
1291 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1292 #endif
1293
1294 /* PyObjectCall2Args.proto */
1295 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1296
1297 /* PyObjectCallMethO.proto */
1298 #if CYTHON_COMPILING_IN_CPYTHON
1299 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1300 #endif
1301
1302 /* PyObjectCallOneArg.proto */
1303 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1304
1305 /* PyObjectGetMethod.proto */
1306 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1307
1308 /* PyObjectCallMethod1.proto */
1309 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1310
1311 /* append.proto */
1312 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1313
1314 /* None.proto */
1315 static CYTHON_INLINE long __Pyx_div_long(long, long);
1316
1317 /* IsLittleEndian.proto */
1318 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1319
1320 /* BufferFormatCheck.proto */
1321 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1322 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1323 __Pyx_BufFmt_StackElem* stack,
1324 __Pyx_TypeInfo* type);
1325
1326 /* BufferGetAndValidate.proto */
1327 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1328 ((obj == Py_None || obj == NULL) ?\
1329 (__Pyx_ZeroBuffer(buf), 0) :\
1330 __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1331 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1332 __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1333 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1334 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1335 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1336 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1337
1338 /* BufferIndexError.proto */
1339 static void __Pyx_RaiseBufferIndexError(int axis);
1340
1341 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1342 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1343 /* PyThreadStateGet.proto */
1344 #if CYTHON_FAST_THREAD_STATE
1345 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1346 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1347 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1348 #else
1349 #define __Pyx_PyThreadState_declare
1350 #define __Pyx_PyThreadState_assign
1351 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1352 #endif
1353
1354 /* PyErrFetchRestore.proto */
1355 #if CYTHON_FAST_THREAD_STATE
1356 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1357 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1358 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1359 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1360 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1361 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1362 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1363 #if CYTHON_COMPILING_IN_CPYTHON
1364 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1365 #else
1366 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1367 #endif
1368 #else
1369 #define __Pyx_PyErr_Clear() PyErr_Clear()
1370 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1371 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1372 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1373 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1374 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1375 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1376 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1377 #endif
1378
1379 /* PySequenceContains.proto */
__Pyx_PySequence_ContainsTF(PyObject * item,PyObject * seq,int eq)1380 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1381 int result = PySequence_Contains(seq, item);
1382 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1383 }
1384
1385 /* SetItemInt.proto */
1386 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1387 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1388 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1389 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1390 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1391 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1392 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1393 int is_list, int wraparound, int boundscheck);
1394
1395 /* PyIntBinop.proto */
1396 #if !CYTHON_COMPILING_IN_PYPY
1397 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1398 #else
1399 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1400 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1401 #endif
1402
1403 /* WriteUnraisableException.proto */
1404 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1405 int lineno, const char *filename,
1406 int full_traceback, int nogil);
1407
1408 /* GetItemInt.proto */
1409 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1410 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1411 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1412 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1413 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1414 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1415 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1416 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1417 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1418 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1419 int wraparound, int boundscheck);
1420 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1421 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1422 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1423 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1424 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1425 int wraparound, int boundscheck);
1426 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1427 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1428 int is_list, int wraparound, int boundscheck);
1429
1430 /* ExtTypeTest.proto */
1431 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1432
1433 /* BufferFallbackError.proto */
1434 static void __Pyx_RaiseBufferFallbackError(void);
1435
1436 /* ObjectGetItem.proto */
1437 #if CYTHON_USE_TYPE_SLOTS
1438 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1439 #else
1440 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1441 #endif
1442
1443 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1444 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1445 /* RaiseException.proto */
1446 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1447
1448 /* DictGetItem.proto */
1449 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1450 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1451 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1452 (likely(PyDict_CheckExact(obj)) ?\
1453 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1454 #else
1455 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1456 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1457 #endif
1458
1459 /* RaiseTooManyValuesToUnpack.proto */
1460 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1461
1462 /* RaiseNeedMoreValuesToUnpack.proto */
1463 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1464
1465 /* RaiseNoneIterError.proto */
1466 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1467
1468 /* GetTopmostException.proto */
1469 #if CYTHON_USE_EXC_INFO_STACK
1470 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1471 #endif
1472
1473 /* SaveResetException.proto */
1474 #if CYTHON_FAST_THREAD_STATE
1475 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1476 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1477 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1478 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1479 #else
1480 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1481 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1482 #endif
1483
1484 /* PyErrExceptionMatches.proto */
1485 #if CYTHON_FAST_THREAD_STATE
1486 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1487 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1488 #else
1489 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1490 #endif
1491
1492 /* GetException.proto */
1493 #if CYTHON_FAST_THREAD_STATE
1494 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1495 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1496 #else
1497 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1498 #endif
1499
1500 /* TypeImport.proto */
1501 #ifndef __PYX_HAVE_RT_ImportType_proto
1502 #define __PYX_HAVE_RT_ImportType_proto
1503 enum __Pyx_ImportType_CheckSize {
1504 __Pyx_ImportType_CheckSize_Error = 0,
1505 __Pyx_ImportType_CheckSize_Warn = 1,
1506 __Pyx_ImportType_CheckSize_Ignore = 2
1507 };
1508 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1509 #endif
1510
1511 /* Import.proto */
1512 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1513
1514 /* PyDictVersioning.proto */
1515 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1516 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1517 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1518 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1519 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1520 (cache_var) = (value);
1521 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1522 static PY_UINT64_T __pyx_dict_version = 0;\
1523 static PyObject *__pyx_dict_cached_value = NULL;\
1524 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1525 (VAR) = __pyx_dict_cached_value;\
1526 } else {\
1527 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1528 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1529 }\
1530 }
1531 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1532 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1533 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1534 #else
1535 #define __PYX_GET_DICT_VERSION(dict) (0)
1536 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1537 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1538 #endif
1539
1540 /* CLineInTraceback.proto */
1541 #ifdef CYTHON_CLINE_IN_TRACEBACK
1542 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1543 #else
1544 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1545 #endif
1546
1547 /* CodeObjectCache.proto */
1548 typedef struct {
1549 PyCodeObject* code_object;
1550 int code_line;
1551 } __Pyx_CodeObjectCacheEntry;
1552 struct __Pyx_CodeObjectCache {
1553 int count;
1554 int max_count;
1555 __Pyx_CodeObjectCacheEntry* entries;
1556 };
1557 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1558 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1559 static PyCodeObject *__pyx_find_code_object(int code_line);
1560 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1561
1562 /* AddTraceback.proto */
1563 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1564 int py_line, const char *filename);
1565
1566 /* BufferStructDeclare.proto */
1567 typedef struct {
1568 Py_ssize_t shape, strides, suboffsets;
1569 } __Pyx_Buf_DimInfo;
1570 typedef struct {
1571 size_t refcount;
1572 Py_buffer pybuffer;
1573 } __Pyx_Buffer;
1574 typedef struct {
1575 __Pyx_Buffer *rcbuffer;
1576 char *data;
1577 __Pyx_Buf_DimInfo diminfo[8];
1578 } __Pyx_LocalBuf_ND;
1579
1580 #if PY_MAJOR_VERSION < 3
1581 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1582 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1583 #else
1584 #define __Pyx_GetBuffer PyObject_GetBuffer
1585 #define __Pyx_ReleaseBuffer PyBuffer_Release
1586 #endif
1587
1588
1589 /* CIntToPy.proto */
1590 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1591
1592 /* Print.proto */
1593 static int __Pyx_Print(PyObject*, PyObject *, int);
1594 #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
1595 static PyObject* __pyx_print = 0;
1596 static PyObject* __pyx_print_kwargs = 0;
1597 #endif
1598
1599 /* CIntToPy.proto */
1600 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1601
1602 /* CIntToPy.proto */
1603 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
1604
1605 /* RealImag.proto */
1606 #if CYTHON_CCOMPLEX
1607 #ifdef __cplusplus
1608 #define __Pyx_CREAL(z) ((z).real())
1609 #define __Pyx_CIMAG(z) ((z).imag())
1610 #else
1611 #define __Pyx_CREAL(z) (__real__(z))
1612 #define __Pyx_CIMAG(z) (__imag__(z))
1613 #endif
1614 #else
1615 #define __Pyx_CREAL(z) ((z).real)
1616 #define __Pyx_CIMAG(z) ((z).imag)
1617 #endif
1618 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1619 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1620 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1621 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1622 #else
1623 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1624 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1625 #endif
1626
1627 /* Arithmetic.proto */
1628 #if CYTHON_CCOMPLEX
1629 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1630 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1631 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1632 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1633 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1634 #define __Pyx_c_neg_float(a) (-(a))
1635 #ifdef __cplusplus
1636 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1637 #define __Pyx_c_conj_float(z) (::std::conj(z))
1638 #if 1
1639 #define __Pyx_c_abs_float(z) (::std::abs(z))
1640 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1641 #endif
1642 #else
1643 #define __Pyx_c_is_zero_float(z) ((z)==0)
1644 #define __Pyx_c_conj_float(z) (conjf(z))
1645 #if 1
1646 #define __Pyx_c_abs_float(z) (cabsf(z))
1647 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1648 #endif
1649 #endif
1650 #else
1651 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1652 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1653 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1654 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1655 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1656 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1657 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1658 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1659 #if 1
1660 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1661 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1662 #endif
1663 #endif
1664
1665 /* Arithmetic.proto */
1666 #if CYTHON_CCOMPLEX
1667 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1668 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1669 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1670 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1671 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1672 #define __Pyx_c_neg_double(a) (-(a))
1673 #ifdef __cplusplus
1674 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1675 #define __Pyx_c_conj_double(z) (::std::conj(z))
1676 #if 1
1677 #define __Pyx_c_abs_double(z) (::std::abs(z))
1678 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1679 #endif
1680 #else
1681 #define __Pyx_c_is_zero_double(z) ((z)==0)
1682 #define __Pyx_c_conj_double(z) (conj(z))
1683 #if 1
1684 #define __Pyx_c_abs_double(z) (cabs(z))
1685 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1686 #endif
1687 #endif
1688 #else
1689 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1690 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1691 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1692 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1693 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1694 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1695 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1696 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1697 #if 1
1698 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1699 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1700 #endif
1701 #endif
1702
1703 /* CIntToPy.proto */
1704 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1705
1706 /* CIntFromPy.proto */
1707 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *);
1708
1709 /* CIntFromPy.proto */
1710 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1711
1712 /* CIntFromPy.proto */
1713 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1714
1715 /* PrintOne.proto */
1716 static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
1717
1718 /* FastTypeChecks.proto */
1719 #if CYTHON_COMPILING_IN_CPYTHON
1720 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1721 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1722 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1723 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1724 #else
1725 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1726 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1727 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1728 #endif
1729 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1730
1731 /* CheckBinaryVersion.proto */
1732 static int __Pyx_check_binary_version(void);
1733
1734 /* InitStrings.proto */
1735 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1736
1737
1738 /* Module declarations from 'cython' */
1739
1740 /* Module declarations from 'libc.string' */
1741
1742 /* Module declarations from 'libc.stdlib' */
1743
1744 /* Module declarations from 'cpython.buffer' */
1745
1746 /* Module declarations from 'libc.stdio' */
1747
1748 /* Module declarations from '__builtin__' */
1749
1750 /* Module declarations from 'cpython.type' */
1751 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1752
1753 /* Module declarations from 'cpython' */
1754
1755 /* Module declarations from 'cpython.object' */
1756
1757 /* Module declarations from 'cpython.ref' */
1758
1759 /* Module declarations from 'cpython.mem' */
1760
1761 /* Module declarations from 'numpy' */
1762
1763 /* Module declarations from 'numpy' */
1764 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1765 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1766 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1767 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1768 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1769 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1770
1771 /* Module declarations from 'yt.utilities.lib.fortran_reader' */
1772 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 };
1773 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
1774 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
1775 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
1776 #define __Pyx_MODULE_NAME "yt.utilities.lib.fortran_reader"
1777 extern int __pyx_module_is_main_yt__utilities__lib__fortran_reader;
1778 int __pyx_module_is_main_yt__utilities__lib__fortran_reader = 0;
1779
1780 /* Implementation of 'yt.utilities.lib.fortran_reader' */
1781 static PyObject *__pyx_builtin_range;
1782 static PyObject *__pyx_builtin_ValueError;
1783 static PyObject *__pyx_builtin_RuntimeError;
1784 static PyObject *__pyx_builtin_ImportError;
1785 static const char __pyx_k_f[] = "f";
1786 static const char __pyx_k_i[] = "i";
1787 static const char __pyx_k_j[] = "j";
1788 static const char __pyx_k_k[] = "k";
1789 static const char __pyx_k_l[] = "l";
1790 static const char __pyx_k_n[] = "n";
1791 static const char __pyx_k_x[] = "x";
1792 static const char __pyx_k_y[] = "y";
1793 static const char __pyx_k_z[] = "z";
1794 static const char __pyx_k_di[] = "di";
1795 static const char __pyx_k_dj[] = "dj";
1796 static const char __pyx_k_dk[] = "dk";
1797 static const char __pyx_k_fn[] = "fn";
1798 static const char __pyx_k_gi[] = "gi";
1799 static const char __pyx_k_ir[] = "ir";
1800 static const char __pyx_k_ix[] = "ix";
1801 static const char __pyx_k_iy[] = "iy";
1802 static const char __pyx_k_iz[] = "iz";
1803 static const char __pyx_k_jr[] = "jr";
1804 static const char __pyx_k_kr[] = "kr";
1805 static const char __pyx_k_np[] = "np";
1806 static const char __pyx_k_nx[] = "nx";
1807 static const char __pyx_k_ny[] = "ny";
1808 static const char __pyx_k_nz[] = "nz";
1809 static const char __pyx_k__11[] = "_";
1810 static const char __pyx_k_buf[] = "buf";
1811 static const char __pyx_k_end[] = "end";
1812 static const char __pyx_k_ic1[] = "ic1";
1813 static const char __pyx_k_lex[] = "lex";
1814 static const char __pyx_k_ley[] = "ley";
1815 static const char __pyx_k_lez[] = "lez";
1816 static const char __pyx_k_var[] = "var";
1817 static const char __pyx_k_data[] = "data";
1818 static const char __pyx_k_file[] = "file";
1819 static const char __pyx_k_iOct[] = "iOct";
1820 static const char __pyx_k_ioct[] = "ioct";
1821 static const char __pyx_k_line[] = "line";
1822 static const char __pyx_k_main[] = "__main__";
1823 static const char __pyx_k_name[] = "__name__";
1824 static const char __pyx_k_offi[] = "offi";
1825 static const char __pyx_k_offj[] = "offj";
1826 static const char __pyx_k_offk[] = "offk";
1827 static const char __pyx_k_temp[] = "temp";
1828 static const char __pyx_k_test[] = "__test__";
1829 static const char __pyx_k_Level[] = "Level";
1830 static const char __pyx_k_bytes[] = "bytes";
1831 static const char __pyx_k_iHOLL[] = "iHOLL";
1832 static const char __pyx_k_iNOLL[] = "iNOLL";
1833 static const char __pyx_k_level[] = "level";
1834 static const char __pyx_k_nocts[] = "nocts";
1835 static const char __pyx_k_numpy[] = "numpy";
1836 static const char __pyx_k_odind[] = "odind";
1837 static const char __pyx_k_print[] = "print";
1838 static const char __pyx_k_range[] = "range";
1839 static const char __pyx_k_append[] = "append";
1840 static const char __pyx_k_buffer[] = "buffer";
1841 static const char __pyx_k_fields[] = "fields";
1842 static const char __pyx_k_filled[] = "filled";
1843 static const char __pyx_k_iOctPs[] = "iOctPs";
1844 static const char __pyx_k_import[] = "__import__";
1845 static const char __pyx_k_nLevel[] = "nLevel";
1846 static const char __pyx_k_nchild[] = "nchild";
1847 static const char __pyx_k_nhvars[] = "nhvars";
1848 static const char __pyx_k_offset[] = "offset";
1849 static const char __pyx_k_readin[] = "readin";
1850 static const char __pyx_k_grid_id[] = "grid_id";
1851 static const char __pyx_k_grid_le[] = "grid_le";
1852 static const char __pyx_k_iOctMax[] = "iOctMax";
1853 static const char __pyx_k_offset1[] = "offset1";
1854 static const char __pyx_k_offset2[] = "offset2";
1855 static const char __pyx_k_to_fill[] = "to_fill";
1856 static const char __pyx_k_filename[] = "filename";
1857 static const char __pyx_k_oct_info[] = "oct_info";
1858 static const char __pyx_k_varindex[] = "varindex";
1859 static const char __pyx_k_end_index[] = "end_index";
1860 static const char __pyx_k_grid_dims[] = "grid_dims";
1861 static const char __pyx_k_ir_offset[] = "ir_offset";
1862 static const char __pyx_k_jr_offset[] = "jr_offset";
1863 static const char __pyx_k_kr_offset[] = "kr_offset";
1864 static const char __pyx_k_max_level[] = "max_level";
1865 static const char __pyx_k_min_level[] = "min_level";
1866 static const char __pyx_k_my_offset[] = "my_offset";
1867 static const char __pyx_k_temp_data[] = "temp_data";
1868 static const char __pyx_k_ValueError[] = "ValueError";
1869 static const char __pyx_k_child_mask[] = "child_mask";
1870 static const char __pyx_k_level_data[] = "level_data";
1871 static const char __pyx_k_level_info[] = "level_info";
1872 static const char __pyx_k_oct_levels[] = "oct_levels";
1873 static const char __pyx_k_ogrid_info[] = "ogrid_info";
1874 static const char __pyx_k_ref_factor[] = "ref_factor";
1875 static const char __pyx_k_ImportError[] = "ImportError";
1876 static const char __pyx_k_next_record[] = "next_record";
1877 static const char __pyx_k_nhydro_vars[] = "nhydro_vars";
1878 static const char __pyx_k_oct_indices[] = "oct_indices";
1879 static const char __pyx_k_start_index[] = "start_index";
1880 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1881 static const char __pyx_k_child_record[] = "child_record";
1882 static const char __pyx_k_dummy_records[] = "dummy_records";
1883 static const char __pyx_k_level_offsets[] = "level_offsets";
1884 static const char __pyx_k_read_and_seek[] = "read_and_seek";
1885 static const char __pyx_k_read_art_grid[] = "read_art_grid";
1886 static const char __pyx_k_read_art_tree[] = "read_art_tree";
1887 static const char __pyx_k_Record_size_is[] = "Record size is:";
1888 static const char __pyx_k_count_art_octs[] = "count_art_octs";
1889 static const char __pyx_k_file_locations[] = "file_locations";
1890 static const char __pyx_k_og_start_index[] = "og_start_index";
1891 static const char __pyx_k_art_child_masks[] = "art_child_masks";
1892 static const char __pyx_k_fill_child_mask[] = "fill_child_mask";
1893 static const char __pyx_k_cell_record_size[] = "cell_record_size";
1894 static const char __pyx_k_root_grid_offset[] = "root_grid_offset";
1895 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1896 static const char __pyx_k_read_art_root_vars[] = "read_art_root_vars";
1897 static const char __pyx_k_component_grid_info[] = "component_grid_info";
1898 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1899 static const char __pyx_k_Simple_readers_for_fortran_unfo[] = "\nSimple readers for fortran unformatted data, specifically for the Tiger code.\n\n\n\n";
1900 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1901 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1902 static const char __pyx_k_yt_utilities_lib_fortran_reader[] = "yt/utilities/lib/fortran_reader.pyx";
1903 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1904 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1905 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1906 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1907 static const char __pyx_k_yt_utilities_lib_fortran_reader_2[] = "yt.utilities.lib.fortran_reader";
1908 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1909 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1910 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1911 static PyObject *__pyx_n_s_ImportError;
1912 static PyObject *__pyx_n_s_Level;
1913 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1914 static PyObject *__pyx_kp_s_Record_size_is;
1915 static PyObject *__pyx_n_s_RuntimeError;
1916 static PyObject *__pyx_n_s_ValueError;
1917 static PyObject *__pyx_n_s__11;
1918 static PyObject *__pyx_n_s_append;
1919 static PyObject *__pyx_n_s_art_child_masks;
1920 static PyObject *__pyx_n_s_buf;
1921 static PyObject *__pyx_n_s_buffer;
1922 static PyObject *__pyx_n_s_bytes;
1923 static PyObject *__pyx_n_s_cell_record_size;
1924 static PyObject *__pyx_n_s_child_mask;
1925 static PyObject *__pyx_n_s_child_record;
1926 static PyObject *__pyx_n_s_cline_in_traceback;
1927 static PyObject *__pyx_n_s_component_grid_info;
1928 static PyObject *__pyx_n_s_count_art_octs;
1929 static PyObject *__pyx_n_s_data;
1930 static PyObject *__pyx_n_s_di;
1931 static PyObject *__pyx_n_s_dj;
1932 static PyObject *__pyx_n_s_dk;
1933 static PyObject *__pyx_n_s_dummy_records;
1934 static PyObject *__pyx_n_s_end;
1935 static PyObject *__pyx_n_s_end_index;
1936 static PyObject *__pyx_n_s_f;
1937 static PyObject *__pyx_n_s_fields;
1938 static PyObject *__pyx_n_s_file;
1939 static PyObject *__pyx_n_s_file_locations;
1940 static PyObject *__pyx_n_s_filename;
1941 static PyObject *__pyx_n_s_fill_child_mask;
1942 static PyObject *__pyx_n_s_filled;
1943 static PyObject *__pyx_n_s_fn;
1944 static PyObject *__pyx_n_s_gi;
1945 static PyObject *__pyx_n_s_grid_dims;
1946 static PyObject *__pyx_n_s_grid_id;
1947 static PyObject *__pyx_n_s_grid_le;
1948 static PyObject *__pyx_n_s_i;
1949 static PyObject *__pyx_n_s_iHOLL;
1950 static PyObject *__pyx_n_s_iNOLL;
1951 static PyObject *__pyx_n_s_iOct;
1952 static PyObject *__pyx_n_s_iOctMax;
1953 static PyObject *__pyx_n_s_iOctPs;
1954 static PyObject *__pyx_n_s_ic1;
1955 static PyObject *__pyx_n_s_import;
1956 static PyObject *__pyx_n_s_ioct;
1957 static PyObject *__pyx_n_s_ir;
1958 static PyObject *__pyx_n_s_ir_offset;
1959 static PyObject *__pyx_n_s_ix;
1960 static PyObject *__pyx_n_s_iy;
1961 static PyObject *__pyx_n_s_iz;
1962 static PyObject *__pyx_n_s_j;
1963 static PyObject *__pyx_n_s_jr;
1964 static PyObject *__pyx_n_s_jr_offset;
1965 static PyObject *__pyx_n_s_k;
1966 static PyObject *__pyx_n_s_kr;
1967 static PyObject *__pyx_n_s_kr_offset;
1968 static PyObject *__pyx_n_s_l;
1969 static PyObject *__pyx_n_s_level;
1970 static PyObject *__pyx_n_s_level_data;
1971 static PyObject *__pyx_n_s_level_info;
1972 static PyObject *__pyx_n_s_level_offsets;
1973 static PyObject *__pyx_n_s_lex;
1974 static PyObject *__pyx_n_s_ley;
1975 static PyObject *__pyx_n_s_lez;
1976 static PyObject *__pyx_n_s_line;
1977 static PyObject *__pyx_n_s_main;
1978 static PyObject *__pyx_n_s_max_level;
1979 static PyObject *__pyx_n_s_min_level;
1980 static PyObject *__pyx_n_s_my_offset;
1981 static PyObject *__pyx_n_s_n;
1982 static PyObject *__pyx_n_s_nLevel;
1983 static PyObject *__pyx_n_s_name;
1984 static PyObject *__pyx_n_s_nchild;
1985 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1986 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1987 static PyObject *__pyx_n_s_next_record;
1988 static PyObject *__pyx_n_s_nhvars;
1989 static PyObject *__pyx_n_s_nhydro_vars;
1990 static PyObject *__pyx_n_s_nocts;
1991 static PyObject *__pyx_n_s_np;
1992 static PyObject *__pyx_n_s_numpy;
1993 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1994 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1995 static PyObject *__pyx_n_s_nx;
1996 static PyObject *__pyx_n_s_ny;
1997 static PyObject *__pyx_n_s_nz;
1998 static PyObject *__pyx_n_s_oct_indices;
1999 static PyObject *__pyx_n_s_oct_info;
2000 static PyObject *__pyx_n_s_oct_levels;
2001 static PyObject *__pyx_n_s_odind;
2002 static PyObject *__pyx_n_s_offi;
2003 static PyObject *__pyx_n_s_offj;
2004 static PyObject *__pyx_n_s_offk;
2005 static PyObject *__pyx_n_s_offset;
2006 static PyObject *__pyx_n_s_offset1;
2007 static PyObject *__pyx_n_s_offset2;
2008 static PyObject *__pyx_n_s_og_start_index;
2009 static PyObject *__pyx_n_s_ogrid_info;
2010 static PyObject *__pyx_n_s_print;
2011 static PyObject *__pyx_n_s_range;
2012 static PyObject *__pyx_n_s_read_and_seek;
2013 static PyObject *__pyx_n_s_read_art_grid;
2014 static PyObject *__pyx_n_s_read_art_root_vars;
2015 static PyObject *__pyx_n_s_read_art_tree;
2016 static PyObject *__pyx_n_s_readin;
2017 static PyObject *__pyx_n_s_ref_factor;
2018 static PyObject *__pyx_n_s_root_grid_offset;
2019 static PyObject *__pyx_n_s_start_index;
2020 static PyObject *__pyx_n_s_temp;
2021 static PyObject *__pyx_n_s_temp_data;
2022 static PyObject *__pyx_n_s_test;
2023 static PyObject *__pyx_n_s_to_fill;
2024 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2025 static PyObject *__pyx_n_s_var;
2026 static PyObject *__pyx_n_s_varindex;
2027 static PyObject *__pyx_n_s_x;
2028 static PyObject *__pyx_n_s_y;
2029 static PyObject *__pyx_kp_s_yt_utilities_lib_fortran_reader;
2030 static PyObject *__pyx_n_s_yt_utilities_lib_fortran_reader_2;
2031 static PyObject *__pyx_n_s_z;
2032 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_read_and_seek(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename, __pyx_t_5numpy_int64_t __pyx_v_offset1, __pyx_t_5numpy_int64_t __pyx_v_offset2, PyArrayObject *__pyx_v_buffer, int __pyx_v_bytes); /* proto */
2033 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_2count_art_octs(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_fn, long __pyx_v_offset, int __pyx_v_min_level, int __pyx_v_max_level, int __pyx_v_nhydro_vars, PyObject *__pyx_v_level_info); /* proto */
2034 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_4read_art_tree(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_fn, long __pyx_v_offset, int __pyx_v_min_level, int __pyx_v_max_level, PyArrayObject *__pyx_v_oct_indices, PyArrayObject *__pyx_v_oct_levels, PyArrayObject *__pyx_v_oct_info); /* proto */
2035 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_6read_art_root_vars(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_fn, long __pyx_v_root_grid_offset, int __pyx_v_nhydro_vars, int __pyx_v_nx, int __pyx_v_ny, CYTHON_UNUSED int __pyx_v_nz, int __pyx_v_ix, int __pyx_v_iy, int __pyx_v_iz, PyObject *__pyx_v_fields, PyObject *__pyx_v_var); /* proto */
2036 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_8read_art_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_varindex, PyArrayObject *__pyx_v_start_index, PyArrayObject *__pyx_v_grid_dims, PyArrayObject *__pyx_v_data, PyArrayObject *__pyx_v_filled, PyArrayObject *__pyx_v_level_data, int __pyx_v_level, int __pyx_v_ref_factor, PyObject *__pyx_v_component_grid_info); /* proto */
2037 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_10fill_child_mask(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_file_locations, PyArrayObject *__pyx_v_grid_le, PyArrayObject *__pyx_v_art_child_masks, PyArrayObject *__pyx_v_child_mask); /* proto */
2038 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2039 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2040 static PyObject *__pyx_int_0;
2041 static PyObject *__pyx_int_1;
2042 static PyObject *__pyx_int_3;
2043 static PyObject *__pyx_int_6;
2044 static PyObject *__pyx_int_4294967296L;
2045 static PyObject *__pyx_slice_;
2046 static PyObject *__pyx_tuple__2;
2047 static PyObject *__pyx_tuple__3;
2048 static PyObject *__pyx_tuple__4;
2049 static PyObject *__pyx_tuple__5;
2050 static PyObject *__pyx_tuple__6;
2051 static PyObject *__pyx_tuple__7;
2052 static PyObject *__pyx_tuple__8;
2053 static PyObject *__pyx_tuple__9;
2054 static PyObject *__pyx_tuple__12;
2055 static PyObject *__pyx_tuple__14;
2056 static PyObject *__pyx_tuple__16;
2057 static PyObject *__pyx_tuple__18;
2058 static PyObject *__pyx_tuple__20;
2059 static PyObject *__pyx_codeobj__10;
2060 static PyObject *__pyx_codeobj__13;
2061 static PyObject *__pyx_codeobj__15;
2062 static PyObject *__pyx_codeobj__17;
2063 static PyObject *__pyx_codeobj__19;
2064 static PyObject *__pyx_codeobj__21;
2065 /* Late includes */
2066
2067 /* "yt/utilities/lib/fortran_reader.pyx":41
2068 * @cython.boundscheck(False)
2069 * @cython.wraparound(False)
2070 * def read_and_seek(char *filename, np.int64_t offset1, # <<<<<<<<<<<<<<
2071 * np.int64_t offset2, np.ndarray buffer, int bytes):
2072 * cdef FILE *f = fopen(filename, "rb")
2073 */
2074
2075 /* Python wrapper */
2076 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_1read_and_seek(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2077 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14fortran_reader_1read_and_seek = {"read_and_seek", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14fortran_reader_1read_and_seek, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14fortran_reader_1read_and_seek(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2078 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_1read_and_seek(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2079 char *__pyx_v_filename;
2080 __pyx_t_5numpy_int64_t __pyx_v_offset1;
2081 __pyx_t_5numpy_int64_t __pyx_v_offset2;
2082 PyArrayObject *__pyx_v_buffer = 0;
2083 int __pyx_v_bytes;
2084 PyObject *__pyx_r = 0;
2085 __Pyx_RefNannyDeclarations
2086 __Pyx_RefNannySetupContext("read_and_seek (wrapper)", 0);
2087 {
2088 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_offset1,&__pyx_n_s_offset2,&__pyx_n_s_buffer,&__pyx_n_s_bytes,0};
2089 PyObject* values[5] = {0,0,0,0,0};
2090 if (unlikely(__pyx_kwds)) {
2091 Py_ssize_t kw_args;
2092 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2093 switch (pos_args) {
2094 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2095 CYTHON_FALLTHROUGH;
2096 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2097 CYTHON_FALLTHROUGH;
2098 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2099 CYTHON_FALLTHROUGH;
2100 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2101 CYTHON_FALLTHROUGH;
2102 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2103 CYTHON_FALLTHROUGH;
2104 case 0: break;
2105 default: goto __pyx_L5_argtuple_error;
2106 }
2107 kw_args = PyDict_Size(__pyx_kwds);
2108 switch (pos_args) {
2109 case 0:
2110 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--;
2111 else goto __pyx_L5_argtuple_error;
2112 CYTHON_FALLTHROUGH;
2113 case 1:
2114 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset1)) != 0)) kw_args--;
2115 else {
2116 __Pyx_RaiseArgtupleInvalid("read_and_seek", 1, 5, 5, 1); __PYX_ERR(0, 41, __pyx_L3_error)
2117 }
2118 CYTHON_FALLTHROUGH;
2119 case 2:
2120 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset2)) != 0)) kw_args--;
2121 else {
2122 __Pyx_RaiseArgtupleInvalid("read_and_seek", 1, 5, 5, 2); __PYX_ERR(0, 41, __pyx_L3_error)
2123 }
2124 CYTHON_FALLTHROUGH;
2125 case 3:
2126 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
2127 else {
2128 __Pyx_RaiseArgtupleInvalid("read_and_seek", 1, 5, 5, 3); __PYX_ERR(0, 41, __pyx_L3_error)
2129 }
2130 CYTHON_FALLTHROUGH;
2131 case 4:
2132 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
2133 else {
2134 __Pyx_RaiseArgtupleInvalid("read_and_seek", 1, 5, 5, 4); __PYX_ERR(0, 41, __pyx_L3_error)
2135 }
2136 }
2137 if (unlikely(kw_args > 0)) {
2138 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_and_seek") < 0)) __PYX_ERR(0, 41, __pyx_L3_error)
2139 }
2140 } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2141 goto __pyx_L5_argtuple_error;
2142 } else {
2143 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2144 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2145 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2146 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2147 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2148 }
2149 __pyx_v_filename = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
2150 __pyx_v_offset1 = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_offset1 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error)
2151 __pyx_v_offset2 = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_offset2 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error)
2152 __pyx_v_buffer = ((PyArrayObject *)values[3]);
2153 __pyx_v_bytes = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_bytes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error)
2154 }
2155 goto __pyx_L4_argument_unpacking_done;
2156 __pyx_L5_argtuple_error:;
2157 __Pyx_RaiseArgtupleInvalid("read_and_seek", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error)
2158 __pyx_L3_error:;
2159 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_and_seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
2160 __Pyx_RefNannyFinishContext();
2161 return NULL;
2162 __pyx_L4_argument_unpacking_done:;
2163 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) __PYX_ERR(0, 42, __pyx_L1_error)
2164 __pyx_r = __pyx_pf_2yt_9utilities_3lib_14fortran_reader_read_and_seek(__pyx_self, __pyx_v_filename, __pyx_v_offset1, __pyx_v_offset2, __pyx_v_buffer, __pyx_v_bytes);
2165
2166 /* function exit code */
2167 goto __pyx_L0;
2168 __pyx_L1_error:;
2169 __pyx_r = NULL;
2170 __pyx_L0:;
2171 __Pyx_RefNannyFinishContext();
2172 return __pyx_r;
2173 }
2174
__pyx_pf_2yt_9utilities_3lib_14fortran_reader_read_and_seek(CYTHON_UNUSED PyObject * __pyx_self,char * __pyx_v_filename,__pyx_t_5numpy_int64_t __pyx_v_offset1,__pyx_t_5numpy_int64_t __pyx_v_offset2,PyArrayObject * __pyx_v_buffer,int __pyx_v_bytes)2175 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_read_and_seek(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename, __pyx_t_5numpy_int64_t __pyx_v_offset1, __pyx_t_5numpy_int64_t __pyx_v_offset2, PyArrayObject *__pyx_v_buffer, int __pyx_v_bytes) {
2176 FILE *__pyx_v_f;
2177 void *__pyx_v_buf;
2178 char __pyx_v_line[0x400];
2179 size_t __pyx_v_n;
2180 PyObject *__pyx_r = NULL;
2181 __Pyx_RefNannyDeclarations
2182 __Pyx_RefNannySetupContext("read_and_seek", 0);
2183
2184 /* "yt/utilities/lib/fortran_reader.pyx":43
2185 * def read_and_seek(char *filename, np.int64_t offset1,
2186 * np.int64_t offset2, np.ndarray buffer, int bytes):
2187 * cdef FILE *f = fopen(filename, "rb") # <<<<<<<<<<<<<<
2188 * cdef void *buf = <void *> buffer.data
2189 * cdef char line[1024]
2190 */
2191 __pyx_v_f = fopen(__pyx_v_filename, ((char const *)"rb"));
2192
2193 /* "yt/utilities/lib/fortran_reader.pyx":44
2194 * np.int64_t offset2, np.ndarray buffer, int bytes):
2195 * cdef FILE *f = fopen(filename, "rb")
2196 * cdef void *buf = <void *> buffer.data # <<<<<<<<<<<<<<
2197 * cdef char line[1024]
2198 * cdef size_t n = 1023
2199 */
2200 __pyx_v_buf = ((void *)__pyx_v_buffer->data);
2201
2202 /* "yt/utilities/lib/fortran_reader.pyx":46
2203 * cdef void *buf = <void *> buffer.data
2204 * cdef char line[1024]
2205 * cdef size_t n = 1023 # <<<<<<<<<<<<<<
2206 * fseek(f, offset1, SEEK_SET)
2207 * fgets(line, n, f)
2208 */
2209 __pyx_v_n = 0x3FF;
2210
2211 /* "yt/utilities/lib/fortran_reader.pyx":47
2212 * cdef char line[1024]
2213 * cdef size_t n = 1023
2214 * fseek(f, offset1, SEEK_SET) # <<<<<<<<<<<<<<
2215 * fgets(line, n, f)
2216 * fseek(f, offset2, SEEK_CUR)
2217 */
2218 (void)(fseek(__pyx_v_f, __pyx_v_offset1, SEEK_SET));
2219
2220 /* "yt/utilities/lib/fortran_reader.pyx":48
2221 * cdef size_t n = 1023
2222 * fseek(f, offset1, SEEK_SET)
2223 * fgets(line, n, f) # <<<<<<<<<<<<<<
2224 * fseek(f, offset2, SEEK_CUR)
2225 * fread(buf, 1, bytes, f)
2226 */
2227 (void)(fgets(__pyx_v_line, __pyx_v_n, __pyx_v_f));
2228
2229 /* "yt/utilities/lib/fortran_reader.pyx":49
2230 * fseek(f, offset1, SEEK_SET)
2231 * fgets(line, n, f)
2232 * fseek(f, offset2, SEEK_CUR) # <<<<<<<<<<<<<<
2233 * fread(buf, 1, bytes, f)
2234 * fclose(f)
2235 */
2236 (void)(fseek(__pyx_v_f, __pyx_v_offset2, SEEK_CUR));
2237
2238 /* "yt/utilities/lib/fortran_reader.pyx":50
2239 * fgets(line, n, f)
2240 * fseek(f, offset2, SEEK_CUR)
2241 * fread(buf, 1, bytes, f) # <<<<<<<<<<<<<<
2242 * fclose(f)
2243 *
2244 */
2245 (void)(fread(__pyx_v_buf, 1, __pyx_v_bytes, __pyx_v_f));
2246
2247 /* "yt/utilities/lib/fortran_reader.pyx":51
2248 * fseek(f, offset2, SEEK_CUR)
2249 * fread(buf, 1, bytes, f)
2250 * fclose(f) # <<<<<<<<<<<<<<
2251 *
2252 * def count_art_octs(char *fn, long offset,
2253 */
2254 (void)(fclose(__pyx_v_f));
2255
2256 /* "yt/utilities/lib/fortran_reader.pyx":41
2257 * @cython.boundscheck(False)
2258 * @cython.wraparound(False)
2259 * def read_and_seek(char *filename, np.int64_t offset1, # <<<<<<<<<<<<<<
2260 * np.int64_t offset2, np.ndarray buffer, int bytes):
2261 * cdef FILE *f = fopen(filename, "rb")
2262 */
2263
2264 /* function exit code */
2265 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2266 __Pyx_XGIVEREF(__pyx_r);
2267 __Pyx_RefNannyFinishContext();
2268 return __pyx_r;
2269 }
2270
2271 /* "yt/utilities/lib/fortran_reader.pyx":53
2272 * fclose(f)
2273 *
2274 * def count_art_octs(char *fn, long offset, # <<<<<<<<<<<<<<
2275 * int min_level, int max_level,
2276 * int nhydro_vars,
2277 */
2278
2279 /* Python wrapper */
2280 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_3count_art_octs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2281 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14fortran_reader_3count_art_octs = {"count_art_octs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14fortran_reader_3count_art_octs, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14fortran_reader_3count_art_octs(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2282 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_3count_art_octs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2283 char *__pyx_v_fn;
2284 long __pyx_v_offset;
2285 int __pyx_v_min_level;
2286 int __pyx_v_max_level;
2287 int __pyx_v_nhydro_vars;
2288 PyObject *__pyx_v_level_info = 0;
2289 PyObject *__pyx_r = 0;
2290 __Pyx_RefNannyDeclarations
2291 __Pyx_RefNannySetupContext("count_art_octs (wrapper)", 0);
2292 {
2293 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fn,&__pyx_n_s_offset,&__pyx_n_s_min_level,&__pyx_n_s_max_level,&__pyx_n_s_nhydro_vars,&__pyx_n_s_level_info,0};
2294 PyObject* values[6] = {0,0,0,0,0,0};
2295 if (unlikely(__pyx_kwds)) {
2296 Py_ssize_t kw_args;
2297 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2298 switch (pos_args) {
2299 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2300 CYTHON_FALLTHROUGH;
2301 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2302 CYTHON_FALLTHROUGH;
2303 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2304 CYTHON_FALLTHROUGH;
2305 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2306 CYTHON_FALLTHROUGH;
2307 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2308 CYTHON_FALLTHROUGH;
2309 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2310 CYTHON_FALLTHROUGH;
2311 case 0: break;
2312 default: goto __pyx_L5_argtuple_error;
2313 }
2314 kw_args = PyDict_Size(__pyx_kwds);
2315 switch (pos_args) {
2316 case 0:
2317 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
2318 else goto __pyx_L5_argtuple_error;
2319 CYTHON_FALLTHROUGH;
2320 case 1:
2321 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--;
2322 else {
2323 __Pyx_RaiseArgtupleInvalid("count_art_octs", 1, 6, 6, 1); __PYX_ERR(0, 53, __pyx_L3_error)
2324 }
2325 CYTHON_FALLTHROUGH;
2326 case 2:
2327 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_level)) != 0)) kw_args--;
2328 else {
2329 __Pyx_RaiseArgtupleInvalid("count_art_octs", 1, 6, 6, 2); __PYX_ERR(0, 53, __pyx_L3_error)
2330 }
2331 CYTHON_FALLTHROUGH;
2332 case 3:
2333 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_level)) != 0)) kw_args--;
2334 else {
2335 __Pyx_RaiseArgtupleInvalid("count_art_octs", 1, 6, 6, 3); __PYX_ERR(0, 53, __pyx_L3_error)
2336 }
2337 CYTHON_FALLTHROUGH;
2338 case 4:
2339 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nhydro_vars)) != 0)) kw_args--;
2340 else {
2341 __Pyx_RaiseArgtupleInvalid("count_art_octs", 1, 6, 6, 4); __PYX_ERR(0, 53, __pyx_L3_error)
2342 }
2343 CYTHON_FALLTHROUGH;
2344 case 5:
2345 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level_info)) != 0)) kw_args--;
2346 else {
2347 __Pyx_RaiseArgtupleInvalid("count_art_octs", 1, 6, 6, 5); __PYX_ERR(0, 53, __pyx_L3_error)
2348 }
2349 }
2350 if (unlikely(kw_args > 0)) {
2351 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_art_octs") < 0)) __PYX_ERR(0, 53, __pyx_L3_error)
2352 }
2353 } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
2354 goto __pyx_L5_argtuple_error;
2355 } else {
2356 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2357 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2358 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2359 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2360 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2361 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2362 }
2363 __pyx_v_fn = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error)
2364 __pyx_v_offset = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error)
2365 __pyx_v_min_level = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_min_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error)
2366 __pyx_v_max_level = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_max_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error)
2367 __pyx_v_nhydro_vars = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nhydro_vars == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L3_error)
2368 __pyx_v_level_info = values[5];
2369 }
2370 goto __pyx_L4_argument_unpacking_done;
2371 __pyx_L5_argtuple_error:;
2372 __Pyx_RaiseArgtupleInvalid("count_art_octs", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 53, __pyx_L3_error)
2373 __pyx_L3_error:;
2374 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.count_art_octs", __pyx_clineno, __pyx_lineno, __pyx_filename);
2375 __Pyx_RefNannyFinishContext();
2376 return NULL;
2377 __pyx_L4_argument_unpacking_done:;
2378 __pyx_r = __pyx_pf_2yt_9utilities_3lib_14fortran_reader_2count_art_octs(__pyx_self, __pyx_v_fn, __pyx_v_offset, __pyx_v_min_level, __pyx_v_max_level, __pyx_v_nhydro_vars, __pyx_v_level_info);
2379
2380 /* function exit code */
2381 __Pyx_RefNannyFinishContext();
2382 return __pyx_r;
2383 }
2384
__pyx_pf_2yt_9utilities_3lib_14fortran_reader_2count_art_octs(CYTHON_UNUSED PyObject * __pyx_self,char * __pyx_v_fn,long __pyx_v_offset,int __pyx_v_min_level,int __pyx_v_max_level,int __pyx_v_nhydro_vars,PyObject * __pyx_v_level_info)2385 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_2count_art_octs(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_fn, long __pyx_v_offset, int __pyx_v_min_level, int __pyx_v_max_level, int __pyx_v_nhydro_vars, PyObject *__pyx_v_level_info) {
2386 int __pyx_v_nchild;
2387 int __pyx_v_next_record;
2388 int __pyx_v_nLevel;
2389 int __pyx_v_dummy_records[9];
2390 int __pyx_v_readin;
2391 FILE *__pyx_v_f;
2392 CYTHON_UNUSED long __pyx_v__;
2393 PyObject *__pyx_r = NULL;
2394 __Pyx_RefNannyDeclarations
2395 long __pyx_t_1;
2396 long __pyx_t_2;
2397 long __pyx_t_3;
2398 PyObject *__pyx_t_4 = NULL;
2399 int __pyx_t_5;
2400 PyObject *__pyx_t_6 = NULL;
2401 __Pyx_RefNannySetupContext("count_art_octs", 0);
2402
2403 /* "yt/utilities/lib/fortran_reader.pyx":57
2404 * int nhydro_vars,
2405 * level_info):
2406 * cdef int nchild = 8 # <<<<<<<<<<<<<<
2407 * cdef int next_record = -1, nLevel = -1
2408 * cdef int dummy_records[9]
2409 */
2410 __pyx_v_nchild = 8;
2411
2412 /* "yt/utilities/lib/fortran_reader.pyx":58
2413 * level_info):
2414 * cdef int nchild = 8
2415 * cdef int next_record = -1, nLevel = -1 # <<<<<<<<<<<<<<
2416 * cdef int dummy_records[9]
2417 * cdef int readin = -1
2418 */
2419 __pyx_v_next_record = -1;
2420 __pyx_v_nLevel = -1;
2421
2422 /* "yt/utilities/lib/fortran_reader.pyx":60
2423 * cdef int next_record = -1, nLevel = -1
2424 * cdef int dummy_records[9]
2425 * cdef int readin = -1 # <<<<<<<<<<<<<<
2426 * cdef FILE *f = fopen(fn, "rb")
2427 * fseek(f, offset, SEEK_SET)
2428 */
2429 __pyx_v_readin = -1;
2430
2431 /* "yt/utilities/lib/fortran_reader.pyx":61
2432 * cdef int dummy_records[9]
2433 * cdef int readin = -1
2434 * cdef FILE *f = fopen(fn, "rb") # <<<<<<<<<<<<<<
2435 * fseek(f, offset, SEEK_SET)
2436 * for _ in range(min_level + 1, max_level + 1):
2437 */
2438 __pyx_v_f = fopen(__pyx_v_fn, ((char const *)"rb"));
2439
2440 /* "yt/utilities/lib/fortran_reader.pyx":62
2441 * cdef int readin = -1
2442 * cdef FILE *f = fopen(fn, "rb")
2443 * fseek(f, offset, SEEK_SET) # <<<<<<<<<<<<<<
2444 * for _ in range(min_level + 1, max_level + 1):
2445 * fread(dummy_records, sizeof(int), 2, f);
2446 */
2447 (void)(fseek(__pyx_v_f, __pyx_v_offset, SEEK_SET));
2448
2449 /* "yt/utilities/lib/fortran_reader.pyx":63
2450 * cdef FILE *f = fopen(fn, "rb")
2451 * fseek(f, offset, SEEK_SET)
2452 * for _ in range(min_level + 1, max_level + 1): # <<<<<<<<<<<<<<
2453 * fread(dummy_records, sizeof(int), 2, f);
2454 * fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel)
2455 */
2456 __pyx_t_1 = (__pyx_v_max_level + 1);
2457 __pyx_t_2 = __pyx_t_1;
2458 for (__pyx_t_3 = (__pyx_v_min_level + 1); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2459 __pyx_v__ = __pyx_t_3;
2460
2461 /* "yt/utilities/lib/fortran_reader.pyx":64
2462 * fseek(f, offset, SEEK_SET)
2463 * for _ in range(min_level + 1, max_level + 1):
2464 * fread(dummy_records, sizeof(int), 2, f); # <<<<<<<<<<<<<<
2465 * fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel)
2466 * print(level_info)
2467 */
2468 (void)(fread(__pyx_v_dummy_records, (sizeof(int)), 2, __pyx_v_f));
2469
2470 /* "yt/utilities/lib/fortran_reader.pyx":65
2471 * for _ in range(min_level + 1, max_level + 1):
2472 * fread(dummy_records, sizeof(int), 2, f);
2473 * fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel) # <<<<<<<<<<<<<<
2474 * print(level_info)
2475 * level_info.append(nLevel)
2476 */
2477 (void)(fread((&__pyx_v_nLevel), (sizeof(int)), 1, __pyx_v_f));
2478 FIX_LONG(__pyx_v_nLevel);
2479
2480 /* "yt/utilities/lib/fortran_reader.pyx":66
2481 * fread(dummy_records, sizeof(int), 2, f);
2482 * fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel)
2483 * print(level_info) # <<<<<<<<<<<<<<
2484 * level_info.append(nLevel)
2485 * fread(dummy_records, sizeof(int), 2, f);
2486 */
2487 if (__Pyx_PrintOne(0, __pyx_v_level_info) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
2488
2489 /* "yt/utilities/lib/fortran_reader.pyx":67
2490 * fread(&nLevel, sizeof(int), 1, f); FIX_LONG(nLevel)
2491 * print(level_info)
2492 * level_info.append(nLevel) # <<<<<<<<<<<<<<
2493 * fread(dummy_records, sizeof(int), 2, f);
2494 * fread(&next_record, sizeof(int), 1, f); FIX_LONG(next_record)
2495 */
2496 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nLevel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error)
2497 __Pyx_GOTREF(__pyx_t_4);
2498 __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_level_info, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 67, __pyx_L1_error)
2499 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2500
2501 /* "yt/utilities/lib/fortran_reader.pyx":68
2502 * print(level_info)
2503 * level_info.append(nLevel)
2504 * fread(dummy_records, sizeof(int), 2, f); # <<<<<<<<<<<<<<
2505 * fread(&next_record, sizeof(int), 1, f); FIX_LONG(next_record)
2506 * print("Record size is:", next_record)
2507 */
2508 (void)(fread(__pyx_v_dummy_records, (sizeof(int)), 2, __pyx_v_f));
2509
2510 /* "yt/utilities/lib/fortran_reader.pyx":69
2511 * level_info.append(nLevel)
2512 * fread(dummy_records, sizeof(int), 2, f);
2513 * fread(&next_record, sizeof(int), 1, f); FIX_LONG(next_record) # <<<<<<<<<<<<<<
2514 * print("Record size is:", next_record)
2515 * # Offset for one record header we just read
2516 */
2517 (void)(fread((&__pyx_v_next_record), (sizeof(int)), 1, __pyx_v_f));
2518 FIX_LONG(__pyx_v_next_record);
2519
2520 /* "yt/utilities/lib/fortran_reader.pyx":70
2521 * fread(dummy_records, sizeof(int), 2, f);
2522 * fread(&next_record, sizeof(int), 1, f); FIX_LONG(next_record)
2523 * print("Record size is:", next_record) # <<<<<<<<<<<<<<
2524 * # Offset for one record header we just read
2525 * next_record = (nLevel * (next_record + 2*sizeof(int))) - sizeof(int)
2526 */
2527 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_next_record); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
2528 __Pyx_GOTREF(__pyx_t_4);
2529 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error)
2530 __Pyx_GOTREF(__pyx_t_6);
2531 __Pyx_INCREF(__pyx_kp_s_Record_size_is);
2532 __Pyx_GIVEREF(__pyx_kp_s_Record_size_is);
2533 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_Record_size_is);
2534 __Pyx_GIVEREF(__pyx_t_4);
2535 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
2536 __pyx_t_4 = 0;
2537 if (__Pyx_PrintOne(0, __pyx_t_6) < 0) __PYX_ERR(0, 70, __pyx_L1_error)
2538 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2539
2540 /* "yt/utilities/lib/fortran_reader.pyx":72
2541 * print("Record size is:", next_record)
2542 * # Offset for one record header we just read
2543 * next_record = (nLevel * (next_record + 2*sizeof(int))) - sizeof(int) # <<<<<<<<<<<<<<
2544 * fseek(f, next_record, SEEK_CUR)
2545 * # Now we skip the second section
2546 */
2547 __pyx_v_next_record = ((__pyx_v_nLevel * (__pyx_v_next_record + (2 * (sizeof(int))))) - (sizeof(int)));
2548
2549 /* "yt/utilities/lib/fortran_reader.pyx":73
2550 * # Offset for one record header we just read
2551 * next_record = (nLevel * (next_record + 2*sizeof(int))) - sizeof(int)
2552 * fseek(f, next_record, SEEK_CUR) # <<<<<<<<<<<<<<
2553 * # Now we skip the second section
2554 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2555 */
2556 (void)(fseek(__pyx_v_f, __pyx_v_next_record, SEEK_CUR));
2557
2558 /* "yt/utilities/lib/fortran_reader.pyx":75
2559 * fseek(f, next_record, SEEK_CUR)
2560 * # Now we skip the second section
2561 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
2562 * nhydro_vars = next_record/4-2-3 #nhvar in daniel's code
2563 * #record length is normally 2 pad bytes, 8 + 2 hvars (the 2 is nchem)
2564 */
2565 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
2566 FIX_LONG(__pyx_v_readin);
2567
2568 /* "yt/utilities/lib/fortran_reader.pyx":76
2569 * # Now we skip the second section
2570 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2571 * nhydro_vars = next_record/4-2-3 #nhvar in daniel's code # <<<<<<<<<<<<<<
2572 * #record length is normally 2 pad bytes, 8 + 2 hvars (the 2 is nchem)
2573 * # and then 3 vars, but we can find nhvars only here and not in other
2574 */
2575 __pyx_v_nhydro_vars = ((__Pyx_div_long(__pyx_v_next_record, 4) - 2) - 3);
2576
2577 /* "yt/utilities/lib/fortran_reader.pyx":80
2578 * # and then 3 vars, but we can find nhvars only here and not in other
2579 * # file headers
2580 * next_record = (2*sizeof(int) + readin) * (nLevel * nchild) # <<<<<<<<<<<<<<
2581 * next_record -= sizeof(int)
2582 * fseek(f, next_record, SEEK_CUR)
2583 */
2584 __pyx_v_next_record = (((2 * (sizeof(int))) + __pyx_v_readin) * (__pyx_v_nLevel * __pyx_v_nchild));
2585
2586 /* "yt/utilities/lib/fortran_reader.pyx":81
2587 * # file headers
2588 * next_record = (2*sizeof(int) + readin) * (nLevel * nchild)
2589 * next_record -= sizeof(int) # <<<<<<<<<<<<<<
2590 * fseek(f, next_record, SEEK_CUR)
2591 * print("nhvars",nhydro_vars)
2592 */
2593 __pyx_v_next_record = (__pyx_v_next_record - (sizeof(int)));
2594
2595 /* "yt/utilities/lib/fortran_reader.pyx":82
2596 * next_record = (2*sizeof(int) + readin) * (nLevel * nchild)
2597 * next_record -= sizeof(int)
2598 * fseek(f, next_record, SEEK_CUR) # <<<<<<<<<<<<<<
2599 * print("nhvars",nhydro_vars)
2600 * fclose(f)
2601 */
2602 (void)(fseek(__pyx_v_f, __pyx_v_next_record, SEEK_CUR));
2603 }
2604
2605 /* "yt/utilities/lib/fortran_reader.pyx":83
2606 * next_record -= sizeof(int)
2607 * fseek(f, next_record, SEEK_CUR)
2608 * print("nhvars",nhydro_vars) # <<<<<<<<<<<<<<
2609 * fclose(f)
2610 *
2611 */
2612 __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_nhydro_vars); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error)
2613 __Pyx_GOTREF(__pyx_t_6);
2614 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
2615 __Pyx_GOTREF(__pyx_t_4);
2616 __Pyx_INCREF(__pyx_n_s_nhvars);
2617 __Pyx_GIVEREF(__pyx_n_s_nhvars);
2618 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_nhvars);
2619 __Pyx_GIVEREF(__pyx_t_6);
2620 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
2621 __pyx_t_6 = 0;
2622 if (__Pyx_PrintOne(0, __pyx_t_4) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
2623 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2624
2625 /* "yt/utilities/lib/fortran_reader.pyx":84
2626 * fseek(f, next_record, SEEK_CUR)
2627 * print("nhvars",nhydro_vars)
2628 * fclose(f) # <<<<<<<<<<<<<<
2629 *
2630 * def read_art_tree(char *fn, long offset,
2631 */
2632 (void)(fclose(__pyx_v_f));
2633
2634 /* "yt/utilities/lib/fortran_reader.pyx":53
2635 * fclose(f)
2636 *
2637 * def count_art_octs(char *fn, long offset, # <<<<<<<<<<<<<<
2638 * int min_level, int max_level,
2639 * int nhydro_vars,
2640 */
2641
2642 /* function exit code */
2643 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2644 goto __pyx_L0;
2645 __pyx_L1_error:;
2646 __Pyx_XDECREF(__pyx_t_4);
2647 __Pyx_XDECREF(__pyx_t_6);
2648 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.count_art_octs", __pyx_clineno, __pyx_lineno, __pyx_filename);
2649 __pyx_r = NULL;
2650 __pyx_L0:;
2651 __Pyx_XGIVEREF(__pyx_r);
2652 __Pyx_RefNannyFinishContext();
2653 return __pyx_r;
2654 }
2655
2656 /* "yt/utilities/lib/fortran_reader.pyx":86
2657 * fclose(f)
2658 *
2659 * def read_art_tree(char *fn, long offset, # <<<<<<<<<<<<<<
2660 * int min_level, int max_level,
2661 * np.ndarray[np.int64_t, ndim=2] oct_indices,
2662 */
2663
2664 /* Python wrapper */
2665 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_5read_art_tree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2666 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14fortran_reader_5read_art_tree = {"read_art_tree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14fortran_reader_5read_art_tree, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14fortran_reader_5read_art_tree(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2667 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_5read_art_tree(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2668 char *__pyx_v_fn;
2669 long __pyx_v_offset;
2670 int __pyx_v_min_level;
2671 int __pyx_v_max_level;
2672 PyArrayObject *__pyx_v_oct_indices = 0;
2673 PyArrayObject *__pyx_v_oct_levels = 0;
2674 PyArrayObject *__pyx_v_oct_info = 0;
2675 PyObject *__pyx_r = 0;
2676 __Pyx_RefNannyDeclarations
2677 __Pyx_RefNannySetupContext("read_art_tree (wrapper)", 0);
2678 {
2679 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fn,&__pyx_n_s_offset,&__pyx_n_s_min_level,&__pyx_n_s_max_level,&__pyx_n_s_oct_indices,&__pyx_n_s_oct_levels,&__pyx_n_s_oct_info,0};
2680 PyObject* values[7] = {0,0,0,0,0,0,0};
2681 if (unlikely(__pyx_kwds)) {
2682 Py_ssize_t kw_args;
2683 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2684 switch (pos_args) {
2685 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2686 CYTHON_FALLTHROUGH;
2687 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2688 CYTHON_FALLTHROUGH;
2689 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2690 CYTHON_FALLTHROUGH;
2691 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2692 CYTHON_FALLTHROUGH;
2693 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2694 CYTHON_FALLTHROUGH;
2695 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2696 CYTHON_FALLTHROUGH;
2697 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2698 CYTHON_FALLTHROUGH;
2699 case 0: break;
2700 default: goto __pyx_L5_argtuple_error;
2701 }
2702 kw_args = PyDict_Size(__pyx_kwds);
2703 switch (pos_args) {
2704 case 0:
2705 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
2706 else goto __pyx_L5_argtuple_error;
2707 CYTHON_FALLTHROUGH;
2708 case 1:
2709 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--;
2710 else {
2711 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, 1); __PYX_ERR(0, 86, __pyx_L3_error)
2712 }
2713 CYTHON_FALLTHROUGH;
2714 case 2:
2715 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_level)) != 0)) kw_args--;
2716 else {
2717 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, 2); __PYX_ERR(0, 86, __pyx_L3_error)
2718 }
2719 CYTHON_FALLTHROUGH;
2720 case 3:
2721 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_level)) != 0)) kw_args--;
2722 else {
2723 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, 3); __PYX_ERR(0, 86, __pyx_L3_error)
2724 }
2725 CYTHON_FALLTHROUGH;
2726 case 4:
2727 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_oct_indices)) != 0)) kw_args--;
2728 else {
2729 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, 4); __PYX_ERR(0, 86, __pyx_L3_error)
2730 }
2731 CYTHON_FALLTHROUGH;
2732 case 5:
2733 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_oct_levels)) != 0)) kw_args--;
2734 else {
2735 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, 5); __PYX_ERR(0, 86, __pyx_L3_error)
2736 }
2737 CYTHON_FALLTHROUGH;
2738 case 6:
2739 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_oct_info)) != 0)) kw_args--;
2740 else {
2741 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, 6); __PYX_ERR(0, 86, __pyx_L3_error)
2742 }
2743 }
2744 if (unlikely(kw_args > 0)) {
2745 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_art_tree") < 0)) __PYX_ERR(0, 86, __pyx_L3_error)
2746 }
2747 } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
2748 goto __pyx_L5_argtuple_error;
2749 } else {
2750 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2751 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2752 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2753 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2754 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2755 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
2756 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
2757 }
2758 __pyx_v_fn = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L3_error)
2759 __pyx_v_offset = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L3_error)
2760 __pyx_v_min_level = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_min_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
2761 __pyx_v_max_level = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_max_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error)
2762 __pyx_v_oct_indices = ((PyArrayObject *)values[4]);
2763 __pyx_v_oct_levels = ((PyArrayObject *)values[5]);
2764 __pyx_v_oct_info = ((PyArrayObject *)values[6]);
2765 }
2766 goto __pyx_L4_argument_unpacking_done;
2767 __pyx_L5_argtuple_error:;
2768 __Pyx_RaiseArgtupleInvalid("read_art_tree", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 86, __pyx_L3_error)
2769 __pyx_L3_error:;
2770 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_art_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
2771 __Pyx_RefNannyFinishContext();
2772 return NULL;
2773 __pyx_L4_argument_unpacking_done:;
2774 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oct_indices), __pyx_ptype_5numpy_ndarray, 1, "oct_indices", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
2775 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oct_levels), __pyx_ptype_5numpy_ndarray, 1, "oct_levels", 0))) __PYX_ERR(0, 89, __pyx_L1_error)
2776 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_oct_info), __pyx_ptype_5numpy_ndarray, 1, "oct_info", 0))) __PYX_ERR(0, 90, __pyx_L1_error)
2777 __pyx_r = __pyx_pf_2yt_9utilities_3lib_14fortran_reader_4read_art_tree(__pyx_self, __pyx_v_fn, __pyx_v_offset, __pyx_v_min_level, __pyx_v_max_level, __pyx_v_oct_indices, __pyx_v_oct_levels, __pyx_v_oct_info);
2778
2779 /* function exit code */
2780 goto __pyx_L0;
2781 __pyx_L1_error:;
2782 __pyx_r = NULL;
2783 __pyx_L0:;
2784 __Pyx_RefNannyFinishContext();
2785 return __pyx_r;
2786 }
2787
__pyx_pf_2yt_9utilities_3lib_14fortran_reader_4read_art_tree(CYTHON_UNUSED PyObject * __pyx_self,char * __pyx_v_fn,long __pyx_v_offset,int __pyx_v_min_level,int __pyx_v_max_level,PyArrayObject * __pyx_v_oct_indices,PyArrayObject * __pyx_v_oct_levels,PyArrayObject * __pyx_v_oct_info)2788 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_4read_art_tree(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_fn, long __pyx_v_offset, int __pyx_v_min_level, int __pyx_v_max_level, PyArrayObject *__pyx_v_oct_indices, PyArrayObject *__pyx_v_oct_levels, PyArrayObject *__pyx_v_oct_info) {
2789 int __pyx_v_nchild;
2790 int __pyx_v_iOct;
2791 int __pyx_v_nLevel;
2792 int __pyx_v_ic1;
2793 __pyx_t_5numpy_int64_t __pyx_v_next_record;
2794 PY_LONG_LONG __pyx_v_child_record;
2795 int __pyx_v_iOctPs[3];
2796 __pyx_t_5numpy_int64_t __pyx_v_dummy_records[9];
2797 int __pyx_v_readin;
2798 FILE *__pyx_v_f;
2799 int __pyx_v_Level;
2800 int *__pyx_v_iNOLL;
2801 int *__pyx_v_iHOLL;
2802 int __pyx_v_iOctMax;
2803 PyObject *__pyx_v_level_offsets = NULL;
2804 CYTHON_UNUSED long __pyx_v__;
2805 __Pyx_LocalBuf_ND __pyx_pybuffernd_oct_indices;
2806 __Pyx_Buffer __pyx_pybuffer_oct_indices;
2807 __Pyx_LocalBuf_ND __pyx_pybuffernd_oct_info;
2808 __Pyx_Buffer __pyx_pybuffer_oct_info;
2809 __Pyx_LocalBuf_ND __pyx_pybuffernd_oct_levels;
2810 __Pyx_Buffer __pyx_pybuffer_oct_levels;
2811 PyObject *__pyx_r = NULL;
2812 __Pyx_RefNannyDeclarations
2813 PyObject *__pyx_t_1 = NULL;
2814 long __pyx_t_2;
2815 long __pyx_t_3;
2816 long __pyx_t_4;
2817 int __pyx_t_5;
2818 int __pyx_t_6;
2819 int __pyx_t_7;
2820 int __pyx_t_8;
2821 int __pyx_t_9;
2822 int __pyx_t_10;
2823 Py_ssize_t __pyx_t_11;
2824 Py_ssize_t __pyx_t_12;
2825 Py_ssize_t __pyx_t_13;
2826 Py_ssize_t __pyx_t_14;
2827 Py_ssize_t __pyx_t_15;
2828 Py_ssize_t __pyx_t_16;
2829 Py_ssize_t __pyx_t_17;
2830 Py_ssize_t __pyx_t_18;
2831 Py_ssize_t __pyx_t_19;
2832 int __pyx_t_20;
2833 PyObject *__pyx_t_21 = NULL;
2834 int __pyx_t_22;
2835 __pyx_t_5numpy_int64_t __pyx_t_23;
2836 __Pyx_RefNannySetupContext("read_art_tree", 0);
2837 __pyx_pybuffer_oct_indices.pybuffer.buf = NULL;
2838 __pyx_pybuffer_oct_indices.refcount = 0;
2839 __pyx_pybuffernd_oct_indices.data = NULL;
2840 __pyx_pybuffernd_oct_indices.rcbuffer = &__pyx_pybuffer_oct_indices;
2841 __pyx_pybuffer_oct_levels.pybuffer.buf = NULL;
2842 __pyx_pybuffer_oct_levels.refcount = 0;
2843 __pyx_pybuffernd_oct_levels.data = NULL;
2844 __pyx_pybuffernd_oct_levels.rcbuffer = &__pyx_pybuffer_oct_levels;
2845 __pyx_pybuffer_oct_info.pybuffer.buf = NULL;
2846 __pyx_pybuffer_oct_info.refcount = 0;
2847 __pyx_pybuffernd_oct_info.data = NULL;
2848 __pyx_pybuffernd_oct_info.rcbuffer = &__pyx_pybuffer_oct_info;
2849 {
2850 __Pyx_BufFmt_StackElem __pyx_stack[1];
2851 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_oct_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_oct_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 86, __pyx_L1_error)
2852 }
2853 __pyx_pybuffernd_oct_indices.diminfo[0].strides = __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_oct_indices.diminfo[0].shape = __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_oct_indices.diminfo[1].strides = __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_oct_indices.diminfo[1].shape = __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.shape[1];
2854 {
2855 __Pyx_BufFmt_StackElem __pyx_stack[1];
2856 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_oct_levels.rcbuffer->pybuffer, (PyObject*)__pyx_v_oct_levels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 86, __pyx_L1_error)
2857 }
2858 __pyx_pybuffernd_oct_levels.diminfo[0].strides = __pyx_pybuffernd_oct_levels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_oct_levels.diminfo[0].shape = __pyx_pybuffernd_oct_levels.rcbuffer->pybuffer.shape[0];
2859 {
2860 __Pyx_BufFmt_StackElem __pyx_stack[1];
2861 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_oct_info.rcbuffer->pybuffer, (PyObject*)__pyx_v_oct_info, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 86, __pyx_L1_error)
2862 }
2863 __pyx_pybuffernd_oct_info.diminfo[0].strides = __pyx_pybuffernd_oct_info.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_oct_info.diminfo[0].shape = __pyx_pybuffernd_oct_info.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_oct_info.diminfo[1].strides = __pyx_pybuffernd_oct_info.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_oct_info.diminfo[1].shape = __pyx_pybuffernd_oct_info.rcbuffer->pybuffer.shape[1];
2864
2865 /* "yt/utilities/lib/fortran_reader.pyx":98
2866 * # nOct. For those following along at home, we only need to read:
2867 * # iOctPr, iOctLv
2868 * cdef int nchild = 8 # <<<<<<<<<<<<<<
2869 * cdef int iOct, nLevel, ic1
2870 * cdef np.int64_t next_record = -1
2871 */
2872 __pyx_v_nchild = 8;
2873
2874 /* "yt/utilities/lib/fortran_reader.pyx":100
2875 * cdef int nchild = 8
2876 * cdef int iOct, nLevel, ic1
2877 * cdef np.int64_t next_record = -1 # <<<<<<<<<<<<<<
2878 * cdef long long child_record
2879 * cdef int iOctPs[3]
2880 */
2881 __pyx_v_next_record = -1LL;
2882
2883 /* "yt/utilities/lib/fortran_reader.pyx":104
2884 * cdef int iOctPs[3]
2885 * cdef np.int64_t dummy_records[9]
2886 * cdef int readin = -1 # <<<<<<<<<<<<<<
2887 * cdef FILE *f = fopen(fn, "rb")
2888 * fseek(f, offset, SEEK_SET)
2889 */
2890 __pyx_v_readin = -1;
2891
2892 /* "yt/utilities/lib/fortran_reader.pyx":105
2893 * cdef np.int64_t dummy_records[9]
2894 * cdef int readin = -1
2895 * cdef FILE *f = fopen(fn, "rb") # <<<<<<<<<<<<<<
2896 * fseek(f, offset, SEEK_SET)
2897 * cdef int Level = -1
2898 */
2899 __pyx_v_f = fopen(__pyx_v_fn, ((char const *)"rb"));
2900
2901 /* "yt/utilities/lib/fortran_reader.pyx":106
2902 * cdef int readin = -1
2903 * cdef FILE *f = fopen(fn, "rb")
2904 * fseek(f, offset, SEEK_SET) # <<<<<<<<<<<<<<
2905 * cdef int Level = -1
2906 * cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2907 */
2908 (void)(fseek(__pyx_v_f, __pyx_v_offset, SEEK_SET));
2909
2910 /* "yt/utilities/lib/fortran_reader.pyx":107
2911 * cdef FILE *f = fopen(fn, "rb")
2912 * fseek(f, offset, SEEK_SET)
2913 * cdef int Level = -1 # <<<<<<<<<<<<<<
2914 * cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2915 * cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2916 */
2917 __pyx_v_Level = -1;
2918
2919 /* "yt/utilities/lib/fortran_reader.pyx":108
2920 * fseek(f, offset, SEEK_SET)
2921 * cdef int Level = -1
2922 * cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1)) # <<<<<<<<<<<<<<
2923 * cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2924 * cdef int iOctMax = 0
2925 */
2926 __pyx_v_iNOLL = ((int *)alloca(((sizeof(int)) * ((__pyx_v_max_level - __pyx_v_min_level) + 1))));
2927
2928 /* "yt/utilities/lib/fortran_reader.pyx":109
2929 * cdef int Level = -1
2930 * cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2931 * cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1)) # <<<<<<<<<<<<<<
2932 * cdef int iOctMax = 0
2933 * level_offsets = [0]
2934 */
2935 __pyx_v_iHOLL = ((int *)alloca(((sizeof(int)) * ((__pyx_v_max_level - __pyx_v_min_level) + 1))));
2936
2937 /* "yt/utilities/lib/fortran_reader.pyx":110
2938 * cdef int * iNOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2939 * cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2940 * cdef int iOctMax = 0 # <<<<<<<<<<<<<<
2941 * level_offsets = [0]
2942 * for _ in range(min_level + 1, max_level + 1):
2943 */
2944 __pyx_v_iOctMax = 0;
2945
2946 /* "yt/utilities/lib/fortran_reader.pyx":111
2947 * cdef int * iHOLL = <int *> alloca(sizeof(int)*(max_level-min_level+1))
2948 * cdef int iOctMax = 0
2949 * level_offsets = [0] # <<<<<<<<<<<<<<
2950 * for _ in range(min_level + 1, max_level + 1):
2951 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2952 */
2953 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
2954 __Pyx_GOTREF(__pyx_t_1);
2955 __Pyx_INCREF(__pyx_int_0);
2956 __Pyx_GIVEREF(__pyx_int_0);
2957 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
2958 __pyx_v_level_offsets = ((PyObject*)__pyx_t_1);
2959 __pyx_t_1 = 0;
2960
2961 /* "yt/utilities/lib/fortran_reader.pyx":112
2962 * cdef int iOctMax = 0
2963 * level_offsets = [0]
2964 * for _ in range(min_level + 1, max_level + 1): # <<<<<<<<<<<<<<
2965 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2966 * fread(&Level, sizeof(int), 1, f); FIX_LONG(Level)
2967 */
2968 __pyx_t_2 = (__pyx_v_max_level + 1);
2969 __pyx_t_3 = __pyx_t_2;
2970 for (__pyx_t_4 = (__pyx_v_min_level + 1); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
2971 __pyx_v__ = __pyx_t_4;
2972
2973 /* "yt/utilities/lib/fortran_reader.pyx":113
2974 * level_offsets = [0]
2975 * for _ in range(min_level + 1, max_level + 1):
2976 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
2977 * fread(&Level, sizeof(int), 1, f); FIX_LONG(Level)
2978 * fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level])
2979 */
2980 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
2981 FIX_LONG(__pyx_v_readin);
2982
2983 /* "yt/utilities/lib/fortran_reader.pyx":114
2984 * for _ in range(min_level + 1, max_level + 1):
2985 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2986 * fread(&Level, sizeof(int), 1, f); FIX_LONG(Level) # <<<<<<<<<<<<<<
2987 * fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level])
2988 * fread(&iHOLL[Level], sizeof(int), 1, f); FIX_LONG(iHOLL[Level])
2989 */
2990 (void)(fread((&__pyx_v_Level), (sizeof(int)), 1, __pyx_v_f));
2991 FIX_LONG(__pyx_v_Level);
2992
2993 /* "yt/utilities/lib/fortran_reader.pyx":115
2994 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2995 * fread(&Level, sizeof(int), 1, f); FIX_LONG(Level)
2996 * fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level]) # <<<<<<<<<<<<<<
2997 * fread(&iHOLL[Level], sizeof(int), 1, f); FIX_LONG(iHOLL[Level])
2998 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
2999 */
3000 (void)(fread((&(__pyx_v_iNOLL[__pyx_v_Level])), (sizeof(int)), 1, __pyx_v_f));
3001 FIX_LONG((__pyx_v_iNOLL[__pyx_v_Level]));
3002
3003 /* "yt/utilities/lib/fortran_reader.pyx":116
3004 * fread(&Level, sizeof(int), 1, f); FIX_LONG(Level)
3005 * fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level])
3006 * fread(&iHOLL[Level], sizeof(int), 1, f); FIX_LONG(iHOLL[Level]) # <<<<<<<<<<<<<<
3007 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3008 * iOct = iHOLL[Level] - 1
3009 */
3010 (void)(fread((&(__pyx_v_iHOLL[__pyx_v_Level])), (sizeof(int)), 1, __pyx_v_f));
3011 FIX_LONG((__pyx_v_iHOLL[__pyx_v_Level]));
3012
3013 /* "yt/utilities/lib/fortran_reader.pyx":117
3014 * fread(&iNOLL[Level], sizeof(int), 1, f); FIX_LONG(iNOLL[Level])
3015 * fread(&iHOLL[Level], sizeof(int), 1, f); FIX_LONG(iHOLL[Level])
3016 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
3017 * iOct = iHOLL[Level] - 1
3018 * nLevel = iNOLL[Level]
3019 */
3020 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
3021 FIX_LONG(__pyx_v_readin);
3022
3023 /* "yt/utilities/lib/fortran_reader.pyx":118
3024 * fread(&iHOLL[Level], sizeof(int), 1, f); FIX_LONG(iHOLL[Level])
3025 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3026 * iOct = iHOLL[Level] - 1 # <<<<<<<<<<<<<<
3027 * nLevel = iNOLL[Level]
3028 * #print("Reading Hierarchy for Level", Lev, Level, nLevel, iOct)
3029 */
3030 __pyx_v_iOct = ((__pyx_v_iHOLL[__pyx_v_Level]) - 1);
3031
3032 /* "yt/utilities/lib/fortran_reader.pyx":119
3033 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3034 * iOct = iHOLL[Level] - 1
3035 * nLevel = iNOLL[Level] # <<<<<<<<<<<<<<
3036 * #print("Reading Hierarchy for Level", Lev, Level, nLevel, iOct)
3037 * #print(ftell(f))
3038 */
3039 __pyx_v_nLevel = (__pyx_v_iNOLL[__pyx_v_Level]);
3040
3041 /* "yt/utilities/lib/fortran_reader.pyx":122
3042 * #print("Reading Hierarchy for Level", Lev, Level, nLevel, iOct)
3043 * #print(ftell(f))
3044 * for ic1 in range(nLevel): # <<<<<<<<<<<<<<
3045 * iOctMax = max(iOctMax, iOct)
3046 * #print(readin, iOct, nLevel, sizeof(int))
3047 */
3048 __pyx_t_5 = __pyx_v_nLevel;
3049 __pyx_t_6 = __pyx_t_5;
3050 for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
3051 __pyx_v_ic1 = __pyx_t_7;
3052
3053 /* "yt/utilities/lib/fortran_reader.pyx":123
3054 * #print(ftell(f))
3055 * for ic1 in range(nLevel):
3056 * iOctMax = max(iOctMax, iOct) # <<<<<<<<<<<<<<
3057 * #print(readin, iOct, nLevel, sizeof(int))
3058 * next_record = ftell(f)
3059 */
3060 __pyx_t_8 = __pyx_v_iOct;
3061 __pyx_t_9 = __pyx_v_iOctMax;
3062 if (((__pyx_t_8 > __pyx_t_9) != 0)) {
3063 __pyx_t_10 = __pyx_t_8;
3064 } else {
3065 __pyx_t_10 = __pyx_t_9;
3066 }
3067 __pyx_v_iOctMax = __pyx_t_10;
3068
3069 /* "yt/utilities/lib/fortran_reader.pyx":125
3070 * iOctMax = max(iOctMax, iOct)
3071 * #print(readin, iOct, nLevel, sizeof(int))
3072 * next_record = ftell(f) # <<<<<<<<<<<<<<
3073 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3074 * assert readin==52
3075 */
3076 __pyx_v_next_record = ftell(__pyx_v_f);
3077
3078 /* "yt/utilities/lib/fortran_reader.pyx":126
3079 * #print(readin, iOct, nLevel, sizeof(int))
3080 * next_record = ftell(f)
3081 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
3082 * assert readin==52
3083 * next_record += readin + sizeof(int)
3084 */
3085 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
3086 FIX_LONG(__pyx_v_readin);
3087
3088 /* "yt/utilities/lib/fortran_reader.pyx":127
3089 * next_record = ftell(f)
3090 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3091 * assert readin==52 # <<<<<<<<<<<<<<
3092 * next_record += readin + sizeof(int)
3093 * fread(iOctPs, sizeof(int), 3, f)
3094 */
3095 #ifndef CYTHON_WITHOUT_ASSERTIONS
3096 if (unlikely(!Py_OptimizeFlag)) {
3097 if (unlikely(!((__pyx_v_readin == 52) != 0))) {
3098 PyErr_SetNone(PyExc_AssertionError);
3099 __PYX_ERR(0, 127, __pyx_L1_error)
3100 }
3101 }
3102 #endif
3103
3104 /* "yt/utilities/lib/fortran_reader.pyx":128
3105 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3106 * assert readin==52
3107 * next_record += readin + sizeof(int) # <<<<<<<<<<<<<<
3108 * fread(iOctPs, sizeof(int), 3, f)
3109 * FIX_LONG(iOctPs[0]); FIX_LONG(iOctPs[1]); FIX_LONG(iOctPs[2])
3110 */
3111 __pyx_v_next_record = (__pyx_v_next_record + (__pyx_v_readin + (sizeof(int))));
3112
3113 /* "yt/utilities/lib/fortran_reader.pyx":129
3114 * assert readin==52
3115 * next_record += readin + sizeof(int)
3116 * fread(iOctPs, sizeof(int), 3, f) # <<<<<<<<<<<<<<
3117 * FIX_LONG(iOctPs[0]); FIX_LONG(iOctPs[1]); FIX_LONG(iOctPs[2])
3118 * oct_indices[iOct, 0] = iOctPs[0]
3119 */
3120 (void)(fread(__pyx_v_iOctPs, (sizeof(int)), 3, __pyx_v_f));
3121
3122 /* "yt/utilities/lib/fortran_reader.pyx":130
3123 * next_record += readin + sizeof(int)
3124 * fread(iOctPs, sizeof(int), 3, f)
3125 * FIX_LONG(iOctPs[0]); FIX_LONG(iOctPs[1]); FIX_LONG(iOctPs[2]) # <<<<<<<<<<<<<<
3126 * oct_indices[iOct, 0] = iOctPs[0]
3127 * oct_indices[iOct, 1] = iOctPs[1]
3128 */
3129 FIX_LONG((__pyx_v_iOctPs[0]));
3130 FIX_LONG((__pyx_v_iOctPs[1]));
3131 FIX_LONG((__pyx_v_iOctPs[2]));
3132
3133 /* "yt/utilities/lib/fortran_reader.pyx":131
3134 * fread(iOctPs, sizeof(int), 3, f)
3135 * FIX_LONG(iOctPs[0]); FIX_LONG(iOctPs[1]); FIX_LONG(iOctPs[2])
3136 * oct_indices[iOct, 0] = iOctPs[0] # <<<<<<<<<<<<<<
3137 * oct_indices[iOct, 1] = iOctPs[1]
3138 * oct_indices[iOct, 2] = iOctPs[2]
3139 */
3140 __pyx_t_11 = __pyx_v_iOct;
3141 __pyx_t_12 = 0;
3142 __pyx_t_10 = -1;
3143 if (__pyx_t_11 < 0) {
3144 __pyx_t_11 += __pyx_pybuffernd_oct_indices.diminfo[0].shape;
3145 if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
3146 } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_oct_indices.diminfo[0].shape)) __pyx_t_10 = 0;
3147 if (__pyx_t_12 < 0) {
3148 __pyx_t_12 += __pyx_pybuffernd_oct_indices.diminfo[1].shape;
3149 if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
3150 } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_oct_indices.diminfo[1].shape)) __pyx_t_10 = 1;
3151 if (unlikely(__pyx_t_10 != -1)) {
3152 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3153 __PYX_ERR(0, 131, __pyx_L1_error)
3154 }
3155 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_oct_indices.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_oct_indices.diminfo[1].strides) = (__pyx_v_iOctPs[0]);
3156
3157 /* "yt/utilities/lib/fortran_reader.pyx":132
3158 * FIX_LONG(iOctPs[0]); FIX_LONG(iOctPs[1]); FIX_LONG(iOctPs[2])
3159 * oct_indices[iOct, 0] = iOctPs[0]
3160 * oct_indices[iOct, 1] = iOctPs[1] # <<<<<<<<<<<<<<
3161 * oct_indices[iOct, 2] = iOctPs[2]
3162 * oct_info[iOct, 1] = ic1
3163 */
3164 __pyx_t_13 = __pyx_v_iOct;
3165 __pyx_t_14 = 1;
3166 __pyx_t_10 = -1;
3167 if (__pyx_t_13 < 0) {
3168 __pyx_t_13 += __pyx_pybuffernd_oct_indices.diminfo[0].shape;
3169 if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0;
3170 } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_oct_indices.diminfo[0].shape)) __pyx_t_10 = 0;
3171 if (__pyx_t_14 < 0) {
3172 __pyx_t_14 += __pyx_pybuffernd_oct_indices.diminfo[1].shape;
3173 if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 1;
3174 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_oct_indices.diminfo[1].shape)) __pyx_t_10 = 1;
3175 if (unlikely(__pyx_t_10 != -1)) {
3176 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3177 __PYX_ERR(0, 132, __pyx_L1_error)
3178 }
3179 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_oct_indices.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_oct_indices.diminfo[1].strides) = (__pyx_v_iOctPs[1]);
3180
3181 /* "yt/utilities/lib/fortran_reader.pyx":133
3182 * oct_indices[iOct, 0] = iOctPs[0]
3183 * oct_indices[iOct, 1] = iOctPs[1]
3184 * oct_indices[iOct, 2] = iOctPs[2] # <<<<<<<<<<<<<<
3185 * oct_info[iOct, 1] = ic1
3186 * #grid_info[iOct, 2] = iOctPr # we don't seem to need this
3187 */
3188 __pyx_t_15 = __pyx_v_iOct;
3189 __pyx_t_16 = 2;
3190 __pyx_t_10 = -1;
3191 if (__pyx_t_15 < 0) {
3192 __pyx_t_15 += __pyx_pybuffernd_oct_indices.diminfo[0].shape;
3193 if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 0;
3194 } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_oct_indices.diminfo[0].shape)) __pyx_t_10 = 0;
3195 if (__pyx_t_16 < 0) {
3196 __pyx_t_16 += __pyx_pybuffernd_oct_indices.diminfo[1].shape;
3197 if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 1;
3198 } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_oct_indices.diminfo[1].shape)) __pyx_t_10 = 1;
3199 if (unlikely(__pyx_t_10 != -1)) {
3200 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3201 __PYX_ERR(0, 133, __pyx_L1_error)
3202 }
3203 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_oct_indices.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_oct_indices.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_oct_indices.diminfo[1].strides) = (__pyx_v_iOctPs[2]);
3204
3205 /* "yt/utilities/lib/fortran_reader.pyx":134
3206 * oct_indices[iOct, 1] = iOctPs[1]
3207 * oct_indices[iOct, 2] = iOctPs[2]
3208 * oct_info[iOct, 1] = ic1 # <<<<<<<<<<<<<<
3209 * #grid_info[iOct, 2] = iOctPr # we don't seem to need this
3210 * fread(dummy_records, sizeof(int), 6, f) # skip Nb
3211 */
3212 __pyx_t_17 = __pyx_v_iOct;
3213 __pyx_t_18 = 1;
3214 __pyx_t_10 = -1;
3215 if (__pyx_t_17 < 0) {
3216 __pyx_t_17 += __pyx_pybuffernd_oct_info.diminfo[0].shape;
3217 if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
3218 } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_oct_info.diminfo[0].shape)) __pyx_t_10 = 0;
3219 if (__pyx_t_18 < 0) {
3220 __pyx_t_18 += __pyx_pybuffernd_oct_info.diminfo[1].shape;
3221 if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
3222 } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_oct_info.diminfo[1].shape)) __pyx_t_10 = 1;
3223 if (unlikely(__pyx_t_10 != -1)) {
3224 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3225 __PYX_ERR(0, 134, __pyx_L1_error)
3226 }
3227 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_oct_info.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_oct_info.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_oct_info.diminfo[1].strides) = __pyx_v_ic1;
3228
3229 /* "yt/utilities/lib/fortran_reader.pyx":136
3230 * oct_info[iOct, 1] = ic1
3231 * #grid_info[iOct, 2] = iOctPr # we don't seem to need this
3232 * fread(dummy_records, sizeof(int), 6, f) # skip Nb # <<<<<<<<<<<<<<
3233 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3234 * #oct_parents[iOct] = readin - 1
3235 */
3236 (void)(fread(__pyx_v_dummy_records, (sizeof(int)), 6, __pyx_v_f));
3237
3238 /* "yt/utilities/lib/fortran_reader.pyx":137
3239 * #grid_info[iOct, 2] = iOctPr # we don't seem to need this
3240 * fread(dummy_records, sizeof(int), 6, f) # skip Nb
3241 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
3242 * #oct_parents[iOct] = readin - 1
3243 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3244 */
3245 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
3246 FIX_LONG(__pyx_v_readin);
3247
3248 /* "yt/utilities/lib/fortran_reader.pyx":139
3249 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3250 * #oct_parents[iOct] = readin - 1
3251 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
3252 * oct_levels[iOct] = readin
3253 * fread(&iOct, sizeof(int), 1, f); FIX_LONG(iOct);
3254 */
3255 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
3256 FIX_LONG(__pyx_v_readin);
3257
3258 /* "yt/utilities/lib/fortran_reader.pyx":140
3259 * #oct_parents[iOct] = readin - 1
3260 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3261 * oct_levels[iOct] = readin # <<<<<<<<<<<<<<
3262 * fread(&iOct, sizeof(int), 1, f); FIX_LONG(iOct);
3263 * iOct -= 1
3264 */
3265 __pyx_t_19 = __pyx_v_iOct;
3266 __pyx_t_10 = -1;
3267 if (__pyx_t_19 < 0) {
3268 __pyx_t_19 += __pyx_pybuffernd_oct_levels.diminfo[0].shape;
3269 if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
3270 } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_oct_levels.diminfo[0].shape)) __pyx_t_10 = 0;
3271 if (unlikely(__pyx_t_10 != -1)) {
3272 __Pyx_RaiseBufferIndexError(__pyx_t_10);
3273 __PYX_ERR(0, 140, __pyx_L1_error)
3274 }
3275 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_oct_levels.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_oct_levels.diminfo[0].strides) = __pyx_v_readin;
3276
3277 /* "yt/utilities/lib/fortran_reader.pyx":141
3278 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3279 * oct_levels[iOct] = readin
3280 * fread(&iOct, sizeof(int), 1, f); FIX_LONG(iOct); # <<<<<<<<<<<<<<
3281 * iOct -= 1
3282 * assert next_record > 0
3283 */
3284 (void)(fread((&__pyx_v_iOct), (sizeof(int)), 1, __pyx_v_f));
3285 FIX_LONG(__pyx_v_iOct);
3286
3287 /* "yt/utilities/lib/fortran_reader.pyx":142
3288 * oct_levels[iOct] = readin
3289 * fread(&iOct, sizeof(int), 1, f); FIX_LONG(iOct);
3290 * iOct -= 1 # <<<<<<<<<<<<<<
3291 * assert next_record > 0
3292 * fseek(f, next_record, SEEK_SET)
3293 */
3294 __pyx_v_iOct = (__pyx_v_iOct - 1);
3295
3296 /* "yt/utilities/lib/fortran_reader.pyx":143
3297 * fread(&iOct, sizeof(int), 1, f); FIX_LONG(iOct);
3298 * iOct -= 1
3299 * assert next_record > 0 # <<<<<<<<<<<<<<
3300 * fseek(f, next_record, SEEK_SET)
3301 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3302 */
3303 #ifndef CYTHON_WITHOUT_ASSERTIONS
3304 if (unlikely(!Py_OptimizeFlag)) {
3305 if (unlikely(!((__pyx_v_next_record > 0) != 0))) {
3306 PyErr_SetNone(PyExc_AssertionError);
3307 __PYX_ERR(0, 143, __pyx_L1_error)
3308 }
3309 }
3310 #endif
3311
3312 /* "yt/utilities/lib/fortran_reader.pyx":144
3313 * iOct -= 1
3314 * assert next_record > 0
3315 * fseek(f, next_record, SEEK_SET) # <<<<<<<<<<<<<<
3316 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3317 * assert readin==52
3318 */
3319 (void)(fseek(__pyx_v_f, __pyx_v_next_record, SEEK_SET));
3320
3321 /* "yt/utilities/lib/fortran_reader.pyx":145
3322 * assert next_record > 0
3323 * fseek(f, next_record, SEEK_SET)
3324 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin) # <<<<<<<<<<<<<<
3325 * assert readin==52
3326 *
3327 */
3328 (void)(fread((&__pyx_v_readin), (sizeof(int)), 1, __pyx_v_f));
3329 FIX_LONG(__pyx_v_readin);
3330
3331 /* "yt/utilities/lib/fortran_reader.pyx":146
3332 * fseek(f, next_record, SEEK_SET)
3333 * fread(&readin, sizeof(int), 1, f); FIX_LONG(readin)
3334 * assert readin==52 # <<<<<<<<<<<<<<
3335 *
3336 * level_offsets.append(ftell(f))
3337 */
3338 #ifndef CYTHON_WITHOUT_ASSERTIONS
3339 if (unlikely(!Py_OptimizeFlag)) {
3340 if (unlikely(!((__pyx_v_readin == 52) != 0))) {
3341 PyErr_SetNone(PyExc_AssertionError);
3342 __PYX_ERR(0, 146, __pyx_L1_error)
3343 }
3344 }
3345 #endif
3346 }
3347
3348 /* "yt/utilities/lib/fortran_reader.pyx":148
3349 * assert readin==52
3350 *
3351 * level_offsets.append(ftell(f)) # <<<<<<<<<<<<<<
3352 *
3353 * #skip over the hydro variables
3354 */
3355 __pyx_t_1 = __Pyx_PyInt_From_long(ftell(__pyx_v_f)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
3356 __Pyx_GOTREF(__pyx_t_1);
3357 __pyx_t_20 = __Pyx_PyList_Append(__pyx_v_level_offsets, __pyx_t_1); if (unlikely(__pyx_t_20 == ((int)-1))) __PYX_ERR(0, 148, __pyx_L1_error)
3358 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3359
3360 /* "yt/utilities/lib/fortran_reader.pyx":153
3361 * #find the length of one child section
3362 * #print('measuring child record ',)
3363 * fread(&next_record, sizeof(int), 1, f); # <<<<<<<<<<<<<<
3364 * #print(next_record,)
3365 * FIX_LONG(next_record)
3366 */
3367 (void)(fread((&__pyx_v_next_record), (sizeof(int)), 1, __pyx_v_f));
3368
3369 /* "yt/utilities/lib/fortran_reader.pyx":155
3370 * fread(&next_record, sizeof(int), 1, f);
3371 * #print(next_record,)
3372 * FIX_LONG(next_record) # <<<<<<<<<<<<<<
3373 * #print(next_record)
3374 * fseek(f,ftell(f)-sizeof(int),SEEK_SET) #rewind
3375 */
3376 FIX_LONG(__pyx_v_next_record);
3377
3378 /* "yt/utilities/lib/fortran_reader.pyx":157
3379 * FIX_LONG(next_record)
3380 * #print(next_record)
3381 * fseek(f,ftell(f)-sizeof(int),SEEK_SET) #rewind # <<<<<<<<<<<<<<
3382 * #This is a sloppy fix; next_record is 64bit
3383 * #and I don't think FIX_LONG(next_record) is working
3384 */
3385 (void)(fseek(__pyx_v_f, (ftell(__pyx_v_f) - (sizeof(int))), SEEK_SET));
3386
3387 /* "yt/utilities/lib/fortran_reader.pyx":161
3388 * #and I don't think FIX_LONG(next_record) is working
3389 * #correctly for 64bits
3390 * if next_record > 4294967296L: # <<<<<<<<<<<<<<
3391 * next_record -= 4294967296L
3392 * assert next_record == 56
3393 */
3394 __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_next_record); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
3395 __Pyx_GOTREF(__pyx_t_1);
3396 __pyx_t_21 = PyObject_RichCompare(__pyx_t_1, __pyx_int_4294967296L, Py_GT); __Pyx_XGOTREF(__pyx_t_21); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 161, __pyx_L1_error)
3397 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3398 __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 161, __pyx_L1_error)
3399 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3400 if (__pyx_t_22) {
3401
3402 /* "yt/utilities/lib/fortran_reader.pyx":162
3403 * #correctly for 64bits
3404 * if next_record > 4294967296L:
3405 * next_record -= 4294967296L # <<<<<<<<<<<<<<
3406 * assert next_record == 56
3407 *
3408 */
3409 __pyx_t_21 = __Pyx_PyInt_From_npy_int64(__pyx_v_next_record); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 162, __pyx_L1_error)
3410 __Pyx_GOTREF(__pyx_t_21);
3411 __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_21, __pyx_int_4294967296L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
3412 __Pyx_GOTREF(__pyx_t_1);
3413 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
3414 __pyx_t_23 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_23 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 162, __pyx_L1_error)
3415 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3416 __pyx_v_next_record = __pyx_t_23;
3417
3418 /* "yt/utilities/lib/fortran_reader.pyx":161
3419 * #and I don't think FIX_LONG(next_record) is working
3420 * #correctly for 64bits
3421 * if next_record > 4294967296L: # <<<<<<<<<<<<<<
3422 * next_record -= 4294967296L
3423 * assert next_record == 56
3424 */
3425 }
3426
3427 /* "yt/utilities/lib/fortran_reader.pyx":163
3428 * if next_record > 4294967296L:
3429 * next_record -= 4294967296L
3430 * assert next_record == 56 # <<<<<<<<<<<<<<
3431 *
3432 * #find the length of all of the children section
3433 */
3434 #ifndef CYTHON_WITHOUT_ASSERTIONS
3435 if (unlikely(!Py_OptimizeFlag)) {
3436 if (unlikely(!((__pyx_v_next_record == 56) != 0))) {
3437 PyErr_SetNone(PyExc_AssertionError);
3438 __PYX_ERR(0, 163, __pyx_L1_error)
3439 }
3440 }
3441 #endif
3442
3443 /* "yt/utilities/lib/fortran_reader.pyx":166
3444 *
3445 * #find the length of all of the children section
3446 * child_record = ftell(f) + (next_record+2*sizeof(int))*nLevel*nchild # <<<<<<<<<<<<<<
3447 * #print('Skipping over hydro vars', ftell(f), child_record)
3448 * fseek(f, child_record, SEEK_SET)
3449 */
3450 __pyx_v_child_record = (ftell(__pyx_v_f) + (((__pyx_v_next_record + (2 * (sizeof(int)))) * __pyx_v_nLevel) * __pyx_v_nchild));
3451
3452 /* "yt/utilities/lib/fortran_reader.pyx":168
3453 * child_record = ftell(f) + (next_record+2*sizeof(int))*nLevel*nchild
3454 * #print('Skipping over hydro vars', ftell(f), child_record)
3455 * fseek(f, child_record, SEEK_SET) # <<<<<<<<<<<<<<
3456 *
3457 * # for ic1 in range(nLevel * nchild):
3458 */
3459 (void)(fseek(__pyx_v_f, __pyx_v_child_record, SEEK_SET));
3460 }
3461
3462 /* "yt/utilities/lib/fortran_reader.pyx":178
3463 * # assert next_record > 0
3464 * # fseek(f, next_record - sizeof(int), SEEK_CUR)
3465 * fclose(f) # <<<<<<<<<<<<<<
3466 * return level_offsets
3467 *
3468 */
3469 (void)(fclose(__pyx_v_f));
3470
3471 /* "yt/utilities/lib/fortran_reader.pyx":179
3472 * # fseek(f, next_record - sizeof(int), SEEK_CUR)
3473 * fclose(f)
3474 * return level_offsets # <<<<<<<<<<<<<<
3475 *
3476 * def read_art_root_vars(char *fn, long root_grid_offset,
3477 */
3478 __Pyx_XDECREF(__pyx_r);
3479 __Pyx_INCREF(__pyx_v_level_offsets);
3480 __pyx_r = __pyx_v_level_offsets;
3481 goto __pyx_L0;
3482
3483 /* "yt/utilities/lib/fortran_reader.pyx":86
3484 * fclose(f)
3485 *
3486 * def read_art_tree(char *fn, long offset, # <<<<<<<<<<<<<<
3487 * int min_level, int max_level,
3488 * np.ndarray[np.int64_t, ndim=2] oct_indices,
3489 */
3490
3491 /* function exit code */
3492 __pyx_L1_error:;
3493 __Pyx_XDECREF(__pyx_t_1);
3494 __Pyx_XDECREF(__pyx_t_21);
3495 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3496 __Pyx_PyThreadState_declare
3497 __Pyx_PyThreadState_assign
3498 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3499 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_oct_indices.rcbuffer->pybuffer);
3500 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_oct_info.rcbuffer->pybuffer);
3501 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_oct_levels.rcbuffer->pybuffer);
3502 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3503 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_art_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
3504 __pyx_r = NULL;
3505 goto __pyx_L2;
3506 __pyx_L0:;
3507 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_oct_indices.rcbuffer->pybuffer);
3508 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_oct_info.rcbuffer->pybuffer);
3509 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_oct_levels.rcbuffer->pybuffer);
3510 __pyx_L2:;
3511 __Pyx_XDECREF(__pyx_v_level_offsets);
3512 __Pyx_XGIVEREF(__pyx_r);
3513 __Pyx_RefNannyFinishContext();
3514 return __pyx_r;
3515 }
3516
3517 /* "yt/utilities/lib/fortran_reader.pyx":181
3518 * return level_offsets
3519 *
3520 * def read_art_root_vars(char *fn, long root_grid_offset, # <<<<<<<<<<<<<<
3521 * int nhydro_vars, int nx, int ny, int nz,
3522 * int ix, int iy, int iz, fields, var):
3523 */
3524
3525 /* Python wrapper */
3526 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_7read_art_root_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3527 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14fortran_reader_7read_art_root_vars = {"read_art_root_vars", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14fortran_reader_7read_art_root_vars, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14fortran_reader_7read_art_root_vars(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3528 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_7read_art_root_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3529 char *__pyx_v_fn;
3530 long __pyx_v_root_grid_offset;
3531 int __pyx_v_nhydro_vars;
3532 int __pyx_v_nx;
3533 int __pyx_v_ny;
3534 CYTHON_UNUSED int __pyx_v_nz;
3535 int __pyx_v_ix;
3536 int __pyx_v_iy;
3537 int __pyx_v_iz;
3538 PyObject *__pyx_v_fields = 0;
3539 PyObject *__pyx_v_var = 0;
3540 PyObject *__pyx_r = 0;
3541 __Pyx_RefNannyDeclarations
3542 __Pyx_RefNannySetupContext("read_art_root_vars (wrapper)", 0);
3543 {
3544 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fn,&__pyx_n_s_root_grid_offset,&__pyx_n_s_nhydro_vars,&__pyx_n_s_nx,&__pyx_n_s_ny,&__pyx_n_s_nz,&__pyx_n_s_ix,&__pyx_n_s_iy,&__pyx_n_s_iz,&__pyx_n_s_fields,&__pyx_n_s_var,0};
3545 PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
3546 if (unlikely(__pyx_kwds)) {
3547 Py_ssize_t kw_args;
3548 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3549 switch (pos_args) {
3550 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3551 CYTHON_FALLTHROUGH;
3552 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3553 CYTHON_FALLTHROUGH;
3554 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3555 CYTHON_FALLTHROUGH;
3556 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3557 CYTHON_FALLTHROUGH;
3558 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3559 CYTHON_FALLTHROUGH;
3560 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3561 CYTHON_FALLTHROUGH;
3562 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3563 CYTHON_FALLTHROUGH;
3564 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3565 CYTHON_FALLTHROUGH;
3566 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3567 CYTHON_FALLTHROUGH;
3568 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3569 CYTHON_FALLTHROUGH;
3570 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3571 CYTHON_FALLTHROUGH;
3572 case 0: break;
3573 default: goto __pyx_L5_argtuple_error;
3574 }
3575 kw_args = PyDict_Size(__pyx_kwds);
3576 switch (pos_args) {
3577 case 0:
3578 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
3579 else goto __pyx_L5_argtuple_error;
3580 CYTHON_FALLTHROUGH;
3581 case 1:
3582 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_root_grid_offset)) != 0)) kw_args--;
3583 else {
3584 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 1); __PYX_ERR(0, 181, __pyx_L3_error)
3585 }
3586 CYTHON_FALLTHROUGH;
3587 case 2:
3588 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nhydro_vars)) != 0)) kw_args--;
3589 else {
3590 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 2); __PYX_ERR(0, 181, __pyx_L3_error)
3591 }
3592 CYTHON_FALLTHROUGH;
3593 case 3:
3594 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nx)) != 0)) kw_args--;
3595 else {
3596 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 3); __PYX_ERR(0, 181, __pyx_L3_error)
3597 }
3598 CYTHON_FALLTHROUGH;
3599 case 4:
3600 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ny)) != 0)) kw_args--;
3601 else {
3602 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 4); __PYX_ERR(0, 181, __pyx_L3_error)
3603 }
3604 CYTHON_FALLTHROUGH;
3605 case 5:
3606 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nz)) != 0)) kw_args--;
3607 else {
3608 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 5); __PYX_ERR(0, 181, __pyx_L3_error)
3609 }
3610 CYTHON_FALLTHROUGH;
3611 case 6:
3612 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ix)) != 0)) kw_args--;
3613 else {
3614 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 6); __PYX_ERR(0, 181, __pyx_L3_error)
3615 }
3616 CYTHON_FALLTHROUGH;
3617 case 7:
3618 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iy)) != 0)) kw_args--;
3619 else {
3620 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 7); __PYX_ERR(0, 181, __pyx_L3_error)
3621 }
3622 CYTHON_FALLTHROUGH;
3623 case 8:
3624 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iz)) != 0)) kw_args--;
3625 else {
3626 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 8); __PYX_ERR(0, 181, __pyx_L3_error)
3627 }
3628 CYTHON_FALLTHROUGH;
3629 case 9:
3630 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fields)) != 0)) kw_args--;
3631 else {
3632 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 9); __PYX_ERR(0, 181, __pyx_L3_error)
3633 }
3634 CYTHON_FALLTHROUGH;
3635 case 10:
3636 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_var)) != 0)) kw_args--;
3637 else {
3638 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, 10); __PYX_ERR(0, 181, __pyx_L3_error)
3639 }
3640 }
3641 if (unlikely(kw_args > 0)) {
3642 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_art_root_vars") < 0)) __PYX_ERR(0, 181, __pyx_L3_error)
3643 }
3644 } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
3645 goto __pyx_L5_argtuple_error;
3646 } else {
3647 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3648 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3649 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3650 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3651 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3652 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3653 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3654 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3655 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3656 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3657 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3658 }
3659 __pyx_v_fn = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_fn) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L3_error)
3660 __pyx_v_root_grid_offset = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_root_grid_offset == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L3_error)
3661 __pyx_v_nhydro_vars = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nhydro_vars == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error)
3662 __pyx_v_nx = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nx == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error)
3663 __pyx_v_ny = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_ny == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error)
3664 __pyx_v_nz = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nz == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error)
3665 __pyx_v_ix = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_ix == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
3666 __pyx_v_iy = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_iy == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
3667 __pyx_v_iz = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_iz == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
3668 __pyx_v_fields = values[9];
3669 __pyx_v_var = values[10];
3670 }
3671 goto __pyx_L4_argument_unpacking_done;
3672 __pyx_L5_argtuple_error:;
3673 __Pyx_RaiseArgtupleInvalid("read_art_root_vars", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 181, __pyx_L3_error)
3674 __pyx_L3_error:;
3675 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_art_root_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
3676 __Pyx_RefNannyFinishContext();
3677 return NULL;
3678 __pyx_L4_argument_unpacking_done:;
3679 __pyx_r = __pyx_pf_2yt_9utilities_3lib_14fortran_reader_6read_art_root_vars(__pyx_self, __pyx_v_fn, __pyx_v_root_grid_offset, __pyx_v_nhydro_vars, __pyx_v_nx, __pyx_v_ny, __pyx_v_nz, __pyx_v_ix, __pyx_v_iy, __pyx_v_iz, __pyx_v_fields, __pyx_v_var);
3680
3681 /* function exit code */
3682 __Pyx_RefNannyFinishContext();
3683 return __pyx_r;
3684 }
3685
__pyx_pf_2yt_9utilities_3lib_14fortran_reader_6read_art_root_vars(CYTHON_UNUSED PyObject * __pyx_self,char * __pyx_v_fn,long __pyx_v_root_grid_offset,int __pyx_v_nhydro_vars,int __pyx_v_nx,int __pyx_v_ny,CYTHON_UNUSED int __pyx_v_nz,int __pyx_v_ix,int __pyx_v_iy,int __pyx_v_iz,PyObject * __pyx_v_fields,PyObject * __pyx_v_var)3686 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_6read_art_root_vars(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_fn, long __pyx_v_root_grid_offset, int __pyx_v_nhydro_vars, int __pyx_v_nx, int __pyx_v_ny, CYTHON_UNUSED int __pyx_v_nz, int __pyx_v_ix, int __pyx_v_iy, int __pyx_v_iz, PyObject *__pyx_v_fields, PyObject *__pyx_v_var) {
3687 FILE *__pyx_v_f;
3688 int __pyx_v_j;
3689 int __pyx_v_l;
3690 int __pyx_v_cell_record_size;
3691 float __pyx_v_temp;
3692 int __pyx_v_my_offset;
3693 PyObject *__pyx_r = NULL;
3694 __Pyx_RefNannyDeclarations
3695 int __pyx_t_1;
3696 int __pyx_t_2;
3697 int __pyx_t_3;
3698 PyObject *__pyx_t_4 = NULL;
3699 int __pyx_t_5;
3700 int __pyx_t_6;
3701 __Pyx_RefNannySetupContext("read_art_root_vars", 0);
3702
3703 /* "yt/utilities/lib/fortran_reader.pyx":185
3704 * int ix, int iy, int iz, fields, var):
3705 *
3706 * cdef FILE *f = fopen(fn, "rb") # <<<<<<<<<<<<<<
3707 * cdef int j,l, cell_record_size = nhydro_vars * sizeof(float)
3708 * cdef float temp = -1
3709 */
3710 __pyx_v_f = fopen(__pyx_v_fn, ((char const *)"rb"));
3711
3712 /* "yt/utilities/lib/fortran_reader.pyx":186
3713 *
3714 * cdef FILE *f = fopen(fn, "rb")
3715 * cdef int j,l, cell_record_size = nhydro_vars * sizeof(float) # <<<<<<<<<<<<<<
3716 * cdef float temp = -1
3717 * l=0
3718 */
3719 __pyx_v_cell_record_size = (__pyx_v_nhydro_vars * (sizeof(float)));
3720
3721 /* "yt/utilities/lib/fortran_reader.pyx":187
3722 * cdef FILE *f = fopen(fn, "rb")
3723 * cdef int j,l, cell_record_size = nhydro_vars * sizeof(float)
3724 * cdef float temp = -1 # <<<<<<<<<<<<<<
3725 * l=0
3726 * fseek(f, root_grid_offset, SEEK_SET)
3727 */
3728 __pyx_v_temp = -1.0;
3729
3730 /* "yt/utilities/lib/fortran_reader.pyx":188
3731 * cdef int j,l, cell_record_size = nhydro_vars * sizeof(float)
3732 * cdef float temp = -1
3733 * l=0 # <<<<<<<<<<<<<<
3734 * fseek(f, root_grid_offset, SEEK_SET)
3735 * # Now we seet out the cell we want
3736 */
3737 __pyx_v_l = 0;
3738
3739 /* "yt/utilities/lib/fortran_reader.pyx":189
3740 * cdef float temp = -1
3741 * l=0
3742 * fseek(f, root_grid_offset, SEEK_SET) # <<<<<<<<<<<<<<
3743 * # Now we seet out the cell we want
3744 * cdef int my_offset = (((iz * ny) + iy) * nx + ix)
3745 */
3746 (void)(fseek(__pyx_v_f, __pyx_v_root_grid_offset, SEEK_SET));
3747
3748 /* "yt/utilities/lib/fortran_reader.pyx":191
3749 * fseek(f, root_grid_offset, SEEK_SET)
3750 * # Now we seet out the cell we want
3751 * cdef int my_offset = (((iz * ny) + iy) * nx + ix) # <<<<<<<<<<<<<<
3752 * #print(cell_record_size, my_offset, ftell(f))
3753 * fseek(f, cell_record_size * my_offset, SEEK_CUR)
3754 */
3755 __pyx_v_my_offset = ((((__pyx_v_iz * __pyx_v_ny) + __pyx_v_iy) * __pyx_v_nx) + __pyx_v_ix);
3756
3757 /* "yt/utilities/lib/fortran_reader.pyx":193
3758 * cdef int my_offset = (((iz * ny) + iy) * nx + ix)
3759 * #print(cell_record_size, my_offset, ftell(f))
3760 * fseek(f, cell_record_size * my_offset, SEEK_CUR) # <<<<<<<<<<<<<<
3761 * #(((C)*GridDimension[1]+(B))*GridDimension[0]+A)
3762 * for j in range(nhydro_vars):
3763 */
3764 (void)(fseek(__pyx_v_f, (__pyx_v_cell_record_size * __pyx_v_my_offset), SEEK_CUR));
3765
3766 /* "yt/utilities/lib/fortran_reader.pyx":195
3767 * fseek(f, cell_record_size * my_offset, SEEK_CUR)
3768 * #(((C)*GridDimension[1]+(B))*GridDimension[0]+A)
3769 * for j in range(nhydro_vars): # <<<<<<<<<<<<<<
3770 * fread(&temp, sizeof(float), 1, f);
3771 * if j in fields:
3772 */
3773 __pyx_t_1 = __pyx_v_nhydro_vars;
3774 __pyx_t_2 = __pyx_t_1;
3775 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3776 __pyx_v_j = __pyx_t_3;
3777
3778 /* "yt/utilities/lib/fortran_reader.pyx":196
3779 * #(((C)*GridDimension[1]+(B))*GridDimension[0]+A)
3780 * for j in range(nhydro_vars):
3781 * fread(&temp, sizeof(float), 1, f); # <<<<<<<<<<<<<<
3782 * if j in fields:
3783 * FIX_FLOAT(temp)
3784 */
3785 (void)(fread((&__pyx_v_temp), (sizeof(float)), 1, __pyx_v_f));
3786
3787 /* "yt/utilities/lib/fortran_reader.pyx":197
3788 * for j in range(nhydro_vars):
3789 * fread(&temp, sizeof(float), 1, f);
3790 * if j in fields: # <<<<<<<<<<<<<<
3791 * FIX_FLOAT(temp)
3792 * var[l]=temp
3793 */
3794 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error)
3795 __Pyx_GOTREF(__pyx_t_4);
3796 __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_4, __pyx_v_fields, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 197, __pyx_L1_error)
3797 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3798 __pyx_t_6 = (__pyx_t_5 != 0);
3799 if (__pyx_t_6) {
3800
3801 /* "yt/utilities/lib/fortran_reader.pyx":198
3802 * fread(&temp, sizeof(float), 1, f);
3803 * if j in fields:
3804 * FIX_FLOAT(temp) # <<<<<<<<<<<<<<
3805 * var[l]=temp
3806 * l+=1
3807 */
3808 FIX_FLOAT(__pyx_v_temp);
3809
3810 /* "yt/utilities/lib/fortran_reader.pyx":199
3811 * if j in fields:
3812 * FIX_FLOAT(temp)
3813 * var[l]=temp # <<<<<<<<<<<<<<
3814 * l+=1
3815 * fclose(f)
3816 */
3817 __pyx_t_4 = PyFloat_FromDouble(__pyx_v_temp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
3818 __Pyx_GOTREF(__pyx_t_4);
3819 if (unlikely(__Pyx_SetItemInt(__pyx_v_var, __pyx_v_l, __pyx_t_4, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
3820 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3821
3822 /* "yt/utilities/lib/fortran_reader.pyx":200
3823 * FIX_FLOAT(temp)
3824 * var[l]=temp
3825 * l+=1 # <<<<<<<<<<<<<<
3826 * fclose(f)
3827 *
3828 */
3829 __pyx_v_l = (__pyx_v_l + 1);
3830
3831 /* "yt/utilities/lib/fortran_reader.pyx":197
3832 * for j in range(nhydro_vars):
3833 * fread(&temp, sizeof(float), 1, f);
3834 * if j in fields: # <<<<<<<<<<<<<<
3835 * FIX_FLOAT(temp)
3836 * var[l]=temp
3837 */
3838 }
3839 }
3840
3841 /* "yt/utilities/lib/fortran_reader.pyx":201
3842 * var[l]=temp
3843 * l+=1
3844 * fclose(f) # <<<<<<<<<<<<<<
3845 *
3846 * cdef void read_art_vars(FILE *f,
3847 */
3848 (void)(fclose(__pyx_v_f));
3849
3850 /* "yt/utilities/lib/fortran_reader.pyx":181
3851 * return level_offsets
3852 *
3853 * def read_art_root_vars(char *fn, long root_grid_offset, # <<<<<<<<<<<<<<
3854 * int nhydro_vars, int nx, int ny, int nz,
3855 * int ix, int iy, int iz, fields, var):
3856 */
3857
3858 /* function exit code */
3859 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3860 goto __pyx_L0;
3861 __pyx_L1_error:;
3862 __Pyx_XDECREF(__pyx_t_4);
3863 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_art_root_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
3864 __pyx_r = NULL;
3865 __pyx_L0:;
3866 __Pyx_XGIVEREF(__pyx_r);
3867 __Pyx_RefNannyFinishContext();
3868 return __pyx_r;
3869 }
3870
3871 /* "yt/utilities/lib/fortran_reader.pyx":203
3872 * fclose(f)
3873 *
3874 * cdef void read_art_vars(FILE *f, # <<<<<<<<<<<<<<
3875 * int min_level, int max_level, int nhydro_vars,
3876 * int grid_level,long grid_id,long child_offset,
3877 */
3878
__pyx_f_2yt_9utilities_3lib_14fortran_reader_read_art_vars(FILE * __pyx_v_f,CYTHON_UNUSED int __pyx_v_min_level,CYTHON_UNUSED int __pyx_v_max_level,int __pyx_v_nhydro_vars,int __pyx_v_grid_level,long __pyx_v_grid_id,CYTHON_UNUSED long __pyx_v_child_offset,PyObject * __pyx_v_fields,PyArrayObject * __pyx_v_level_offsets,PyObject * __pyx_v_var)3879 static void __pyx_f_2yt_9utilities_3lib_14fortran_reader_read_art_vars(FILE *__pyx_v_f, CYTHON_UNUSED int __pyx_v_min_level, CYTHON_UNUSED int __pyx_v_max_level, int __pyx_v_nhydro_vars, int __pyx_v_grid_level, long __pyx_v_grid_id, CYTHON_UNUSED long __pyx_v_child_offset, PyObject *__pyx_v_fields, PyArrayObject *__pyx_v_level_offsets, PyObject *__pyx_v_var) {
3880 int __pyx_v_record_size;
3881 float __pyx_v_temp;
3882 float __pyx_v_varpad[2];
3883 int __pyx_v_new_padding;
3884 int __pyx_v_padding[3];
3885 long __pyx_v_offset;
3886 long __pyx_v_j;
3887 PyObject *__pyx_v_l = NULL;
3888 int __pyx_v_k;
3889 __Pyx_LocalBuf_ND __pyx_pybuffernd_level_offsets;
3890 __Pyx_Buffer __pyx_pybuffer_level_offsets;
3891 __Pyx_RefNannyDeclarations
3892 Py_ssize_t __pyx_t_1;
3893 int __pyx_t_2;
3894 long __pyx_t_3;
3895 int __pyx_t_4;
3896 int __pyx_t_5;
3897 PyObject *__pyx_t_6 = NULL;
3898 int __pyx_t_7;
3899 int __pyx_t_8;
3900 PyObject *__pyx_t_9 = NULL;
3901 PyObject *__pyx_t_10 = NULL;
3902 __Pyx_RefNannySetupContext("read_art_vars", 0);
3903 __pyx_pybuffer_level_offsets.pybuffer.buf = NULL;
3904 __pyx_pybuffer_level_offsets.refcount = 0;
3905 __pyx_pybuffernd_level_offsets.data = NULL;
3906 __pyx_pybuffernd_level_offsets.rcbuffer = &__pyx_pybuffer_level_offsets;
3907 {
3908 __Pyx_BufFmt_StackElem __pyx_stack[1];
3909 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_level_offsets.rcbuffer->pybuffer, (PyObject*)__pyx_v_level_offsets, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 203, __pyx_L1_error)
3910 }
3911 __pyx_pybuffernd_level_offsets.diminfo[0].strides = __pyx_pybuffernd_level_offsets.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_level_offsets.diminfo[0].shape = __pyx_pybuffernd_level_offsets.rcbuffer->pybuffer.shape[0];
3912
3913 /* "yt/utilities/lib/fortran_reader.pyx":211
3914 * # nhydro_vars is the number of columns- 3 (adjusting for vars)
3915 * # this is normally 10=(8+2chem species)
3916 * cdef int record_size = 2+1+1+nhydro_vars+2 # <<<<<<<<<<<<<<
3917 * cdef float temp = -1.0
3918 * cdef float varpad[2]
3919 */
3920 __pyx_v_record_size = ((4 + __pyx_v_nhydro_vars) + 2);
3921
3922 /* "yt/utilities/lib/fortran_reader.pyx":212
3923 * # this is normally 10=(8+2chem species)
3924 * cdef int record_size = 2+1+1+nhydro_vars+2
3925 * cdef float temp = -1.0 # <<<<<<<<<<<<<<
3926 * cdef float varpad[2]
3927 * cdef int new_padding = -1
3928 */
3929 __pyx_v_temp = -1.0;
3930
3931 /* "yt/utilities/lib/fortran_reader.pyx":214
3932 * cdef float temp = -1.0
3933 * cdef float varpad[2]
3934 * cdef int new_padding = -1 # <<<<<<<<<<<<<<
3935 * cdef int padding[3]
3936 * cdef long offset = 8*grid_id*record_size*sizeof(float)
3937 */
3938 __pyx_v_new_padding = -1;
3939
3940 /* "yt/utilities/lib/fortran_reader.pyx":216
3941 * cdef int new_padding = -1
3942 * cdef int padding[3]
3943 * cdef long offset = 8*grid_id*record_size*sizeof(float) # <<<<<<<<<<<<<<
3944 * fseek(f, level_offsets[grid_level] + offset, SEEK_SET)
3945 * for j in range(8): #iterate over the children
3946 */
3947 __pyx_v_offset = (((8 * __pyx_v_grid_id) * __pyx_v_record_size) * (sizeof(float)));
3948
3949 /* "yt/utilities/lib/fortran_reader.pyx":217
3950 * cdef int padding[3]
3951 * cdef long offset = 8*grid_id*record_size*sizeof(float)
3952 * fseek(f, level_offsets[grid_level] + offset, SEEK_SET) # <<<<<<<<<<<<<<
3953 * for j in range(8): #iterate over the children
3954 * l = 0
3955 */
3956 __pyx_t_1 = __pyx_v_grid_level;
3957 __pyx_t_2 = -1;
3958 if (__pyx_t_1 < 0) {
3959 __pyx_t_1 += __pyx_pybuffernd_level_offsets.diminfo[0].shape;
3960 if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
3961 } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_level_offsets.diminfo[0].shape)) __pyx_t_2 = 0;
3962 if (unlikely(__pyx_t_2 != -1)) {
3963 __Pyx_RaiseBufferIndexError(__pyx_t_2);
3964 __PYX_ERR(0, 217, __pyx_L1_error)
3965 }
3966 (void)(fseek(__pyx_v_f, ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_level_offsets.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_level_offsets.diminfo[0].strides)) + __pyx_v_offset), SEEK_SET));
3967
3968 /* "yt/utilities/lib/fortran_reader.pyx":218
3969 * cdef long offset = 8*grid_id*record_size*sizeof(float)
3970 * fseek(f, level_offsets[grid_level] + offset, SEEK_SET)
3971 * for j in range(8): #iterate over the children # <<<<<<<<<<<<<<
3972 * l = 0
3973 * fread(padding, sizeof(int), 3, f); FIX_LONG(padding[0])
3974 */
3975 for (__pyx_t_3 = 0; __pyx_t_3 < 8; __pyx_t_3+=1) {
3976 __pyx_v_j = __pyx_t_3;
3977
3978 /* "yt/utilities/lib/fortran_reader.pyx":219
3979 * fseek(f, level_offsets[grid_level] + offset, SEEK_SET)
3980 * for j in range(8): #iterate over the children
3981 * l = 0 # <<<<<<<<<<<<<<
3982 * fread(padding, sizeof(int), 3, f); FIX_LONG(padding[0])
3983 * #print("Record Size", padding[0])
3984 */
3985 __Pyx_INCREF(__pyx_int_0);
3986 __Pyx_XDECREF_SET(__pyx_v_l, __pyx_int_0);
3987
3988 /* "yt/utilities/lib/fortran_reader.pyx":220
3989 * for j in range(8): #iterate over the children
3990 * l = 0
3991 * fread(padding, sizeof(int), 3, f); FIX_LONG(padding[0]) # <<<<<<<<<<<<<<
3992 * #print("Record Size", padding[0])
3993 * # This should be replaced by an fread of nhydro_vars length
3994 */
3995 (void)(fread(__pyx_v_padding, (sizeof(int)), 3, __pyx_v_f));
3996 FIX_LONG((__pyx_v_padding[0]));
3997
3998 /* "yt/utilities/lib/fortran_reader.pyx":223
3999 * #print("Record Size", padding[0])
4000 * # This should be replaced by an fread of nhydro_vars length
4001 * for k in range(nhydro_vars): #iterate over the record # <<<<<<<<<<<<<<
4002 * fread(&temp, sizeof(float), 1, f); FIX_FLOAT(temp)
4003 * #print(k, temp)
4004 */
4005 __pyx_t_2 = __pyx_v_nhydro_vars;
4006 __pyx_t_4 = __pyx_t_2;
4007 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
4008 __pyx_v_k = __pyx_t_5;
4009
4010 /* "yt/utilities/lib/fortran_reader.pyx":224
4011 * # This should be replaced by an fread of nhydro_vars length
4012 * for k in range(nhydro_vars): #iterate over the record
4013 * fread(&temp, sizeof(float), 1, f); FIX_FLOAT(temp) # <<<<<<<<<<<<<<
4014 * #print(k, temp)
4015 * if k in fields:
4016 */
4017 (void)(fread((&__pyx_v_temp), (sizeof(float)), 1, __pyx_v_f));
4018 FIX_FLOAT(__pyx_v_temp);
4019
4020 /* "yt/utilities/lib/fortran_reader.pyx":226
4021 * fread(&temp, sizeof(float), 1, f); FIX_FLOAT(temp)
4022 * #print(k, temp)
4023 * if k in fields: # <<<<<<<<<<<<<<
4024 * var[j,l] = temp
4025 * l += 1
4026 */
4027 __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error)
4028 __Pyx_GOTREF(__pyx_t_6);
4029 __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_fields, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 226, __pyx_L1_error)
4030 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4031 __pyx_t_8 = (__pyx_t_7 != 0);
4032 if (__pyx_t_8) {
4033
4034 /* "yt/utilities/lib/fortran_reader.pyx":227
4035 * #print(k, temp)
4036 * if k in fields:
4037 * var[j,l] = temp # <<<<<<<<<<<<<<
4038 * l += 1
4039 * fread(varpad, sizeof(float), 2, f)
4040 */
4041 __pyx_t_6 = PyFloat_FromDouble(__pyx_v_temp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 227, __pyx_L1_error)
4042 __Pyx_GOTREF(__pyx_t_6);
4043 __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_j); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 227, __pyx_L1_error)
4044 __Pyx_GOTREF(__pyx_t_9);
4045 __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 227, __pyx_L1_error)
4046 __Pyx_GOTREF(__pyx_t_10);
4047 __Pyx_GIVEREF(__pyx_t_9);
4048 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
4049 __Pyx_INCREF(__pyx_v_l);
4050 __Pyx_GIVEREF(__pyx_v_l);
4051 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_l);
4052 __pyx_t_9 = 0;
4053 if (unlikely(PyObject_SetItem(__pyx_v_var, __pyx_t_10, __pyx_t_6) < 0)) __PYX_ERR(0, 227, __pyx_L1_error)
4054 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4055 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4056
4057 /* "yt/utilities/lib/fortran_reader.pyx":228
4058 * if k in fields:
4059 * var[j,l] = temp
4060 * l += 1 # <<<<<<<<<<<<<<
4061 * fread(varpad, sizeof(float), 2, f)
4062 * fread(&new_padding, sizeof(int), 1, f); FIX_LONG(new_padding)
4063 */
4064 __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_v_l, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 228, __pyx_L1_error)
4065 __Pyx_GOTREF(__pyx_t_6);
4066 __Pyx_DECREF_SET(__pyx_v_l, __pyx_t_6);
4067 __pyx_t_6 = 0;
4068
4069 /* "yt/utilities/lib/fortran_reader.pyx":226
4070 * fread(&temp, sizeof(float), 1, f); FIX_FLOAT(temp)
4071 * #print(k, temp)
4072 * if k in fields: # <<<<<<<<<<<<<<
4073 * var[j,l] = temp
4074 * l += 1
4075 */
4076 }
4077 }
4078
4079 /* "yt/utilities/lib/fortran_reader.pyx":229
4080 * var[j,l] = temp
4081 * l += 1
4082 * fread(varpad, sizeof(float), 2, f) # <<<<<<<<<<<<<<
4083 * fread(&new_padding, sizeof(int), 1, f); FIX_LONG(new_padding)
4084 * assert(padding[0] == new_padding)
4085 */
4086 (void)(fread(__pyx_v_varpad, (sizeof(float)), 2, __pyx_v_f));
4087
4088 /* "yt/utilities/lib/fortran_reader.pyx":230
4089 * l += 1
4090 * fread(varpad, sizeof(float), 2, f)
4091 * fread(&new_padding, sizeof(int), 1, f); FIX_LONG(new_padding) # <<<<<<<<<<<<<<
4092 * assert(padding[0] == new_padding)
4093 *
4094 */
4095 (void)(fread((&__pyx_v_new_padding), (sizeof(int)), 1, __pyx_v_f));
4096 FIX_LONG(__pyx_v_new_padding);
4097
4098 /* "yt/utilities/lib/fortran_reader.pyx":231
4099 * fread(varpad, sizeof(float), 2, f)
4100 * fread(&new_padding, sizeof(int), 1, f); FIX_LONG(new_padding)
4101 * assert(padding[0] == new_padding) # <<<<<<<<<<<<<<
4102 *
4103 * @cython.cdivision(True)
4104 */
4105 #ifndef CYTHON_WITHOUT_ASSERTIONS
4106 if (unlikely(!Py_OptimizeFlag)) {
4107 if (unlikely(!(((__pyx_v_padding[0]) == __pyx_v_new_padding) != 0))) {
4108 PyErr_SetNone(PyExc_AssertionError);
4109 __PYX_ERR(0, 231, __pyx_L1_error)
4110 }
4111 }
4112 #endif
4113 }
4114
4115 /* "yt/utilities/lib/fortran_reader.pyx":203
4116 * fclose(f)
4117 *
4118 * cdef void read_art_vars(FILE *f, # <<<<<<<<<<<<<<
4119 * int min_level, int max_level, int nhydro_vars,
4120 * int grid_level,long grid_id,long child_offset,
4121 */
4122
4123 /* function exit code */
4124 goto __pyx_L0;
4125 __pyx_L1_error:;
4126 __Pyx_XDECREF(__pyx_t_6);
4127 __Pyx_XDECREF(__pyx_t_9);
4128 __Pyx_XDECREF(__pyx_t_10);
4129 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4130 __Pyx_PyThreadState_declare
4131 __Pyx_PyThreadState_assign
4132 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4133 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level_offsets.rcbuffer->pybuffer);
4134 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4135 __Pyx_WriteUnraisable("yt.utilities.lib.fortran_reader.read_art_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4136 goto __pyx_L2;
4137 __pyx_L0:;
4138 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level_offsets.rcbuffer->pybuffer);
4139 __pyx_L2:;
4140 __Pyx_XDECREF(__pyx_v_l);
4141 __Pyx_RefNannyFinishContext();
4142 }
4143
4144 /* "yt/utilities/lib/fortran_reader.pyx":236
4145 * @cython.boundscheck(False)
4146 * @cython.wraparound(False)
4147 * def read_art_grid(int varindex, # <<<<<<<<<<<<<<
4148 * np.ndarray[np.int64_t, ndim=1] start_index,
4149 * np.ndarray[np.int32_t, ndim=1] grid_dims,
4150 */
4151
4152 /* Python wrapper */
4153 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_9read_art_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4154 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14fortran_reader_9read_art_grid = {"read_art_grid", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14fortran_reader_9read_art_grid, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14fortran_reader_9read_art_grid(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4155 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_9read_art_grid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4156 int __pyx_v_varindex;
4157 PyArrayObject *__pyx_v_start_index = 0;
4158 PyArrayObject *__pyx_v_grid_dims = 0;
4159 PyArrayObject *__pyx_v_data = 0;
4160 PyArrayObject *__pyx_v_filled = 0;
4161 PyArrayObject *__pyx_v_level_data = 0;
4162 int __pyx_v_level;
4163 int __pyx_v_ref_factor;
4164 PyObject *__pyx_v_component_grid_info = 0;
4165 PyObject *__pyx_r = 0;
4166 __Pyx_RefNannyDeclarations
4167 __Pyx_RefNannySetupContext("read_art_grid (wrapper)", 0);
4168 {
4169 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_varindex,&__pyx_n_s_start_index,&__pyx_n_s_grid_dims,&__pyx_n_s_data,&__pyx_n_s_filled,&__pyx_n_s_level_data,&__pyx_n_s_level,&__pyx_n_s_ref_factor,&__pyx_n_s_component_grid_info,0};
4170 PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
4171 if (unlikely(__pyx_kwds)) {
4172 Py_ssize_t kw_args;
4173 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4174 switch (pos_args) {
4175 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4176 CYTHON_FALLTHROUGH;
4177 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4178 CYTHON_FALLTHROUGH;
4179 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4180 CYTHON_FALLTHROUGH;
4181 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4182 CYTHON_FALLTHROUGH;
4183 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4184 CYTHON_FALLTHROUGH;
4185 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4186 CYTHON_FALLTHROUGH;
4187 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4188 CYTHON_FALLTHROUGH;
4189 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4190 CYTHON_FALLTHROUGH;
4191 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4192 CYTHON_FALLTHROUGH;
4193 case 0: break;
4194 default: goto __pyx_L5_argtuple_error;
4195 }
4196 kw_args = PyDict_Size(__pyx_kwds);
4197 switch (pos_args) {
4198 case 0:
4199 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_varindex)) != 0)) kw_args--;
4200 else goto __pyx_L5_argtuple_error;
4201 CYTHON_FALLTHROUGH;
4202 case 1:
4203 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_index)) != 0)) kw_args--;
4204 else {
4205 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 1); __PYX_ERR(0, 236, __pyx_L3_error)
4206 }
4207 CYTHON_FALLTHROUGH;
4208 case 2:
4209 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid_dims)) != 0)) kw_args--;
4210 else {
4211 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 2); __PYX_ERR(0, 236, __pyx_L3_error)
4212 }
4213 CYTHON_FALLTHROUGH;
4214 case 3:
4215 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
4216 else {
4217 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 3); __PYX_ERR(0, 236, __pyx_L3_error)
4218 }
4219 CYTHON_FALLTHROUGH;
4220 case 4:
4221 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filled)) != 0)) kw_args--;
4222 else {
4223 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 4); __PYX_ERR(0, 236, __pyx_L3_error)
4224 }
4225 CYTHON_FALLTHROUGH;
4226 case 5:
4227 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level_data)) != 0)) kw_args--;
4228 else {
4229 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 5); __PYX_ERR(0, 236, __pyx_L3_error)
4230 }
4231 CYTHON_FALLTHROUGH;
4232 case 6:
4233 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
4234 else {
4235 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 6); __PYX_ERR(0, 236, __pyx_L3_error)
4236 }
4237 CYTHON_FALLTHROUGH;
4238 case 7:
4239 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ref_factor)) != 0)) kw_args--;
4240 else {
4241 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 7); __PYX_ERR(0, 236, __pyx_L3_error)
4242 }
4243 CYTHON_FALLTHROUGH;
4244 case 8:
4245 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_component_grid_info)) != 0)) kw_args--;
4246 else {
4247 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, 8); __PYX_ERR(0, 236, __pyx_L3_error)
4248 }
4249 }
4250 if (unlikely(kw_args > 0)) {
4251 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_art_grid") < 0)) __PYX_ERR(0, 236, __pyx_L3_error)
4252 }
4253 } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
4254 goto __pyx_L5_argtuple_error;
4255 } else {
4256 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4257 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4258 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4259 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4260 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4261 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4262 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4263 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4264 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4265 }
4266 __pyx_v_varindex = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_varindex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error)
4267 __pyx_v_start_index = ((PyArrayObject *)values[1]);
4268 __pyx_v_grid_dims = ((PyArrayObject *)values[2]);
4269 __pyx_v_data = ((PyArrayObject *)values[3]);
4270 __pyx_v_filled = ((PyArrayObject *)values[4]);
4271 __pyx_v_level_data = ((PyArrayObject *)values[5]);
4272 __pyx_v_level = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
4273 __pyx_v_ref_factor = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_ref_factor == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
4274 __pyx_v_component_grid_info = values[8];
4275 }
4276 goto __pyx_L4_argument_unpacking_done;
4277 __pyx_L5_argtuple_error:;
4278 __Pyx_RaiseArgtupleInvalid("read_art_grid", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 236, __pyx_L3_error)
4279 __pyx_L3_error:;
4280 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_art_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
4281 __Pyx_RefNannyFinishContext();
4282 return NULL;
4283 __pyx_L4_argument_unpacking_done:;
4284 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start_index), __pyx_ptype_5numpy_ndarray, 1, "start_index", 0))) __PYX_ERR(0, 237, __pyx_L1_error)
4285 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "grid_dims", 0))) __PYX_ERR(0, 238, __pyx_L1_error)
4286 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) __PYX_ERR(0, 239, __pyx_L1_error)
4287 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filled), __pyx_ptype_5numpy_ndarray, 1, "filled", 0))) __PYX_ERR(0, 240, __pyx_L1_error)
4288 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_level_data), __pyx_ptype_5numpy_ndarray, 1, "level_data", 0))) __PYX_ERR(0, 241, __pyx_L1_error)
4289 __pyx_r = __pyx_pf_2yt_9utilities_3lib_14fortran_reader_8read_art_grid(__pyx_self, __pyx_v_varindex, __pyx_v_start_index, __pyx_v_grid_dims, __pyx_v_data, __pyx_v_filled, __pyx_v_level_data, __pyx_v_level, __pyx_v_ref_factor, __pyx_v_component_grid_info);
4290
4291 /* function exit code */
4292 goto __pyx_L0;
4293 __pyx_L1_error:;
4294 __pyx_r = NULL;
4295 __pyx_L0:;
4296 __Pyx_RefNannyFinishContext();
4297 return __pyx_r;
4298 }
4299
__pyx_pf_2yt_9utilities_3lib_14fortran_reader_8read_art_grid(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_varindex,PyArrayObject * __pyx_v_start_index,PyArrayObject * __pyx_v_grid_dims,PyArrayObject * __pyx_v_data,PyArrayObject * __pyx_v_filled,PyArrayObject * __pyx_v_level_data,int __pyx_v_level,int __pyx_v_ref_factor,PyObject * __pyx_v_component_grid_info)4300 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_8read_art_grid(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_varindex, PyArrayObject *__pyx_v_start_index, PyArrayObject *__pyx_v_grid_dims, PyArrayObject *__pyx_v_data, PyArrayObject *__pyx_v_filled, PyArrayObject *__pyx_v_level_data, int __pyx_v_level, int __pyx_v_ref_factor, PyObject *__pyx_v_component_grid_info) {
4301 int __pyx_v_gi;
4302 int __pyx_v_i;
4303 int __pyx_v_j;
4304 int __pyx_v_k;
4305 int __pyx_v_grid_id;
4306 int __pyx_v_ir;
4307 int __pyx_v_jr;
4308 int __pyx_v_kr;
4309 int __pyx_v_offi;
4310 int __pyx_v_offj;
4311 int __pyx_v_offk;
4312 int __pyx_v_odind;
4313 __pyx_t_5numpy_int64_t __pyx_v_di;
4314 __pyx_t_5numpy_int64_t __pyx_v_dj;
4315 __pyx_t_5numpy_int64_t __pyx_v_dk;
4316 PyArrayObject *__pyx_v_ogrid_info = 0;
4317 PyArrayObject *__pyx_v_og_start_index = 0;
4318 __pyx_t_5numpy_float64_t __pyx_v_temp_data;
4319 __pyx_t_5numpy_int64_t __pyx_v_end_index[3];
4320 int __pyx_v_kr_offset;
4321 int __pyx_v_jr_offset;
4322 int __pyx_v_ir_offset;
4323 int __pyx_v_to_fill;
4324 __Pyx_LocalBuf_ND __pyx_pybuffernd_data;
4325 __Pyx_Buffer __pyx_pybuffer_data;
4326 __Pyx_LocalBuf_ND __pyx_pybuffernd_filled;
4327 __Pyx_Buffer __pyx_pybuffer_filled;
4328 __Pyx_LocalBuf_ND __pyx_pybuffernd_grid_dims;
4329 __Pyx_Buffer __pyx_pybuffer_grid_dims;
4330 __Pyx_LocalBuf_ND __pyx_pybuffernd_level_data;
4331 __Pyx_Buffer __pyx_pybuffer_level_data;
4332 __Pyx_LocalBuf_ND __pyx_pybuffernd_og_start_index;
4333 __Pyx_Buffer __pyx_pybuffer_og_start_index;
4334 __Pyx_LocalBuf_ND __pyx_pybuffernd_ogrid_info;
4335 __Pyx_Buffer __pyx_pybuffer_ogrid_info;
4336 __Pyx_LocalBuf_ND __pyx_pybuffernd_start_index;
4337 __Pyx_Buffer __pyx_pybuffer_start_index;
4338 PyObject *__pyx_r = NULL;
4339 __Pyx_RefNannyDeclarations
4340 int __pyx_t_1;
4341 Py_ssize_t __pyx_t_2;
4342 Py_ssize_t __pyx_t_3;
4343 Py_ssize_t __pyx_t_4;
4344 Py_ssize_t __pyx_t_5;
4345 PyObject *__pyx_t_6 = NULL;
4346 PyArrayObject *__pyx_t_7 = NULL;
4347 int __pyx_t_8;
4348 PyObject *__pyx_t_9 = NULL;
4349 PyObject *__pyx_t_10 = NULL;
4350 PyObject *__pyx_t_11 = NULL;
4351 Py_ssize_t __pyx_t_12;
4352 PyArrayObject *__pyx_t_13 = NULL;
4353 long __pyx_t_14;
4354 long __pyx_t_15;
4355 Py_ssize_t __pyx_t_16;
4356 int __pyx_t_17;
4357 Py_ssize_t __pyx_t_18;
4358 int __pyx_t_19;
4359 long __pyx_t_20;
4360 long __pyx_t_21;
4361 int __pyx_t_22;
4362 Py_ssize_t __pyx_t_23;
4363 Py_ssize_t __pyx_t_24;
4364 long __pyx_t_25;
4365 long __pyx_t_26;
4366 int __pyx_t_27;
4367 Py_ssize_t __pyx_t_28;
4368 Py_ssize_t __pyx_t_29;
4369 Py_ssize_t __pyx_t_30;
4370 Py_ssize_t __pyx_t_31;
4371 Py_ssize_t __pyx_t_32;
4372 Py_ssize_t __pyx_t_33;
4373 Py_ssize_t __pyx_t_34;
4374 Py_ssize_t __pyx_t_35;
4375 Py_ssize_t __pyx_t_36;
4376 Py_ssize_t __pyx_t_37;
4377 Py_ssize_t __pyx_t_38;
4378 Py_ssize_t __pyx_t_39;
4379 Py_ssize_t __pyx_t_40;
4380 Py_ssize_t __pyx_t_41;
4381 Py_ssize_t __pyx_t_42;
4382 Py_ssize_t __pyx_t_43;
4383 Py_ssize_t __pyx_t_44;
4384 Py_ssize_t __pyx_t_45;
4385 Py_ssize_t __pyx_t_46;
4386 Py_ssize_t __pyx_t_47;
4387 Py_ssize_t __pyx_t_48;
4388 Py_ssize_t __pyx_t_49;
4389 Py_ssize_t __pyx_t_50;
4390 __Pyx_RefNannySetupContext("read_art_grid", 0);
4391 __pyx_pybuffer_ogrid_info.pybuffer.buf = NULL;
4392 __pyx_pybuffer_ogrid_info.refcount = 0;
4393 __pyx_pybuffernd_ogrid_info.data = NULL;
4394 __pyx_pybuffernd_ogrid_info.rcbuffer = &__pyx_pybuffer_ogrid_info;
4395 __pyx_pybuffer_og_start_index.pybuffer.buf = NULL;
4396 __pyx_pybuffer_og_start_index.refcount = 0;
4397 __pyx_pybuffernd_og_start_index.data = NULL;
4398 __pyx_pybuffernd_og_start_index.rcbuffer = &__pyx_pybuffer_og_start_index;
4399 __pyx_pybuffer_start_index.pybuffer.buf = NULL;
4400 __pyx_pybuffer_start_index.refcount = 0;
4401 __pyx_pybuffernd_start_index.data = NULL;
4402 __pyx_pybuffernd_start_index.rcbuffer = &__pyx_pybuffer_start_index;
4403 __pyx_pybuffer_grid_dims.pybuffer.buf = NULL;
4404 __pyx_pybuffer_grid_dims.refcount = 0;
4405 __pyx_pybuffernd_grid_dims.data = NULL;
4406 __pyx_pybuffernd_grid_dims.rcbuffer = &__pyx_pybuffer_grid_dims;
4407 __pyx_pybuffer_data.pybuffer.buf = NULL;
4408 __pyx_pybuffer_data.refcount = 0;
4409 __pyx_pybuffernd_data.data = NULL;
4410 __pyx_pybuffernd_data.rcbuffer = &__pyx_pybuffer_data;
4411 __pyx_pybuffer_filled.pybuffer.buf = NULL;
4412 __pyx_pybuffer_filled.refcount = 0;
4413 __pyx_pybuffernd_filled.data = NULL;
4414 __pyx_pybuffernd_filled.rcbuffer = &__pyx_pybuffer_filled;
4415 __pyx_pybuffer_level_data.pybuffer.buf = NULL;
4416 __pyx_pybuffer_level_data.refcount = 0;
4417 __pyx_pybuffernd_level_data.data = NULL;
4418 __pyx_pybuffernd_level_data.rcbuffer = &__pyx_pybuffer_level_data;
4419 {
4420 __Pyx_BufFmt_StackElem __pyx_stack[1];
4421 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_start_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error)
4422 }
4423 __pyx_pybuffernd_start_index.diminfo[0].strides = __pyx_pybuffernd_start_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_start_index.diminfo[0].shape = __pyx_pybuffernd_start_index.rcbuffer->pybuffer.shape[0];
4424 {
4425 __Pyx_BufFmt_StackElem __pyx_stack[1];
4426 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_grid_dims.rcbuffer->pybuffer, (PyObject*)__pyx_v_grid_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error)
4427 }
4428 __pyx_pybuffernd_grid_dims.diminfo[0].strides = __pyx_pybuffernd_grid_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_grid_dims.diminfo[0].shape = __pyx_pybuffernd_grid_dims.rcbuffer->pybuffer.shape[0];
4429 {
4430 __Pyx_BufFmt_StackElem __pyx_stack[1];
4431 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error)
4432 }
4433 __pyx_pybuffernd_data.diminfo[0].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_data.diminfo[0].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_data.diminfo[1].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_data.diminfo[1].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_data.diminfo[2].strides = __pyx_pybuffernd_data.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_data.diminfo[2].shape = __pyx_pybuffernd_data.rcbuffer->pybuffer.shape[2];
4434 {
4435 __Pyx_BufFmt_StackElem __pyx_stack[1];
4436 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_filled.rcbuffer->pybuffer, (PyObject*)__pyx_v_filled, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error)
4437 }
4438 __pyx_pybuffernd_filled.diminfo[0].strides = __pyx_pybuffernd_filled.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_filled.diminfo[0].shape = __pyx_pybuffernd_filled.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_filled.diminfo[1].strides = __pyx_pybuffernd_filled.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_filled.diminfo[1].shape = __pyx_pybuffernd_filled.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_filled.diminfo[2].strides = __pyx_pybuffernd_filled.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_filled.diminfo[2].shape = __pyx_pybuffernd_filled.rcbuffer->pybuffer.shape[2];
4439 {
4440 __Pyx_BufFmt_StackElem __pyx_stack[1];
4441 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_level_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_level_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error)
4442 }
4443 __pyx_pybuffernd_level_data.diminfo[0].strides = __pyx_pybuffernd_level_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_level_data.diminfo[0].shape = __pyx_pybuffernd_level_data.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_level_data.diminfo[1].strides = __pyx_pybuffernd_level_data.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_level_data.diminfo[1].shape = __pyx_pybuffernd_level_data.rcbuffer->pybuffer.shape[1];
4444
4445 /* "yt/utilities/lib/fortran_reader.pyx":253
4446 * cdef np.int64_t end_index[3]
4447 * cdef int kr_offset, jr_offset, ir_offset
4448 * cdef int to_fill = 0 # <<<<<<<<<<<<<<
4449 * # Note that indexing into a cell is:
4450 * # (k*2 + j)*2 + i
4451 */
4452 __pyx_v_to_fill = 0;
4453
4454 /* "yt/utilities/lib/fortran_reader.pyx":256
4455 * # Note that indexing into a cell is:
4456 * # (k*2 + j)*2 + i
4457 * for i in range(3): # <<<<<<<<<<<<<<
4458 * end_index[i] = start_index[i] + grid_dims[i]
4459 * for gi in range(len(component_grid_info)):
4460 */
4461 for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4462 __pyx_v_i = __pyx_t_1;
4463
4464 /* "yt/utilities/lib/fortran_reader.pyx":257
4465 * # (k*2 + j)*2 + i
4466 * for i in range(3):
4467 * end_index[i] = start_index[i] + grid_dims[i] # <<<<<<<<<<<<<<
4468 * for gi in range(len(component_grid_info)):
4469 * ogrid_info = component_grid_info[gi]
4470 */
4471 __pyx_t_2 = __pyx_v_i;
4472 __pyx_t_3 = __pyx_v_i;
4473 (__pyx_v_end_index[__pyx_v_i]) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_start_index.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_grid_dims.diminfo[0].strides)));
4474 }
4475
4476 /* "yt/utilities/lib/fortran_reader.pyx":258
4477 * for i in range(3):
4478 * end_index[i] = start_index[i] + grid_dims[i]
4479 * for gi in range(len(component_grid_info)): # <<<<<<<<<<<<<<
4480 * ogrid_info = component_grid_info[gi]
4481 * grid_id = ogrid_info[1]
4482 */
4483 __pyx_t_4 = PyObject_Length(__pyx_v_component_grid_info); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 258, __pyx_L1_error)
4484 __pyx_t_5 = __pyx_t_4;
4485 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_5; __pyx_t_1+=1) {
4486 __pyx_v_gi = __pyx_t_1;
4487
4488 /* "yt/utilities/lib/fortran_reader.pyx":259
4489 * end_index[i] = start_index[i] + grid_dims[i]
4490 * for gi in range(len(component_grid_info)):
4491 * ogrid_info = component_grid_info[gi] # <<<<<<<<<<<<<<
4492 * grid_id = ogrid_info[1]
4493 * og_start_index = ogrid_info[3:6] #the oct left edge
4494 */
4495 __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_component_grid_info, __pyx_v_gi, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __pyx_L1_error)
4496 __Pyx_GOTREF(__pyx_t_6);
4497 if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 259, __pyx_L1_error)
4498 __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
4499 {
4500 __Pyx_BufFmt_StackElem __pyx_stack[1];
4501 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer);
4502 __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
4503 if (unlikely(__pyx_t_8 < 0)) {
4504 PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
4505 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer, (PyObject*)__pyx_v_ogrid_info, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
4506 Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
4507 __Pyx_RaiseBufferFallbackError();
4508 } else {
4509 PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
4510 }
4511 __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0;
4512 }
4513 __pyx_pybuffernd_ogrid_info.diminfo[0].strides = __pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ogrid_info.diminfo[0].shape = __pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer.shape[0];
4514 if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
4515 }
4516 __pyx_t_7 = 0;
4517 __Pyx_XDECREF_SET(__pyx_v_ogrid_info, ((PyArrayObject *)__pyx_t_6));
4518 __pyx_t_6 = 0;
4519
4520 /* "yt/utilities/lib/fortran_reader.pyx":260
4521 * for gi in range(len(component_grid_info)):
4522 * ogrid_info = component_grid_info[gi]
4523 * grid_id = ogrid_info[1] # <<<<<<<<<<<<<<
4524 * og_start_index = ogrid_info[3:6] #the oct left edge
4525 * for i in range(2*ref_factor):
4526 */
4527 __pyx_t_12 = 1;
4528 __pyx_v_grid_id = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_ogrid_info.diminfo[0].strides));
4529
4530 /* "yt/utilities/lib/fortran_reader.pyx":261
4531 * ogrid_info = component_grid_info[gi]
4532 * grid_id = ogrid_info[1]
4533 * og_start_index = ogrid_info[3:6] #the oct left edge # <<<<<<<<<<<<<<
4534 * for i in range(2*ref_factor):
4535 * di = i + og_start_index[0] * ref_factor
4536 */
4537 __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_ogrid_info), __pyx_slice_); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 261, __pyx_L1_error)
4538 __Pyx_GOTREF(__pyx_t_6);
4539 if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 261, __pyx_L1_error)
4540 __pyx_t_13 = ((PyArrayObject *)__pyx_t_6);
4541 {
4542 __Pyx_BufFmt_StackElem __pyx_stack[1];
4543 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_og_start_index.rcbuffer->pybuffer);
4544 __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_og_start_index.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
4545 if (unlikely(__pyx_t_8 < 0)) {
4546 PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
4547 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_og_start_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_og_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
4548 Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
4549 __Pyx_RaiseBufferFallbackError();
4550 } else {
4551 PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
4552 }
4553 __pyx_t_11 = __pyx_t_10 = __pyx_t_9 = 0;
4554 }
4555 __pyx_pybuffernd_og_start_index.diminfo[0].strides = __pyx_pybuffernd_og_start_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_og_start_index.diminfo[0].shape = __pyx_pybuffernd_og_start_index.rcbuffer->pybuffer.shape[0];
4556 if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 261, __pyx_L1_error)
4557 }
4558 __pyx_t_13 = 0;
4559 __Pyx_XDECREF_SET(__pyx_v_og_start_index, ((PyArrayObject *)__pyx_t_6));
4560 __pyx_t_6 = 0;
4561
4562 /* "yt/utilities/lib/fortran_reader.pyx":262
4563 * grid_id = ogrid_info[1]
4564 * og_start_index = ogrid_info[3:6] #the oct left edge
4565 * for i in range(2*ref_factor): # <<<<<<<<<<<<<<
4566 * di = i + og_start_index[0] * ref_factor
4567 * if di < start_index[0] or di >= end_index[0]: continue
4568 */
4569 __pyx_t_14 = (2 * __pyx_v_ref_factor);
4570 __pyx_t_15 = __pyx_t_14;
4571 for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_15; __pyx_t_8+=1) {
4572 __pyx_v_i = __pyx_t_8;
4573
4574 /* "yt/utilities/lib/fortran_reader.pyx":263
4575 * og_start_index = ogrid_info[3:6] #the oct left edge
4576 * for i in range(2*ref_factor):
4577 * di = i + og_start_index[0] * ref_factor # <<<<<<<<<<<<<<
4578 * if di < start_index[0] or di >= end_index[0]: continue
4579 * ir = <int> (i / ref_factor)
4580 */
4581 __pyx_t_16 = 0;
4582 __pyx_v_di = (__pyx_v_i + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_og_start_index.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_og_start_index.diminfo[0].strides)) * __pyx_v_ref_factor));
4583
4584 /* "yt/utilities/lib/fortran_reader.pyx":264
4585 * for i in range(2*ref_factor):
4586 * di = i + og_start_index[0] * ref_factor
4587 * if di < start_index[0] or di >= end_index[0]: continue # <<<<<<<<<<<<<<
4588 * ir = <int> (i / ref_factor)
4589 * for j in range(2 * ref_factor):
4590 */
4591 __pyx_t_18 = 0;
4592 __pyx_t_19 = ((__pyx_v_di < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_start_index.diminfo[0].strides))) != 0);
4593 if (!__pyx_t_19) {
4594 } else {
4595 __pyx_t_17 = __pyx_t_19;
4596 goto __pyx_L10_bool_binop_done;
4597 }
4598 __pyx_t_19 = ((__pyx_v_di >= (__pyx_v_end_index[0])) != 0);
4599 __pyx_t_17 = __pyx_t_19;
4600 __pyx_L10_bool_binop_done:;
4601 if (__pyx_t_17) {
4602 goto __pyx_L7_continue;
4603 }
4604
4605 /* "yt/utilities/lib/fortran_reader.pyx":265
4606 * di = i + og_start_index[0] * ref_factor
4607 * if di < start_index[0] or di >= end_index[0]: continue
4608 * ir = <int> (i / ref_factor) # <<<<<<<<<<<<<<
4609 * for j in range(2 * ref_factor):
4610 * dj = j + og_start_index[1] * ref_factor
4611 */
4612 __pyx_v_ir = ((int)(__pyx_v_i / __pyx_v_ref_factor));
4613
4614 /* "yt/utilities/lib/fortran_reader.pyx":266
4615 * if di < start_index[0] or di >= end_index[0]: continue
4616 * ir = <int> (i / ref_factor)
4617 * for j in range(2 * ref_factor): # <<<<<<<<<<<<<<
4618 * dj = j + og_start_index[1] * ref_factor
4619 * if dj < start_index[1] or dj >= end_index[1]: continue
4620 */
4621 __pyx_t_20 = (2 * __pyx_v_ref_factor);
4622 __pyx_t_21 = __pyx_t_20;
4623 for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
4624 __pyx_v_j = __pyx_t_22;
4625
4626 /* "yt/utilities/lib/fortran_reader.pyx":267
4627 * ir = <int> (i / ref_factor)
4628 * for j in range(2 * ref_factor):
4629 * dj = j + og_start_index[1] * ref_factor # <<<<<<<<<<<<<<
4630 * if dj < start_index[1] or dj >= end_index[1]: continue
4631 * jr = <int> (j / ref_factor)
4632 */
4633 __pyx_t_23 = 1;
4634 __pyx_v_dj = (__pyx_v_j + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_og_start_index.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_og_start_index.diminfo[0].strides)) * __pyx_v_ref_factor));
4635
4636 /* "yt/utilities/lib/fortran_reader.pyx":268
4637 * for j in range(2 * ref_factor):
4638 * dj = j + og_start_index[1] * ref_factor
4639 * if dj < start_index[1] or dj >= end_index[1]: continue # <<<<<<<<<<<<<<
4640 * jr = <int> (j / ref_factor)
4641 * for k in range(2 * ref_factor):
4642 */
4643 __pyx_t_24 = 1;
4644 __pyx_t_19 = ((__pyx_v_dj < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_start_index.diminfo[0].strides))) != 0);
4645 if (!__pyx_t_19) {
4646 } else {
4647 __pyx_t_17 = __pyx_t_19;
4648 goto __pyx_L15_bool_binop_done;
4649 }
4650 __pyx_t_19 = ((__pyx_v_dj >= (__pyx_v_end_index[1])) != 0);
4651 __pyx_t_17 = __pyx_t_19;
4652 __pyx_L15_bool_binop_done:;
4653 if (__pyx_t_17) {
4654 goto __pyx_L12_continue;
4655 }
4656
4657 /* "yt/utilities/lib/fortran_reader.pyx":269
4658 * dj = j + og_start_index[1] * ref_factor
4659 * if dj < start_index[1] or dj >= end_index[1]: continue
4660 * jr = <int> (j / ref_factor) # <<<<<<<<<<<<<<
4661 * for k in range(2 * ref_factor):
4662 * dk = k + og_start_index[2] * ref_factor
4663 */
4664 __pyx_v_jr = ((int)(__pyx_v_j / __pyx_v_ref_factor));
4665
4666 /* "yt/utilities/lib/fortran_reader.pyx":270
4667 * if dj < start_index[1] or dj >= end_index[1]: continue
4668 * jr = <int> (j / ref_factor)
4669 * for k in range(2 * ref_factor): # <<<<<<<<<<<<<<
4670 * dk = k + og_start_index[2] * ref_factor
4671 * if dk < start_index[2] or dk >= end_index[2]: continue
4672 */
4673 __pyx_t_25 = (2 * __pyx_v_ref_factor);
4674 __pyx_t_26 = __pyx_t_25;
4675 for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
4676 __pyx_v_k = __pyx_t_27;
4677
4678 /* "yt/utilities/lib/fortran_reader.pyx":271
4679 * jr = <int> (j / ref_factor)
4680 * for k in range(2 * ref_factor):
4681 * dk = k + og_start_index[2] * ref_factor # <<<<<<<<<<<<<<
4682 * if dk < start_index[2] or dk >= end_index[2]: continue
4683 * kr = <int> (k / ref_factor)
4684 */
4685 __pyx_t_28 = 2;
4686 __pyx_v_dk = (__pyx_v_k + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_og_start_index.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_og_start_index.diminfo[0].strides)) * __pyx_v_ref_factor));
4687
4688 /* "yt/utilities/lib/fortran_reader.pyx":272
4689 * for k in range(2 * ref_factor):
4690 * dk = k + og_start_index[2] * ref_factor
4691 * if dk < start_index[2] or dk >= end_index[2]: continue # <<<<<<<<<<<<<<
4692 * kr = <int> (k / ref_factor)
4693 * offi = di - start_index[0]
4694 */
4695 __pyx_t_29 = 2;
4696 __pyx_t_19 = ((__pyx_v_dk < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_start_index.diminfo[0].strides))) != 0);
4697 if (!__pyx_t_19) {
4698 } else {
4699 __pyx_t_17 = __pyx_t_19;
4700 goto __pyx_L20_bool_binop_done;
4701 }
4702 __pyx_t_19 = ((__pyx_v_dk >= (__pyx_v_end_index[2])) != 0);
4703 __pyx_t_17 = __pyx_t_19;
4704 __pyx_L20_bool_binop_done:;
4705 if (__pyx_t_17) {
4706 goto __pyx_L17_continue;
4707 }
4708
4709 /* "yt/utilities/lib/fortran_reader.pyx":273
4710 * dk = k + og_start_index[2] * ref_factor
4711 * if dk < start_index[2] or dk >= end_index[2]: continue
4712 * kr = <int> (k / ref_factor) # <<<<<<<<<<<<<<
4713 * offi = di - start_index[0]
4714 * offj = dj - start_index[1]
4715 */
4716 __pyx_v_kr = ((int)(__pyx_v_k / __pyx_v_ref_factor));
4717
4718 /* "yt/utilities/lib/fortran_reader.pyx":274
4719 * if dk < start_index[2] or dk >= end_index[2]: continue
4720 * kr = <int> (k / ref_factor)
4721 * offi = di - start_index[0] # <<<<<<<<<<<<<<
4722 * offj = dj - start_index[1]
4723 * offk = dk - start_index[2]
4724 */
4725 __pyx_t_30 = 0;
4726 __pyx_v_offi = (__pyx_v_di - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_start_index.diminfo[0].strides)));
4727
4728 /* "yt/utilities/lib/fortran_reader.pyx":275
4729 * kr = <int> (k / ref_factor)
4730 * offi = di - start_index[0]
4731 * offj = dj - start_index[1] # <<<<<<<<<<<<<<
4732 * offk = dk - start_index[2]
4733 * #print(offi, filled.shape[0],)
4734 */
4735 __pyx_t_31 = 1;
4736 __pyx_v_offj = (__pyx_v_dj - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_start_index.diminfo[0].strides)));
4737
4738 /* "yt/utilities/lib/fortran_reader.pyx":276
4739 * offi = di - start_index[0]
4740 * offj = dj - start_index[1]
4741 * offk = dk - start_index[2] # <<<<<<<<<<<<<<
4742 * #print(offi, filled.shape[0],)
4743 * #print(offj, filled.shape[1],)
4744 */
4745 __pyx_t_32 = 2;
4746 __pyx_v_offk = (__pyx_v_dk - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_start_index.diminfo[0].strides)));
4747
4748 /* "yt/utilities/lib/fortran_reader.pyx":280
4749 * #print(offj, filled.shape[1],)
4750 * #print(offk, filled.shape[2])
4751 * if filled[offi, offj, offk] == 1: continue # <<<<<<<<<<<<<<
4752 * if level > 0:
4753 * odind = (kr*2 + jr)*2 + ir
4754 */
4755 __pyx_t_33 = __pyx_v_offi;
4756 __pyx_t_34 = __pyx_v_offj;
4757 __pyx_t_35 = __pyx_v_offk;
4758 __pyx_t_17 = (((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_filled.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_filled.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_filled.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_filled.diminfo[2].strides)) == 1) != 0);
4759 if (__pyx_t_17) {
4760 goto __pyx_L17_continue;
4761 }
4762
4763 /* "yt/utilities/lib/fortran_reader.pyx":281
4764 * #print(offk, filled.shape[2])
4765 * if filled[offi, offj, offk] == 1: continue
4766 * if level > 0: # <<<<<<<<<<<<<<
4767 * odind = (kr*2 + jr)*2 + ir
4768 * # Replace with an ART-specific reader
4769 */
4770 __pyx_t_17 = ((__pyx_v_level > 0) != 0);
4771 if (__pyx_t_17) {
4772
4773 /* "yt/utilities/lib/fortran_reader.pyx":282
4774 * if filled[offi, offj, offk] == 1: continue
4775 * if level > 0:
4776 * odind = (kr*2 + jr)*2 + ir # <<<<<<<<<<<<<<
4777 * # Replace with an ART-specific reader
4778 * #temp_data = local_hydro_data.m_var_array[
4779 */
4780 __pyx_v_odind = ((((__pyx_v_kr * 2) + __pyx_v_jr) * 2) + __pyx_v_ir);
4781
4782 /* "yt/utilities/lib/fortran_reader.pyx":286
4783 * #temp_data = local_hydro_data.m_var_array[
4784 * # level][8*offset + odind]
4785 * temp_data = level_data[varindex, 8*grid_id + odind] # <<<<<<<<<<<<<<
4786 * else:
4787 * kr_offset = kr + <int> (start_index[0] / ref_factor)
4788 */
4789 __pyx_t_36 = __pyx_v_varindex;
4790 __pyx_t_37 = ((8 * __pyx_v_grid_id) + __pyx_v_odind);
4791 __pyx_v_temp_data = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_level_data.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_level_data.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_level_data.diminfo[1].strides));
4792
4793 /* "yt/utilities/lib/fortran_reader.pyx":281
4794 * #print(offk, filled.shape[2])
4795 * if filled[offi, offj, offk] == 1: continue
4796 * if level > 0: # <<<<<<<<<<<<<<
4797 * odind = (kr*2 + jr)*2 + ir
4798 * # Replace with an ART-specific reader
4799 */
4800 goto __pyx_L23;
4801 }
4802
4803 /* "yt/utilities/lib/fortran_reader.pyx":288
4804 * temp_data = level_data[varindex, 8*grid_id + odind]
4805 * else:
4806 * kr_offset = kr + <int> (start_index[0] / ref_factor) # <<<<<<<<<<<<<<
4807 * jr_offset = jr + <int> (start_index[1] / ref_factor)
4808 * ir_offset = ir + <int> (start_index[2] / ref_factor)
4809 */
4810 /*else*/ {
4811 __pyx_t_38 = 0;
4812 __pyx_v_kr_offset = (__pyx_v_kr + ((int)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_start_index.diminfo[0].strides)) / __pyx_v_ref_factor)));
4813
4814 /* "yt/utilities/lib/fortran_reader.pyx":289
4815 * else:
4816 * kr_offset = kr + <int> (start_index[0] / ref_factor)
4817 * jr_offset = jr + <int> (start_index[1] / ref_factor) # <<<<<<<<<<<<<<
4818 * ir_offset = ir + <int> (start_index[2] / ref_factor)
4819 * odind = (kr_offset * grid_dims[0] + jr_offset)*grid_dims[1] + ir_offset
4820 */
4821 __pyx_t_39 = 1;
4822 __pyx_v_jr_offset = (__pyx_v_jr + ((int)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_start_index.diminfo[0].strides)) / __pyx_v_ref_factor)));
4823
4824 /* "yt/utilities/lib/fortran_reader.pyx":290
4825 * kr_offset = kr + <int> (start_index[0] / ref_factor)
4826 * jr_offset = jr + <int> (start_index[1] / ref_factor)
4827 * ir_offset = ir + <int> (start_index[2] / ref_factor) # <<<<<<<<<<<<<<
4828 * odind = (kr_offset * grid_dims[0] + jr_offset)*grid_dims[1] + ir_offset
4829 * temp_data = level_data[varindex, odind]
4830 */
4831 __pyx_t_40 = 2;
4832 __pyx_v_ir_offset = (__pyx_v_ir + ((int)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_start_index.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_start_index.diminfo[0].strides)) / __pyx_v_ref_factor)));
4833
4834 /* "yt/utilities/lib/fortran_reader.pyx":291
4835 * jr_offset = jr + <int> (start_index[1] / ref_factor)
4836 * ir_offset = ir + <int> (start_index[2] / ref_factor)
4837 * odind = (kr_offset * grid_dims[0] + jr_offset)*grid_dims[1] + ir_offset # <<<<<<<<<<<<<<
4838 * temp_data = level_data[varindex, odind]
4839 * data[offi, offj, offk] = temp_data
4840 */
4841 __pyx_t_41 = 0;
4842 __pyx_t_42 = 1;
4843 __pyx_v_odind = ((((__pyx_v_kr_offset * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_grid_dims.diminfo[0].strides))) + __pyx_v_jr_offset) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_grid_dims.diminfo[0].strides))) + __pyx_v_ir_offset);
4844
4845 /* "yt/utilities/lib/fortran_reader.pyx":292
4846 * ir_offset = ir + <int> (start_index[2] / ref_factor)
4847 * odind = (kr_offset * grid_dims[0] + jr_offset)*grid_dims[1] + ir_offset
4848 * temp_data = level_data[varindex, odind] # <<<<<<<<<<<<<<
4849 * data[offi, offj, offk] = temp_data
4850 * filled[offi, offj, offk] = 1
4851 */
4852 __pyx_t_43 = __pyx_v_varindex;
4853 __pyx_t_44 = __pyx_v_odind;
4854 __pyx_v_temp_data = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_level_data.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_level_data.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_level_data.diminfo[1].strides));
4855 }
4856 __pyx_L23:;
4857
4858 /* "yt/utilities/lib/fortran_reader.pyx":293
4859 * odind = (kr_offset * grid_dims[0] + jr_offset)*grid_dims[1] + ir_offset
4860 * temp_data = level_data[varindex, odind]
4861 * data[offi, offj, offk] = temp_data # <<<<<<<<<<<<<<
4862 * filled[offi, offj, offk] = 1
4863 * to_fill += 1
4864 */
4865 __pyx_t_45 = __pyx_v_offi;
4866 __pyx_t_46 = __pyx_v_offj;
4867 __pyx_t_47 = __pyx_v_offk;
4868 *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_data.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_data.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_data.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_data.diminfo[2].strides) = __pyx_v_temp_data;
4869
4870 /* "yt/utilities/lib/fortran_reader.pyx":294
4871 * temp_data = level_data[varindex, odind]
4872 * data[offi, offj, offk] = temp_data
4873 * filled[offi, offj, offk] = 1 # <<<<<<<<<<<<<<
4874 * to_fill += 1
4875 * return to_fill
4876 */
4877 __pyx_t_48 = __pyx_v_offi;
4878 __pyx_t_49 = __pyx_v_offj;
4879 __pyx_t_50 = __pyx_v_offk;
4880 *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_filled.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_filled.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_filled.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_filled.diminfo[2].strides) = 1;
4881
4882 /* "yt/utilities/lib/fortran_reader.pyx":295
4883 * data[offi, offj, offk] = temp_data
4884 * filled[offi, offj, offk] = 1
4885 * to_fill += 1 # <<<<<<<<<<<<<<
4886 * return to_fill
4887 *
4888 */
4889 __pyx_v_to_fill = (__pyx_v_to_fill + 1);
4890 __pyx_L17_continue:;
4891 }
4892 __pyx_L12_continue:;
4893 }
4894 __pyx_L7_continue:;
4895 }
4896 }
4897
4898 /* "yt/utilities/lib/fortran_reader.pyx":296
4899 * filled[offi, offj, offk] = 1
4900 * to_fill += 1
4901 * return to_fill # <<<<<<<<<<<<<<
4902 *
4903 * @cython.cdivision(True)
4904 */
4905 __Pyx_XDECREF(__pyx_r);
4906 __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_to_fill); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 296, __pyx_L1_error)
4907 __Pyx_GOTREF(__pyx_t_6);
4908 __pyx_r = __pyx_t_6;
4909 __pyx_t_6 = 0;
4910 goto __pyx_L0;
4911
4912 /* "yt/utilities/lib/fortran_reader.pyx":236
4913 * @cython.boundscheck(False)
4914 * @cython.wraparound(False)
4915 * def read_art_grid(int varindex, # <<<<<<<<<<<<<<
4916 * np.ndarray[np.int64_t, ndim=1] start_index,
4917 * np.ndarray[np.int32_t, ndim=1] grid_dims,
4918 */
4919
4920 /* function exit code */
4921 __pyx_L1_error:;
4922 __Pyx_XDECREF(__pyx_t_6);
4923 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4924 __Pyx_PyThreadState_declare
4925 __Pyx_PyThreadState_assign
4926 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4927 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer);
4928 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_filled.rcbuffer->pybuffer);
4929 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_dims.rcbuffer->pybuffer);
4930 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level_data.rcbuffer->pybuffer);
4931 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_og_start_index.rcbuffer->pybuffer);
4932 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer);
4933 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_start_index.rcbuffer->pybuffer);
4934 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4935 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.read_art_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
4936 __pyx_r = NULL;
4937 goto __pyx_L2;
4938 __pyx_L0:;
4939 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_data.rcbuffer->pybuffer);
4940 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_filled.rcbuffer->pybuffer);
4941 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_dims.rcbuffer->pybuffer);
4942 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level_data.rcbuffer->pybuffer);
4943 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_og_start_index.rcbuffer->pybuffer);
4944 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ogrid_info.rcbuffer->pybuffer);
4945 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_start_index.rcbuffer->pybuffer);
4946 __pyx_L2:;
4947 __Pyx_XDECREF((PyObject *)__pyx_v_ogrid_info);
4948 __Pyx_XDECREF((PyObject *)__pyx_v_og_start_index);
4949 __Pyx_XGIVEREF(__pyx_r);
4950 __Pyx_RefNannyFinishContext();
4951 return __pyx_r;
4952 }
4953
4954 /* "yt/utilities/lib/fortran_reader.pyx":301
4955 * @cython.boundscheck(True)
4956 * @cython.wraparound(False)
4957 * def fill_child_mask(np.ndarray[np.int64_t, ndim=2] file_locations, # <<<<<<<<<<<<<<
4958 * np.ndarray[np.int64_t, ndim=1] grid_le,
4959 * np.ndarray[np.uint8_t, ndim=4] art_child_masks,
4960 */
4961
4962 /* Python wrapper */
4963 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_11fill_child_mask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4964 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14fortran_reader_11fill_child_mask = {"fill_child_mask", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14fortran_reader_11fill_child_mask, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14fortran_reader_11fill_child_mask(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4965 static PyObject *__pyx_pw_2yt_9utilities_3lib_14fortran_reader_11fill_child_mask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4966 PyArrayObject *__pyx_v_file_locations = 0;
4967 PyArrayObject *__pyx_v_grid_le = 0;
4968 PyArrayObject *__pyx_v_art_child_masks = 0;
4969 PyArrayObject *__pyx_v_child_mask = 0;
4970 PyObject *__pyx_r = 0;
4971 __Pyx_RefNannyDeclarations
4972 __Pyx_RefNannySetupContext("fill_child_mask (wrapper)", 0);
4973 {
4974 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file_locations,&__pyx_n_s_grid_le,&__pyx_n_s_art_child_masks,&__pyx_n_s_child_mask,0};
4975 PyObject* values[4] = {0,0,0,0};
4976 if (unlikely(__pyx_kwds)) {
4977 Py_ssize_t kw_args;
4978 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4979 switch (pos_args) {
4980 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4981 CYTHON_FALLTHROUGH;
4982 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4983 CYTHON_FALLTHROUGH;
4984 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4985 CYTHON_FALLTHROUGH;
4986 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4987 CYTHON_FALLTHROUGH;
4988 case 0: break;
4989 default: goto __pyx_L5_argtuple_error;
4990 }
4991 kw_args = PyDict_Size(__pyx_kwds);
4992 switch (pos_args) {
4993 case 0:
4994 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_locations)) != 0)) kw_args--;
4995 else goto __pyx_L5_argtuple_error;
4996 CYTHON_FALLTHROUGH;
4997 case 1:
4998 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid_le)) != 0)) kw_args--;
4999 else {
5000 __Pyx_RaiseArgtupleInvalid("fill_child_mask", 1, 4, 4, 1); __PYX_ERR(0, 301, __pyx_L3_error)
5001 }
5002 CYTHON_FALLTHROUGH;
5003 case 2:
5004 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_art_child_masks)) != 0)) kw_args--;
5005 else {
5006 __Pyx_RaiseArgtupleInvalid("fill_child_mask", 1, 4, 4, 2); __PYX_ERR(0, 301, __pyx_L3_error)
5007 }
5008 CYTHON_FALLTHROUGH;
5009 case 3:
5010 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_child_mask)) != 0)) kw_args--;
5011 else {
5012 __Pyx_RaiseArgtupleInvalid("fill_child_mask", 1, 4, 4, 3); __PYX_ERR(0, 301, __pyx_L3_error)
5013 }
5014 }
5015 if (unlikely(kw_args > 0)) {
5016 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_child_mask") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
5017 }
5018 } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
5019 goto __pyx_L5_argtuple_error;
5020 } else {
5021 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5022 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5023 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5024 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5025 }
5026 __pyx_v_file_locations = ((PyArrayObject *)values[0]);
5027 __pyx_v_grid_le = ((PyArrayObject *)values[1]);
5028 __pyx_v_art_child_masks = ((PyArrayObject *)values[2]);
5029 __pyx_v_child_mask = ((PyArrayObject *)values[3]);
5030 }
5031 goto __pyx_L4_argument_unpacking_done;
5032 __pyx_L5_argtuple_error:;
5033 __Pyx_RaiseArgtupleInvalid("fill_child_mask", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
5034 __pyx_L3_error:;
5035 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.fill_child_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
5036 __Pyx_RefNannyFinishContext();
5037 return NULL;
5038 __pyx_L4_argument_unpacking_done:;
5039 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_locations), __pyx_ptype_5numpy_ndarray, 1, "file_locations", 0))) __PYX_ERR(0, 301, __pyx_L1_error)
5040 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_grid_le), __pyx_ptype_5numpy_ndarray, 1, "grid_le", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
5041 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_art_child_masks), __pyx_ptype_5numpy_ndarray, 1, "art_child_masks", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
5042 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_mask), __pyx_ptype_5numpy_ndarray, 1, "child_mask", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
5043 __pyx_r = __pyx_pf_2yt_9utilities_3lib_14fortran_reader_10fill_child_mask(__pyx_self, __pyx_v_file_locations, __pyx_v_grid_le, __pyx_v_art_child_masks, __pyx_v_child_mask);
5044
5045 /* function exit code */
5046 goto __pyx_L0;
5047 __pyx_L1_error:;
5048 __pyx_r = NULL;
5049 __pyx_L0:;
5050 __Pyx_RefNannyFinishContext();
5051 return __pyx_r;
5052 }
5053
__pyx_pf_2yt_9utilities_3lib_14fortran_reader_10fill_child_mask(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_file_locations,PyArrayObject * __pyx_v_grid_le,PyArrayObject * __pyx_v_art_child_masks,PyArrayObject * __pyx_v_child_mask)5054 static PyObject *__pyx_pf_2yt_9utilities_3lib_14fortran_reader_10fill_child_mask(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_file_locations, PyArrayObject *__pyx_v_grid_le, PyArrayObject *__pyx_v_art_child_masks, PyArrayObject *__pyx_v_child_mask) {
5055 int __pyx_v_i;
5056 int __pyx_v_ioct;
5057 int __pyx_v_x;
5058 int __pyx_v_y;
5059 int __pyx_v_z;
5060 int __pyx_v_nocts;
5061 int __pyx_v_lex;
5062 int __pyx_v_ley;
5063 int __pyx_v_lez;
5064 __Pyx_LocalBuf_ND __pyx_pybuffernd_art_child_masks;
5065 __Pyx_Buffer __pyx_pybuffer_art_child_masks;
5066 __Pyx_LocalBuf_ND __pyx_pybuffernd_child_mask;
5067 __Pyx_Buffer __pyx_pybuffer_child_mask;
5068 __Pyx_LocalBuf_ND __pyx_pybuffernd_file_locations;
5069 __Pyx_Buffer __pyx_pybuffer_file_locations;
5070 __Pyx_LocalBuf_ND __pyx_pybuffernd_grid_le;
5071 __Pyx_Buffer __pyx_pybuffer_grid_le;
5072 PyObject *__pyx_r = NULL;
5073 __Pyx_RefNannyDeclarations
5074 int __pyx_t_1;
5075 int __pyx_t_2;
5076 int __pyx_t_3;
5077 Py_ssize_t __pyx_t_4;
5078 Py_ssize_t __pyx_t_5;
5079 int __pyx_t_6;
5080 Py_ssize_t __pyx_t_7;
5081 Py_ssize_t __pyx_t_8;
5082 Py_ssize_t __pyx_t_9;
5083 Py_ssize_t __pyx_t_10;
5084 Py_ssize_t __pyx_t_11;
5085 Py_ssize_t __pyx_t_12;
5086 Py_ssize_t __pyx_t_13;
5087 Py_ssize_t __pyx_t_14;
5088 Py_ssize_t __pyx_t_15;
5089 int __pyx_t_16;
5090 int __pyx_t_17;
5091 Py_ssize_t __pyx_t_18;
5092 Py_ssize_t __pyx_t_19;
5093 Py_ssize_t __pyx_t_20;
5094 Py_ssize_t __pyx_t_21;
5095 int __pyx_t_22;
5096 Py_ssize_t __pyx_t_23;
5097 Py_ssize_t __pyx_t_24;
5098 Py_ssize_t __pyx_t_25;
5099 __Pyx_RefNannySetupContext("fill_child_mask", 0);
5100 __pyx_pybuffer_file_locations.pybuffer.buf = NULL;
5101 __pyx_pybuffer_file_locations.refcount = 0;
5102 __pyx_pybuffernd_file_locations.data = NULL;
5103 __pyx_pybuffernd_file_locations.rcbuffer = &__pyx_pybuffer_file_locations;
5104 __pyx_pybuffer_grid_le.pybuffer.buf = NULL;
5105 __pyx_pybuffer_grid_le.refcount = 0;
5106 __pyx_pybuffernd_grid_le.data = NULL;
5107 __pyx_pybuffernd_grid_le.rcbuffer = &__pyx_pybuffer_grid_le;
5108 __pyx_pybuffer_art_child_masks.pybuffer.buf = NULL;
5109 __pyx_pybuffer_art_child_masks.refcount = 0;
5110 __pyx_pybuffernd_art_child_masks.data = NULL;
5111 __pyx_pybuffernd_art_child_masks.rcbuffer = &__pyx_pybuffer_art_child_masks;
5112 __pyx_pybuffer_child_mask.pybuffer.buf = NULL;
5113 __pyx_pybuffer_child_mask.refcount = 0;
5114 __pyx_pybuffernd_child_mask.data = NULL;
5115 __pyx_pybuffernd_child_mask.rcbuffer = &__pyx_pybuffer_child_mask;
5116 {
5117 __Pyx_BufFmt_StackElem __pyx_stack[1];
5118 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_file_locations.rcbuffer->pybuffer, (PyObject*)__pyx_v_file_locations, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
5119 }
5120 __pyx_pybuffernd_file_locations.diminfo[0].strides = __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_file_locations.diminfo[0].shape = __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_file_locations.diminfo[1].strides = __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_file_locations.diminfo[1].shape = __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.shape[1];
5121 {
5122 __Pyx_BufFmt_StackElem __pyx_stack[1];
5123 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_grid_le.rcbuffer->pybuffer, (PyObject*)__pyx_v_grid_le, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
5124 }
5125 __pyx_pybuffernd_grid_le.diminfo[0].strides = __pyx_pybuffernd_grid_le.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_grid_le.diminfo[0].shape = __pyx_pybuffernd_grid_le.rcbuffer->pybuffer.shape[0];
5126 {
5127 __Pyx_BufFmt_StackElem __pyx_stack[1];
5128 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer, (PyObject*)__pyx_v_art_child_masks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
5129 }
5130 __pyx_pybuffernd_art_child_masks.diminfo[0].strides = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_art_child_masks.diminfo[0].shape = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_art_child_masks.diminfo[1].strides = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_art_child_masks.diminfo[1].shape = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_art_child_masks.diminfo[2].strides = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_art_child_masks.diminfo[2].shape = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_art_child_masks.diminfo[3].strides = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_art_child_masks.diminfo[3].shape = __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.shape[3];
5131 {
5132 __Pyx_BufFmt_StackElem __pyx_stack[1];
5133 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_child_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_child_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
5134 }
5135 __pyx_pybuffernd_child_mask.diminfo[0].strides = __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_child_mask.diminfo[0].shape = __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_child_mask.diminfo[1].strides = __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_child_mask.diminfo[1].shape = __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_child_mask.diminfo[2].strides = __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_child_mask.diminfo[2].shape = __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.shape[2];
5136
5137 /* "yt/utilities/lib/fortran_reader.pyx":310
5138 * #then use the art_child_masks info to fill in child_mask
5139 * cdef int i,ioct,x,y,z
5140 * cdef int nocts = file_locations.shape[0] # <<<<<<<<<<<<<<
5141 * cdef int lex,ley,lez
5142 * for i in range(nocts):
5143 */
5144 __pyx_v_nocts = (__pyx_v_file_locations->dimensions[0]);
5145
5146 /* "yt/utilities/lib/fortran_reader.pyx":312
5147 * cdef int nocts = file_locations.shape[0]
5148 * cdef int lex,ley,lez
5149 * for i in range(nocts): # <<<<<<<<<<<<<<
5150 * ioct = file_locations[i,1] #from fortran to python indexing?
5151 * lex = file_locations[i,3] - grid_le[0] #the oct left edge x
5152 */
5153 __pyx_t_1 = __pyx_v_nocts;
5154 __pyx_t_2 = __pyx_t_1;
5155 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5156 __pyx_v_i = __pyx_t_3;
5157
5158 /* "yt/utilities/lib/fortran_reader.pyx":313
5159 * cdef int lex,ley,lez
5160 * for i in range(nocts):
5161 * ioct = file_locations[i,1] #from fortran to python indexing? # <<<<<<<<<<<<<<
5162 * lex = file_locations[i,3] - grid_le[0] #the oct left edge x
5163 * ley = file_locations[i,4] - grid_le[1]
5164 */
5165 __pyx_t_4 = __pyx_v_i;
5166 __pyx_t_5 = 1;
5167 __pyx_t_6 = -1;
5168 if (__pyx_t_4 < 0) {
5169 __pyx_t_6 = 0;
5170 } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_file_locations.diminfo[0].shape)) __pyx_t_6 = 0;
5171 if (__pyx_t_5 < 0) {
5172 __pyx_t_6 = 1;
5173 } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_file_locations.diminfo[1].shape)) __pyx_t_6 = 1;
5174 if (unlikely(__pyx_t_6 != -1)) {
5175 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5176 __PYX_ERR(0, 313, __pyx_L1_error)
5177 }
5178 __pyx_v_ioct = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_file_locations.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_file_locations.diminfo[1].strides));
5179
5180 /* "yt/utilities/lib/fortran_reader.pyx":314
5181 * for i in range(nocts):
5182 * ioct = file_locations[i,1] #from fortran to python indexing?
5183 * lex = file_locations[i,3] - grid_le[0] #the oct left edge x # <<<<<<<<<<<<<<
5184 * ley = file_locations[i,4] - grid_le[1]
5185 * lez = file_locations[i,5] - grid_le[2]
5186 */
5187 __pyx_t_7 = __pyx_v_i;
5188 __pyx_t_8 = 3;
5189 __pyx_t_6 = -1;
5190 if (__pyx_t_7 < 0) {
5191 __pyx_t_6 = 0;
5192 } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_file_locations.diminfo[0].shape)) __pyx_t_6 = 0;
5193 if (__pyx_t_8 < 0) {
5194 __pyx_t_6 = 1;
5195 } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_file_locations.diminfo[1].shape)) __pyx_t_6 = 1;
5196 if (unlikely(__pyx_t_6 != -1)) {
5197 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5198 __PYX_ERR(0, 314, __pyx_L1_error)
5199 }
5200 __pyx_t_9 = 0;
5201 __pyx_t_6 = -1;
5202 if (__pyx_t_9 < 0) {
5203 __pyx_t_6 = 0;
5204 } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_grid_le.diminfo[0].shape)) __pyx_t_6 = 0;
5205 if (unlikely(__pyx_t_6 != -1)) {
5206 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5207 __PYX_ERR(0, 314, __pyx_L1_error)
5208 }
5209 __pyx_v_lex = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_file_locations.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_file_locations.diminfo[1].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_grid_le.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_grid_le.diminfo[0].strides)));
5210
5211 /* "yt/utilities/lib/fortran_reader.pyx":315
5212 * ioct = file_locations[i,1] #from fortran to python indexing?
5213 * lex = file_locations[i,3] - grid_le[0] #the oct left edge x
5214 * ley = file_locations[i,4] - grid_le[1] # <<<<<<<<<<<<<<
5215 * lez = file_locations[i,5] - grid_le[2]
5216 * for x in range(2):
5217 */
5218 __pyx_t_10 = __pyx_v_i;
5219 __pyx_t_11 = 4;
5220 __pyx_t_6 = -1;
5221 if (__pyx_t_10 < 0) {
5222 __pyx_t_6 = 0;
5223 } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_file_locations.diminfo[0].shape)) __pyx_t_6 = 0;
5224 if (__pyx_t_11 < 0) {
5225 __pyx_t_6 = 1;
5226 } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_file_locations.diminfo[1].shape)) __pyx_t_6 = 1;
5227 if (unlikely(__pyx_t_6 != -1)) {
5228 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5229 __PYX_ERR(0, 315, __pyx_L1_error)
5230 }
5231 __pyx_t_12 = 1;
5232 __pyx_t_6 = -1;
5233 if (__pyx_t_12 < 0) {
5234 __pyx_t_6 = 0;
5235 } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_grid_le.diminfo[0].shape)) __pyx_t_6 = 0;
5236 if (unlikely(__pyx_t_6 != -1)) {
5237 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5238 __PYX_ERR(0, 315, __pyx_L1_error)
5239 }
5240 __pyx_v_ley = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_file_locations.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_file_locations.diminfo[1].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_grid_le.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_grid_le.diminfo[0].strides)));
5241
5242 /* "yt/utilities/lib/fortran_reader.pyx":316
5243 * lex = file_locations[i,3] - grid_le[0] #the oct left edge x
5244 * ley = file_locations[i,4] - grid_le[1]
5245 * lez = file_locations[i,5] - grid_le[2] # <<<<<<<<<<<<<<
5246 * for x in range(2):
5247 * for y in range(2):
5248 */
5249 __pyx_t_13 = __pyx_v_i;
5250 __pyx_t_14 = 5;
5251 __pyx_t_6 = -1;
5252 if (__pyx_t_13 < 0) {
5253 __pyx_t_6 = 0;
5254 } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_file_locations.diminfo[0].shape)) __pyx_t_6 = 0;
5255 if (__pyx_t_14 < 0) {
5256 __pyx_t_6 = 1;
5257 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_file_locations.diminfo[1].shape)) __pyx_t_6 = 1;
5258 if (unlikely(__pyx_t_6 != -1)) {
5259 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5260 __PYX_ERR(0, 316, __pyx_L1_error)
5261 }
5262 __pyx_t_15 = 2;
5263 __pyx_t_6 = -1;
5264 if (__pyx_t_15 < 0) {
5265 __pyx_t_6 = 0;
5266 } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_grid_le.diminfo[0].shape)) __pyx_t_6 = 0;
5267 if (unlikely(__pyx_t_6 != -1)) {
5268 __Pyx_RaiseBufferIndexError(__pyx_t_6);
5269 __PYX_ERR(0, 316, __pyx_L1_error)
5270 }
5271 __pyx_v_lez = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_file_locations.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_file_locations.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_file_locations.diminfo[1].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_grid_le.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_grid_le.diminfo[0].strides)));
5272
5273 /* "yt/utilities/lib/fortran_reader.pyx":317
5274 * ley = file_locations[i,4] - grid_le[1]
5275 * lez = file_locations[i,5] - grid_le[2]
5276 * for x in range(2): # <<<<<<<<<<<<<<
5277 * for y in range(2):
5278 * for z in range(2):
5279 */
5280 for (__pyx_t_6 = 0; __pyx_t_6 < 2; __pyx_t_6+=1) {
5281 __pyx_v_x = __pyx_t_6;
5282
5283 /* "yt/utilities/lib/fortran_reader.pyx":318
5284 * lez = file_locations[i,5] - grid_le[2]
5285 * for x in range(2):
5286 * for y in range(2): # <<<<<<<<<<<<<<
5287 * for z in range(2):
5288 * child_mask[lex+x,ley+y,lez+z] = art_child_masks[ioct,x,y,z]
5289 */
5290 for (__pyx_t_16 = 0; __pyx_t_16 < 2; __pyx_t_16+=1) {
5291 __pyx_v_y = __pyx_t_16;
5292
5293 /* "yt/utilities/lib/fortran_reader.pyx":319
5294 * for x in range(2):
5295 * for y in range(2):
5296 * for z in range(2): # <<<<<<<<<<<<<<
5297 * child_mask[lex+x,ley+y,lez+z] = art_child_masks[ioct,x,y,z]
5298 */
5299 for (__pyx_t_17 = 0; __pyx_t_17 < 2; __pyx_t_17+=1) {
5300 __pyx_v_z = __pyx_t_17;
5301
5302 /* "yt/utilities/lib/fortran_reader.pyx":320
5303 * for y in range(2):
5304 * for z in range(2):
5305 * child_mask[lex+x,ley+y,lez+z] = art_child_masks[ioct,x,y,z] # <<<<<<<<<<<<<<
5306 */
5307 __pyx_t_18 = __pyx_v_ioct;
5308 __pyx_t_19 = __pyx_v_x;
5309 __pyx_t_20 = __pyx_v_y;
5310 __pyx_t_21 = __pyx_v_z;
5311 __pyx_t_22 = -1;
5312 if (__pyx_t_18 < 0) {
5313 __pyx_t_22 = 0;
5314 } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_art_child_masks.diminfo[0].shape)) __pyx_t_22 = 0;
5315 if (__pyx_t_19 < 0) {
5316 __pyx_t_22 = 1;
5317 } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_art_child_masks.diminfo[1].shape)) __pyx_t_22 = 1;
5318 if (__pyx_t_20 < 0) {
5319 __pyx_t_22 = 2;
5320 } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_art_child_masks.diminfo[2].shape)) __pyx_t_22 = 2;
5321 if (__pyx_t_21 < 0) {
5322 __pyx_t_22 = 3;
5323 } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_art_child_masks.diminfo[3].shape)) __pyx_t_22 = 3;
5324 if (unlikely(__pyx_t_22 != -1)) {
5325 __Pyx_RaiseBufferIndexError(__pyx_t_22);
5326 __PYX_ERR(0, 320, __pyx_L1_error)
5327 }
5328 __pyx_t_23 = (__pyx_v_lex + __pyx_v_x);
5329 __pyx_t_24 = (__pyx_v_ley + __pyx_v_y);
5330 __pyx_t_25 = (__pyx_v_lez + __pyx_v_z);
5331 __pyx_t_22 = -1;
5332 if (__pyx_t_23 < 0) {
5333 __pyx_t_22 = 0;
5334 } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_child_mask.diminfo[0].shape)) __pyx_t_22 = 0;
5335 if (__pyx_t_24 < 0) {
5336 __pyx_t_22 = 1;
5337 } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_child_mask.diminfo[1].shape)) __pyx_t_22 = 1;
5338 if (__pyx_t_25 < 0) {
5339 __pyx_t_22 = 2;
5340 } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_child_mask.diminfo[2].shape)) __pyx_t_22 = 2;
5341 if (unlikely(__pyx_t_22 != -1)) {
5342 __Pyx_RaiseBufferIndexError(__pyx_t_22);
5343 __PYX_ERR(0, 320, __pyx_L1_error)
5344 }
5345 *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_child_mask.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_child_mask.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_child_mask.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_child_mask.diminfo[2].strides) = (*__Pyx_BufPtrStrided4d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_art_child_masks.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_art_child_masks.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_art_child_masks.diminfo[2].strides, __pyx_t_21, __pyx_pybuffernd_art_child_masks.diminfo[3].strides));
5346 }
5347 }
5348 }
5349 }
5350
5351 /* "yt/utilities/lib/fortran_reader.pyx":301
5352 * @cython.boundscheck(True)
5353 * @cython.wraparound(False)
5354 * def fill_child_mask(np.ndarray[np.int64_t, ndim=2] file_locations, # <<<<<<<<<<<<<<
5355 * np.ndarray[np.int64_t, ndim=1] grid_le,
5356 * np.ndarray[np.uint8_t, ndim=4] art_child_masks,
5357 */
5358
5359 /* function exit code */
5360 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5361 goto __pyx_L0;
5362 __pyx_L1_error:;
5363 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5364 __Pyx_PyThreadState_declare
5365 __Pyx_PyThreadState_assign
5366 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5367 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer);
5368 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_child_mask.rcbuffer->pybuffer);
5369 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_file_locations.rcbuffer->pybuffer);
5370 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_le.rcbuffer->pybuffer);
5371 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5372 __Pyx_AddTraceback("yt.utilities.lib.fortran_reader.fill_child_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
5373 __pyx_r = NULL;
5374 goto __pyx_L2;
5375 __pyx_L0:;
5376 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_art_child_masks.rcbuffer->pybuffer);
5377 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_child_mask.rcbuffer->pybuffer);
5378 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_file_locations.rcbuffer->pybuffer);
5379 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_grid_le.rcbuffer->pybuffer);
5380 __pyx_L2:;
5381 __Pyx_XGIVEREF(__pyx_r);
5382 __Pyx_RefNannyFinishContext();
5383 return __pyx_r;
5384 }
5385
5386 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
5387 * # experimental exception made for __getbuffer__ and __releasebuffer__
5388 * # -- the details of this may change.
5389 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
5390 * # This implementation of getbuffer is geared towards Cython
5391 * # requirements, and does not yet fulfill the PEP.
5392 */
5393
5394 /* Python wrapper */
5395 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)5396 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5397 int __pyx_r;
5398 __Pyx_RefNannyDeclarations
5399 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
5400 __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
5401
5402 /* function exit code */
5403 __Pyx_RefNannyFinishContext();
5404 return __pyx_r;
5405 }
5406
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)5407 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5408 int __pyx_v_i;
5409 int __pyx_v_ndim;
5410 int __pyx_v_endian_detector;
5411 int __pyx_v_little_endian;
5412 int __pyx_v_t;
5413 char *__pyx_v_f;
5414 PyArray_Descr *__pyx_v_descr = 0;
5415 int __pyx_v_offset;
5416 int __pyx_r;
5417 __Pyx_RefNannyDeclarations
5418 int __pyx_t_1;
5419 int __pyx_t_2;
5420 PyObject *__pyx_t_3 = NULL;
5421 int __pyx_t_4;
5422 int __pyx_t_5;
5423 int __pyx_t_6;
5424 PyArray_Descr *__pyx_t_7;
5425 PyObject *__pyx_t_8 = NULL;
5426 char *__pyx_t_9;
5427 if (__pyx_v_info == NULL) {
5428 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
5429 return -1;
5430 }
5431 __Pyx_RefNannySetupContext("__getbuffer__", 0);
5432 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
5433 __Pyx_GIVEREF(__pyx_v_info->obj);
5434
5435 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
5436 *
5437 * cdef int i, ndim
5438 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
5439 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5440 *
5441 */
5442 __pyx_v_endian_detector = 1;
5443
5444 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
5445 * cdef int i, ndim
5446 * cdef int endian_detector = 1
5447 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
5448 *
5449 * ndim = PyArray_NDIM(self)
5450 */
5451 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
5452
5453 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
5454 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5455 *
5456 * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
5457 *
5458 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5459 */
5460 __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
5461
5462 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
5463 * ndim = PyArray_NDIM(self)
5464 *
5465 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
5466 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5467 * raise ValueError(u"ndarray is not C contiguous")
5468 */
5469 __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
5470 if (__pyx_t_2) {
5471 } else {
5472 __pyx_t_1 = __pyx_t_2;
5473 goto __pyx_L4_bool_binop_done;
5474 }
5475
5476 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
5477 *
5478 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5479 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
5480 * raise ValueError(u"ndarray is not C contiguous")
5481 *
5482 */
5483 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
5484 __pyx_t_1 = __pyx_t_2;
5485 __pyx_L4_bool_binop_done:;
5486
5487 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
5488 * ndim = PyArray_NDIM(self)
5489 *
5490 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
5491 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5492 * raise ValueError(u"ndarray is not C contiguous")
5493 */
5494 if (unlikely(__pyx_t_1)) {
5495
5496 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
5497 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5498 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5499 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
5500 *
5501 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5502 */
5503 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
5504 __Pyx_GOTREF(__pyx_t_3);
5505 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5506 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5507 __PYX_ERR(1, 272, __pyx_L1_error)
5508
5509 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
5510 * ndim = PyArray_NDIM(self)
5511 *
5512 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
5513 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5514 * raise ValueError(u"ndarray is not C contiguous")
5515 */
5516 }
5517
5518 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
5519 * raise ValueError(u"ndarray is not C contiguous")
5520 *
5521 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
5522 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5523 * raise ValueError(u"ndarray is not Fortran contiguous")
5524 */
5525 __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
5526 if (__pyx_t_2) {
5527 } else {
5528 __pyx_t_1 = __pyx_t_2;
5529 goto __pyx_L7_bool_binop_done;
5530 }
5531
5532 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
5533 *
5534 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5535 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
5536 * raise ValueError(u"ndarray is not Fortran contiguous")
5537 *
5538 */
5539 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
5540 __pyx_t_1 = __pyx_t_2;
5541 __pyx_L7_bool_binop_done:;
5542
5543 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
5544 * raise ValueError(u"ndarray is not C contiguous")
5545 *
5546 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
5547 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5548 * raise ValueError(u"ndarray is not Fortran contiguous")
5549 */
5550 if (unlikely(__pyx_t_1)) {
5551
5552 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
5553 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5554 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5555 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
5556 *
5557 * info.buf = PyArray_DATA(self)
5558 */
5559 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
5560 __Pyx_GOTREF(__pyx_t_3);
5561 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5562 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5563 __PYX_ERR(1, 276, __pyx_L1_error)
5564
5565 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
5566 * raise ValueError(u"ndarray is not C contiguous")
5567 *
5568 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
5569 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5570 * raise ValueError(u"ndarray is not Fortran contiguous")
5571 */
5572 }
5573
5574 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
5575 * raise ValueError(u"ndarray is not Fortran contiguous")
5576 *
5577 * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
5578 * info.ndim = ndim
5579 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
5580 */
5581 __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
5582
5583 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
5584 *
5585 * info.buf = PyArray_DATA(self)
5586 * info.ndim = ndim # <<<<<<<<<<<<<<
5587 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
5588 * # Allocate new buffer for strides and shape info.
5589 */
5590 __pyx_v_info->ndim = __pyx_v_ndim;
5591
5592 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
5593 * info.buf = PyArray_DATA(self)
5594 * info.ndim = ndim
5595 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
5596 * # Allocate new buffer for strides and shape info.
5597 * # This is allocated as one block, strides first.
5598 */
5599 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
5600 if (__pyx_t_1) {
5601
5602 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
5603 * # Allocate new buffer for strides and shape info.
5604 * # This is allocated as one block, strides first.
5605 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
5606 * info.shape = info.strides + ndim
5607 * for i in range(ndim):
5608 */
5609 __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
5610
5611 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
5612 * # This is allocated as one block, strides first.
5613 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
5614 * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
5615 * for i in range(ndim):
5616 * info.strides[i] = PyArray_STRIDES(self)[i]
5617 */
5618 __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
5619
5620 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
5621 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
5622 * info.shape = info.strides + ndim
5623 * for i in range(ndim): # <<<<<<<<<<<<<<
5624 * info.strides[i] = PyArray_STRIDES(self)[i]
5625 * info.shape[i] = PyArray_DIMS(self)[i]
5626 */
5627 __pyx_t_4 = __pyx_v_ndim;
5628 __pyx_t_5 = __pyx_t_4;
5629 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
5630 __pyx_v_i = __pyx_t_6;
5631
5632 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
5633 * info.shape = info.strides + ndim
5634 * for i in range(ndim):
5635 * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
5636 * info.shape[i] = PyArray_DIMS(self)[i]
5637 * else:
5638 */
5639 (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
5640
5641 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
5642 * for i in range(ndim):
5643 * info.strides[i] = PyArray_STRIDES(self)[i]
5644 * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
5645 * else:
5646 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5647 */
5648 (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
5649 }
5650
5651 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
5652 * info.buf = PyArray_DATA(self)
5653 * info.ndim = ndim
5654 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
5655 * # Allocate new buffer for strides and shape info.
5656 * # This is allocated as one block, strides first.
5657 */
5658 goto __pyx_L9;
5659 }
5660
5661 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
5662 * info.shape[i] = PyArray_DIMS(self)[i]
5663 * else:
5664 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
5665 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5666 * info.suboffsets = NULL
5667 */
5668 /*else*/ {
5669 __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
5670
5671 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
5672 * else:
5673 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5674 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
5675 * info.suboffsets = NULL
5676 * info.itemsize = PyArray_ITEMSIZE(self)
5677 */
5678 __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
5679 }
5680 __pyx_L9:;
5681
5682 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
5683 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5684 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5685 * info.suboffsets = NULL # <<<<<<<<<<<<<<
5686 * info.itemsize = PyArray_ITEMSIZE(self)
5687 * info.readonly = not PyArray_ISWRITEABLE(self)
5688 */
5689 __pyx_v_info->suboffsets = NULL;
5690
5691 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
5692 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5693 * info.suboffsets = NULL
5694 * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
5695 * info.readonly = not PyArray_ISWRITEABLE(self)
5696 *
5697 */
5698 __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
5699
5700 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
5701 * info.suboffsets = NULL
5702 * info.itemsize = PyArray_ITEMSIZE(self)
5703 * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
5704 *
5705 * cdef int t
5706 */
5707 __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
5708
5709 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
5710 *
5711 * cdef int t
5712 * cdef char* f = NULL # <<<<<<<<<<<<<<
5713 * cdef dtype descr = <dtype>PyArray_DESCR(self)
5714 * cdef int offset
5715 */
5716 __pyx_v_f = NULL;
5717
5718 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
5719 * cdef int t
5720 * cdef char* f = NULL
5721 * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
5722 * cdef int offset
5723 *
5724 */
5725 __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
5726 __pyx_t_3 = ((PyObject *)__pyx_t_7);
5727 __Pyx_INCREF(__pyx_t_3);
5728 __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
5729 __pyx_t_3 = 0;
5730
5731 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
5732 * cdef int offset
5733 *
5734 * info.obj = self # <<<<<<<<<<<<<<
5735 *
5736 * if not PyDataType_HASFIELDS(descr):
5737 */
5738 __Pyx_INCREF(((PyObject *)__pyx_v_self));
5739 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
5740 __Pyx_GOTREF(__pyx_v_info->obj);
5741 __Pyx_DECREF(__pyx_v_info->obj);
5742 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
5743
5744 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
5745 * info.obj = self
5746 *
5747 * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
5748 * t = descr.type_num
5749 * if ((descr.byteorder == c'>' and little_endian) or
5750 */
5751 __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
5752 if (__pyx_t_1) {
5753
5754 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
5755 *
5756 * if not PyDataType_HASFIELDS(descr):
5757 * t = descr.type_num # <<<<<<<<<<<<<<
5758 * if ((descr.byteorder == c'>' and little_endian) or
5759 * (descr.byteorder == c'<' and not little_endian)):
5760 */
5761 __pyx_t_4 = __pyx_v_descr->type_num;
5762 __pyx_v_t = __pyx_t_4;
5763
5764 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
5765 * if not PyDataType_HASFIELDS(descr):
5766 * t = descr.type_num
5767 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5768 * (descr.byteorder == c'<' and not little_endian)):
5769 * raise ValueError(u"Non-native byte order not supported")
5770 */
5771 __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
5772 if (!__pyx_t_2) {
5773 goto __pyx_L15_next_or;
5774 } else {
5775 }
5776 __pyx_t_2 = (__pyx_v_little_endian != 0);
5777 if (!__pyx_t_2) {
5778 } else {
5779 __pyx_t_1 = __pyx_t_2;
5780 goto __pyx_L14_bool_binop_done;
5781 }
5782 __pyx_L15_next_or:;
5783
5784 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
5785 * t = descr.type_num
5786 * if ((descr.byteorder == c'>' and little_endian) or
5787 * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
5788 * raise ValueError(u"Non-native byte order not supported")
5789 * if t == NPY_BYTE: f = "b"
5790 */
5791 __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
5792 if (__pyx_t_2) {
5793 } else {
5794 __pyx_t_1 = __pyx_t_2;
5795 goto __pyx_L14_bool_binop_done;
5796 }
5797 __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
5798 __pyx_t_1 = __pyx_t_2;
5799 __pyx_L14_bool_binop_done:;
5800
5801 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
5802 * if not PyDataType_HASFIELDS(descr):
5803 * t = descr.type_num
5804 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5805 * (descr.byteorder == c'<' and not little_endian)):
5806 * raise ValueError(u"Non-native byte order not supported")
5807 */
5808 if (unlikely(__pyx_t_1)) {
5809
5810 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
5811 * if ((descr.byteorder == c'>' and little_endian) or
5812 * (descr.byteorder == c'<' and not little_endian)):
5813 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
5814 * if t == NPY_BYTE: f = "b"
5815 * elif t == NPY_UBYTE: f = "B"
5816 */
5817 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
5818 __Pyx_GOTREF(__pyx_t_3);
5819 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5820 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5821 __PYX_ERR(1, 306, __pyx_L1_error)
5822
5823 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
5824 * if not PyDataType_HASFIELDS(descr):
5825 * t = descr.type_num
5826 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
5827 * (descr.byteorder == c'<' and not little_endian)):
5828 * raise ValueError(u"Non-native byte order not supported")
5829 */
5830 }
5831
5832 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
5833 * (descr.byteorder == c'<' and not little_endian)):
5834 * raise ValueError(u"Non-native byte order not supported")
5835 * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
5836 * elif t == NPY_UBYTE: f = "B"
5837 * elif t == NPY_SHORT: f = "h"
5838 */
5839 switch (__pyx_v_t) {
5840 case NPY_BYTE:
5841 __pyx_v_f = ((char *)"b");
5842 break;
5843 case NPY_UBYTE:
5844
5845 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
5846 * raise ValueError(u"Non-native byte order not supported")
5847 * if t == NPY_BYTE: f = "b"
5848 * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
5849 * elif t == NPY_SHORT: f = "h"
5850 * elif t == NPY_USHORT: f = "H"
5851 */
5852 __pyx_v_f = ((char *)"B");
5853 break;
5854 case NPY_SHORT:
5855
5856 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
5857 * if t == NPY_BYTE: f = "b"
5858 * elif t == NPY_UBYTE: f = "B"
5859 * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
5860 * elif t == NPY_USHORT: f = "H"
5861 * elif t == NPY_INT: f = "i"
5862 */
5863 __pyx_v_f = ((char *)"h");
5864 break;
5865 case NPY_USHORT:
5866
5867 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
5868 * elif t == NPY_UBYTE: f = "B"
5869 * elif t == NPY_SHORT: f = "h"
5870 * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
5871 * elif t == NPY_INT: f = "i"
5872 * elif t == NPY_UINT: f = "I"
5873 */
5874 __pyx_v_f = ((char *)"H");
5875 break;
5876 case NPY_INT:
5877
5878 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
5879 * elif t == NPY_SHORT: f = "h"
5880 * elif t == NPY_USHORT: f = "H"
5881 * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
5882 * elif t == NPY_UINT: f = "I"
5883 * elif t == NPY_LONG: f = "l"
5884 */
5885 __pyx_v_f = ((char *)"i");
5886 break;
5887 case NPY_UINT:
5888
5889 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
5890 * elif t == NPY_USHORT: f = "H"
5891 * elif t == NPY_INT: f = "i"
5892 * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
5893 * elif t == NPY_LONG: f = "l"
5894 * elif t == NPY_ULONG: f = "L"
5895 */
5896 __pyx_v_f = ((char *)"I");
5897 break;
5898 case NPY_LONG:
5899
5900 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
5901 * elif t == NPY_INT: f = "i"
5902 * elif t == NPY_UINT: f = "I"
5903 * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
5904 * elif t == NPY_ULONG: f = "L"
5905 * elif t == NPY_LONGLONG: f = "q"
5906 */
5907 __pyx_v_f = ((char *)"l");
5908 break;
5909 case NPY_ULONG:
5910
5911 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
5912 * elif t == NPY_UINT: f = "I"
5913 * elif t == NPY_LONG: f = "l"
5914 * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
5915 * elif t == NPY_LONGLONG: f = "q"
5916 * elif t == NPY_ULONGLONG: f = "Q"
5917 */
5918 __pyx_v_f = ((char *)"L");
5919 break;
5920 case NPY_LONGLONG:
5921
5922 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
5923 * elif t == NPY_LONG: f = "l"
5924 * elif t == NPY_ULONG: f = "L"
5925 * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
5926 * elif t == NPY_ULONGLONG: f = "Q"
5927 * elif t == NPY_FLOAT: f = "f"
5928 */
5929 __pyx_v_f = ((char *)"q");
5930 break;
5931 case NPY_ULONGLONG:
5932
5933 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
5934 * elif t == NPY_ULONG: f = "L"
5935 * elif t == NPY_LONGLONG: f = "q"
5936 * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
5937 * elif t == NPY_FLOAT: f = "f"
5938 * elif t == NPY_DOUBLE: f = "d"
5939 */
5940 __pyx_v_f = ((char *)"Q");
5941 break;
5942 case NPY_FLOAT:
5943
5944 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
5945 * elif t == NPY_LONGLONG: f = "q"
5946 * elif t == NPY_ULONGLONG: f = "Q"
5947 * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
5948 * elif t == NPY_DOUBLE: f = "d"
5949 * elif t == NPY_LONGDOUBLE: f = "g"
5950 */
5951 __pyx_v_f = ((char *)"f");
5952 break;
5953 case NPY_DOUBLE:
5954
5955 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
5956 * elif t == NPY_ULONGLONG: f = "Q"
5957 * elif t == NPY_FLOAT: f = "f"
5958 * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
5959 * elif t == NPY_LONGDOUBLE: f = "g"
5960 * elif t == NPY_CFLOAT: f = "Zf"
5961 */
5962 __pyx_v_f = ((char *)"d");
5963 break;
5964 case NPY_LONGDOUBLE:
5965
5966 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
5967 * elif t == NPY_FLOAT: f = "f"
5968 * elif t == NPY_DOUBLE: f = "d"
5969 * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
5970 * elif t == NPY_CFLOAT: f = "Zf"
5971 * elif t == NPY_CDOUBLE: f = "Zd"
5972 */
5973 __pyx_v_f = ((char *)"g");
5974 break;
5975 case NPY_CFLOAT:
5976
5977 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
5978 * elif t == NPY_DOUBLE: f = "d"
5979 * elif t == NPY_LONGDOUBLE: f = "g"
5980 * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
5981 * elif t == NPY_CDOUBLE: f = "Zd"
5982 * elif t == NPY_CLONGDOUBLE: f = "Zg"
5983 */
5984 __pyx_v_f = ((char *)"Zf");
5985 break;
5986 case NPY_CDOUBLE:
5987
5988 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
5989 * elif t == NPY_LONGDOUBLE: f = "g"
5990 * elif t == NPY_CFLOAT: f = "Zf"
5991 * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
5992 * elif t == NPY_CLONGDOUBLE: f = "Zg"
5993 * elif t == NPY_OBJECT: f = "O"
5994 */
5995 __pyx_v_f = ((char *)"Zd");
5996 break;
5997 case NPY_CLONGDOUBLE:
5998
5999 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
6000 * elif t == NPY_CFLOAT: f = "Zf"
6001 * elif t == NPY_CDOUBLE: f = "Zd"
6002 * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
6003 * elif t == NPY_OBJECT: f = "O"
6004 * else:
6005 */
6006 __pyx_v_f = ((char *)"Zg");
6007 break;
6008 case NPY_OBJECT:
6009
6010 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
6011 * elif t == NPY_CDOUBLE: f = "Zd"
6012 * elif t == NPY_CLONGDOUBLE: f = "Zg"
6013 * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
6014 * else:
6015 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6016 */
6017 __pyx_v_f = ((char *)"O");
6018 break;
6019 default:
6020
6021 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
6022 * elif t == NPY_OBJECT: f = "O"
6023 * else:
6024 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
6025 * info.format = f
6026 * return
6027 */
6028 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
6029 __Pyx_GOTREF(__pyx_t_3);
6030 __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
6031 __Pyx_GOTREF(__pyx_t_8);
6032 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6033 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
6034 __Pyx_GOTREF(__pyx_t_3);
6035 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6036 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6037 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6038 __PYX_ERR(1, 325, __pyx_L1_error)
6039 break;
6040 }
6041
6042 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
6043 * else:
6044 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6045 * info.format = f # <<<<<<<<<<<<<<
6046 * return
6047 * else:
6048 */
6049 __pyx_v_info->format = __pyx_v_f;
6050
6051 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
6052 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6053 * info.format = f
6054 * return # <<<<<<<<<<<<<<
6055 * else:
6056 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
6057 */
6058 __pyx_r = 0;
6059 goto __pyx_L0;
6060
6061 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
6062 * info.obj = self
6063 *
6064 * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
6065 * t = descr.type_num
6066 * if ((descr.byteorder == c'>' and little_endian) or
6067 */
6068 }
6069
6070 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
6071 * return
6072 * else:
6073 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
6074 * info.format[0] = c'^' # Native data types, manual alignment
6075 * offset = 0
6076 */
6077 /*else*/ {
6078 __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
6079
6080 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
6081 * else:
6082 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
6083 * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
6084 * offset = 0
6085 * f = _util_dtypestring(descr, info.format + 1,
6086 */
6087 (__pyx_v_info->format[0]) = '^';
6088
6089 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
6090 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
6091 * info.format[0] = c'^' # Native data types, manual alignment
6092 * offset = 0 # <<<<<<<<<<<<<<
6093 * f = _util_dtypestring(descr, info.format + 1,
6094 * info.format + _buffer_format_string_len,
6095 */
6096 __pyx_v_offset = 0;
6097
6098 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
6099 * info.format[0] = c'^' # Native data types, manual alignment
6100 * offset = 0
6101 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
6102 * info.format + _buffer_format_string_len,
6103 * &offset)
6104 */
6105 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
6106 __pyx_v_f = __pyx_t_9;
6107
6108 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
6109 * info.format + _buffer_format_string_len,
6110 * &offset)
6111 * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
6112 *
6113 * def __releasebuffer__(ndarray self, Py_buffer* info):
6114 */
6115 (__pyx_v_f[0]) = '\x00';
6116 }
6117
6118 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
6119 * # experimental exception made for __getbuffer__ and __releasebuffer__
6120 * # -- the details of this may change.
6121 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
6122 * # This implementation of getbuffer is geared towards Cython
6123 * # requirements, and does not yet fulfill the PEP.
6124 */
6125
6126 /* function exit code */
6127 __pyx_r = 0;
6128 goto __pyx_L0;
6129 __pyx_L1_error:;
6130 __Pyx_XDECREF(__pyx_t_3);
6131 __Pyx_XDECREF(__pyx_t_8);
6132 __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6133 __pyx_r = -1;
6134 if (__pyx_v_info->obj != NULL) {
6135 __Pyx_GOTREF(__pyx_v_info->obj);
6136 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6137 }
6138 goto __pyx_L2;
6139 __pyx_L0:;
6140 if (__pyx_v_info->obj == Py_None) {
6141 __Pyx_GOTREF(__pyx_v_info->obj);
6142 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6143 }
6144 __pyx_L2:;
6145 __Pyx_XDECREF((PyObject *)__pyx_v_descr);
6146 __Pyx_RefNannyFinishContext();
6147 return __pyx_r;
6148 }
6149
6150 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
6151 * f[0] = c'\0' # Terminate format string
6152 *
6153 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
6154 * if PyArray_HASFIELDS(self):
6155 * PyObject_Free(info.format)
6156 */
6157
6158 /* Python wrapper */
6159 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
__pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info)6160 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6161 __Pyx_RefNannyDeclarations
6162 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
6163 __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
6164
6165 /* function exit code */
6166 __Pyx_RefNannyFinishContext();
6167 }
6168
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)6169 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6170 __Pyx_RefNannyDeclarations
6171 int __pyx_t_1;
6172 __Pyx_RefNannySetupContext("__releasebuffer__", 0);
6173
6174 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
6175 *
6176 * def __releasebuffer__(ndarray self, Py_buffer* info):
6177 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
6178 * PyObject_Free(info.format)
6179 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6180 */
6181 __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
6182 if (__pyx_t_1) {
6183
6184 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
6185 * def __releasebuffer__(ndarray self, Py_buffer* info):
6186 * if PyArray_HASFIELDS(self):
6187 * PyObject_Free(info.format) # <<<<<<<<<<<<<<
6188 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6189 * PyObject_Free(info.strides)
6190 */
6191 PyObject_Free(__pyx_v_info->format);
6192
6193 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
6194 *
6195 * def __releasebuffer__(ndarray self, Py_buffer* info):
6196 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
6197 * PyObject_Free(info.format)
6198 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6199 */
6200 }
6201
6202 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
6203 * if PyArray_HASFIELDS(self):
6204 * PyObject_Free(info.format)
6205 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
6206 * PyObject_Free(info.strides)
6207 * # info.shape was stored after info.strides in the same block
6208 */
6209 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
6210 if (__pyx_t_1) {
6211
6212 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
6213 * PyObject_Free(info.format)
6214 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
6215 * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
6216 * # info.shape was stored after info.strides in the same block
6217 *
6218 */
6219 PyObject_Free(__pyx_v_info->strides);
6220
6221 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
6222 * if PyArray_HASFIELDS(self):
6223 * PyObject_Free(info.format)
6224 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
6225 * PyObject_Free(info.strides)
6226 * # info.shape was stored after info.strides in the same block
6227 */
6228 }
6229
6230 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
6231 * f[0] = c'\0' # Terminate format string
6232 *
6233 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
6234 * if PyArray_HASFIELDS(self):
6235 * PyObject_Free(info.format)
6236 */
6237
6238 /* function exit code */
6239 __Pyx_RefNannyFinishContext();
6240 }
6241
6242 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
6243 * ctypedef npy_cdouble complex_t
6244 *
6245 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
6246 * return PyArray_MultiIterNew(1, <void*>a)
6247 *
6248 */
6249
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)6250 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6251 PyObject *__pyx_r = NULL;
6252 __Pyx_RefNannyDeclarations
6253 PyObject *__pyx_t_1 = NULL;
6254 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
6255
6256 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
6257 *
6258 * cdef inline object PyArray_MultiIterNew1(a):
6259 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
6260 *
6261 * cdef inline object PyArray_MultiIterNew2(a, b):
6262 */
6263 __Pyx_XDECREF(__pyx_r);
6264 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
6265 __Pyx_GOTREF(__pyx_t_1);
6266 __pyx_r = __pyx_t_1;
6267 __pyx_t_1 = 0;
6268 goto __pyx_L0;
6269
6270 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
6271 * ctypedef npy_cdouble complex_t
6272 *
6273 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
6274 * return PyArray_MultiIterNew(1, <void*>a)
6275 *
6276 */
6277
6278 /* function exit code */
6279 __pyx_L1_error:;
6280 __Pyx_XDECREF(__pyx_t_1);
6281 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6282 __pyx_r = 0;
6283 __pyx_L0:;
6284 __Pyx_XGIVEREF(__pyx_r);
6285 __Pyx_RefNannyFinishContext();
6286 return __pyx_r;
6287 }
6288
6289 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
6290 * return PyArray_MultiIterNew(1, <void*>a)
6291 *
6292 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
6293 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6294 *
6295 */
6296
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)6297 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6298 PyObject *__pyx_r = NULL;
6299 __Pyx_RefNannyDeclarations
6300 PyObject *__pyx_t_1 = NULL;
6301 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
6302
6303 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
6304 *
6305 * cdef inline object PyArray_MultiIterNew2(a, b):
6306 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
6307 *
6308 * cdef inline object PyArray_MultiIterNew3(a, b, c):
6309 */
6310 __Pyx_XDECREF(__pyx_r);
6311 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
6312 __Pyx_GOTREF(__pyx_t_1);
6313 __pyx_r = __pyx_t_1;
6314 __pyx_t_1 = 0;
6315 goto __pyx_L0;
6316
6317 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
6318 * return PyArray_MultiIterNew(1, <void*>a)
6319 *
6320 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
6321 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6322 *
6323 */
6324
6325 /* function exit code */
6326 __pyx_L1_error:;
6327 __Pyx_XDECREF(__pyx_t_1);
6328 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6329 __pyx_r = 0;
6330 __pyx_L0:;
6331 __Pyx_XGIVEREF(__pyx_r);
6332 __Pyx_RefNannyFinishContext();
6333 return __pyx_r;
6334 }
6335
6336 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
6337 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6338 *
6339 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
6340 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6341 *
6342 */
6343
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)6344 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6345 PyObject *__pyx_r = NULL;
6346 __Pyx_RefNannyDeclarations
6347 PyObject *__pyx_t_1 = NULL;
6348 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
6349
6350 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
6351 *
6352 * cdef inline object PyArray_MultiIterNew3(a, b, c):
6353 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
6354 *
6355 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6356 */
6357 __Pyx_XDECREF(__pyx_r);
6358 __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, 828, __pyx_L1_error)
6359 __Pyx_GOTREF(__pyx_t_1);
6360 __pyx_r = __pyx_t_1;
6361 __pyx_t_1 = 0;
6362 goto __pyx_L0;
6363
6364 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
6365 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6366 *
6367 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
6368 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6369 *
6370 */
6371
6372 /* function exit code */
6373 __pyx_L1_error:;
6374 __Pyx_XDECREF(__pyx_t_1);
6375 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6376 __pyx_r = 0;
6377 __pyx_L0:;
6378 __Pyx_XGIVEREF(__pyx_r);
6379 __Pyx_RefNannyFinishContext();
6380 return __pyx_r;
6381 }
6382
6383 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
6384 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6385 *
6386 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
6387 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6388 *
6389 */
6390
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)6391 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) {
6392 PyObject *__pyx_r = NULL;
6393 __Pyx_RefNannyDeclarations
6394 PyObject *__pyx_t_1 = NULL;
6395 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
6396
6397 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
6398 *
6399 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6400 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
6401 *
6402 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6403 */
6404 __Pyx_XDECREF(__pyx_r);
6405 __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, 831, __pyx_L1_error)
6406 __Pyx_GOTREF(__pyx_t_1);
6407 __pyx_r = __pyx_t_1;
6408 __pyx_t_1 = 0;
6409 goto __pyx_L0;
6410
6411 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
6412 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6413 *
6414 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
6415 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6416 *
6417 */
6418
6419 /* function exit code */
6420 __pyx_L1_error:;
6421 __Pyx_XDECREF(__pyx_t_1);
6422 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6423 __pyx_r = 0;
6424 __pyx_L0:;
6425 __Pyx_XGIVEREF(__pyx_r);
6426 __Pyx_RefNannyFinishContext();
6427 return __pyx_r;
6428 }
6429
6430 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
6431 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6432 *
6433 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
6434 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6435 *
6436 */
6437
__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)6438 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) {
6439 PyObject *__pyx_r = NULL;
6440 __Pyx_RefNannyDeclarations
6441 PyObject *__pyx_t_1 = NULL;
6442 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
6443
6444 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
6445 *
6446 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6447 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
6448 *
6449 * cdef inline tuple PyDataType_SHAPE(dtype d):
6450 */
6451 __Pyx_XDECREF(__pyx_r);
6452 __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, 834, __pyx_L1_error)
6453 __Pyx_GOTREF(__pyx_t_1);
6454 __pyx_r = __pyx_t_1;
6455 __pyx_t_1 = 0;
6456 goto __pyx_L0;
6457
6458 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
6459 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6460 *
6461 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
6462 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6463 *
6464 */
6465
6466 /* function exit code */
6467 __pyx_L1_error:;
6468 __Pyx_XDECREF(__pyx_t_1);
6469 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6470 __pyx_r = 0;
6471 __pyx_L0:;
6472 __Pyx_XGIVEREF(__pyx_r);
6473 __Pyx_RefNannyFinishContext();
6474 return __pyx_r;
6475 }
6476
6477 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
6478 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6479 *
6480 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
6481 * if PyDataType_HASSUBARRAY(d):
6482 * return <tuple>d.subarray.shape
6483 */
6484
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)6485 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6486 PyObject *__pyx_r = NULL;
6487 __Pyx_RefNannyDeclarations
6488 int __pyx_t_1;
6489 __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
6490
6491 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
6492 *
6493 * cdef inline tuple PyDataType_SHAPE(dtype d):
6494 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
6495 * return <tuple>d.subarray.shape
6496 * else:
6497 */
6498 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6499 if (__pyx_t_1) {
6500
6501 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
6502 * cdef inline tuple PyDataType_SHAPE(dtype d):
6503 * if PyDataType_HASSUBARRAY(d):
6504 * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
6505 * else:
6506 * return ()
6507 */
6508 __Pyx_XDECREF(__pyx_r);
6509 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6510 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6511 goto __pyx_L0;
6512
6513 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
6514 *
6515 * cdef inline tuple PyDataType_SHAPE(dtype d):
6516 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
6517 * return <tuple>d.subarray.shape
6518 * else:
6519 */
6520 }
6521
6522 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
6523 * return <tuple>d.subarray.shape
6524 * else:
6525 * return () # <<<<<<<<<<<<<<
6526 *
6527 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
6528 */
6529 /*else*/ {
6530 __Pyx_XDECREF(__pyx_r);
6531 __Pyx_INCREF(__pyx_empty_tuple);
6532 __pyx_r = __pyx_empty_tuple;
6533 goto __pyx_L0;
6534 }
6535
6536 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
6537 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6538 *
6539 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
6540 * if PyDataType_HASSUBARRAY(d):
6541 * return <tuple>d.subarray.shape
6542 */
6543
6544 /* function exit code */
6545 __pyx_L0:;
6546 __Pyx_XGIVEREF(__pyx_r);
6547 __Pyx_RefNannyFinishContext();
6548 return __pyx_r;
6549 }
6550
6551 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
6552 * return ()
6553 *
6554 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
6555 * # Recursive utility function used in __getbuffer__ to get format
6556 * # string. The new location in the format string is returned.
6557 */
6558
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)6559 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
6560 PyArray_Descr *__pyx_v_child = 0;
6561 int __pyx_v_endian_detector;
6562 int __pyx_v_little_endian;
6563 PyObject *__pyx_v_fields = 0;
6564 PyObject *__pyx_v_childname = NULL;
6565 PyObject *__pyx_v_new_offset = NULL;
6566 PyObject *__pyx_v_t = NULL;
6567 char *__pyx_r;
6568 __Pyx_RefNannyDeclarations
6569 PyObject *__pyx_t_1 = NULL;
6570 Py_ssize_t __pyx_t_2;
6571 PyObject *__pyx_t_3 = NULL;
6572 PyObject *__pyx_t_4 = NULL;
6573 int __pyx_t_5;
6574 int __pyx_t_6;
6575 int __pyx_t_7;
6576 long __pyx_t_8;
6577 char *__pyx_t_9;
6578 __Pyx_RefNannySetupContext("_util_dtypestring", 0);
6579
6580 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
6581 *
6582 * cdef dtype child
6583 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
6584 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
6585 * cdef tuple fields
6586 */
6587 __pyx_v_endian_detector = 1;
6588
6589 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
6590 * cdef dtype child
6591 * cdef int endian_detector = 1
6592 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
6593 * cdef tuple fields
6594 *
6595 */
6596 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
6597
6598 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
6599 * cdef tuple fields
6600 *
6601 * for childname in descr.names: # <<<<<<<<<<<<<<
6602 * fields = descr.fields[childname]
6603 * child, new_offset = fields
6604 */
6605 if (unlikely(__pyx_v_descr->names == Py_None)) {
6606 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
6607 __PYX_ERR(1, 851, __pyx_L1_error)
6608 }
6609 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6610 for (;;) {
6611 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6612 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6613 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
6614 #else
6615 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
6616 __Pyx_GOTREF(__pyx_t_3);
6617 #endif
6618 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
6619 __pyx_t_3 = 0;
6620
6621 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
6622 *
6623 * for childname in descr.names:
6624 * fields = descr.fields[childname] # <<<<<<<<<<<<<<
6625 * child, new_offset = fields
6626 *
6627 */
6628 if (unlikely(__pyx_v_descr->fields == Py_None)) {
6629 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6630 __PYX_ERR(1, 852, __pyx_L1_error)
6631 }
6632 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
6633 __Pyx_GOTREF(__pyx_t_3);
6634 if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
6635 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
6636 __pyx_t_3 = 0;
6637
6638 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
6639 * for childname in descr.names:
6640 * fields = descr.fields[childname]
6641 * child, new_offset = fields # <<<<<<<<<<<<<<
6642 *
6643 * if (end - f) - <int>(new_offset - offset[0]) < 15:
6644 */
6645 if (likely(__pyx_v_fields != Py_None)) {
6646 PyObject* sequence = __pyx_v_fields;
6647 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6648 if (unlikely(size != 2)) {
6649 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6650 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6651 __PYX_ERR(1, 853, __pyx_L1_error)
6652 }
6653 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6654 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
6655 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
6656 __Pyx_INCREF(__pyx_t_3);
6657 __Pyx_INCREF(__pyx_t_4);
6658 #else
6659 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
6660 __Pyx_GOTREF(__pyx_t_3);
6661 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
6662 __Pyx_GOTREF(__pyx_t_4);
6663 #endif
6664 } else {
6665 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
6666 }
6667 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
6668 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
6669 __pyx_t_3 = 0;
6670 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
6671 __pyx_t_4 = 0;
6672
6673 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
6674 * child, new_offset = fields
6675 *
6676 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
6677 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6678 *
6679 */
6680 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
6681 __Pyx_GOTREF(__pyx_t_4);
6682 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
6683 __Pyx_GOTREF(__pyx_t_3);
6684 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6685 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
6686 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6687 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
6688 if (unlikely(__pyx_t_6)) {
6689
6690 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
6691 *
6692 * if (end - f) - <int>(new_offset - offset[0]) < 15:
6693 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
6694 *
6695 * if ((child.byteorder == c'>' and little_endian) or
6696 */
6697 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
6698 __Pyx_GOTREF(__pyx_t_3);
6699 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6700 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6701 __PYX_ERR(1, 856, __pyx_L1_error)
6702
6703 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
6704 * child, new_offset = fields
6705 *
6706 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
6707 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6708 *
6709 */
6710 }
6711
6712 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
6713 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6714 *
6715 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
6716 * (child.byteorder == c'<' and not little_endian)):
6717 * raise ValueError(u"Non-native byte order not supported")
6718 */
6719 __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
6720 if (!__pyx_t_7) {
6721 goto __pyx_L8_next_or;
6722 } else {
6723 }
6724 __pyx_t_7 = (__pyx_v_little_endian != 0);
6725 if (!__pyx_t_7) {
6726 } else {
6727 __pyx_t_6 = __pyx_t_7;
6728 goto __pyx_L7_bool_binop_done;
6729 }
6730 __pyx_L8_next_or:;
6731
6732 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
6733 *
6734 * if ((child.byteorder == c'>' and little_endian) or
6735 * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
6736 * raise ValueError(u"Non-native byte order not supported")
6737 * # One could encode it in the format string and have Cython
6738 */
6739 __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
6740 if (__pyx_t_7) {
6741 } else {
6742 __pyx_t_6 = __pyx_t_7;
6743 goto __pyx_L7_bool_binop_done;
6744 }
6745 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
6746 __pyx_t_6 = __pyx_t_7;
6747 __pyx_L7_bool_binop_done:;
6748
6749 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
6750 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6751 *
6752 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
6753 * (child.byteorder == c'<' and not little_endian)):
6754 * raise ValueError(u"Non-native byte order not supported")
6755 */
6756 if (unlikely(__pyx_t_6)) {
6757
6758 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
6759 * if ((child.byteorder == c'>' and little_endian) or
6760 * (child.byteorder == c'<' and not little_endian)):
6761 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
6762 * # One could encode it in the format string and have Cython
6763 * # complain instead, BUT: < and > in format strings also imply
6764 */
6765 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
6766 __Pyx_GOTREF(__pyx_t_3);
6767 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6768 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6769 __PYX_ERR(1, 860, __pyx_L1_error)
6770
6771 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
6772 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6773 *
6774 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
6775 * (child.byteorder == c'<' and not little_endian)):
6776 * raise ValueError(u"Non-native byte order not supported")
6777 */
6778 }
6779
6780 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
6781 *
6782 * # Output padding bytes
6783 * while offset[0] < new_offset: # <<<<<<<<<<<<<<
6784 * f[0] = 120 # "x"; pad byte
6785 * f += 1
6786 */
6787 while (1) {
6788 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
6789 __Pyx_GOTREF(__pyx_t_3);
6790 __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
6791 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6792 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
6793 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6794 if (!__pyx_t_6) break;
6795
6796 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
6797 * # Output padding bytes
6798 * while offset[0] < new_offset:
6799 * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
6800 * f += 1
6801 * offset[0] += 1
6802 */
6803 (__pyx_v_f[0]) = 0x78;
6804
6805 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
6806 * while offset[0] < new_offset:
6807 * f[0] = 120 # "x"; pad byte
6808 * f += 1 # <<<<<<<<<<<<<<
6809 * offset[0] += 1
6810 *
6811 */
6812 __pyx_v_f = (__pyx_v_f + 1);
6813
6814 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
6815 * f[0] = 120 # "x"; pad byte
6816 * f += 1
6817 * offset[0] += 1 # <<<<<<<<<<<<<<
6818 *
6819 * offset[0] += child.itemsize
6820 */
6821 __pyx_t_8 = 0;
6822 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
6823 }
6824
6825 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
6826 * offset[0] += 1
6827 *
6828 * offset[0] += child.itemsize # <<<<<<<<<<<<<<
6829 *
6830 * if not PyDataType_HASFIELDS(child):
6831 */
6832 __pyx_t_8 = 0;
6833 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
6834
6835 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
6836 * offset[0] += child.itemsize
6837 *
6838 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
6839 * t = child.type_num
6840 * if end - f < 5:
6841 */
6842 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
6843 if (__pyx_t_6) {
6844
6845 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
6846 *
6847 * if not PyDataType_HASFIELDS(child):
6848 * t = child.type_num # <<<<<<<<<<<<<<
6849 * if end - f < 5:
6850 * raise RuntimeError(u"Format string allocated too short.")
6851 */
6852 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
6853 __Pyx_GOTREF(__pyx_t_4);
6854 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
6855 __pyx_t_4 = 0;
6856
6857 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
6858 * if not PyDataType_HASFIELDS(child):
6859 * t = child.type_num
6860 * if end - f < 5: # <<<<<<<<<<<<<<
6861 * raise RuntimeError(u"Format string allocated too short.")
6862 *
6863 */
6864 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
6865 if (unlikely(__pyx_t_6)) {
6866
6867 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
6868 * t = child.type_num
6869 * if end - f < 5:
6870 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
6871 *
6872 * # Until ticket #99 is fixed, use integers to avoid warnings
6873 */
6874 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
6875 __Pyx_GOTREF(__pyx_t_4);
6876 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6877 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6878 __PYX_ERR(1, 880, __pyx_L1_error)
6879
6880 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
6881 * if not PyDataType_HASFIELDS(child):
6882 * t = child.type_num
6883 * if end - f < 5: # <<<<<<<<<<<<<<
6884 * raise RuntimeError(u"Format string allocated too short.")
6885 *
6886 */
6887 }
6888
6889 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
6890 *
6891 * # Until ticket #99 is fixed, use integers to avoid warnings
6892 * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
6893 * elif t == NPY_UBYTE: f[0] = 66 #"B"
6894 * elif t == NPY_SHORT: f[0] = 104 #"h"
6895 */
6896 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
6897 __Pyx_GOTREF(__pyx_t_4);
6898 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
6899 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6900 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
6901 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6902 if (__pyx_t_6) {
6903 (__pyx_v_f[0]) = 98;
6904 goto __pyx_L15;
6905 }
6906
6907 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
6908 * # Until ticket #99 is fixed, use integers to avoid warnings
6909 * if t == NPY_BYTE: f[0] = 98 #"b"
6910 * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
6911 * elif t == NPY_SHORT: f[0] = 104 #"h"
6912 * elif t == NPY_USHORT: f[0] = 72 #"H"
6913 */
6914 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
6915 __Pyx_GOTREF(__pyx_t_3);
6916 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
6917 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6918 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
6919 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6920 if (__pyx_t_6) {
6921 (__pyx_v_f[0]) = 66;
6922 goto __pyx_L15;
6923 }
6924
6925 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
6926 * if t == NPY_BYTE: f[0] = 98 #"b"
6927 * elif t == NPY_UBYTE: f[0] = 66 #"B"
6928 * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
6929 * elif t == NPY_USHORT: f[0] = 72 #"H"
6930 * elif t == NPY_INT: f[0] = 105 #"i"
6931 */
6932 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
6933 __Pyx_GOTREF(__pyx_t_4);
6934 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
6935 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6936 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
6937 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6938 if (__pyx_t_6) {
6939 (__pyx_v_f[0]) = 0x68;
6940 goto __pyx_L15;
6941 }
6942
6943 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
6944 * elif t == NPY_UBYTE: f[0] = 66 #"B"
6945 * elif t == NPY_SHORT: f[0] = 104 #"h"
6946 * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
6947 * elif t == NPY_INT: f[0] = 105 #"i"
6948 * elif t == NPY_UINT: f[0] = 73 #"I"
6949 */
6950 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
6951 __Pyx_GOTREF(__pyx_t_3);
6952 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
6953 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6954 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
6955 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6956 if (__pyx_t_6) {
6957 (__pyx_v_f[0]) = 72;
6958 goto __pyx_L15;
6959 }
6960
6961 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
6962 * elif t == NPY_SHORT: f[0] = 104 #"h"
6963 * elif t == NPY_USHORT: f[0] = 72 #"H"
6964 * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
6965 * elif t == NPY_UINT: f[0] = 73 #"I"
6966 * elif t == NPY_LONG: f[0] = 108 #"l"
6967 */
6968 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
6969 __Pyx_GOTREF(__pyx_t_4);
6970 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
6971 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6972 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
6973 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6974 if (__pyx_t_6) {
6975 (__pyx_v_f[0]) = 0x69;
6976 goto __pyx_L15;
6977 }
6978
6979 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
6980 * elif t == NPY_USHORT: f[0] = 72 #"H"
6981 * elif t == NPY_INT: f[0] = 105 #"i"
6982 * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
6983 * elif t == NPY_LONG: f[0] = 108 #"l"
6984 * elif t == NPY_ULONG: f[0] = 76 #"L"
6985 */
6986 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
6987 __Pyx_GOTREF(__pyx_t_3);
6988 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
6989 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6990 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
6991 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6992 if (__pyx_t_6) {
6993 (__pyx_v_f[0]) = 73;
6994 goto __pyx_L15;
6995 }
6996
6997 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
6998 * elif t == NPY_INT: f[0] = 105 #"i"
6999 * elif t == NPY_UINT: f[0] = 73 #"I"
7000 * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
7001 * elif t == NPY_ULONG: f[0] = 76 #"L"
7002 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7003 */
7004 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
7005 __Pyx_GOTREF(__pyx_t_4);
7006 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
7007 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7008 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
7009 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7010 if (__pyx_t_6) {
7011 (__pyx_v_f[0]) = 0x6C;
7012 goto __pyx_L15;
7013 }
7014
7015 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
7016 * elif t == NPY_UINT: f[0] = 73 #"I"
7017 * elif t == NPY_LONG: f[0] = 108 #"l"
7018 * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
7019 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7020 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7021 */
7022 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
7023 __Pyx_GOTREF(__pyx_t_3);
7024 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
7025 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7026 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
7027 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7028 if (__pyx_t_6) {
7029 (__pyx_v_f[0]) = 76;
7030 goto __pyx_L15;
7031 }
7032
7033 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
7034 * elif t == NPY_LONG: f[0] = 108 #"l"
7035 * elif t == NPY_ULONG: f[0] = 76 #"L"
7036 * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
7037 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7038 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7039 */
7040 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
7041 __Pyx_GOTREF(__pyx_t_4);
7042 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
7043 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7044 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
7045 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7046 if (__pyx_t_6) {
7047 (__pyx_v_f[0]) = 0x71;
7048 goto __pyx_L15;
7049 }
7050
7051 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
7052 * elif t == NPY_ULONG: f[0] = 76 #"L"
7053 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7054 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
7055 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7056 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7057 */
7058 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
7059 __Pyx_GOTREF(__pyx_t_3);
7060 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
7061 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7062 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
7063 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7064 if (__pyx_t_6) {
7065 (__pyx_v_f[0]) = 81;
7066 goto __pyx_L15;
7067 }
7068
7069 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
7070 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
7071 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7072 * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
7073 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7074 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7075 */
7076 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
7077 __Pyx_GOTREF(__pyx_t_4);
7078 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
7079 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7080 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
7081 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7082 if (__pyx_t_6) {
7083 (__pyx_v_f[0]) = 0x66;
7084 goto __pyx_L15;
7085 }
7086
7087 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
7088 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
7089 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7090 * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
7091 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7092 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7093 */
7094 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
7095 __Pyx_GOTREF(__pyx_t_3);
7096 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
7097 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7098 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
7099 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7100 if (__pyx_t_6) {
7101 (__pyx_v_f[0]) = 0x64;
7102 goto __pyx_L15;
7103 }
7104
7105 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
7106 * elif t == NPY_FLOAT: f[0] = 102 #"f"
7107 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7108 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
7109 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7110 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7111 */
7112 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
7113 __Pyx_GOTREF(__pyx_t_4);
7114 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
7115 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7116 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
7117 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7118 if (__pyx_t_6) {
7119 (__pyx_v_f[0]) = 0x67;
7120 goto __pyx_L15;
7121 }
7122
7123 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
7124 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
7125 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7126 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
7127 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7128 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7129 */
7130 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
7131 __Pyx_GOTREF(__pyx_t_3);
7132 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
7133 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7134 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
7135 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7136 if (__pyx_t_6) {
7137 (__pyx_v_f[0]) = 90;
7138 (__pyx_v_f[1]) = 0x66;
7139 __pyx_v_f = (__pyx_v_f + 1);
7140 goto __pyx_L15;
7141 }
7142
7143 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
7144 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
7145 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7146 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
7147 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7148 * elif t == NPY_OBJECT: f[0] = 79 #"O"
7149 */
7150 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
7151 __Pyx_GOTREF(__pyx_t_4);
7152 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
7153 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7154 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
7155 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7156 if (__pyx_t_6) {
7157 (__pyx_v_f[0]) = 90;
7158 (__pyx_v_f[1]) = 0x64;
7159 __pyx_v_f = (__pyx_v_f + 1);
7160 goto __pyx_L15;
7161 }
7162
7163 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
7164 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
7165 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7166 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
7167 * elif t == NPY_OBJECT: f[0] = 79 #"O"
7168 * else:
7169 */
7170 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
7171 __Pyx_GOTREF(__pyx_t_3);
7172 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
7173 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7174 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
7175 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7176 if (__pyx_t_6) {
7177 (__pyx_v_f[0]) = 90;
7178 (__pyx_v_f[1]) = 0x67;
7179 __pyx_v_f = (__pyx_v_f + 1);
7180 goto __pyx_L15;
7181 }
7182
7183 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
7184 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
7185 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7186 * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
7187 * else:
7188 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7189 */
7190 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
7191 __Pyx_GOTREF(__pyx_t_4);
7192 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
7193 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7194 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
7195 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7196 if (likely(__pyx_t_6)) {
7197 (__pyx_v_f[0]) = 79;
7198 goto __pyx_L15;
7199 }
7200
7201 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
7202 * elif t == NPY_OBJECT: f[0] = 79 #"O"
7203 * else:
7204 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
7205 * f += 1
7206 * else:
7207 */
7208 /*else*/ {
7209 __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
7210 __Pyx_GOTREF(__pyx_t_3);
7211 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
7212 __Pyx_GOTREF(__pyx_t_4);
7213 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7214 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7215 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7216 __PYX_ERR(1, 901, __pyx_L1_error)
7217 }
7218 __pyx_L15:;
7219
7220 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
7221 * else:
7222 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7223 * f += 1 # <<<<<<<<<<<<<<
7224 * else:
7225 * # Cython ignores struct boundary information ("T{...}"),
7226 */
7227 __pyx_v_f = (__pyx_v_f + 1);
7228
7229 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
7230 * offset[0] += child.itemsize
7231 *
7232 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
7233 * t = child.type_num
7234 * if end - f < 5:
7235 */
7236 goto __pyx_L13;
7237 }
7238
7239 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
7240 * # Cython ignores struct boundary information ("T{...}"),
7241 * # so don't output it
7242 * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
7243 * return f
7244 *
7245 */
7246 /*else*/ {
7247 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
7248 __pyx_v_f = __pyx_t_9;
7249 }
7250 __pyx_L13:;
7251
7252 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
7253 * cdef tuple fields
7254 *
7255 * for childname in descr.names: # <<<<<<<<<<<<<<
7256 * fields = descr.fields[childname]
7257 * child, new_offset = fields
7258 */
7259 }
7260 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7261
7262 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
7263 * # so don't output it
7264 * f = _util_dtypestring(child, f, end, offset)
7265 * return f # <<<<<<<<<<<<<<
7266 *
7267 *
7268 */
7269 __pyx_r = __pyx_v_f;
7270 goto __pyx_L0;
7271
7272 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
7273 * return ()
7274 *
7275 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
7276 * # Recursive utility function used in __getbuffer__ to get format
7277 * # string. The new location in the format string is returned.
7278 */
7279
7280 /* function exit code */
7281 __pyx_L1_error:;
7282 __Pyx_XDECREF(__pyx_t_1);
7283 __Pyx_XDECREF(__pyx_t_3);
7284 __Pyx_XDECREF(__pyx_t_4);
7285 __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
7286 __pyx_r = NULL;
7287 __pyx_L0:;
7288 __Pyx_XDECREF((PyObject *)__pyx_v_child);
7289 __Pyx_XDECREF(__pyx_v_fields);
7290 __Pyx_XDECREF(__pyx_v_childname);
7291 __Pyx_XDECREF(__pyx_v_new_offset);
7292 __Pyx_XDECREF(__pyx_v_t);
7293 __Pyx_RefNannyFinishContext();
7294 return __pyx_r;
7295 }
7296
7297 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
7298 * int _import_umath() except -1
7299 *
7300 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
7301 * Py_INCREF(base) # important to do this before stealing the reference below!
7302 * PyArray_SetBaseObject(arr, base)
7303 */
7304
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)7305 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7306 __Pyx_RefNannyDeclarations
7307 __Pyx_RefNannySetupContext("set_array_base", 0);
7308
7309 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
7310 *
7311 * cdef inline void set_array_base(ndarray arr, object base):
7312 * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
7313 * PyArray_SetBaseObject(arr, base)
7314 *
7315 */
7316 Py_INCREF(__pyx_v_base);
7317
7318 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
7319 * cdef inline void set_array_base(ndarray arr, object base):
7320 * Py_INCREF(base) # important to do this before stealing the reference below!
7321 * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
7322 *
7323 * cdef inline object get_array_base(ndarray arr):
7324 */
7325 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
7326
7327 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
7328 * int _import_umath() except -1
7329 *
7330 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
7331 * Py_INCREF(base) # important to do this before stealing the reference below!
7332 * PyArray_SetBaseObject(arr, base)
7333 */
7334
7335 /* function exit code */
7336 __Pyx_RefNannyFinishContext();
7337 }
7338
7339 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
7340 * PyArray_SetBaseObject(arr, base)
7341 *
7342 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
7343 * base = PyArray_BASE(arr)
7344 * if base is NULL:
7345 */
7346
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)7347 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7348 PyObject *__pyx_v_base;
7349 PyObject *__pyx_r = NULL;
7350 __Pyx_RefNannyDeclarations
7351 int __pyx_t_1;
7352 __Pyx_RefNannySetupContext("get_array_base", 0);
7353
7354 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
7355 *
7356 * cdef inline object get_array_base(ndarray arr):
7357 * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
7358 * if base is NULL:
7359 * return None
7360 */
7361 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
7362
7363 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
7364 * cdef inline object get_array_base(ndarray arr):
7365 * base = PyArray_BASE(arr)
7366 * if base is NULL: # <<<<<<<<<<<<<<
7367 * return None
7368 * return <object>base
7369 */
7370 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
7371 if (__pyx_t_1) {
7372
7373 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
7374 * base = PyArray_BASE(arr)
7375 * if base is NULL:
7376 * return None # <<<<<<<<<<<<<<
7377 * return <object>base
7378 *
7379 */
7380 __Pyx_XDECREF(__pyx_r);
7381 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7382 goto __pyx_L0;
7383
7384 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
7385 * cdef inline object get_array_base(ndarray arr):
7386 * base = PyArray_BASE(arr)
7387 * if base is NULL: # <<<<<<<<<<<<<<
7388 * return None
7389 * return <object>base
7390 */
7391 }
7392
7393 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
7394 * if base is NULL:
7395 * return None
7396 * return <object>base # <<<<<<<<<<<<<<
7397 *
7398 * # Versions of the import_* functions which are more suitable for
7399 */
7400 __Pyx_XDECREF(__pyx_r);
7401 __Pyx_INCREF(((PyObject *)__pyx_v_base));
7402 __pyx_r = ((PyObject *)__pyx_v_base);
7403 goto __pyx_L0;
7404
7405 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
7406 * PyArray_SetBaseObject(arr, base)
7407 *
7408 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
7409 * base = PyArray_BASE(arr)
7410 * if base is NULL:
7411 */
7412
7413 /* function exit code */
7414 __pyx_L0:;
7415 __Pyx_XGIVEREF(__pyx_r);
7416 __Pyx_RefNannyFinishContext();
7417 return __pyx_r;
7418 }
7419
7420 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
7421 * # Versions of the import_* functions which are more suitable for
7422 * # Cython code.
7423 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
7424 * try:
7425 * _import_array()
7426 */
7427
__pyx_f_5numpy_import_array(void)7428 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
7429 int __pyx_r;
7430 __Pyx_RefNannyDeclarations
7431 PyObject *__pyx_t_1 = NULL;
7432 PyObject *__pyx_t_2 = NULL;
7433 PyObject *__pyx_t_3 = NULL;
7434 int __pyx_t_4;
7435 PyObject *__pyx_t_5 = NULL;
7436 PyObject *__pyx_t_6 = NULL;
7437 PyObject *__pyx_t_7 = NULL;
7438 PyObject *__pyx_t_8 = NULL;
7439 __Pyx_RefNannySetupContext("import_array", 0);
7440
7441 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
7442 * # Cython code.
7443 * cdef inline int import_array() except -1:
7444 * try: # <<<<<<<<<<<<<<
7445 * _import_array()
7446 * except Exception:
7447 */
7448 {
7449 __Pyx_PyThreadState_declare
7450 __Pyx_PyThreadState_assign
7451 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7452 __Pyx_XGOTREF(__pyx_t_1);
7453 __Pyx_XGOTREF(__pyx_t_2);
7454 __Pyx_XGOTREF(__pyx_t_3);
7455 /*try:*/ {
7456
7457 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
7458 * cdef inline int import_array() except -1:
7459 * try:
7460 * _import_array() # <<<<<<<<<<<<<<
7461 * except Exception:
7462 * raise ImportError("numpy.core.multiarray failed to import")
7463 */
7464 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
7465
7466 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
7467 * # Cython code.
7468 * cdef inline int import_array() except -1:
7469 * try: # <<<<<<<<<<<<<<
7470 * _import_array()
7471 * except Exception:
7472 */
7473 }
7474 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7475 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7476 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7477 goto __pyx_L8_try_end;
7478 __pyx_L3_error:;
7479
7480 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
7481 * try:
7482 * _import_array()
7483 * except Exception: # <<<<<<<<<<<<<<
7484 * raise ImportError("numpy.core.multiarray failed to import")
7485 *
7486 */
7487 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7488 if (__pyx_t_4) {
7489 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7490 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
7491 __Pyx_GOTREF(__pyx_t_5);
7492 __Pyx_GOTREF(__pyx_t_6);
7493 __Pyx_GOTREF(__pyx_t_7);
7494
7495 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
7496 * _import_array()
7497 * except Exception:
7498 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
7499 *
7500 * cdef inline int import_umath() except -1:
7501 */
7502 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
7503 __Pyx_GOTREF(__pyx_t_8);
7504 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7505 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7506 __PYX_ERR(1, 1038, __pyx_L5_except_error)
7507 }
7508 goto __pyx_L5_except_error;
7509 __pyx_L5_except_error:;
7510
7511 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
7512 * # Cython code.
7513 * cdef inline int import_array() except -1:
7514 * try: # <<<<<<<<<<<<<<
7515 * _import_array()
7516 * except Exception:
7517 */
7518 __Pyx_XGIVEREF(__pyx_t_1);
7519 __Pyx_XGIVEREF(__pyx_t_2);
7520 __Pyx_XGIVEREF(__pyx_t_3);
7521 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7522 goto __pyx_L1_error;
7523 __pyx_L8_try_end:;
7524 }
7525
7526 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
7527 * # Versions of the import_* functions which are more suitable for
7528 * # Cython code.
7529 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
7530 * try:
7531 * _import_array()
7532 */
7533
7534 /* function exit code */
7535 __pyx_r = 0;
7536 goto __pyx_L0;
7537 __pyx_L1_error:;
7538 __Pyx_XDECREF(__pyx_t_5);
7539 __Pyx_XDECREF(__pyx_t_6);
7540 __Pyx_XDECREF(__pyx_t_7);
7541 __Pyx_XDECREF(__pyx_t_8);
7542 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7543 __pyx_r = -1;
7544 __pyx_L0:;
7545 __Pyx_RefNannyFinishContext();
7546 return __pyx_r;
7547 }
7548
7549 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
7550 * raise ImportError("numpy.core.multiarray failed to import")
7551 *
7552 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
7553 * try:
7554 * _import_umath()
7555 */
7556
__pyx_f_5numpy_import_umath(void)7557 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
7558 int __pyx_r;
7559 __Pyx_RefNannyDeclarations
7560 PyObject *__pyx_t_1 = NULL;
7561 PyObject *__pyx_t_2 = NULL;
7562 PyObject *__pyx_t_3 = NULL;
7563 int __pyx_t_4;
7564 PyObject *__pyx_t_5 = NULL;
7565 PyObject *__pyx_t_6 = NULL;
7566 PyObject *__pyx_t_7 = NULL;
7567 PyObject *__pyx_t_8 = NULL;
7568 __Pyx_RefNannySetupContext("import_umath", 0);
7569
7570 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
7571 *
7572 * cdef inline int import_umath() except -1:
7573 * try: # <<<<<<<<<<<<<<
7574 * _import_umath()
7575 * except Exception:
7576 */
7577 {
7578 __Pyx_PyThreadState_declare
7579 __Pyx_PyThreadState_assign
7580 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7581 __Pyx_XGOTREF(__pyx_t_1);
7582 __Pyx_XGOTREF(__pyx_t_2);
7583 __Pyx_XGOTREF(__pyx_t_3);
7584 /*try:*/ {
7585
7586 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
7587 * cdef inline int import_umath() except -1:
7588 * try:
7589 * _import_umath() # <<<<<<<<<<<<<<
7590 * except Exception:
7591 * raise ImportError("numpy.core.umath failed to import")
7592 */
7593 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
7594
7595 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
7596 *
7597 * cdef inline int import_umath() except -1:
7598 * try: # <<<<<<<<<<<<<<
7599 * _import_umath()
7600 * except Exception:
7601 */
7602 }
7603 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7604 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7605 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7606 goto __pyx_L8_try_end;
7607 __pyx_L3_error:;
7608
7609 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
7610 * try:
7611 * _import_umath()
7612 * except Exception: # <<<<<<<<<<<<<<
7613 * raise ImportError("numpy.core.umath failed to import")
7614 *
7615 */
7616 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7617 if (__pyx_t_4) {
7618 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7619 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
7620 __Pyx_GOTREF(__pyx_t_5);
7621 __Pyx_GOTREF(__pyx_t_6);
7622 __Pyx_GOTREF(__pyx_t_7);
7623
7624 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
7625 * _import_umath()
7626 * except Exception:
7627 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
7628 *
7629 * cdef inline int import_ufunc() except -1:
7630 */
7631 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
7632 __Pyx_GOTREF(__pyx_t_8);
7633 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7634 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7635 __PYX_ERR(1, 1044, __pyx_L5_except_error)
7636 }
7637 goto __pyx_L5_except_error;
7638 __pyx_L5_except_error:;
7639
7640 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
7641 *
7642 * cdef inline int import_umath() except -1:
7643 * try: # <<<<<<<<<<<<<<
7644 * _import_umath()
7645 * except Exception:
7646 */
7647 __Pyx_XGIVEREF(__pyx_t_1);
7648 __Pyx_XGIVEREF(__pyx_t_2);
7649 __Pyx_XGIVEREF(__pyx_t_3);
7650 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7651 goto __pyx_L1_error;
7652 __pyx_L8_try_end:;
7653 }
7654
7655 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
7656 * raise ImportError("numpy.core.multiarray failed to import")
7657 *
7658 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
7659 * try:
7660 * _import_umath()
7661 */
7662
7663 /* function exit code */
7664 __pyx_r = 0;
7665 goto __pyx_L0;
7666 __pyx_L1_error:;
7667 __Pyx_XDECREF(__pyx_t_5);
7668 __Pyx_XDECREF(__pyx_t_6);
7669 __Pyx_XDECREF(__pyx_t_7);
7670 __Pyx_XDECREF(__pyx_t_8);
7671 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7672 __pyx_r = -1;
7673 __pyx_L0:;
7674 __Pyx_RefNannyFinishContext();
7675 return __pyx_r;
7676 }
7677
7678 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
7679 * raise ImportError("numpy.core.umath failed to import")
7680 *
7681 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
7682 * try:
7683 * _import_umath()
7684 */
7685
__pyx_f_5numpy_import_ufunc(void)7686 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
7687 int __pyx_r;
7688 __Pyx_RefNannyDeclarations
7689 PyObject *__pyx_t_1 = NULL;
7690 PyObject *__pyx_t_2 = NULL;
7691 PyObject *__pyx_t_3 = NULL;
7692 int __pyx_t_4;
7693 PyObject *__pyx_t_5 = NULL;
7694 PyObject *__pyx_t_6 = NULL;
7695 PyObject *__pyx_t_7 = NULL;
7696 PyObject *__pyx_t_8 = NULL;
7697 __Pyx_RefNannySetupContext("import_ufunc", 0);
7698
7699 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
7700 *
7701 * cdef inline int import_ufunc() except -1:
7702 * try: # <<<<<<<<<<<<<<
7703 * _import_umath()
7704 * except Exception:
7705 */
7706 {
7707 __Pyx_PyThreadState_declare
7708 __Pyx_PyThreadState_assign
7709 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7710 __Pyx_XGOTREF(__pyx_t_1);
7711 __Pyx_XGOTREF(__pyx_t_2);
7712 __Pyx_XGOTREF(__pyx_t_3);
7713 /*try:*/ {
7714
7715 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
7716 * cdef inline int import_ufunc() except -1:
7717 * try:
7718 * _import_umath() # <<<<<<<<<<<<<<
7719 * except Exception:
7720 * raise ImportError("numpy.core.umath failed to import")
7721 */
7722 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
7723
7724 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
7725 *
7726 * cdef inline int import_ufunc() except -1:
7727 * try: # <<<<<<<<<<<<<<
7728 * _import_umath()
7729 * except Exception:
7730 */
7731 }
7732 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7733 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7734 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7735 goto __pyx_L8_try_end;
7736 __pyx_L3_error:;
7737
7738 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
7739 * try:
7740 * _import_umath()
7741 * except Exception: # <<<<<<<<<<<<<<
7742 * raise ImportError("numpy.core.umath failed to import")
7743 */
7744 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7745 if (__pyx_t_4) {
7746 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7747 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
7748 __Pyx_GOTREF(__pyx_t_5);
7749 __Pyx_GOTREF(__pyx_t_6);
7750 __Pyx_GOTREF(__pyx_t_7);
7751
7752 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
7753 * _import_umath()
7754 * except Exception:
7755 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
7756 */
7757 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
7758 __Pyx_GOTREF(__pyx_t_8);
7759 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7760 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7761 __PYX_ERR(1, 1050, __pyx_L5_except_error)
7762 }
7763 goto __pyx_L5_except_error;
7764 __pyx_L5_except_error:;
7765
7766 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
7767 *
7768 * cdef inline int import_ufunc() except -1:
7769 * try: # <<<<<<<<<<<<<<
7770 * _import_umath()
7771 * except Exception:
7772 */
7773 __Pyx_XGIVEREF(__pyx_t_1);
7774 __Pyx_XGIVEREF(__pyx_t_2);
7775 __Pyx_XGIVEREF(__pyx_t_3);
7776 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7777 goto __pyx_L1_error;
7778 __pyx_L8_try_end:;
7779 }
7780
7781 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
7782 * raise ImportError("numpy.core.umath failed to import")
7783 *
7784 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
7785 * try:
7786 * _import_umath()
7787 */
7788
7789 /* function exit code */
7790 __pyx_r = 0;
7791 goto __pyx_L0;
7792 __pyx_L1_error:;
7793 __Pyx_XDECREF(__pyx_t_5);
7794 __Pyx_XDECREF(__pyx_t_6);
7795 __Pyx_XDECREF(__pyx_t_7);
7796 __Pyx_XDECREF(__pyx_t_8);
7797 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7798 __pyx_r = -1;
7799 __pyx_L0:;
7800 __Pyx_RefNannyFinishContext();
7801 return __pyx_r;
7802 }
7803
7804 static PyMethodDef __pyx_methods[] = {
7805 {0, 0, 0, 0}
7806 };
7807
7808 #if PY_MAJOR_VERSION >= 3
7809 #if CYTHON_PEP489_MULTI_PHASE_INIT
7810 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
7811 static int __pyx_pymod_exec_fortran_reader(PyObject* module); /*proto*/
7812 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
7813 {Py_mod_create, (void*)__pyx_pymod_create},
7814 {Py_mod_exec, (void*)__pyx_pymod_exec_fortran_reader},
7815 {0, NULL}
7816 };
7817 #endif
7818
7819 static struct PyModuleDef __pyx_moduledef = {
7820 PyModuleDef_HEAD_INIT,
7821 "fortran_reader",
7822 __pyx_k_Simple_readers_for_fortran_unfo, /* m_doc */
7823 #if CYTHON_PEP489_MULTI_PHASE_INIT
7824 0, /* m_size */
7825 #else
7826 -1, /* m_size */
7827 #endif
7828 __pyx_methods /* m_methods */,
7829 #if CYTHON_PEP489_MULTI_PHASE_INIT
7830 __pyx_moduledef_slots, /* m_slots */
7831 #else
7832 NULL, /* m_reload */
7833 #endif
7834 NULL, /* m_traverse */
7835 NULL, /* m_clear */
7836 NULL /* m_free */
7837 };
7838 #endif
7839 #ifndef CYTHON_SMALL_CODE
7840 #if defined(__clang__)
7841 #define CYTHON_SMALL_CODE
7842 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
7843 #define CYTHON_SMALL_CODE __attribute__((cold))
7844 #else
7845 #define CYTHON_SMALL_CODE
7846 #endif
7847 #endif
7848
7849 static __Pyx_StringTabEntry __pyx_string_tab[] = {
7850 {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
7851 {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
7852 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
7853 {&__pyx_n_s_Level, __pyx_k_Level, sizeof(__pyx_k_Level), 0, 0, 1, 1},
7854 {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
7855 {&__pyx_kp_s_Record_size_is, __pyx_k_Record_size_is, sizeof(__pyx_k_Record_size_is), 0, 0, 1, 0},
7856 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
7857 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
7858 {&__pyx_n_s__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 0, 1, 1},
7859 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
7860 {&__pyx_n_s_art_child_masks, __pyx_k_art_child_masks, sizeof(__pyx_k_art_child_masks), 0, 0, 1, 1},
7861 {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1},
7862 {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1},
7863 {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
7864 {&__pyx_n_s_cell_record_size, __pyx_k_cell_record_size, sizeof(__pyx_k_cell_record_size), 0, 0, 1, 1},
7865 {&__pyx_n_s_child_mask, __pyx_k_child_mask, sizeof(__pyx_k_child_mask), 0, 0, 1, 1},
7866 {&__pyx_n_s_child_record, __pyx_k_child_record, sizeof(__pyx_k_child_record), 0, 0, 1, 1},
7867 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
7868 {&__pyx_n_s_component_grid_info, __pyx_k_component_grid_info, sizeof(__pyx_k_component_grid_info), 0, 0, 1, 1},
7869 {&__pyx_n_s_count_art_octs, __pyx_k_count_art_octs, sizeof(__pyx_k_count_art_octs), 0, 0, 1, 1},
7870 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
7871 {&__pyx_n_s_di, __pyx_k_di, sizeof(__pyx_k_di), 0, 0, 1, 1},
7872 {&__pyx_n_s_dj, __pyx_k_dj, sizeof(__pyx_k_dj), 0, 0, 1, 1},
7873 {&__pyx_n_s_dk, __pyx_k_dk, sizeof(__pyx_k_dk), 0, 0, 1, 1},
7874 {&__pyx_n_s_dummy_records, __pyx_k_dummy_records, sizeof(__pyx_k_dummy_records), 0, 0, 1, 1},
7875 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
7876 {&__pyx_n_s_end_index, __pyx_k_end_index, sizeof(__pyx_k_end_index), 0, 0, 1, 1},
7877 {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
7878 {&__pyx_n_s_fields, __pyx_k_fields, sizeof(__pyx_k_fields), 0, 0, 1, 1},
7879 {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
7880 {&__pyx_n_s_file_locations, __pyx_k_file_locations, sizeof(__pyx_k_file_locations), 0, 0, 1, 1},
7881 {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
7882 {&__pyx_n_s_fill_child_mask, __pyx_k_fill_child_mask, sizeof(__pyx_k_fill_child_mask), 0, 0, 1, 1},
7883 {&__pyx_n_s_filled, __pyx_k_filled, sizeof(__pyx_k_filled), 0, 0, 1, 1},
7884 {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1},
7885 {&__pyx_n_s_gi, __pyx_k_gi, sizeof(__pyx_k_gi), 0, 0, 1, 1},
7886 {&__pyx_n_s_grid_dims, __pyx_k_grid_dims, sizeof(__pyx_k_grid_dims), 0, 0, 1, 1},
7887 {&__pyx_n_s_grid_id, __pyx_k_grid_id, sizeof(__pyx_k_grid_id), 0, 0, 1, 1},
7888 {&__pyx_n_s_grid_le, __pyx_k_grid_le, sizeof(__pyx_k_grid_le), 0, 0, 1, 1},
7889 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
7890 {&__pyx_n_s_iHOLL, __pyx_k_iHOLL, sizeof(__pyx_k_iHOLL), 0, 0, 1, 1},
7891 {&__pyx_n_s_iNOLL, __pyx_k_iNOLL, sizeof(__pyx_k_iNOLL), 0, 0, 1, 1},
7892 {&__pyx_n_s_iOct, __pyx_k_iOct, sizeof(__pyx_k_iOct), 0, 0, 1, 1},
7893 {&__pyx_n_s_iOctMax, __pyx_k_iOctMax, sizeof(__pyx_k_iOctMax), 0, 0, 1, 1},
7894 {&__pyx_n_s_iOctPs, __pyx_k_iOctPs, sizeof(__pyx_k_iOctPs), 0, 0, 1, 1},
7895 {&__pyx_n_s_ic1, __pyx_k_ic1, sizeof(__pyx_k_ic1), 0, 0, 1, 1},
7896 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
7897 {&__pyx_n_s_ioct, __pyx_k_ioct, sizeof(__pyx_k_ioct), 0, 0, 1, 1},
7898 {&__pyx_n_s_ir, __pyx_k_ir, sizeof(__pyx_k_ir), 0, 0, 1, 1},
7899 {&__pyx_n_s_ir_offset, __pyx_k_ir_offset, sizeof(__pyx_k_ir_offset), 0, 0, 1, 1},
7900 {&__pyx_n_s_ix, __pyx_k_ix, sizeof(__pyx_k_ix), 0, 0, 1, 1},
7901 {&__pyx_n_s_iy, __pyx_k_iy, sizeof(__pyx_k_iy), 0, 0, 1, 1},
7902 {&__pyx_n_s_iz, __pyx_k_iz, sizeof(__pyx_k_iz), 0, 0, 1, 1},
7903 {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
7904 {&__pyx_n_s_jr, __pyx_k_jr, sizeof(__pyx_k_jr), 0, 0, 1, 1},
7905 {&__pyx_n_s_jr_offset, __pyx_k_jr_offset, sizeof(__pyx_k_jr_offset), 0, 0, 1, 1},
7906 {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
7907 {&__pyx_n_s_kr, __pyx_k_kr, sizeof(__pyx_k_kr), 0, 0, 1, 1},
7908 {&__pyx_n_s_kr_offset, __pyx_k_kr_offset, sizeof(__pyx_k_kr_offset), 0, 0, 1, 1},
7909 {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
7910 {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
7911 {&__pyx_n_s_level_data, __pyx_k_level_data, sizeof(__pyx_k_level_data), 0, 0, 1, 1},
7912 {&__pyx_n_s_level_info, __pyx_k_level_info, sizeof(__pyx_k_level_info), 0, 0, 1, 1},
7913 {&__pyx_n_s_level_offsets, __pyx_k_level_offsets, sizeof(__pyx_k_level_offsets), 0, 0, 1, 1},
7914 {&__pyx_n_s_lex, __pyx_k_lex, sizeof(__pyx_k_lex), 0, 0, 1, 1},
7915 {&__pyx_n_s_ley, __pyx_k_ley, sizeof(__pyx_k_ley), 0, 0, 1, 1},
7916 {&__pyx_n_s_lez, __pyx_k_lez, sizeof(__pyx_k_lez), 0, 0, 1, 1},
7917 {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
7918 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
7919 {&__pyx_n_s_max_level, __pyx_k_max_level, sizeof(__pyx_k_max_level), 0, 0, 1, 1},
7920 {&__pyx_n_s_min_level, __pyx_k_min_level, sizeof(__pyx_k_min_level), 0, 0, 1, 1},
7921 {&__pyx_n_s_my_offset, __pyx_k_my_offset, sizeof(__pyx_k_my_offset), 0, 0, 1, 1},
7922 {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
7923 {&__pyx_n_s_nLevel, __pyx_k_nLevel, sizeof(__pyx_k_nLevel), 0, 0, 1, 1},
7924 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
7925 {&__pyx_n_s_nchild, __pyx_k_nchild, sizeof(__pyx_k_nchild), 0, 0, 1, 1},
7926 {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
7927 {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
7928 {&__pyx_n_s_next_record, __pyx_k_next_record, sizeof(__pyx_k_next_record), 0, 0, 1, 1},
7929 {&__pyx_n_s_nhvars, __pyx_k_nhvars, sizeof(__pyx_k_nhvars), 0, 0, 1, 1},
7930 {&__pyx_n_s_nhydro_vars, __pyx_k_nhydro_vars, sizeof(__pyx_k_nhydro_vars), 0, 0, 1, 1},
7931 {&__pyx_n_s_nocts, __pyx_k_nocts, sizeof(__pyx_k_nocts), 0, 0, 1, 1},
7932 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
7933 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
7934 {&__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},
7935 {&__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},
7936 {&__pyx_n_s_nx, __pyx_k_nx, sizeof(__pyx_k_nx), 0, 0, 1, 1},
7937 {&__pyx_n_s_ny, __pyx_k_ny, sizeof(__pyx_k_ny), 0, 0, 1, 1},
7938 {&__pyx_n_s_nz, __pyx_k_nz, sizeof(__pyx_k_nz), 0, 0, 1, 1},
7939 {&__pyx_n_s_oct_indices, __pyx_k_oct_indices, sizeof(__pyx_k_oct_indices), 0, 0, 1, 1},
7940 {&__pyx_n_s_oct_info, __pyx_k_oct_info, sizeof(__pyx_k_oct_info), 0, 0, 1, 1},
7941 {&__pyx_n_s_oct_levels, __pyx_k_oct_levels, sizeof(__pyx_k_oct_levels), 0, 0, 1, 1},
7942 {&__pyx_n_s_odind, __pyx_k_odind, sizeof(__pyx_k_odind), 0, 0, 1, 1},
7943 {&__pyx_n_s_offi, __pyx_k_offi, sizeof(__pyx_k_offi), 0, 0, 1, 1},
7944 {&__pyx_n_s_offj, __pyx_k_offj, sizeof(__pyx_k_offj), 0, 0, 1, 1},
7945 {&__pyx_n_s_offk, __pyx_k_offk, sizeof(__pyx_k_offk), 0, 0, 1, 1},
7946 {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
7947 {&__pyx_n_s_offset1, __pyx_k_offset1, sizeof(__pyx_k_offset1), 0, 0, 1, 1},
7948 {&__pyx_n_s_offset2, __pyx_k_offset2, sizeof(__pyx_k_offset2), 0, 0, 1, 1},
7949 {&__pyx_n_s_og_start_index, __pyx_k_og_start_index, sizeof(__pyx_k_og_start_index), 0, 0, 1, 1},
7950 {&__pyx_n_s_ogrid_info, __pyx_k_ogrid_info, sizeof(__pyx_k_ogrid_info), 0, 0, 1, 1},
7951 {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
7952 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
7953 {&__pyx_n_s_read_and_seek, __pyx_k_read_and_seek, sizeof(__pyx_k_read_and_seek), 0, 0, 1, 1},
7954 {&__pyx_n_s_read_art_grid, __pyx_k_read_art_grid, sizeof(__pyx_k_read_art_grid), 0, 0, 1, 1},
7955 {&__pyx_n_s_read_art_root_vars, __pyx_k_read_art_root_vars, sizeof(__pyx_k_read_art_root_vars), 0, 0, 1, 1},
7956 {&__pyx_n_s_read_art_tree, __pyx_k_read_art_tree, sizeof(__pyx_k_read_art_tree), 0, 0, 1, 1},
7957 {&__pyx_n_s_readin, __pyx_k_readin, sizeof(__pyx_k_readin), 0, 0, 1, 1},
7958 {&__pyx_n_s_ref_factor, __pyx_k_ref_factor, sizeof(__pyx_k_ref_factor), 0, 0, 1, 1},
7959 {&__pyx_n_s_root_grid_offset, __pyx_k_root_grid_offset, sizeof(__pyx_k_root_grid_offset), 0, 0, 1, 1},
7960 {&__pyx_n_s_start_index, __pyx_k_start_index, sizeof(__pyx_k_start_index), 0, 0, 1, 1},
7961 {&__pyx_n_s_temp, __pyx_k_temp, sizeof(__pyx_k_temp), 0, 0, 1, 1},
7962 {&__pyx_n_s_temp_data, __pyx_k_temp_data, sizeof(__pyx_k_temp_data), 0, 0, 1, 1},
7963 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
7964 {&__pyx_n_s_to_fill, __pyx_k_to_fill, sizeof(__pyx_k_to_fill), 0, 0, 1, 1},
7965 {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
7966 {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
7967 {&__pyx_n_s_varindex, __pyx_k_varindex, sizeof(__pyx_k_varindex), 0, 0, 1, 1},
7968 {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
7969 {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
7970 {&__pyx_kp_s_yt_utilities_lib_fortran_reader, __pyx_k_yt_utilities_lib_fortran_reader, sizeof(__pyx_k_yt_utilities_lib_fortran_reader), 0, 0, 1, 0},
7971 {&__pyx_n_s_yt_utilities_lib_fortran_reader_2, __pyx_k_yt_utilities_lib_fortran_reader_2, sizeof(__pyx_k_yt_utilities_lib_fortran_reader_2), 0, 0, 1, 1},
7972 {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
7973 {0, 0, 0, 0, 0, 0, 0}
7974 };
__Pyx_InitCachedBuiltins(void)7975 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
7976 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 63, __pyx_L1_error)
7977 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
7978 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
7979 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
7980 return 0;
7981 __pyx_L1_error:;
7982 return -1;
7983 }
7984
__Pyx_InitCachedConstants(void)7985 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
7986 __Pyx_RefNannyDeclarations
7987 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
7988
7989 /* "yt/utilities/lib/fortran_reader.pyx":261
7990 * ogrid_info = component_grid_info[gi]
7991 * grid_id = ogrid_info[1]
7992 * og_start_index = ogrid_info[3:6] #the oct left edge # <<<<<<<<<<<<<<
7993 * for i in range(2*ref_factor):
7994 * di = i + og_start_index[0] * ref_factor
7995 */
7996 __pyx_slice_ = PySlice_New(__pyx_int_3, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 261, __pyx_L1_error)
7997 __Pyx_GOTREF(__pyx_slice_);
7998 __Pyx_GIVEREF(__pyx_slice_);
7999
8000 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
8001 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8002 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
8003 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
8004 *
8005 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8006 */
8007 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 272, __pyx_L1_error)
8008 __Pyx_GOTREF(__pyx_tuple__2);
8009 __Pyx_GIVEREF(__pyx_tuple__2);
8010
8011 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
8012 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8013 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
8014 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
8015 *
8016 * info.buf = PyArray_DATA(self)
8017 */
8018 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 276, __pyx_L1_error)
8019 __Pyx_GOTREF(__pyx_tuple__3);
8020 __Pyx_GIVEREF(__pyx_tuple__3);
8021
8022 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
8023 * if ((descr.byteorder == c'>' and little_endian) or
8024 * (descr.byteorder == c'<' and not little_endian)):
8025 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
8026 * if t == NPY_BYTE: f = "b"
8027 * elif t == NPY_UBYTE: f = "B"
8028 */
8029 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 306, __pyx_L1_error)
8030 __Pyx_GOTREF(__pyx_tuple__4);
8031 __Pyx_GIVEREF(__pyx_tuple__4);
8032
8033 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
8034 *
8035 * if (end - f) - <int>(new_offset - offset[0]) < 15:
8036 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
8037 *
8038 * if ((child.byteorder == c'>' and little_endian) or
8039 */
8040 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 856, __pyx_L1_error)
8041 __Pyx_GOTREF(__pyx_tuple__5);
8042 __Pyx_GIVEREF(__pyx_tuple__5);
8043
8044 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
8045 * t = child.type_num
8046 * if end - f < 5:
8047 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
8048 *
8049 * # Until ticket #99 is fixed, use integers to avoid warnings
8050 */
8051 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 880, __pyx_L1_error)
8052 __Pyx_GOTREF(__pyx_tuple__6);
8053 __Pyx_GIVEREF(__pyx_tuple__6);
8054
8055 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
8056 * _import_array()
8057 * except Exception:
8058 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
8059 *
8060 * cdef inline int import_umath() except -1:
8061 */
8062 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1038, __pyx_L1_error)
8063 __Pyx_GOTREF(__pyx_tuple__7);
8064 __Pyx_GIVEREF(__pyx_tuple__7);
8065
8066 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
8067 * _import_umath()
8068 * except Exception:
8069 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
8070 *
8071 * cdef inline int import_ufunc() except -1:
8072 */
8073 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1044, __pyx_L1_error)
8074 __Pyx_GOTREF(__pyx_tuple__8);
8075 __Pyx_GIVEREF(__pyx_tuple__8);
8076
8077 /* "yt/utilities/lib/fortran_reader.pyx":41
8078 * @cython.boundscheck(False)
8079 * @cython.wraparound(False)
8080 * def read_and_seek(char *filename, np.int64_t offset1, # <<<<<<<<<<<<<<
8081 * np.int64_t offset2, np.ndarray buffer, int bytes):
8082 * cdef FILE *f = fopen(filename, "rb")
8083 */
8084 __pyx_tuple__9 = PyTuple_Pack(9, __pyx_n_s_filename, __pyx_n_s_offset1, __pyx_n_s_offset2, __pyx_n_s_buffer, __pyx_n_s_bytes, __pyx_n_s_f, __pyx_n_s_buf, __pyx_n_s_line, __pyx_n_s_n); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 41, __pyx_L1_error)
8085 __Pyx_GOTREF(__pyx_tuple__9);
8086 __Pyx_GIVEREF(__pyx_tuple__9);
8087 __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 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_yt_utilities_lib_fortran_reader, __pyx_n_s_read_and_seek, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 41, __pyx_L1_error)
8088
8089 /* "yt/utilities/lib/fortran_reader.pyx":53
8090 * fclose(f)
8091 *
8092 * def count_art_octs(char *fn, long offset, # <<<<<<<<<<<<<<
8093 * int min_level, int max_level,
8094 * int nhydro_vars,
8095 */
8096 __pyx_tuple__12 = PyTuple_Pack(13, __pyx_n_s_fn, __pyx_n_s_offset, __pyx_n_s_min_level, __pyx_n_s_max_level, __pyx_n_s_nhydro_vars, __pyx_n_s_level_info, __pyx_n_s_nchild, __pyx_n_s_next_record, __pyx_n_s_nLevel, __pyx_n_s_dummy_records, __pyx_n_s_readin, __pyx_n_s_f, __pyx_n_s__11); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 53, __pyx_L1_error)
8097 __Pyx_GOTREF(__pyx_tuple__12);
8098 __Pyx_GIVEREF(__pyx_tuple__12);
8099 __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(6, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_fortran_reader, __pyx_n_s_count_art_octs, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 53, __pyx_L1_error)
8100
8101 /* "yt/utilities/lib/fortran_reader.pyx":86
8102 * fclose(f)
8103 *
8104 * def read_art_tree(char *fn, long offset, # <<<<<<<<<<<<<<
8105 * int min_level, int max_level,
8106 * np.ndarray[np.int64_t, ndim=2] oct_indices,
8107 */
8108 __pyx_tuple__14 = PyTuple_Pack(23, __pyx_n_s_fn, __pyx_n_s_offset, __pyx_n_s_min_level, __pyx_n_s_max_level, __pyx_n_s_oct_indices, __pyx_n_s_oct_levels, __pyx_n_s_oct_info, __pyx_n_s_nchild, __pyx_n_s_iOct, __pyx_n_s_nLevel, __pyx_n_s_ic1, __pyx_n_s_next_record, __pyx_n_s_child_record, __pyx_n_s_iOctPs, __pyx_n_s_dummy_records, __pyx_n_s_readin, __pyx_n_s_f, __pyx_n_s_Level, __pyx_n_s_iNOLL, __pyx_n_s_iHOLL, __pyx_n_s_iOctMax, __pyx_n_s_level_offsets, __pyx_n_s__11); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 86, __pyx_L1_error)
8109 __Pyx_GOTREF(__pyx_tuple__14);
8110 __Pyx_GIVEREF(__pyx_tuple__14);
8111 __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(7, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_fortran_reader, __pyx_n_s_read_art_tree, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 86, __pyx_L1_error)
8112
8113 /* "yt/utilities/lib/fortran_reader.pyx":181
8114 * return level_offsets
8115 *
8116 * def read_art_root_vars(char *fn, long root_grid_offset, # <<<<<<<<<<<<<<
8117 * int nhydro_vars, int nx, int ny, int nz,
8118 * int ix, int iy, int iz, fields, var):
8119 */
8120 __pyx_tuple__16 = PyTuple_Pack(17, __pyx_n_s_fn, __pyx_n_s_root_grid_offset, __pyx_n_s_nhydro_vars, __pyx_n_s_nx, __pyx_n_s_ny, __pyx_n_s_nz, __pyx_n_s_ix, __pyx_n_s_iy, __pyx_n_s_iz, __pyx_n_s_fields, __pyx_n_s_var, __pyx_n_s_f, __pyx_n_s_j, __pyx_n_s_l, __pyx_n_s_cell_record_size, __pyx_n_s_temp, __pyx_n_s_my_offset); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 181, __pyx_L1_error)
8121 __Pyx_GOTREF(__pyx_tuple__16);
8122 __Pyx_GIVEREF(__pyx_tuple__16);
8123 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(11, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_fortran_reader, __pyx_n_s_read_art_root_vars, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 181, __pyx_L1_error)
8124
8125 /* "yt/utilities/lib/fortran_reader.pyx":236
8126 * @cython.boundscheck(False)
8127 * @cython.wraparound(False)
8128 * def read_art_grid(int varindex, # <<<<<<<<<<<<<<
8129 * np.ndarray[np.int64_t, ndim=1] start_index,
8130 * np.ndarray[np.int32_t, ndim=1] grid_dims,
8131 */
8132 __pyx_tuple__18 = PyTuple_Pack(32, __pyx_n_s_varindex, __pyx_n_s_start_index, __pyx_n_s_grid_dims, __pyx_n_s_data, __pyx_n_s_filled, __pyx_n_s_level_data, __pyx_n_s_level, __pyx_n_s_ref_factor, __pyx_n_s_component_grid_info, __pyx_n_s_gi, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_grid_id, __pyx_n_s_ir, __pyx_n_s_jr, __pyx_n_s_kr, __pyx_n_s_offi, __pyx_n_s_offj, __pyx_n_s_offk, __pyx_n_s_odind, __pyx_n_s_di, __pyx_n_s_dj, __pyx_n_s_dk, __pyx_n_s_ogrid_info, __pyx_n_s_og_start_index, __pyx_n_s_temp_data, __pyx_n_s_end_index, __pyx_n_s_kr_offset, __pyx_n_s_jr_offset, __pyx_n_s_ir_offset, __pyx_n_s_to_fill); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 236, __pyx_L1_error)
8133 __Pyx_GOTREF(__pyx_tuple__18);
8134 __Pyx_GIVEREF(__pyx_tuple__18);
8135 __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(9, 0, 32, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_fortran_reader, __pyx_n_s_read_art_grid, 236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 236, __pyx_L1_error)
8136
8137 /* "yt/utilities/lib/fortran_reader.pyx":301
8138 * @cython.boundscheck(True)
8139 * @cython.wraparound(False)
8140 * def fill_child_mask(np.ndarray[np.int64_t, ndim=2] file_locations, # <<<<<<<<<<<<<<
8141 * np.ndarray[np.int64_t, ndim=1] grid_le,
8142 * np.ndarray[np.uint8_t, ndim=4] art_child_masks,
8143 */
8144 __pyx_tuple__20 = PyTuple_Pack(13, __pyx_n_s_file_locations, __pyx_n_s_grid_le, __pyx_n_s_art_child_masks, __pyx_n_s_child_mask, __pyx_n_s_i, __pyx_n_s_ioct, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_nocts, __pyx_n_s_lex, __pyx_n_s_ley, __pyx_n_s_lez); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 301, __pyx_L1_error)
8145 __Pyx_GOTREF(__pyx_tuple__20);
8146 __Pyx_GIVEREF(__pyx_tuple__20);
8147 __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_fortran_reader, __pyx_n_s_fill_child_mask, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 301, __pyx_L1_error)
8148 __Pyx_RefNannyFinishContext();
8149 return 0;
8150 __pyx_L1_error:;
8151 __Pyx_RefNannyFinishContext();
8152 return -1;
8153 }
8154
__Pyx_InitGlobals(void)8155 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
8156 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
8157 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 2, __pyx_L1_error)
8158 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 2, __pyx_L1_error)
8159 __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 2, __pyx_L1_error)
8160 __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 2, __pyx_L1_error)
8161 __pyx_int_4294967296L = PyLong_FromString((char *)"4294967296", 0, 0); if (unlikely(!__pyx_int_4294967296L)) __PYX_ERR(0, 2, __pyx_L1_error)
8162 return 0;
8163 __pyx_L1_error:;
8164 return -1;
8165 }
8166
8167 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
8168 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
8169 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
8170 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
8171 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
8172 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
8173 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
8174
__Pyx_modinit_global_init_code(void)8175 static int __Pyx_modinit_global_init_code(void) {
8176 __Pyx_RefNannyDeclarations
8177 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
8178 /*--- Global init code ---*/
8179 __Pyx_RefNannyFinishContext();
8180 return 0;
8181 }
8182
__Pyx_modinit_variable_export_code(void)8183 static int __Pyx_modinit_variable_export_code(void) {
8184 __Pyx_RefNannyDeclarations
8185 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
8186 /*--- Variable export code ---*/
8187 __Pyx_RefNannyFinishContext();
8188 return 0;
8189 }
8190
__Pyx_modinit_function_export_code(void)8191 static int __Pyx_modinit_function_export_code(void) {
8192 __Pyx_RefNannyDeclarations
8193 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
8194 /*--- Function export code ---*/
8195 __Pyx_RefNannyFinishContext();
8196 return 0;
8197 }
8198
__Pyx_modinit_type_init_code(void)8199 static int __Pyx_modinit_type_init_code(void) {
8200 __Pyx_RefNannyDeclarations
8201 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
8202 /*--- Type init code ---*/
8203 __Pyx_RefNannyFinishContext();
8204 return 0;
8205 }
8206
__Pyx_modinit_type_import_code(void)8207 static int __Pyx_modinit_type_import_code(void) {
8208 __Pyx_RefNannyDeclarations
8209 PyObject *__pyx_t_1 = NULL;
8210 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
8211 /*--- Type import code ---*/
8212 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
8213 __Pyx_GOTREF(__pyx_t_1);
8214 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
8215 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
8216 sizeof(PyTypeObject),
8217 #else
8218 sizeof(PyHeapTypeObject),
8219 #endif
8220 __Pyx_ImportType_CheckSize_Warn);
8221 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
8222 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8223 __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
8224 __Pyx_GOTREF(__pyx_t_1);
8225 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
8226 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
8227 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
8228 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
8229 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
8230 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
8231 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
8232 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
8233 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
8234 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
8235 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8236 __Pyx_RefNannyFinishContext();
8237 return 0;
8238 __pyx_L1_error:;
8239 __Pyx_XDECREF(__pyx_t_1);
8240 __Pyx_RefNannyFinishContext();
8241 return -1;
8242 }
8243
__Pyx_modinit_variable_import_code(void)8244 static int __Pyx_modinit_variable_import_code(void) {
8245 __Pyx_RefNannyDeclarations
8246 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
8247 /*--- Variable import code ---*/
8248 __Pyx_RefNannyFinishContext();
8249 return 0;
8250 }
8251
__Pyx_modinit_function_import_code(void)8252 static int __Pyx_modinit_function_import_code(void) {
8253 __Pyx_RefNannyDeclarations
8254 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
8255 /*--- Function import code ---*/
8256 __Pyx_RefNannyFinishContext();
8257 return 0;
8258 }
8259
8260
8261 #if PY_MAJOR_VERSION < 3
8262 #ifdef CYTHON_NO_PYINIT_EXPORT
8263 #define __Pyx_PyMODINIT_FUNC void
8264 #else
8265 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
8266 #endif
8267 #else
8268 #ifdef CYTHON_NO_PYINIT_EXPORT
8269 #define __Pyx_PyMODINIT_FUNC PyObject *
8270 #else
8271 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
8272 #endif
8273 #endif
8274
8275
8276 #if PY_MAJOR_VERSION < 3
8277 __Pyx_PyMODINIT_FUNC initfortran_reader(void) CYTHON_SMALL_CODE; /*proto*/
initfortran_reader(void)8278 __Pyx_PyMODINIT_FUNC initfortran_reader(void)
8279 #else
8280 __Pyx_PyMODINIT_FUNC PyInit_fortran_reader(void) CYTHON_SMALL_CODE; /*proto*/
8281 __Pyx_PyMODINIT_FUNC PyInit_fortran_reader(void)
8282 #if CYTHON_PEP489_MULTI_PHASE_INIT
8283 {
8284 return PyModuleDef_Init(&__pyx_moduledef);
8285 }
8286 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
8287 #if PY_VERSION_HEX >= 0x030700A1
8288 static PY_INT64_T main_interpreter_id = -1;
8289 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
8290 if (main_interpreter_id == -1) {
8291 main_interpreter_id = current_id;
8292 return (unlikely(current_id == -1)) ? -1 : 0;
8293 } else if (unlikely(main_interpreter_id != current_id))
8294 #else
8295 static PyInterpreterState *main_interpreter = NULL;
8296 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
8297 if (!main_interpreter) {
8298 main_interpreter = current_interpreter;
8299 } else if (unlikely(main_interpreter != current_interpreter))
8300 #endif
8301 {
8302 PyErr_SetString(
8303 PyExc_ImportError,
8304 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
8305 return -1;
8306 }
8307 return 0;
8308 }
8309 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) {
8310 PyObject *value = PyObject_GetAttrString(spec, from_name);
8311 int result = 0;
8312 if (likely(value)) {
8313 if (allow_none || value != Py_None) {
8314 result = PyDict_SetItemString(moddict, to_name, value);
8315 }
8316 Py_DECREF(value);
8317 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
8318 PyErr_Clear();
8319 } else {
8320 result = -1;
8321 }
8322 return result;
8323 }
8324 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
8325 PyObject *module = NULL, *moddict, *modname;
8326 if (__Pyx_check_single_interpreter())
8327 return NULL;
8328 if (__pyx_m)
8329 return __Pyx_NewRef(__pyx_m);
8330 modname = PyObject_GetAttrString(spec, "name");
8331 if (unlikely(!modname)) goto bad;
8332 module = PyModule_NewObject(modname);
8333 Py_DECREF(modname);
8334 if (unlikely(!module)) goto bad;
8335 moddict = PyModule_GetDict(module);
8336 if (unlikely(!moddict)) goto bad;
8337 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
8338 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
8339 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
8340 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
8341 return module;
8342 bad:
8343 Py_XDECREF(module);
8344 return NULL;
8345 }
8346
8347
8348 static CYTHON_SMALL_CODE int __pyx_pymod_exec_fortran_reader(PyObject *__pyx_pyinit_module)
8349 #endif
8350 #endif
8351 {
8352 PyObject *__pyx_t_1 = NULL;
8353 __Pyx_RefNannyDeclarations
8354 #if CYTHON_PEP489_MULTI_PHASE_INIT
8355 if (__pyx_m) {
8356 if (__pyx_m == __pyx_pyinit_module) return 0;
8357 PyErr_SetString(PyExc_RuntimeError, "Module 'fortran_reader' has already been imported. Re-initialisation is not supported.");
8358 return -1;
8359 }
8360 #elif PY_MAJOR_VERSION >= 3
8361 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
8362 #endif
8363 #if CYTHON_REFNANNY
8364 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
8365 if (!__Pyx_RefNanny) {
8366 PyErr_Clear();
8367 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
8368 if (!__Pyx_RefNanny)
8369 Py_FatalError("failed to import 'refnanny' module");
8370 }
8371 #endif
8372 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_fortran_reader(void)", 0);
8373 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8374 #ifdef __Pxy_PyFrame_Initialize_Offsets
8375 __Pxy_PyFrame_Initialize_Offsets();
8376 #endif
8377 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
8378 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
8379 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
8380 #ifdef __Pyx_CyFunction_USED
8381 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8382 #endif
8383 #ifdef __Pyx_FusedFunction_USED
8384 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8385 #endif
8386 #ifdef __Pyx_Coroutine_USED
8387 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8388 #endif
8389 #ifdef __Pyx_Generator_USED
8390 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8391 #endif
8392 #ifdef __Pyx_AsyncGen_USED
8393 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8394 #endif
8395 #ifdef __Pyx_StopAsyncIteration_USED
8396 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8397 #endif
8398 /*--- Library function declarations ---*/
8399 /*--- Threads initialization code ---*/
8400 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
8401 #ifdef WITH_THREAD /* Python build with threading support? */
8402 PyEval_InitThreads();
8403 #endif
8404 #endif
8405 /*--- Module creation code ---*/
8406 #if CYTHON_PEP489_MULTI_PHASE_INIT
8407 __pyx_m = __pyx_pyinit_module;
8408 Py_INCREF(__pyx_m);
8409 #else
8410 #if PY_MAJOR_VERSION < 3
8411 __pyx_m = Py_InitModule4("fortran_reader", __pyx_methods, __pyx_k_Simple_readers_for_fortran_unfo, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
8412 #else
8413 __pyx_m = PyModule_Create(&__pyx_moduledef);
8414 #endif
8415 if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
8416 #endif
8417 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
8418 Py_INCREF(__pyx_d);
8419 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
8420 Py_INCREF(__pyx_b);
8421 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
8422 Py_INCREF(__pyx_cython_runtime);
8423 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
8424 /*--- Initialize various global constants etc. ---*/
8425 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8426 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
8427 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8428 #endif
8429 if (__pyx_module_is_main_yt__utilities__lib__fortran_reader) {
8430 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8431 }
8432 #if PY_MAJOR_VERSION >= 3
8433 {
8434 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
8435 if (!PyDict_GetItemString(modules, "yt.utilities.lib.fortran_reader")) {
8436 if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.fortran_reader", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
8437 }
8438 }
8439 #endif
8440 /*--- Builtin init code ---*/
8441 if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
8442 /*--- Constants init code ---*/
8443 if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
8444 /*--- Global type/function init code ---*/
8445 (void)__Pyx_modinit_global_init_code();
8446 (void)__Pyx_modinit_variable_export_code();
8447 (void)__Pyx_modinit_function_export_code();
8448 (void)__Pyx_modinit_type_init_code();
8449 if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
8450 (void)__Pyx_modinit_variable_import_code();
8451 (void)__Pyx_modinit_function_import_code();
8452 /*--- Execution code ---*/
8453 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
8454 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8455 #endif
8456
8457 /* "yt/utilities/lib/fortran_reader.pyx":11
8458 *
8459 *
8460 * import numpy as np # <<<<<<<<<<<<<<
8461 *
8462 * cimport cython
8463 */
8464 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
8465 __Pyx_GOTREF(__pyx_t_1);
8466 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
8467 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8468
8469 /* "yt/utilities/lib/fortran_reader.pyx":41
8470 * @cython.boundscheck(False)
8471 * @cython.wraparound(False)
8472 * def read_and_seek(char *filename, np.int64_t offset1, # <<<<<<<<<<<<<<
8473 * np.int64_t offset2, np.ndarray buffer, int bytes):
8474 * cdef FILE *f = fopen(filename, "rb")
8475 */
8476 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14fortran_reader_1read_and_seek, NULL, __pyx_n_s_yt_utilities_lib_fortran_reader_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
8477 __Pyx_GOTREF(__pyx_t_1);
8478 if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_and_seek, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
8479 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8480
8481 /* "yt/utilities/lib/fortran_reader.pyx":53
8482 * fclose(f)
8483 *
8484 * def count_art_octs(char *fn, long offset, # <<<<<<<<<<<<<<
8485 * int min_level, int max_level,
8486 * int nhydro_vars,
8487 */
8488 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14fortran_reader_3count_art_octs, NULL, __pyx_n_s_yt_utilities_lib_fortran_reader_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
8489 __Pyx_GOTREF(__pyx_t_1);
8490 if (PyDict_SetItem(__pyx_d, __pyx_n_s_count_art_octs, __pyx_t_1) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
8491 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8492
8493 /* "yt/utilities/lib/fortran_reader.pyx":86
8494 * fclose(f)
8495 *
8496 * def read_art_tree(char *fn, long offset, # <<<<<<<<<<<<<<
8497 * int min_level, int max_level,
8498 * np.ndarray[np.int64_t, ndim=2] oct_indices,
8499 */
8500 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14fortran_reader_5read_art_tree, NULL, __pyx_n_s_yt_utilities_lib_fortran_reader_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
8501 __Pyx_GOTREF(__pyx_t_1);
8502 if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_art_tree, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
8503 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8504
8505 /* "yt/utilities/lib/fortran_reader.pyx":181
8506 * return level_offsets
8507 *
8508 * def read_art_root_vars(char *fn, long root_grid_offset, # <<<<<<<<<<<<<<
8509 * int nhydro_vars, int nx, int ny, int nz,
8510 * int ix, int iy, int iz, fields, var):
8511 */
8512 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14fortran_reader_7read_art_root_vars, NULL, __pyx_n_s_yt_utilities_lib_fortran_reader_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
8513 __Pyx_GOTREF(__pyx_t_1);
8514 if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_art_root_vars, __pyx_t_1) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
8515 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8516
8517 /* "yt/utilities/lib/fortran_reader.pyx":236
8518 * @cython.boundscheck(False)
8519 * @cython.wraparound(False)
8520 * def read_art_grid(int varindex, # <<<<<<<<<<<<<<
8521 * np.ndarray[np.int64_t, ndim=1] start_index,
8522 * np.ndarray[np.int32_t, ndim=1] grid_dims,
8523 */
8524 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14fortran_reader_9read_art_grid, NULL, __pyx_n_s_yt_utilities_lib_fortran_reader_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
8525 __Pyx_GOTREF(__pyx_t_1);
8526 if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_art_grid, __pyx_t_1) < 0) __PYX_ERR(0, 236, __pyx_L1_error)
8527 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8528
8529 /* "yt/utilities/lib/fortran_reader.pyx":301
8530 * @cython.boundscheck(True)
8531 * @cython.wraparound(False)
8532 * def fill_child_mask(np.ndarray[np.int64_t, ndim=2] file_locations, # <<<<<<<<<<<<<<
8533 * np.ndarray[np.int64_t, ndim=1] grid_le,
8534 * np.ndarray[np.uint8_t, ndim=4] art_child_masks,
8535 */
8536 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14fortran_reader_11fill_child_mask, NULL, __pyx_n_s_yt_utilities_lib_fortran_reader_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
8537 __Pyx_GOTREF(__pyx_t_1);
8538 if (PyDict_SetItem(__pyx_d, __pyx_n_s_fill_child_mask, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
8539 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8540
8541 /* "yt/utilities/lib/fortran_reader.pyx":2
8542 *
8543 * # distutils: libraries = STD_LIBS # <<<<<<<<<<<<<<
8544 * """
8545 * Simple readers for fortran unformatted data, specifically for the Tiger code.
8546 */
8547 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
8548 __Pyx_GOTREF(__pyx_t_1);
8549 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
8550 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8551
8552 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
8553 * raise ImportError("numpy.core.umath failed to import")
8554 *
8555 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
8556 * try:
8557 * _import_umath()
8558 */
8559
8560 /*--- Wrapped vars code ---*/
8561
8562 goto __pyx_L0;
8563 __pyx_L1_error:;
8564 __Pyx_XDECREF(__pyx_t_1);
8565 if (__pyx_m) {
8566 if (__pyx_d) {
8567 __Pyx_AddTraceback("init yt.utilities.lib.fortran_reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
8568 }
8569 Py_CLEAR(__pyx_m);
8570 } else if (!PyErr_Occurred()) {
8571 PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.fortran_reader");
8572 }
8573 __pyx_L0:;
8574 __Pyx_RefNannyFinishContext();
8575 #if CYTHON_PEP489_MULTI_PHASE_INIT
8576 return (__pyx_m != NULL) ? 0 : -1;
8577 #elif PY_MAJOR_VERSION >= 3
8578 return __pyx_m;
8579 #else
8580 return;
8581 #endif
8582 }
8583
8584 /* --- Runtime support code --- */
8585 /* Refnanny */
8586 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)8587 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
8588 PyObject *m = NULL, *p = NULL;
8589 void *r = NULL;
8590 m = PyImport_ImportModule(modname);
8591 if (!m) goto end;
8592 p = PyObject_GetAttrString(m, "RefNannyAPI");
8593 if (!p) goto end;
8594 r = PyLong_AsVoidPtr(p);
8595 end:
8596 Py_XDECREF(p);
8597 Py_XDECREF(m);
8598 return (__Pyx_RefNannyAPIStruct *)r;
8599 }
8600 #endif
8601
8602 /* PyObjectGetAttrStr */
8603 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)8604 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
8605 PyTypeObject* tp = Py_TYPE(obj);
8606 if (likely(tp->tp_getattro))
8607 return tp->tp_getattro(obj, attr_name);
8608 #if PY_MAJOR_VERSION < 3
8609 if (likely(tp->tp_getattr))
8610 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
8611 #endif
8612 return PyObject_GetAttr(obj, attr_name);
8613 }
8614 #endif
8615
8616 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)8617 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
8618 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
8619 if (unlikely(!result)) {
8620 PyErr_Format(PyExc_NameError,
8621 #if PY_MAJOR_VERSION >= 3
8622 "name '%U' is not defined", name);
8623 #else
8624 "name '%.200s' is not defined", PyString_AS_STRING(name));
8625 #endif
8626 }
8627 return result;
8628 }
8629
8630 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)8631 static void __Pyx_RaiseArgtupleInvalid(
8632 const char* func_name,
8633 int exact,
8634 Py_ssize_t num_min,
8635 Py_ssize_t num_max,
8636 Py_ssize_t num_found)
8637 {
8638 Py_ssize_t num_expected;
8639 const char *more_or_less;
8640 if (num_found < num_min) {
8641 num_expected = num_min;
8642 more_or_less = "at least";
8643 } else {
8644 num_expected = num_max;
8645 more_or_less = "at most";
8646 }
8647 if (exact) {
8648 more_or_less = "exactly";
8649 }
8650 PyErr_Format(PyExc_TypeError,
8651 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
8652 func_name, more_or_less, num_expected,
8653 (num_expected == 1) ? "" : "s", num_found);
8654 }
8655
8656 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)8657 static void __Pyx_RaiseDoubleKeywordsError(
8658 const char* func_name,
8659 PyObject* kw_name)
8660 {
8661 PyErr_Format(PyExc_TypeError,
8662 #if PY_MAJOR_VERSION >= 3
8663 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
8664 #else
8665 "%s() got multiple values for keyword argument '%s'", func_name,
8666 PyString_AsString(kw_name));
8667 #endif
8668 }
8669
8670 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)8671 static int __Pyx_ParseOptionalKeywords(
8672 PyObject *kwds,
8673 PyObject **argnames[],
8674 PyObject *kwds2,
8675 PyObject *values[],
8676 Py_ssize_t num_pos_args,
8677 const char* function_name)
8678 {
8679 PyObject *key = 0, *value = 0;
8680 Py_ssize_t pos = 0;
8681 PyObject*** name;
8682 PyObject*** first_kw_arg = argnames + num_pos_args;
8683 while (PyDict_Next(kwds, &pos, &key, &value)) {
8684 name = first_kw_arg;
8685 while (*name && (**name != key)) name++;
8686 if (*name) {
8687 values[name-argnames] = value;
8688 continue;
8689 }
8690 name = first_kw_arg;
8691 #if PY_MAJOR_VERSION < 3
8692 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
8693 while (*name) {
8694 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
8695 && _PyString_Eq(**name, key)) {
8696 values[name-argnames] = value;
8697 break;
8698 }
8699 name++;
8700 }
8701 if (*name) continue;
8702 else {
8703 PyObject*** argname = argnames;
8704 while (argname != first_kw_arg) {
8705 if ((**argname == key) || (
8706 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
8707 && _PyString_Eq(**argname, key))) {
8708 goto arg_passed_twice;
8709 }
8710 argname++;
8711 }
8712 }
8713 } else
8714 #endif
8715 if (likely(PyUnicode_Check(key))) {
8716 while (*name) {
8717 int cmp = (**name == key) ? 0 :
8718 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
8719 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
8720 #endif
8721 PyUnicode_Compare(**name, key);
8722 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8723 if (cmp == 0) {
8724 values[name-argnames] = value;
8725 break;
8726 }
8727 name++;
8728 }
8729 if (*name) continue;
8730 else {
8731 PyObject*** argname = argnames;
8732 while (argname != first_kw_arg) {
8733 int cmp = (**argname == key) ? 0 :
8734 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
8735 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
8736 #endif
8737 PyUnicode_Compare(**argname, key);
8738 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
8739 if (cmp == 0) goto arg_passed_twice;
8740 argname++;
8741 }
8742 }
8743 } else
8744 goto invalid_keyword_type;
8745 if (kwds2) {
8746 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
8747 } else {
8748 goto invalid_keyword;
8749 }
8750 }
8751 return 0;
8752 arg_passed_twice:
8753 __Pyx_RaiseDoubleKeywordsError(function_name, key);
8754 goto bad;
8755 invalid_keyword_type:
8756 PyErr_Format(PyExc_TypeError,
8757 "%.200s() keywords must be strings", function_name);
8758 goto bad;
8759 invalid_keyword:
8760 PyErr_Format(PyExc_TypeError,
8761 #if PY_MAJOR_VERSION < 3
8762 "%.200s() got an unexpected keyword argument '%.200s'",
8763 function_name, PyString_AsString(key));
8764 #else
8765 "%s() got an unexpected keyword argument '%U'",
8766 function_name, key);
8767 #endif
8768 bad:
8769 return -1;
8770 }
8771
8772 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)8773 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
8774 {
8775 if (unlikely(!type)) {
8776 PyErr_SetString(PyExc_SystemError, "Missing type object");
8777 return 0;
8778 }
8779 else if (exact) {
8780 #if PY_MAJOR_VERSION == 2
8781 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
8782 #endif
8783 }
8784 else {
8785 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
8786 }
8787 PyErr_Format(PyExc_TypeError,
8788 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
8789 name, type->tp_name, Py_TYPE(obj)->tp_name);
8790 return 0;
8791 }
8792
8793 /* PyCFunctionFastCall */
8794 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)8795 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
8796 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
8797 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
8798 PyObject *self = PyCFunction_GET_SELF(func);
8799 int flags = PyCFunction_GET_FLAGS(func);
8800 assert(PyCFunction_Check(func));
8801 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
8802 assert(nargs >= 0);
8803 assert(nargs == 0 || args != NULL);
8804 /* _PyCFunction_FastCallDict() must not be called with an exception set,
8805 because it may clear it (directly or indirectly) and so the
8806 caller loses its exception */
8807 assert(!PyErr_Occurred());
8808 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
8809 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
8810 } else {
8811 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
8812 }
8813 }
8814 #endif
8815
8816 /* PyFunctionFastCall */
8817 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)8818 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
8819 PyObject *globals) {
8820 PyFrameObject *f;
8821 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8822 PyObject **fastlocals;
8823 Py_ssize_t i;
8824 PyObject *result;
8825 assert(globals != NULL);
8826 /* XXX Perhaps we should create a specialized
8827 PyFrame_New() that doesn't take locals, but does
8828 take builtins without sanity checking them.
8829 */
8830 assert(tstate != NULL);
8831 f = PyFrame_New(tstate, co, globals, NULL);
8832 if (f == NULL) {
8833 return NULL;
8834 }
8835 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
8836 for (i = 0; i < na; i++) {
8837 Py_INCREF(*args);
8838 fastlocals[i] = *args++;
8839 }
8840 result = PyEval_EvalFrameEx(f,0);
8841 ++tstate->recursion_depth;
8842 Py_DECREF(f);
8843 --tstate->recursion_depth;
8844 return result;
8845 }
8846 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)8847 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
8848 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
8849 PyObject *globals = PyFunction_GET_GLOBALS(func);
8850 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
8851 PyObject *closure;
8852 #if PY_MAJOR_VERSION >= 3
8853 PyObject *kwdefs;
8854 #endif
8855 PyObject *kwtuple, **k;
8856 PyObject **d;
8857 Py_ssize_t nd;
8858 Py_ssize_t nk;
8859 PyObject *result;
8860 assert(kwargs == NULL || PyDict_Check(kwargs));
8861 nk = kwargs ? PyDict_Size(kwargs) : 0;
8862 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
8863 return NULL;
8864 }
8865 if (
8866 #if PY_MAJOR_VERSION >= 3
8867 co->co_kwonlyargcount == 0 &&
8868 #endif
8869 likely(kwargs == NULL || nk == 0) &&
8870 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
8871 if (argdefs == NULL && co->co_argcount == nargs) {
8872 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
8873 goto done;
8874 }
8875 else if (nargs == 0 && argdefs != NULL
8876 && co->co_argcount == Py_SIZE(argdefs)) {
8877 /* function called with no arguments, but all parameters have
8878 a default value: use default values as arguments .*/
8879 args = &PyTuple_GET_ITEM(argdefs, 0);
8880 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
8881 goto done;
8882 }
8883 }
8884 if (kwargs != NULL) {
8885 Py_ssize_t pos, i;
8886 kwtuple = PyTuple_New(2 * nk);
8887 if (kwtuple == NULL) {
8888 result = NULL;
8889 goto done;
8890 }
8891 k = &PyTuple_GET_ITEM(kwtuple, 0);
8892 pos = i = 0;
8893 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
8894 Py_INCREF(k[i]);
8895 Py_INCREF(k[i+1]);
8896 i += 2;
8897 }
8898 nk = i / 2;
8899 }
8900 else {
8901 kwtuple = NULL;
8902 k = NULL;
8903 }
8904 closure = PyFunction_GET_CLOSURE(func);
8905 #if PY_MAJOR_VERSION >= 3
8906 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
8907 #endif
8908 if (argdefs != NULL) {
8909 d = &PyTuple_GET_ITEM(argdefs, 0);
8910 nd = Py_SIZE(argdefs);
8911 }
8912 else {
8913 d = NULL;
8914 nd = 0;
8915 }
8916 #if PY_MAJOR_VERSION >= 3
8917 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
8918 args, (int)nargs,
8919 k, (int)nk,
8920 d, (int)nd, kwdefs, closure);
8921 #else
8922 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
8923 args, (int)nargs,
8924 k, (int)nk,
8925 d, (int)nd, closure);
8926 #endif
8927 Py_XDECREF(kwtuple);
8928 done:
8929 Py_LeaveRecursiveCall();
8930 return result;
8931 }
8932 #endif
8933 #endif
8934
8935 /* PyObjectCall */
8936 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)8937 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
8938 PyObject *result;
8939 ternaryfunc call = func->ob_type->tp_call;
8940 if (unlikely(!call))
8941 return PyObject_Call(func, arg, kw);
8942 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
8943 return NULL;
8944 result = (*call)(func, arg, kw);
8945 Py_LeaveRecursiveCall();
8946 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
8947 PyErr_SetString(
8948 PyExc_SystemError,
8949 "NULL result without error in PyObject_Call");
8950 }
8951 return result;
8952 }
8953 #endif
8954
8955 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)8956 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
8957 PyObject *args, *result = NULL;
8958 #if CYTHON_FAST_PYCALL
8959 if (PyFunction_Check(function)) {
8960 PyObject *args[2] = {arg1, arg2};
8961 return __Pyx_PyFunction_FastCall(function, args, 2);
8962 }
8963 #endif
8964 #if CYTHON_FAST_PYCCALL
8965 if (__Pyx_PyFastCFunction_Check(function)) {
8966 PyObject *args[2] = {arg1, arg2};
8967 return __Pyx_PyCFunction_FastCall(function, args, 2);
8968 }
8969 #endif
8970 args = PyTuple_New(2);
8971 if (unlikely(!args)) goto done;
8972 Py_INCREF(arg1);
8973 PyTuple_SET_ITEM(args, 0, arg1);
8974 Py_INCREF(arg2);
8975 PyTuple_SET_ITEM(args, 1, arg2);
8976 Py_INCREF(function);
8977 result = __Pyx_PyObject_Call(function, args, NULL);
8978 Py_DECREF(args);
8979 Py_DECREF(function);
8980 done:
8981 return result;
8982 }
8983
8984 /* PyObjectCallMethO */
8985 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)8986 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
8987 PyObject *self, *result;
8988 PyCFunction cfunc;
8989 cfunc = PyCFunction_GET_FUNCTION(func);
8990 self = PyCFunction_GET_SELF(func);
8991 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
8992 return NULL;
8993 result = cfunc(self, arg);
8994 Py_LeaveRecursiveCall();
8995 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
8996 PyErr_SetString(
8997 PyExc_SystemError,
8998 "NULL result without error in PyObject_Call");
8999 }
9000 return result;
9001 }
9002 #endif
9003
9004 /* PyObjectCallOneArg */
9005 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)9006 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9007 PyObject *result;
9008 PyObject *args = PyTuple_New(1);
9009 if (unlikely(!args)) return NULL;
9010 Py_INCREF(arg);
9011 PyTuple_SET_ITEM(args, 0, arg);
9012 result = __Pyx_PyObject_Call(func, args, NULL);
9013 Py_DECREF(args);
9014 return result;
9015 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)9016 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9017 #if CYTHON_FAST_PYCALL
9018 if (PyFunction_Check(func)) {
9019 return __Pyx_PyFunction_FastCall(func, &arg, 1);
9020 }
9021 #endif
9022 if (likely(PyCFunction_Check(func))) {
9023 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
9024 return __Pyx_PyObject_CallMethO(func, arg);
9025 #if CYTHON_FAST_PYCCALL
9026 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
9027 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
9028 #endif
9029 }
9030 }
9031 return __Pyx__PyObject_CallOneArg(func, arg);
9032 }
9033 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)9034 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9035 PyObject *result;
9036 PyObject *args = PyTuple_Pack(1, arg);
9037 if (unlikely(!args)) return NULL;
9038 result = __Pyx_PyObject_Call(func, args, NULL);
9039 Py_DECREF(args);
9040 return result;
9041 }
9042 #endif
9043
9044 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)9045 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
9046 PyObject *attr;
9047 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
9048 PyTypeObject *tp = Py_TYPE(obj);
9049 PyObject *descr;
9050 descrgetfunc f = NULL;
9051 PyObject **dictptr, *dict;
9052 int meth_found = 0;
9053 assert (*method == NULL);
9054 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
9055 attr = __Pyx_PyObject_GetAttrStr(obj, name);
9056 goto try_unpack;
9057 }
9058 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
9059 return 0;
9060 }
9061 descr = _PyType_Lookup(tp, name);
9062 if (likely(descr != NULL)) {
9063 Py_INCREF(descr);
9064 #if PY_MAJOR_VERSION >= 3
9065 #ifdef __Pyx_CyFunction_USED
9066 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
9067 #else
9068 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
9069 #endif
9070 #else
9071 #ifdef __Pyx_CyFunction_USED
9072 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
9073 #else
9074 if (likely(PyFunction_Check(descr)))
9075 #endif
9076 #endif
9077 {
9078 meth_found = 1;
9079 } else {
9080 f = Py_TYPE(descr)->tp_descr_get;
9081 if (f != NULL && PyDescr_IsData(descr)) {
9082 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
9083 Py_DECREF(descr);
9084 goto try_unpack;
9085 }
9086 }
9087 }
9088 dictptr = _PyObject_GetDictPtr(obj);
9089 if (dictptr != NULL && (dict = *dictptr) != NULL) {
9090 Py_INCREF(dict);
9091 attr = __Pyx_PyDict_GetItemStr(dict, name);
9092 if (attr != NULL) {
9093 Py_INCREF(attr);
9094 Py_DECREF(dict);
9095 Py_XDECREF(descr);
9096 goto try_unpack;
9097 }
9098 Py_DECREF(dict);
9099 }
9100 if (meth_found) {
9101 *method = descr;
9102 return 1;
9103 }
9104 if (f != NULL) {
9105 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
9106 Py_DECREF(descr);
9107 goto try_unpack;
9108 }
9109 if (descr != NULL) {
9110 *method = descr;
9111 return 0;
9112 }
9113 PyErr_Format(PyExc_AttributeError,
9114 #if PY_MAJOR_VERSION >= 3
9115 "'%.50s' object has no attribute '%U'",
9116 tp->tp_name, name);
9117 #else
9118 "'%.50s' object has no attribute '%.400s'",
9119 tp->tp_name, PyString_AS_STRING(name));
9120 #endif
9121 return 0;
9122 #else
9123 attr = __Pyx_PyObject_GetAttrStr(obj, name);
9124 goto try_unpack;
9125 #endif
9126 try_unpack:
9127 #if CYTHON_UNPACK_METHODS
9128 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
9129 PyObject *function = PyMethod_GET_FUNCTION(attr);
9130 Py_INCREF(function);
9131 Py_DECREF(attr);
9132 *method = function;
9133 return 1;
9134 }
9135 #endif
9136 *method = attr;
9137 return 0;
9138 }
9139
9140 /* PyObjectCallMethod1 */
__Pyx__PyObject_CallMethod1(PyObject * method,PyObject * arg)9141 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
9142 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
9143 Py_DECREF(method);
9144 return result;
9145 }
__Pyx_PyObject_CallMethod1(PyObject * obj,PyObject * method_name,PyObject * arg)9146 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
9147 PyObject *method = NULL, *result;
9148 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
9149 if (likely(is_method)) {
9150 result = __Pyx_PyObject_Call2Args(method, obj, arg);
9151 Py_DECREF(method);
9152 return result;
9153 }
9154 if (unlikely(!method)) return NULL;
9155 return __Pyx__PyObject_CallMethod1(method, arg);
9156 }
9157
9158 /* append */
__Pyx_PyObject_Append(PyObject * L,PyObject * x)9159 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
9160 if (likely(PyList_CheckExact(L))) {
9161 if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
9162 } else {
9163 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
9164 if (unlikely(!retval))
9165 return -1;
9166 Py_DECREF(retval);
9167 }
9168 return 0;
9169 }
9170
9171 /* None */
__Pyx_div_long(long a,long b)9172 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
9173 long q = a / b;
9174 long r = a - q*b;
9175 q -= ((r != 0) & ((r ^ b) < 0));
9176 return q;
9177 }
9178
9179 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)9180 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
9181 {
9182 union {
9183 uint32_t u32;
9184 uint8_t u8[4];
9185 } S;
9186 S.u32 = 0x01020304;
9187 return S.u8[0] == 4;
9188 }
9189
9190 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)9191 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
9192 __Pyx_BufFmt_StackElem* stack,
9193 __Pyx_TypeInfo* type) {
9194 stack[0].field = &ctx->root;
9195 stack[0].parent_offset = 0;
9196 ctx->root.type = type;
9197 ctx->root.name = "buffer dtype";
9198 ctx->root.offset = 0;
9199 ctx->head = stack;
9200 ctx->head->field = &ctx->root;
9201 ctx->fmt_offset = 0;
9202 ctx->head->parent_offset = 0;
9203 ctx->new_packmode = '@';
9204 ctx->enc_packmode = '@';
9205 ctx->new_count = 1;
9206 ctx->enc_count = 0;
9207 ctx->enc_type = 0;
9208 ctx->is_complex = 0;
9209 ctx->is_valid_array = 0;
9210 ctx->struct_alignment = 0;
9211 while (type->typegroup == 'S') {
9212 ++ctx->head;
9213 ctx->head->field = type->fields;
9214 ctx->head->parent_offset = 0;
9215 type = type->fields->type;
9216 }
9217 }
__Pyx_BufFmt_ParseNumber(const char ** ts)9218 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
9219 int count;
9220 const char* t = *ts;
9221 if (*t < '0' || *t > '9') {
9222 return -1;
9223 } else {
9224 count = *t++ - '0';
9225 while (*t >= '0' && *t <= '9') {
9226 count *= 10;
9227 count += *t++ - '0';
9228 }
9229 }
9230 *ts = t;
9231 return count;
9232 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)9233 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
9234 int number = __Pyx_BufFmt_ParseNumber(ts);
9235 if (number == -1)
9236 PyErr_Format(PyExc_ValueError,\
9237 "Does not understand character buffer dtype format string ('%c')", **ts);
9238 return number;
9239 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)9240 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
9241 PyErr_Format(PyExc_ValueError,
9242 "Unexpected format string character: '%c'", ch);
9243 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)9244 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
9245 switch (ch) {
9246 case 'c': return "'char'";
9247 case 'b': return "'signed char'";
9248 case 'B': return "'unsigned char'";
9249 case 'h': return "'short'";
9250 case 'H': return "'unsigned short'";
9251 case 'i': return "'int'";
9252 case 'I': return "'unsigned int'";
9253 case 'l': return "'long'";
9254 case 'L': return "'unsigned long'";
9255 case 'q': return "'long long'";
9256 case 'Q': return "'unsigned long long'";
9257 case 'f': return (is_complex ? "'complex float'" : "'float'");
9258 case 'd': return (is_complex ? "'complex double'" : "'double'");
9259 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
9260 case 'T': return "a struct";
9261 case 'O': return "Python object";
9262 case 'P': return "a pointer";
9263 case 's': case 'p': return "a string";
9264 case 0: return "end";
9265 default: return "unparseable format string";
9266 }
9267 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)9268 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
9269 switch (ch) {
9270 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
9271 case 'h': case 'H': return 2;
9272 case 'i': case 'I': case 'l': case 'L': return 4;
9273 case 'q': case 'Q': return 8;
9274 case 'f': return (is_complex ? 8 : 4);
9275 case 'd': return (is_complex ? 16 : 8);
9276 case 'g': {
9277 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
9278 return 0;
9279 }
9280 case 'O': case 'P': return sizeof(void*);
9281 default:
9282 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
9283 return 0;
9284 }
9285 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)9286 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
9287 switch (ch) {
9288 case 'c': case 'b': case 'B': case 's': case 'p': return 1;
9289 case 'h': case 'H': return sizeof(short);
9290 case 'i': case 'I': return sizeof(int);
9291 case 'l': case 'L': return sizeof(long);
9292 #ifdef HAVE_LONG_LONG
9293 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
9294 #endif
9295 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
9296 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
9297 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
9298 case 'O': case 'P': return sizeof(void*);
9299 default: {
9300 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
9301 return 0;
9302 }
9303 }
9304 }
9305 typedef struct { char c; short x; } __Pyx_st_short;
9306 typedef struct { char c; int x; } __Pyx_st_int;
9307 typedef struct { char c; long x; } __Pyx_st_long;
9308 typedef struct { char c; float x; } __Pyx_st_float;
9309 typedef struct { char c; double x; } __Pyx_st_double;
9310 typedef struct { char c; long double x; } __Pyx_st_longdouble;
9311 typedef struct { char c; void *x; } __Pyx_st_void_p;
9312 #ifdef HAVE_LONG_LONG
9313 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
9314 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)9315 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
9316 switch (ch) {
9317 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
9318 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
9319 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
9320 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
9321 #ifdef HAVE_LONG_LONG
9322 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
9323 #endif
9324 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
9325 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
9326 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
9327 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
9328 default:
9329 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
9330 return 0;
9331 }
9332 }
9333 /* These are for computing the padding at the end of the struct to align
9334 on the first member of the struct. This will probably the same as above,
9335 but we don't have any guarantees.
9336 */
9337 typedef struct { short x; char c; } __Pyx_pad_short;
9338 typedef struct { int x; char c; } __Pyx_pad_int;
9339 typedef struct { long x; char c; } __Pyx_pad_long;
9340 typedef struct { float x; char c; } __Pyx_pad_float;
9341 typedef struct { double x; char c; } __Pyx_pad_double;
9342 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
9343 typedef struct { void *x; char c; } __Pyx_pad_void_p;
9344 #ifdef HAVE_LONG_LONG
9345 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
9346 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)9347 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
9348 switch (ch) {
9349 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
9350 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
9351 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
9352 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
9353 #ifdef HAVE_LONG_LONG
9354 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
9355 #endif
9356 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
9357 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
9358 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
9359 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
9360 default:
9361 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
9362 return 0;
9363 }
9364 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)9365 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
9366 switch (ch) {
9367 case 'c':
9368 return 'H';
9369 case 'b': case 'h': case 'i':
9370 case 'l': case 'q': case 's': case 'p':
9371 return 'I';
9372 case 'B': case 'H': case 'I': case 'L': case 'Q':
9373 return 'U';
9374 case 'f': case 'd': case 'g':
9375 return (is_complex ? 'C' : 'R');
9376 case 'O':
9377 return 'O';
9378 case 'P':
9379 return 'P';
9380 default: {
9381 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
9382 return 0;
9383 }
9384 }
9385 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)9386 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
9387 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
9388 const char* expected;
9389 const char* quote;
9390 if (ctx->head == NULL) {
9391 expected = "end";
9392 quote = "";
9393 } else {
9394 expected = ctx->head->field->type->name;
9395 quote = "'";
9396 }
9397 PyErr_Format(PyExc_ValueError,
9398 "Buffer dtype mismatch, expected %s%s%s but got %s",
9399 quote, expected, quote,
9400 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
9401 } else {
9402 __Pyx_StructField* field = ctx->head->field;
9403 __Pyx_StructField* parent = (ctx->head - 1)->field;
9404 PyErr_Format(PyExc_ValueError,
9405 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
9406 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
9407 parent->type->name, field->name);
9408 }
9409 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)9410 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
9411 char group;
9412 size_t size, offset, arraysize = 1;
9413 if (ctx->enc_type == 0) return 0;
9414 if (ctx->head->field->type->arraysize[0]) {
9415 int i, ndim = 0;
9416 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
9417 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
9418 ndim = 1;
9419 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
9420 PyErr_Format(PyExc_ValueError,
9421 "Expected a dimension of size %zu, got %zu",
9422 ctx->head->field->type->arraysize[0], ctx->enc_count);
9423 return -1;
9424 }
9425 }
9426 if (!ctx->is_valid_array) {
9427 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
9428 ctx->head->field->type->ndim, ndim);
9429 return -1;
9430 }
9431 for (i = 0; i < ctx->head->field->type->ndim; i++) {
9432 arraysize *= ctx->head->field->type->arraysize[i];
9433 }
9434 ctx->is_valid_array = 0;
9435 ctx->enc_count = 1;
9436 }
9437 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
9438 do {
9439 __Pyx_StructField* field = ctx->head->field;
9440 __Pyx_TypeInfo* type = field->type;
9441 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
9442 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
9443 } else {
9444 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
9445 }
9446 if (ctx->enc_packmode == '@') {
9447 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
9448 size_t align_mod_offset;
9449 if (align_at == 0) return -1;
9450 align_mod_offset = ctx->fmt_offset % align_at;
9451 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
9452 if (ctx->struct_alignment == 0)
9453 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
9454 ctx->is_complex);
9455 }
9456 if (type->size != size || type->typegroup != group) {
9457 if (type->typegroup == 'C' && type->fields != NULL) {
9458 size_t parent_offset = ctx->head->parent_offset + field->offset;
9459 ++ctx->head;
9460 ctx->head->field = type->fields;
9461 ctx->head->parent_offset = parent_offset;
9462 continue;
9463 }
9464 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
9465 } else {
9466 __Pyx_BufFmt_RaiseExpected(ctx);
9467 return -1;
9468 }
9469 }
9470 offset = ctx->head->parent_offset + field->offset;
9471 if (ctx->fmt_offset != offset) {
9472 PyErr_Format(PyExc_ValueError,
9473 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
9474 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
9475 return -1;
9476 }
9477 ctx->fmt_offset += size;
9478 if (arraysize)
9479 ctx->fmt_offset += (arraysize - 1) * size;
9480 --ctx->enc_count;
9481 while (1) {
9482 if (field == &ctx->root) {
9483 ctx->head = NULL;
9484 if (ctx->enc_count != 0) {
9485 __Pyx_BufFmt_RaiseExpected(ctx);
9486 return -1;
9487 }
9488 break;
9489 }
9490 ctx->head->field = ++field;
9491 if (field->type == NULL) {
9492 --ctx->head;
9493 field = ctx->head->field;
9494 continue;
9495 } else if (field->type->typegroup == 'S') {
9496 size_t parent_offset = ctx->head->parent_offset + field->offset;
9497 if (field->type->fields->type == NULL) continue;
9498 field = field->type->fields;
9499 ++ctx->head;
9500 ctx->head->field = field;
9501 ctx->head->parent_offset = parent_offset;
9502 break;
9503 } else {
9504 break;
9505 }
9506 }
9507 } while (ctx->enc_count);
9508 ctx->enc_type = 0;
9509 ctx->is_complex = 0;
9510 return 0;
9511 }
9512 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)9513 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
9514 {
9515 const char *ts = *tsp;
9516 int i = 0, number;
9517 int ndim = ctx->head->field->type->ndim;
9518 ;
9519 ++ts;
9520 if (ctx->new_count != 1) {
9521 PyErr_SetString(PyExc_ValueError,
9522 "Cannot handle repeated arrays in format string");
9523 return NULL;
9524 }
9525 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9526 while (*ts && *ts != ')') {
9527 switch (*ts) {
9528 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
9529 default: break;
9530 }
9531 number = __Pyx_BufFmt_ExpectNumber(&ts);
9532 if (number == -1) return NULL;
9533 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
9534 return PyErr_Format(PyExc_ValueError,
9535 "Expected a dimension of size %zu, got %d",
9536 ctx->head->field->type->arraysize[i], number);
9537 if (*ts != ',' && *ts != ')')
9538 return PyErr_Format(PyExc_ValueError,
9539 "Expected a comma in format string, got '%c'", *ts);
9540 if (*ts == ',') ts++;
9541 i++;
9542 }
9543 if (i != ndim)
9544 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
9545 ctx->head->field->type->ndim, i);
9546 if (!*ts) {
9547 PyErr_SetString(PyExc_ValueError,
9548 "Unexpected end of format string, expected ')'");
9549 return NULL;
9550 }
9551 ctx->is_valid_array = 1;
9552 ctx->new_count = 1;
9553 *tsp = ++ts;
9554 return Py_None;
9555 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)9556 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
9557 int got_Z = 0;
9558 while (1) {
9559 switch(*ts) {
9560 case 0:
9561 if (ctx->enc_type != 0 && ctx->head == NULL) {
9562 __Pyx_BufFmt_RaiseExpected(ctx);
9563 return NULL;
9564 }
9565 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9566 if (ctx->head != NULL) {
9567 __Pyx_BufFmt_RaiseExpected(ctx);
9568 return NULL;
9569 }
9570 return ts;
9571 case ' ':
9572 case '\r':
9573 case '\n':
9574 ++ts;
9575 break;
9576 case '<':
9577 if (!__Pyx_Is_Little_Endian()) {
9578 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
9579 return NULL;
9580 }
9581 ctx->new_packmode = '=';
9582 ++ts;
9583 break;
9584 case '>':
9585 case '!':
9586 if (__Pyx_Is_Little_Endian()) {
9587 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
9588 return NULL;
9589 }
9590 ctx->new_packmode = '=';
9591 ++ts;
9592 break;
9593 case '=':
9594 case '@':
9595 case '^':
9596 ctx->new_packmode = *ts++;
9597 break;
9598 case 'T':
9599 {
9600 const char* ts_after_sub;
9601 size_t i, struct_count = ctx->new_count;
9602 size_t struct_alignment = ctx->struct_alignment;
9603 ctx->new_count = 1;
9604 ++ts;
9605 if (*ts != '{') {
9606 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
9607 return NULL;
9608 }
9609 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9610 ctx->enc_type = 0;
9611 ctx->enc_count = 0;
9612 ctx->struct_alignment = 0;
9613 ++ts;
9614 ts_after_sub = ts;
9615 for (i = 0; i != struct_count; ++i) {
9616 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
9617 if (!ts_after_sub) return NULL;
9618 }
9619 ts = ts_after_sub;
9620 if (struct_alignment) ctx->struct_alignment = struct_alignment;
9621 }
9622 break;
9623 case '}':
9624 {
9625 size_t alignment = ctx->struct_alignment;
9626 ++ts;
9627 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9628 ctx->enc_type = 0;
9629 if (alignment && ctx->fmt_offset % alignment) {
9630 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
9631 }
9632 }
9633 return ts;
9634 case 'x':
9635 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9636 ctx->fmt_offset += ctx->new_count;
9637 ctx->new_count = 1;
9638 ctx->enc_count = 0;
9639 ctx->enc_type = 0;
9640 ctx->enc_packmode = ctx->new_packmode;
9641 ++ts;
9642 break;
9643 case 'Z':
9644 got_Z = 1;
9645 ++ts;
9646 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
9647 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
9648 return NULL;
9649 }
9650 CYTHON_FALLTHROUGH;
9651 case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
9652 case 'l': case 'L': case 'q': case 'Q':
9653 case 'f': case 'd': case 'g':
9654 case 'O': case 'p':
9655 if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
9656 ctx->enc_packmode == ctx->new_packmode) {
9657 ctx->enc_count += ctx->new_count;
9658 ctx->new_count = 1;
9659 got_Z = 0;
9660 ++ts;
9661 break;
9662 }
9663 CYTHON_FALLTHROUGH;
9664 case 's':
9665 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
9666 ctx->enc_count = ctx->new_count;
9667 ctx->enc_packmode = ctx->new_packmode;
9668 ctx->enc_type = *ts;
9669 ctx->is_complex = got_Z;
9670 ++ts;
9671 ctx->new_count = 1;
9672 got_Z = 0;
9673 break;
9674 case ':':
9675 ++ts;
9676 while(*ts != ':') ++ts;
9677 ++ts;
9678 break;
9679 case '(':
9680 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
9681 break;
9682 default:
9683 {
9684 int number = __Pyx_BufFmt_ExpectNumber(&ts);
9685 if (number == -1) return NULL;
9686 ctx->new_count = (size_t)number;
9687 }
9688 }
9689 }
9690 }
9691
9692 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)9693 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
9694 if (unlikely(info->buf == NULL)) return;
9695 if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
9696 __Pyx_ReleaseBuffer(info);
9697 }
__Pyx_ZeroBuffer(Py_buffer * buf)9698 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
9699 buf->buf = NULL;
9700 buf->obj = NULL;
9701 buf->strides = __Pyx_zeros;
9702 buf->shape = __Pyx_zeros;
9703 buf->suboffsets = __Pyx_minusones;
9704 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)9705 static int __Pyx__GetBufferAndValidate(
9706 Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
9707 int nd, int cast, __Pyx_BufFmt_StackElem* stack)
9708 {
9709 buf->buf = NULL;
9710 if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
9711 __Pyx_ZeroBuffer(buf);
9712 return -1;
9713 }
9714 if (unlikely(buf->ndim != nd)) {
9715 PyErr_Format(PyExc_ValueError,
9716 "Buffer has wrong number of dimensions (expected %d, got %d)",
9717 nd, buf->ndim);
9718 goto fail;
9719 }
9720 if (!cast) {
9721 __Pyx_BufFmt_Context ctx;
9722 __Pyx_BufFmt_Init(&ctx, stack, dtype);
9723 if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
9724 }
9725 if (unlikely((size_t)buf->itemsize != dtype->size)) {
9726 PyErr_Format(PyExc_ValueError,
9727 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
9728 buf->itemsize, (buf->itemsize > 1) ? "s" : "",
9729 dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
9730 goto fail;
9731 }
9732 if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
9733 return 0;
9734 fail:;
9735 __Pyx_SafeReleaseBuffer(buf);
9736 return -1;
9737 }
9738
9739 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)9740 static void __Pyx_RaiseBufferIndexError(int axis) {
9741 PyErr_Format(PyExc_IndexError,
9742 "Out of bounds on buffer access (axis %d)", axis);
9743 }
9744
9745 /* PyErrFetchRestore */
9746 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)9747 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
9748 PyObject *tmp_type, *tmp_value, *tmp_tb;
9749 tmp_type = tstate->curexc_type;
9750 tmp_value = tstate->curexc_value;
9751 tmp_tb = tstate->curexc_traceback;
9752 tstate->curexc_type = type;
9753 tstate->curexc_value = value;
9754 tstate->curexc_traceback = tb;
9755 Py_XDECREF(tmp_type);
9756 Py_XDECREF(tmp_value);
9757 Py_XDECREF(tmp_tb);
9758 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)9759 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9760 *type = tstate->curexc_type;
9761 *value = tstate->curexc_value;
9762 *tb = tstate->curexc_traceback;
9763 tstate->curexc_type = 0;
9764 tstate->curexc_value = 0;
9765 tstate->curexc_traceback = 0;
9766 }
9767 #endif
9768
9769 /* SetItemInt */
__Pyx_SetItemInt_Generic(PyObject * o,PyObject * j,PyObject * v)9770 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
9771 int r;
9772 if (!j) return -1;
9773 r = PyObject_SetItem(o, j, v);
9774 Py_DECREF(j);
9775 return r;
9776 }
__Pyx_SetItemInt_Fast(PyObject * o,Py_ssize_t i,PyObject * v,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)9777 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
9778 CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
9779 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
9780 if (is_list || PyList_CheckExact(o)) {
9781 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
9782 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
9783 PyObject* old = PyList_GET_ITEM(o, n);
9784 Py_INCREF(v);
9785 PyList_SET_ITEM(o, n, v);
9786 Py_DECREF(old);
9787 return 1;
9788 }
9789 } else {
9790 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
9791 if (likely(m && m->sq_ass_item)) {
9792 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
9793 Py_ssize_t l = m->sq_length(o);
9794 if (likely(l >= 0)) {
9795 i += l;
9796 } else {
9797 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
9798 return -1;
9799 PyErr_Clear();
9800 }
9801 }
9802 return m->sq_ass_item(o, i, v);
9803 }
9804 }
9805 #else
9806 #if CYTHON_COMPILING_IN_PYPY
9807 if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
9808 #else
9809 if (is_list || PySequence_Check(o))
9810 #endif
9811 {
9812 return PySequence_SetItem(o, i, v);
9813 }
9814 #endif
9815 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
9816 }
9817
9818 /* PyIntBinop */
9819 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)9820 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
9821 (void)inplace;
9822 (void)zerodivision_check;
9823 #if PY_MAJOR_VERSION < 3
9824 if (likely(PyInt_CheckExact(op1))) {
9825 const long b = intval;
9826 long x;
9827 long a = PyInt_AS_LONG(op1);
9828 x = (long)((unsigned long)a + b);
9829 if (likely((x^a) >= 0 || (x^b) >= 0))
9830 return PyInt_FromLong(x);
9831 return PyLong_Type.tp_as_number->nb_add(op1, op2);
9832 }
9833 #endif
9834 #if CYTHON_USE_PYLONG_INTERNALS
9835 if (likely(PyLong_CheckExact(op1))) {
9836 const long b = intval;
9837 long a, x;
9838 #ifdef HAVE_LONG_LONG
9839 const PY_LONG_LONG llb = intval;
9840 PY_LONG_LONG lla, llx;
9841 #endif
9842 const digit* digits = ((PyLongObject*)op1)->ob_digit;
9843 const Py_ssize_t size = Py_SIZE(op1);
9844 if (likely(__Pyx_sst_abs(size) <= 1)) {
9845 a = likely(size) ? digits[0] : 0;
9846 if (size == -1) a = -a;
9847 } else {
9848 switch (size) {
9849 case -2:
9850 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9851 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9852 break;
9853 #ifdef HAVE_LONG_LONG
9854 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
9855 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9856 goto long_long;
9857 #endif
9858 }
9859 CYTHON_FALLTHROUGH;
9860 case 2:
9861 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9862 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9863 break;
9864 #ifdef HAVE_LONG_LONG
9865 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
9866 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9867 goto long_long;
9868 #endif
9869 }
9870 CYTHON_FALLTHROUGH;
9871 case -3:
9872 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9873 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9874 break;
9875 #ifdef HAVE_LONG_LONG
9876 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
9877 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9878 goto long_long;
9879 #endif
9880 }
9881 CYTHON_FALLTHROUGH;
9882 case 3:
9883 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9884 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9885 break;
9886 #ifdef HAVE_LONG_LONG
9887 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
9888 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9889 goto long_long;
9890 #endif
9891 }
9892 CYTHON_FALLTHROUGH;
9893 case -4:
9894 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9895 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9896 break;
9897 #ifdef HAVE_LONG_LONG
9898 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
9899 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9900 goto long_long;
9901 #endif
9902 }
9903 CYTHON_FALLTHROUGH;
9904 case 4:
9905 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9906 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9907 break;
9908 #ifdef HAVE_LONG_LONG
9909 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
9910 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9911 goto long_long;
9912 #endif
9913 }
9914 CYTHON_FALLTHROUGH;
9915 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
9916 }
9917 }
9918 x = a + b;
9919 return PyLong_FromLong(x);
9920 #ifdef HAVE_LONG_LONG
9921 long_long:
9922 llx = lla + llb;
9923 return PyLong_FromLongLong(llx);
9924 #endif
9925
9926
9927 }
9928 #endif
9929 if (PyFloat_CheckExact(op1)) {
9930 const long b = intval;
9931 double a = PyFloat_AS_DOUBLE(op1);
9932 double result;
9933 PyFPE_START_PROTECT("add", return NULL)
9934 result = ((double)a) + (double)b;
9935 PyFPE_END_PROTECT(result)
9936 return PyFloat_FromDouble(result);
9937 }
9938 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
9939 }
9940 #endif
9941
9942 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)9943 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
9944 CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
9945 int full_traceback, CYTHON_UNUSED int nogil) {
9946 PyObject *old_exc, *old_val, *old_tb;
9947 PyObject *ctx;
9948 __Pyx_PyThreadState_declare
9949 #ifdef WITH_THREAD
9950 PyGILState_STATE state;
9951 if (nogil)
9952 state = PyGILState_Ensure();
9953 #ifdef _MSC_VER
9954 else state = (PyGILState_STATE)-1;
9955 #endif
9956 #endif
9957 __Pyx_PyThreadState_assign
9958 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
9959 if (full_traceback) {
9960 Py_XINCREF(old_exc);
9961 Py_XINCREF(old_val);
9962 Py_XINCREF(old_tb);
9963 __Pyx_ErrRestore(old_exc, old_val, old_tb);
9964 PyErr_PrintEx(1);
9965 }
9966 #if PY_MAJOR_VERSION < 3
9967 ctx = PyString_FromString(name);
9968 #else
9969 ctx = PyUnicode_FromString(name);
9970 #endif
9971 __Pyx_ErrRestore(old_exc, old_val, old_tb);
9972 if (!ctx) {
9973 PyErr_WriteUnraisable(Py_None);
9974 } else {
9975 PyErr_WriteUnraisable(ctx);
9976 Py_DECREF(ctx);
9977 }
9978 #ifdef WITH_THREAD
9979 if (nogil)
9980 PyGILState_Release(state);
9981 #endif
9982 }
9983
9984 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)9985 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
9986 PyObject *r;
9987 if (!j) return NULL;
9988 r = PyObject_GetItem(o, j);
9989 Py_DECREF(j);
9990 return r;
9991 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)9992 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
9993 CYTHON_NCP_UNUSED int wraparound,
9994 CYTHON_NCP_UNUSED int boundscheck) {
9995 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9996 Py_ssize_t wrapped_i = i;
9997 if (wraparound & unlikely(i < 0)) {
9998 wrapped_i += PyList_GET_SIZE(o);
9999 }
10000 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
10001 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
10002 Py_INCREF(r);
10003 return r;
10004 }
10005 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10006 #else
10007 return PySequence_GetItem(o, i);
10008 #endif
10009 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)10010 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
10011 CYTHON_NCP_UNUSED int wraparound,
10012 CYTHON_NCP_UNUSED int boundscheck) {
10013 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10014 Py_ssize_t wrapped_i = i;
10015 if (wraparound & unlikely(i < 0)) {
10016 wrapped_i += PyTuple_GET_SIZE(o);
10017 }
10018 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
10019 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
10020 Py_INCREF(r);
10021 return r;
10022 }
10023 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10024 #else
10025 return PySequence_GetItem(o, i);
10026 #endif
10027 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)10028 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
10029 CYTHON_NCP_UNUSED int wraparound,
10030 CYTHON_NCP_UNUSED int boundscheck) {
10031 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
10032 if (is_list || PyList_CheckExact(o)) {
10033 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
10034 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
10035 PyObject *r = PyList_GET_ITEM(o, n);
10036 Py_INCREF(r);
10037 return r;
10038 }
10039 }
10040 else if (PyTuple_CheckExact(o)) {
10041 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
10042 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
10043 PyObject *r = PyTuple_GET_ITEM(o, n);
10044 Py_INCREF(r);
10045 return r;
10046 }
10047 } else {
10048 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
10049 if (likely(m && m->sq_item)) {
10050 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
10051 Py_ssize_t l = m->sq_length(o);
10052 if (likely(l >= 0)) {
10053 i += l;
10054 } else {
10055 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
10056 return NULL;
10057 PyErr_Clear();
10058 }
10059 }
10060 return m->sq_item(o, i);
10061 }
10062 }
10063 #else
10064 if (is_list || PySequence_Check(o)) {
10065 return PySequence_GetItem(o, i);
10066 }
10067 #endif
10068 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
10069 }
10070
10071 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)10072 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
10073 if (unlikely(!type)) {
10074 PyErr_SetString(PyExc_SystemError, "Missing type object");
10075 return 0;
10076 }
10077 if (likely(__Pyx_TypeCheck(obj, type)))
10078 return 1;
10079 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
10080 Py_TYPE(obj)->tp_name, type->tp_name);
10081 return 0;
10082 }
10083
10084 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)10085 static void __Pyx_RaiseBufferFallbackError(void) {
10086 PyErr_SetString(PyExc_ValueError,
10087 "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
10088 }
10089
10090 /* ObjectGetItem */
10091 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)10092 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
10093 PyObject *runerr;
10094 Py_ssize_t key_value;
10095 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
10096 if (unlikely(!(m && m->sq_item))) {
10097 PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
10098 return NULL;
10099 }
10100 key_value = __Pyx_PyIndex_AsSsize_t(index);
10101 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
10102 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
10103 }
10104 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
10105 PyErr_Clear();
10106 PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
10107 }
10108 return NULL;
10109 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)10110 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
10111 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
10112 if (likely(m && m->mp_subscript)) {
10113 return m->mp_subscript(obj, key);
10114 }
10115 return __Pyx_PyObject_GetIndex(obj, key);
10116 }
10117 #endif
10118
10119 /* RaiseException */
10120 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)10121 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
10122 CYTHON_UNUSED PyObject *cause) {
10123 __Pyx_PyThreadState_declare
10124 Py_XINCREF(type);
10125 if (!value || value == Py_None)
10126 value = NULL;
10127 else
10128 Py_INCREF(value);
10129 if (!tb || tb == Py_None)
10130 tb = NULL;
10131 else {
10132 Py_INCREF(tb);
10133 if (!PyTraceBack_Check(tb)) {
10134 PyErr_SetString(PyExc_TypeError,
10135 "raise: arg 3 must be a traceback or None");
10136 goto raise_error;
10137 }
10138 }
10139 if (PyType_Check(type)) {
10140 #if CYTHON_COMPILING_IN_PYPY
10141 if (!value) {
10142 Py_INCREF(Py_None);
10143 value = Py_None;
10144 }
10145 #endif
10146 PyErr_NormalizeException(&type, &value, &tb);
10147 } else {
10148 if (value) {
10149 PyErr_SetString(PyExc_TypeError,
10150 "instance exception may not have a separate value");
10151 goto raise_error;
10152 }
10153 value = type;
10154 type = (PyObject*) Py_TYPE(type);
10155 Py_INCREF(type);
10156 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
10157 PyErr_SetString(PyExc_TypeError,
10158 "raise: exception class must be a subclass of BaseException");
10159 goto raise_error;
10160 }
10161 }
10162 __Pyx_PyThreadState_assign
10163 __Pyx_ErrRestore(type, value, tb);
10164 return;
10165 raise_error:
10166 Py_XDECREF(value);
10167 Py_XDECREF(type);
10168 Py_XDECREF(tb);
10169 return;
10170 }
10171 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)10172 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
10173 PyObject* owned_instance = NULL;
10174 if (tb == Py_None) {
10175 tb = 0;
10176 } else if (tb && !PyTraceBack_Check(tb)) {
10177 PyErr_SetString(PyExc_TypeError,
10178 "raise: arg 3 must be a traceback or None");
10179 goto bad;
10180 }
10181 if (value == Py_None)
10182 value = 0;
10183 if (PyExceptionInstance_Check(type)) {
10184 if (value) {
10185 PyErr_SetString(PyExc_TypeError,
10186 "instance exception may not have a separate value");
10187 goto bad;
10188 }
10189 value = type;
10190 type = (PyObject*) Py_TYPE(value);
10191 } else if (PyExceptionClass_Check(type)) {
10192 PyObject *instance_class = NULL;
10193 if (value && PyExceptionInstance_Check(value)) {
10194 instance_class = (PyObject*) Py_TYPE(value);
10195 if (instance_class != type) {
10196 int is_subclass = PyObject_IsSubclass(instance_class, type);
10197 if (!is_subclass) {
10198 instance_class = NULL;
10199 } else if (unlikely(is_subclass == -1)) {
10200 goto bad;
10201 } else {
10202 type = instance_class;
10203 }
10204 }
10205 }
10206 if (!instance_class) {
10207 PyObject *args;
10208 if (!value)
10209 args = PyTuple_New(0);
10210 else if (PyTuple_Check(value)) {
10211 Py_INCREF(value);
10212 args = value;
10213 } else
10214 args = PyTuple_Pack(1, value);
10215 if (!args)
10216 goto bad;
10217 owned_instance = PyObject_Call(type, args, NULL);
10218 Py_DECREF(args);
10219 if (!owned_instance)
10220 goto bad;
10221 value = owned_instance;
10222 if (!PyExceptionInstance_Check(value)) {
10223 PyErr_Format(PyExc_TypeError,
10224 "calling %R should have returned an instance of "
10225 "BaseException, not %R",
10226 type, Py_TYPE(value));
10227 goto bad;
10228 }
10229 }
10230 } else {
10231 PyErr_SetString(PyExc_TypeError,
10232 "raise: exception class must be a subclass of BaseException");
10233 goto bad;
10234 }
10235 if (cause) {
10236 PyObject *fixed_cause;
10237 if (cause == Py_None) {
10238 fixed_cause = NULL;
10239 } else if (PyExceptionClass_Check(cause)) {
10240 fixed_cause = PyObject_CallObject(cause, NULL);
10241 if (fixed_cause == NULL)
10242 goto bad;
10243 } else if (PyExceptionInstance_Check(cause)) {
10244 fixed_cause = cause;
10245 Py_INCREF(fixed_cause);
10246 } else {
10247 PyErr_SetString(PyExc_TypeError,
10248 "exception causes must derive from "
10249 "BaseException");
10250 goto bad;
10251 }
10252 PyException_SetCause(value, fixed_cause);
10253 }
10254 PyErr_SetObject(type, value);
10255 if (tb) {
10256 #if CYTHON_COMPILING_IN_PYPY
10257 PyObject *tmp_type, *tmp_value, *tmp_tb;
10258 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
10259 Py_INCREF(tb);
10260 PyErr_Restore(tmp_type, tmp_value, tb);
10261 Py_XDECREF(tmp_tb);
10262 #else
10263 PyThreadState *tstate = __Pyx_PyThreadState_Current;
10264 PyObject* tmp_tb = tstate->curexc_traceback;
10265 if (tb != tmp_tb) {
10266 Py_INCREF(tb);
10267 tstate->curexc_traceback = tb;
10268 Py_XDECREF(tmp_tb);
10269 }
10270 #endif
10271 }
10272 bad:
10273 Py_XDECREF(owned_instance);
10274 return;
10275 }
10276 #endif
10277
10278 /* DictGetItem */
10279 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)10280 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
10281 PyObject *value;
10282 value = PyDict_GetItemWithError(d, key);
10283 if (unlikely(!value)) {
10284 if (!PyErr_Occurred()) {
10285 if (unlikely(PyTuple_Check(key))) {
10286 PyObject* args = PyTuple_Pack(1, key);
10287 if (likely(args)) {
10288 PyErr_SetObject(PyExc_KeyError, args);
10289 Py_DECREF(args);
10290 }
10291 } else {
10292 PyErr_SetObject(PyExc_KeyError, key);
10293 }
10294 }
10295 return NULL;
10296 }
10297 Py_INCREF(value);
10298 return value;
10299 }
10300 #endif
10301
10302 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)10303 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
10304 PyErr_Format(PyExc_ValueError,
10305 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
10306 }
10307
10308 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)10309 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
10310 PyErr_Format(PyExc_ValueError,
10311 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
10312 index, (index == 1) ? "" : "s");
10313 }
10314
10315 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)10316 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
10317 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
10318 }
10319
10320 /* GetTopmostException */
10321 #if CYTHON_USE_EXC_INFO_STACK
10322 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)10323 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
10324 {
10325 _PyErr_StackItem *exc_info = tstate->exc_info;
10326 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
10327 exc_info->previous_item != NULL)
10328 {
10329 exc_info = exc_info->previous_item;
10330 }
10331 return exc_info;
10332 }
10333 #endif
10334
10335 /* SaveResetException */
10336 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)10337 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
10338 #if CYTHON_USE_EXC_INFO_STACK
10339 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
10340 *type = exc_info->exc_type;
10341 *value = exc_info->exc_value;
10342 *tb = exc_info->exc_traceback;
10343 #else
10344 *type = tstate->exc_type;
10345 *value = tstate->exc_value;
10346 *tb = tstate->exc_traceback;
10347 #endif
10348 Py_XINCREF(*type);
10349 Py_XINCREF(*value);
10350 Py_XINCREF(*tb);
10351 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)10352 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
10353 PyObject *tmp_type, *tmp_value, *tmp_tb;
10354 #if CYTHON_USE_EXC_INFO_STACK
10355 _PyErr_StackItem *exc_info = tstate->exc_info;
10356 tmp_type = exc_info->exc_type;
10357 tmp_value = exc_info->exc_value;
10358 tmp_tb = exc_info->exc_traceback;
10359 exc_info->exc_type = type;
10360 exc_info->exc_value = value;
10361 exc_info->exc_traceback = tb;
10362 #else
10363 tmp_type = tstate->exc_type;
10364 tmp_value = tstate->exc_value;
10365 tmp_tb = tstate->exc_traceback;
10366 tstate->exc_type = type;
10367 tstate->exc_value = value;
10368 tstate->exc_traceback = tb;
10369 #endif
10370 Py_XDECREF(tmp_type);
10371 Py_XDECREF(tmp_value);
10372 Py_XDECREF(tmp_tb);
10373 }
10374 #endif
10375
10376 /* PyErrExceptionMatches */
10377 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)10378 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
10379 Py_ssize_t i, n;
10380 n = PyTuple_GET_SIZE(tuple);
10381 #if PY_MAJOR_VERSION >= 3
10382 for (i=0; i<n; i++) {
10383 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
10384 }
10385 #endif
10386 for (i=0; i<n; i++) {
10387 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
10388 }
10389 return 0;
10390 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)10391 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
10392 PyObject *exc_type = tstate->curexc_type;
10393 if (exc_type == err) return 1;
10394 if (unlikely(!exc_type)) return 0;
10395 if (unlikely(PyTuple_Check(err)))
10396 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
10397 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
10398 }
10399 #endif
10400
10401 /* GetException */
10402 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)10403 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
10404 #else
10405 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
10406 #endif
10407 {
10408 PyObject *local_type, *local_value, *local_tb;
10409 #if CYTHON_FAST_THREAD_STATE
10410 PyObject *tmp_type, *tmp_value, *tmp_tb;
10411 local_type = tstate->curexc_type;
10412 local_value = tstate->curexc_value;
10413 local_tb = tstate->curexc_traceback;
10414 tstate->curexc_type = 0;
10415 tstate->curexc_value = 0;
10416 tstate->curexc_traceback = 0;
10417 #else
10418 PyErr_Fetch(&local_type, &local_value, &local_tb);
10419 #endif
10420 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
10421 #if CYTHON_FAST_THREAD_STATE
10422 if (unlikely(tstate->curexc_type))
10423 #else
10424 if (unlikely(PyErr_Occurred()))
10425 #endif
10426 goto bad;
10427 #if PY_MAJOR_VERSION >= 3
10428 if (local_tb) {
10429 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
10430 goto bad;
10431 }
10432 #endif
10433 Py_XINCREF(local_tb);
10434 Py_XINCREF(local_type);
10435 Py_XINCREF(local_value);
10436 *type = local_type;
10437 *value = local_value;
10438 *tb = local_tb;
10439 #if CYTHON_FAST_THREAD_STATE
10440 #if CYTHON_USE_EXC_INFO_STACK
10441 {
10442 _PyErr_StackItem *exc_info = tstate->exc_info;
10443 tmp_type = exc_info->exc_type;
10444 tmp_value = exc_info->exc_value;
10445 tmp_tb = exc_info->exc_traceback;
10446 exc_info->exc_type = local_type;
10447 exc_info->exc_value = local_value;
10448 exc_info->exc_traceback = local_tb;
10449 }
10450 #else
10451 tmp_type = tstate->exc_type;
10452 tmp_value = tstate->exc_value;
10453 tmp_tb = tstate->exc_traceback;
10454 tstate->exc_type = local_type;
10455 tstate->exc_value = local_value;
10456 tstate->exc_traceback = local_tb;
10457 #endif
10458 Py_XDECREF(tmp_type);
10459 Py_XDECREF(tmp_value);
10460 Py_XDECREF(tmp_tb);
10461 #else
10462 PyErr_SetExcInfo(local_type, local_value, local_tb);
10463 #endif
10464 return 0;
10465 bad:
10466 *type = 0;
10467 *value = 0;
10468 *tb = 0;
10469 Py_XDECREF(local_type);
10470 Py_XDECREF(local_value);
10471 Py_XDECREF(local_tb);
10472 return -1;
10473 }
10474
10475 /* TypeImport */
10476 #ifndef __PYX_HAVE_RT_ImportType
10477 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)10478 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
10479 size_t size, enum __Pyx_ImportType_CheckSize check_size)
10480 {
10481 PyObject *result = 0;
10482 char warning[200];
10483 Py_ssize_t basicsize;
10484 #ifdef Py_LIMITED_API
10485 PyObject *py_basicsize;
10486 #endif
10487 result = PyObject_GetAttrString(module, class_name);
10488 if (!result)
10489 goto bad;
10490 if (!PyType_Check(result)) {
10491 PyErr_Format(PyExc_TypeError,
10492 "%.200s.%.200s is not a type object",
10493 module_name, class_name);
10494 goto bad;
10495 }
10496 #ifndef Py_LIMITED_API
10497 basicsize = ((PyTypeObject *)result)->tp_basicsize;
10498 #else
10499 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
10500 if (!py_basicsize)
10501 goto bad;
10502 basicsize = PyLong_AsSsize_t(py_basicsize);
10503 Py_DECREF(py_basicsize);
10504 py_basicsize = 0;
10505 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
10506 goto bad;
10507 #endif
10508 if ((size_t)basicsize < size) {
10509 PyErr_Format(PyExc_ValueError,
10510 "%.200s.%.200s size changed, may indicate binary incompatibility. "
10511 "Expected %zd from C header, got %zd from PyObject",
10512 module_name, class_name, size, basicsize);
10513 goto bad;
10514 }
10515 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
10516 PyErr_Format(PyExc_ValueError,
10517 "%.200s.%.200s size changed, may indicate binary incompatibility. "
10518 "Expected %zd from C header, got %zd from PyObject",
10519 module_name, class_name, size, basicsize);
10520 goto bad;
10521 }
10522 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
10523 PyOS_snprintf(warning, sizeof(warning),
10524 "%s.%s size changed, may indicate binary incompatibility. "
10525 "Expected %zd from C header, got %zd from PyObject",
10526 module_name, class_name, size, basicsize);
10527 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
10528 }
10529 return (PyTypeObject *)result;
10530 bad:
10531 Py_XDECREF(result);
10532 return NULL;
10533 }
10534 #endif
10535
10536 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)10537 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
10538 PyObject *empty_list = 0;
10539 PyObject *module = 0;
10540 PyObject *global_dict = 0;
10541 PyObject *empty_dict = 0;
10542 PyObject *list;
10543 #if PY_MAJOR_VERSION < 3
10544 PyObject *py_import;
10545 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
10546 if (!py_import)
10547 goto bad;
10548 #endif
10549 if (from_list)
10550 list = from_list;
10551 else {
10552 empty_list = PyList_New(0);
10553 if (!empty_list)
10554 goto bad;
10555 list = empty_list;
10556 }
10557 global_dict = PyModule_GetDict(__pyx_m);
10558 if (!global_dict)
10559 goto bad;
10560 empty_dict = PyDict_New();
10561 if (!empty_dict)
10562 goto bad;
10563 {
10564 #if PY_MAJOR_VERSION >= 3
10565 if (level == -1) {
10566 if (strchr(__Pyx_MODULE_NAME, '.')) {
10567 module = PyImport_ImportModuleLevelObject(
10568 name, global_dict, empty_dict, list, 1);
10569 if (!module) {
10570 if (!PyErr_ExceptionMatches(PyExc_ImportError))
10571 goto bad;
10572 PyErr_Clear();
10573 }
10574 }
10575 level = 0;
10576 }
10577 #endif
10578 if (!module) {
10579 #if PY_MAJOR_VERSION < 3
10580 PyObject *py_level = PyInt_FromLong(level);
10581 if (!py_level)
10582 goto bad;
10583 module = PyObject_CallFunctionObjArgs(py_import,
10584 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
10585 Py_DECREF(py_level);
10586 #else
10587 module = PyImport_ImportModuleLevelObject(
10588 name, global_dict, empty_dict, list, level);
10589 #endif
10590 }
10591 }
10592 bad:
10593 #if PY_MAJOR_VERSION < 3
10594 Py_XDECREF(py_import);
10595 #endif
10596 Py_XDECREF(empty_list);
10597 Py_XDECREF(empty_dict);
10598 return module;
10599 }
10600
10601 /* PyDictVersioning */
10602 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)10603 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
10604 PyObject *dict = Py_TYPE(obj)->tp_dict;
10605 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
10606 }
__Pyx_get_object_dict_version(PyObject * obj)10607 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
10608 PyObject **dictptr = NULL;
10609 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
10610 if (offset) {
10611 #if CYTHON_COMPILING_IN_CPYTHON
10612 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
10613 #else
10614 dictptr = _PyObject_GetDictPtr(obj);
10615 #endif
10616 }
10617 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
10618 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)10619 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
10620 PyObject *dict = Py_TYPE(obj)->tp_dict;
10621 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
10622 return 0;
10623 return obj_dict_version == __Pyx_get_object_dict_version(obj);
10624 }
10625 #endif
10626
10627 /* CLineInTraceback */
10628 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)10629 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
10630 PyObject *use_cline;
10631 PyObject *ptype, *pvalue, *ptraceback;
10632 #if CYTHON_COMPILING_IN_CPYTHON
10633 PyObject **cython_runtime_dict;
10634 #endif
10635 if (unlikely(!__pyx_cython_runtime)) {
10636 return c_line;
10637 }
10638 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
10639 #if CYTHON_COMPILING_IN_CPYTHON
10640 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
10641 if (likely(cython_runtime_dict)) {
10642 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
10643 use_cline, *cython_runtime_dict,
10644 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
10645 } else
10646 #endif
10647 {
10648 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
10649 if (use_cline_obj) {
10650 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
10651 Py_DECREF(use_cline_obj);
10652 } else {
10653 PyErr_Clear();
10654 use_cline = NULL;
10655 }
10656 }
10657 if (!use_cline) {
10658 c_line = 0;
10659 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
10660 }
10661 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
10662 c_line = 0;
10663 }
10664 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
10665 return c_line;
10666 }
10667 #endif
10668
10669 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)10670 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
10671 int start = 0, mid = 0, end = count - 1;
10672 if (end >= 0 && code_line > entries[end].code_line) {
10673 return count;
10674 }
10675 while (start < end) {
10676 mid = start + (end - start) / 2;
10677 if (code_line < entries[mid].code_line) {
10678 end = mid;
10679 } else if (code_line > entries[mid].code_line) {
10680 start = mid + 1;
10681 } else {
10682 return mid;
10683 }
10684 }
10685 if (code_line <= entries[mid].code_line) {
10686 return mid;
10687 } else {
10688 return mid + 1;
10689 }
10690 }
__pyx_find_code_object(int code_line)10691 static PyCodeObject *__pyx_find_code_object(int code_line) {
10692 PyCodeObject* code_object;
10693 int pos;
10694 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
10695 return NULL;
10696 }
10697 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
10698 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
10699 return NULL;
10700 }
10701 code_object = __pyx_code_cache.entries[pos].code_object;
10702 Py_INCREF(code_object);
10703 return code_object;
10704 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)10705 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
10706 int pos, i;
10707 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
10708 if (unlikely(!code_line)) {
10709 return;
10710 }
10711 if (unlikely(!entries)) {
10712 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
10713 if (likely(entries)) {
10714 __pyx_code_cache.entries = entries;
10715 __pyx_code_cache.max_count = 64;
10716 __pyx_code_cache.count = 1;
10717 entries[0].code_line = code_line;
10718 entries[0].code_object = code_object;
10719 Py_INCREF(code_object);
10720 }
10721 return;
10722 }
10723 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
10724 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
10725 PyCodeObject* tmp = entries[pos].code_object;
10726 entries[pos].code_object = code_object;
10727 Py_DECREF(tmp);
10728 return;
10729 }
10730 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
10731 int new_max = __pyx_code_cache.max_count + 64;
10732 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
10733 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
10734 if (unlikely(!entries)) {
10735 return;
10736 }
10737 __pyx_code_cache.entries = entries;
10738 __pyx_code_cache.max_count = new_max;
10739 }
10740 for (i=__pyx_code_cache.count; i>pos; i--) {
10741 entries[i] = entries[i-1];
10742 }
10743 entries[pos].code_line = code_line;
10744 entries[pos].code_object = code_object;
10745 __pyx_code_cache.count++;
10746 Py_INCREF(code_object);
10747 }
10748
10749 /* AddTraceback */
10750 #include "compile.h"
10751 #include "frameobject.h"
10752 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)10753 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
10754 const char *funcname, int c_line,
10755 int py_line, const char *filename) {
10756 PyCodeObject *py_code = 0;
10757 PyObject *py_srcfile = 0;
10758 PyObject *py_funcname = 0;
10759 #if PY_MAJOR_VERSION < 3
10760 py_srcfile = PyString_FromString(filename);
10761 #else
10762 py_srcfile = PyUnicode_FromString(filename);
10763 #endif
10764 if (!py_srcfile) goto bad;
10765 if (c_line) {
10766 #if PY_MAJOR_VERSION < 3
10767 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
10768 #else
10769 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
10770 #endif
10771 }
10772 else {
10773 #if PY_MAJOR_VERSION < 3
10774 py_funcname = PyString_FromString(funcname);
10775 #else
10776 py_funcname = PyUnicode_FromString(funcname);
10777 #endif
10778 }
10779 if (!py_funcname) goto bad;
10780 py_code = __Pyx_PyCode_New(
10781 0,
10782 0,
10783 0,
10784 0,
10785 0,
10786 __pyx_empty_bytes, /*PyObject *code,*/
10787 __pyx_empty_tuple, /*PyObject *consts,*/
10788 __pyx_empty_tuple, /*PyObject *names,*/
10789 __pyx_empty_tuple, /*PyObject *varnames,*/
10790 __pyx_empty_tuple, /*PyObject *freevars,*/
10791 __pyx_empty_tuple, /*PyObject *cellvars,*/
10792 py_srcfile, /*PyObject *filename,*/
10793 py_funcname, /*PyObject *name,*/
10794 py_line,
10795 __pyx_empty_bytes /*PyObject *lnotab*/
10796 );
10797 Py_DECREF(py_srcfile);
10798 Py_DECREF(py_funcname);
10799 return py_code;
10800 bad:
10801 Py_XDECREF(py_srcfile);
10802 Py_XDECREF(py_funcname);
10803 return NULL;
10804 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)10805 static void __Pyx_AddTraceback(const char *funcname, int c_line,
10806 int py_line, const char *filename) {
10807 PyCodeObject *py_code = 0;
10808 PyFrameObject *py_frame = 0;
10809 PyThreadState *tstate = __Pyx_PyThreadState_Current;
10810 if (c_line) {
10811 c_line = __Pyx_CLineForTraceback(tstate, c_line);
10812 }
10813 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
10814 if (!py_code) {
10815 py_code = __Pyx_CreateCodeObjectForTraceback(
10816 funcname, c_line, py_line, filename);
10817 if (!py_code) goto bad;
10818 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
10819 }
10820 py_frame = PyFrame_New(
10821 tstate, /*PyThreadState *tstate,*/
10822 py_code, /*PyCodeObject *code,*/
10823 __pyx_d, /*PyObject *globals,*/
10824 0 /*PyObject *locals*/
10825 );
10826 if (!py_frame) goto bad;
10827 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
10828 PyTraceBack_Here(py_frame);
10829 bad:
10830 Py_XDECREF(py_code);
10831 Py_XDECREF(py_frame);
10832 }
10833
10834 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)10835 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
10836 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
10837 if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
10838 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
10839 return -1;
10840 }
__Pyx_ReleaseBuffer(Py_buffer * view)10841 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
10842 PyObject *obj = view->obj;
10843 if (!obj) return;
10844 if (PyObject_CheckBuffer(obj)) {
10845 PyBuffer_Release(view);
10846 return;
10847 }
10848 if ((0)) {}
10849 else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
10850 view->obj = NULL;
10851 Py_DECREF(obj);
10852 }
10853 #endif
10854
10855
10856 /* CIntFromPyVerify */
10857 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
10858 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
10859 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
10860 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
10861 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
10862 {\
10863 func_type value = func_value;\
10864 if (sizeof(target_type) < sizeof(func_type)) {\
10865 if (unlikely(value != (func_type) (target_type) value)) {\
10866 func_type zero = 0;\
10867 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
10868 return (target_type) -1;\
10869 if (is_unsigned && unlikely(value < zero))\
10870 goto raise_neg_overflow;\
10871 else\
10872 goto raise_overflow;\
10873 }\
10874 }\
10875 return (target_type) value;\
10876 }
10877
10878 /* CIntToPy */
__Pyx_PyInt_From_long(long value)10879 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
10880 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
10881 const int is_unsigned = neg_one > const_zero;
10882 if (is_unsigned) {
10883 if (sizeof(long) < sizeof(long)) {
10884 return PyInt_FromLong((long) value);
10885 } else if (sizeof(long) <= sizeof(unsigned long)) {
10886 return PyLong_FromUnsignedLong((unsigned long) value);
10887 #ifdef HAVE_LONG_LONG
10888 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10889 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10890 #endif
10891 }
10892 } else {
10893 if (sizeof(long) <= sizeof(long)) {
10894 return PyInt_FromLong((long) value);
10895 #ifdef HAVE_LONG_LONG
10896 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10897 return PyLong_FromLongLong((PY_LONG_LONG) value);
10898 #endif
10899 }
10900 }
10901 {
10902 int one = 1; int little = (int)*(unsigned char *)&one;
10903 unsigned char *bytes = (unsigned char *)&value;
10904 return _PyLong_FromByteArray(bytes, sizeof(long),
10905 little, !is_unsigned);
10906 }
10907 }
10908
10909 /* Print */
10910 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_GetStdout(void)10911 static PyObject *__Pyx_GetStdout(void) {
10912 PyObject *f = PySys_GetObject((char *)"stdout");
10913 if (!f) {
10914 PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
10915 }
10916 return f;
10917 }
__Pyx_Print(PyObject * f,PyObject * arg_tuple,int newline)10918 static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
10919 int i;
10920 if (!f) {
10921 if (!(f = __Pyx_GetStdout()))
10922 return -1;
10923 }
10924 Py_INCREF(f);
10925 for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
10926 PyObject* v;
10927 if (PyFile_SoftSpace(f, 1)) {
10928 if (PyFile_WriteString(" ", f) < 0)
10929 goto error;
10930 }
10931 v = PyTuple_GET_ITEM(arg_tuple, i);
10932 if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
10933 goto error;
10934 if (PyString_Check(v)) {
10935 char *s = PyString_AsString(v);
10936 Py_ssize_t len = PyString_Size(v);
10937 if (len > 0) {
10938 switch (s[len-1]) {
10939 case ' ': break;
10940 case '\f': case '\r': case '\n': case '\t': case '\v':
10941 PyFile_SoftSpace(f, 0);
10942 break;
10943 default: break;
10944 }
10945 }
10946 }
10947 }
10948 if (newline) {
10949 if (PyFile_WriteString("\n", f) < 0)
10950 goto error;
10951 PyFile_SoftSpace(f, 0);
10952 }
10953 Py_DECREF(f);
10954 return 0;
10955 error:
10956 Py_DECREF(f);
10957 return -1;
10958 }
10959 #else
__Pyx_Print(PyObject * stream,PyObject * arg_tuple,int newline)10960 static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
10961 PyObject* kwargs = 0;
10962 PyObject* result = 0;
10963 PyObject* end_string;
10964 if (unlikely(!__pyx_print)) {
10965 __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
10966 if (!__pyx_print)
10967 return -1;
10968 }
10969 if (stream) {
10970 kwargs = PyDict_New();
10971 if (unlikely(!kwargs))
10972 return -1;
10973 if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
10974 goto bad;
10975 if (!newline) {
10976 end_string = PyUnicode_FromStringAndSize(" ", 1);
10977 if (unlikely(!end_string))
10978 goto bad;
10979 if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
10980 Py_DECREF(end_string);
10981 goto bad;
10982 }
10983 Py_DECREF(end_string);
10984 }
10985 } else if (!newline) {
10986 if (unlikely(!__pyx_print_kwargs)) {
10987 __pyx_print_kwargs = PyDict_New();
10988 if (unlikely(!__pyx_print_kwargs))
10989 return -1;
10990 end_string = PyUnicode_FromStringAndSize(" ", 1);
10991 if (unlikely(!end_string))
10992 return -1;
10993 if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
10994 Py_DECREF(end_string);
10995 return -1;
10996 }
10997 Py_DECREF(end_string);
10998 }
10999 kwargs = __pyx_print_kwargs;
11000 }
11001 result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
11002 if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
11003 Py_DECREF(kwargs);
11004 if (!result)
11005 return -1;
11006 Py_DECREF(result);
11007 return 0;
11008 bad:
11009 if (kwargs != __pyx_print_kwargs)
11010 Py_XDECREF(kwargs);
11011 return -1;
11012 }
11013 #endif
11014
11015 /* CIntToPy */
__Pyx_PyInt_From_int(int value)11016 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
11017 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
11018 const int is_unsigned = neg_one > const_zero;
11019 if (is_unsigned) {
11020 if (sizeof(int) < sizeof(long)) {
11021 return PyInt_FromLong((long) value);
11022 } else if (sizeof(int) <= sizeof(unsigned long)) {
11023 return PyLong_FromUnsignedLong((unsigned long) value);
11024 #ifdef HAVE_LONG_LONG
11025 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
11026 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
11027 #endif
11028 }
11029 } else {
11030 if (sizeof(int) <= sizeof(long)) {
11031 return PyInt_FromLong((long) value);
11032 #ifdef HAVE_LONG_LONG
11033 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
11034 return PyLong_FromLongLong((PY_LONG_LONG) value);
11035 #endif
11036 }
11037 }
11038 {
11039 int one = 1; int little = (int)*(unsigned char *)&one;
11040 unsigned char *bytes = (unsigned char *)&value;
11041 return _PyLong_FromByteArray(bytes, sizeof(int),
11042 little, !is_unsigned);
11043 }
11044 }
11045
11046 /* CIntToPy */
__Pyx_PyInt_From_npy_int64(npy_int64 value)11047 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
11048 const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
11049 const int is_unsigned = neg_one > const_zero;
11050 if (is_unsigned) {
11051 if (sizeof(npy_int64) < sizeof(long)) {
11052 return PyInt_FromLong((long) value);
11053 } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
11054 return PyLong_FromUnsignedLong((unsigned long) value);
11055 #ifdef HAVE_LONG_LONG
11056 } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
11057 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
11058 #endif
11059 }
11060 } else {
11061 if (sizeof(npy_int64) <= sizeof(long)) {
11062 return PyInt_FromLong((long) value);
11063 #ifdef HAVE_LONG_LONG
11064 } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
11065 return PyLong_FromLongLong((PY_LONG_LONG) value);
11066 #endif
11067 }
11068 }
11069 {
11070 int one = 1; int little = (int)*(unsigned char *)&one;
11071 unsigned char *bytes = (unsigned char *)&value;
11072 return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
11073 little, !is_unsigned);
11074 }
11075 }
11076
11077 /* Declarations */
11078 #if CYTHON_CCOMPLEX
11079 #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)11080 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
11081 return ::std::complex< float >(x, y);
11082 }
11083 #else
__pyx_t_float_complex_from_parts(float x,float y)11084 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
11085 return x + y*(__pyx_t_float_complex)_Complex_I;
11086 }
11087 #endif
11088 #else
__pyx_t_float_complex_from_parts(float x,float y)11089 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
11090 __pyx_t_float_complex z;
11091 z.real = x;
11092 z.imag = y;
11093 return z;
11094 }
11095 #endif
11096
11097 /* Arithmetic */
11098 #if CYTHON_CCOMPLEX
11099 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11100 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11101 return (a.real == b.real) && (a.imag == b.imag);
11102 }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11103 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11104 __pyx_t_float_complex z;
11105 z.real = a.real + b.real;
11106 z.imag = a.imag + b.imag;
11107 return z;
11108 }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11109 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11110 __pyx_t_float_complex z;
11111 z.real = a.real - b.real;
11112 z.imag = a.imag - b.imag;
11113 return z;
11114 }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11115 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11116 __pyx_t_float_complex z;
11117 z.real = a.real * b.real - a.imag * b.imag;
11118 z.imag = a.real * b.imag + a.imag * b.real;
11119 return z;
11120 }
11121 #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11122 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11123 if (b.imag == 0) {
11124 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
11125 } else if (fabsf(b.real) >= fabsf(b.imag)) {
11126 if (b.real == 0 && b.imag == 0) {
11127 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
11128 } else {
11129 float r = b.imag / b.real;
11130 float s = (float)(1.0) / (b.real + b.imag * r);
11131 return __pyx_t_float_complex_from_parts(
11132 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
11133 }
11134 } else {
11135 float r = b.real / b.imag;
11136 float s = (float)(1.0) / (b.imag + b.real * r);
11137 return __pyx_t_float_complex_from_parts(
11138 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
11139 }
11140 }
11141 #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11142 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11143 if (b.imag == 0) {
11144 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
11145 } else {
11146 float denom = b.real * b.real + b.imag * b.imag;
11147 return __pyx_t_float_complex_from_parts(
11148 (a.real * b.real + a.imag * b.imag) / denom,
11149 (a.imag * b.real - a.real * b.imag) / denom);
11150 }
11151 }
11152 #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)11153 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
11154 __pyx_t_float_complex z;
11155 z.real = -a.real;
11156 z.imag = -a.imag;
11157 return z;
11158 }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)11159 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
11160 return (a.real == 0) && (a.imag == 0);
11161 }
__Pyx_c_conj_float(__pyx_t_float_complex a)11162 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
11163 __pyx_t_float_complex z;
11164 z.real = a.real;
11165 z.imag = -a.imag;
11166 return z;
11167 }
11168 #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)11169 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
11170 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
11171 return sqrtf(z.real*z.real + z.imag*z.imag);
11172 #else
11173 return hypotf(z.real, z.imag);
11174 #endif
11175 }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)11176 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
11177 __pyx_t_float_complex z;
11178 float r, lnr, theta, z_r, z_theta;
11179 if (b.imag == 0 && b.real == (int)b.real) {
11180 if (b.real < 0) {
11181 float denom = a.real * a.real + a.imag * a.imag;
11182 a.real = a.real / denom;
11183 a.imag = -a.imag / denom;
11184 b.real = -b.real;
11185 }
11186 switch ((int)b.real) {
11187 case 0:
11188 z.real = 1;
11189 z.imag = 0;
11190 return z;
11191 case 1:
11192 return a;
11193 case 2:
11194 z = __Pyx_c_prod_float(a, a);
11195 return __Pyx_c_prod_float(a, a);
11196 case 3:
11197 z = __Pyx_c_prod_float(a, a);
11198 return __Pyx_c_prod_float(z, a);
11199 case 4:
11200 z = __Pyx_c_prod_float(a, a);
11201 return __Pyx_c_prod_float(z, z);
11202 }
11203 }
11204 if (a.imag == 0) {
11205 if (a.real == 0) {
11206 return a;
11207 } else if (b.imag == 0) {
11208 z.real = powf(a.real, b.real);
11209 z.imag = 0;
11210 return z;
11211 } else if (a.real > 0) {
11212 r = a.real;
11213 theta = 0;
11214 } else {
11215 r = -a.real;
11216 theta = atan2f(0.0, -1.0);
11217 }
11218 } else {
11219 r = __Pyx_c_abs_float(a);
11220 theta = atan2f(a.imag, a.real);
11221 }
11222 lnr = logf(r);
11223 z_r = expf(lnr * b.real - theta * b.imag);
11224 z_theta = theta * b.real + lnr * b.imag;
11225 z.real = z_r * cosf(z_theta);
11226 z.imag = z_r * sinf(z_theta);
11227 return z;
11228 }
11229 #endif
11230 #endif
11231
11232 /* Declarations */
11233 #if CYTHON_CCOMPLEX
11234 #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)11235 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
11236 return ::std::complex< double >(x, y);
11237 }
11238 #else
__pyx_t_double_complex_from_parts(double x,double y)11239 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
11240 return x + y*(__pyx_t_double_complex)_Complex_I;
11241 }
11242 #endif
11243 #else
__pyx_t_double_complex_from_parts(double x,double y)11244 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
11245 __pyx_t_double_complex z;
11246 z.real = x;
11247 z.imag = y;
11248 return z;
11249 }
11250 #endif
11251
11252 /* Arithmetic */
11253 #if CYTHON_CCOMPLEX
11254 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11255 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11256 return (a.real == b.real) && (a.imag == b.imag);
11257 }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11258 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11259 __pyx_t_double_complex z;
11260 z.real = a.real + b.real;
11261 z.imag = a.imag + b.imag;
11262 return z;
11263 }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11264 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11265 __pyx_t_double_complex z;
11266 z.real = a.real - b.real;
11267 z.imag = a.imag - b.imag;
11268 return z;
11269 }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11270 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11271 __pyx_t_double_complex z;
11272 z.real = a.real * b.real - a.imag * b.imag;
11273 z.imag = a.real * b.imag + a.imag * b.real;
11274 return z;
11275 }
11276 #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11277 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11278 if (b.imag == 0) {
11279 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
11280 } else if (fabs(b.real) >= fabs(b.imag)) {
11281 if (b.real == 0 && b.imag == 0) {
11282 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
11283 } else {
11284 double r = b.imag / b.real;
11285 double s = (double)(1.0) / (b.real + b.imag * r);
11286 return __pyx_t_double_complex_from_parts(
11287 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
11288 }
11289 } else {
11290 double r = b.real / b.imag;
11291 double s = (double)(1.0) / (b.imag + b.real * r);
11292 return __pyx_t_double_complex_from_parts(
11293 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
11294 }
11295 }
11296 #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11297 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11298 if (b.imag == 0) {
11299 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
11300 } else {
11301 double denom = b.real * b.real + b.imag * b.imag;
11302 return __pyx_t_double_complex_from_parts(
11303 (a.real * b.real + a.imag * b.imag) / denom,
11304 (a.imag * b.real - a.real * b.imag) / denom);
11305 }
11306 }
11307 #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)11308 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
11309 __pyx_t_double_complex z;
11310 z.real = -a.real;
11311 z.imag = -a.imag;
11312 return z;
11313 }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)11314 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
11315 return (a.real == 0) && (a.imag == 0);
11316 }
__Pyx_c_conj_double(__pyx_t_double_complex a)11317 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
11318 __pyx_t_double_complex z;
11319 z.real = a.real;
11320 z.imag = -a.imag;
11321 return z;
11322 }
11323 #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)11324 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
11325 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
11326 return sqrt(z.real*z.real + z.imag*z.imag);
11327 #else
11328 return hypot(z.real, z.imag);
11329 #endif
11330 }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)11331 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
11332 __pyx_t_double_complex z;
11333 double r, lnr, theta, z_r, z_theta;
11334 if (b.imag == 0 && b.real == (int)b.real) {
11335 if (b.real < 0) {
11336 double denom = a.real * a.real + a.imag * a.imag;
11337 a.real = a.real / denom;
11338 a.imag = -a.imag / denom;
11339 b.real = -b.real;
11340 }
11341 switch ((int)b.real) {
11342 case 0:
11343 z.real = 1;
11344 z.imag = 0;
11345 return z;
11346 case 1:
11347 return a;
11348 case 2:
11349 z = __Pyx_c_prod_double(a, a);
11350 return __Pyx_c_prod_double(a, a);
11351 case 3:
11352 z = __Pyx_c_prod_double(a, a);
11353 return __Pyx_c_prod_double(z, a);
11354 case 4:
11355 z = __Pyx_c_prod_double(a, a);
11356 return __Pyx_c_prod_double(z, z);
11357 }
11358 }
11359 if (a.imag == 0) {
11360 if (a.real == 0) {
11361 return a;
11362 } else if (b.imag == 0) {
11363 z.real = pow(a.real, b.real);
11364 z.imag = 0;
11365 return z;
11366 } else if (a.real > 0) {
11367 r = a.real;
11368 theta = 0;
11369 } else {
11370 r = -a.real;
11371 theta = atan2(0.0, -1.0);
11372 }
11373 } else {
11374 r = __Pyx_c_abs_double(a);
11375 theta = atan2(a.imag, a.real);
11376 }
11377 lnr = log(r);
11378 z_r = exp(lnr * b.real - theta * b.imag);
11379 z_theta = theta * b.real + lnr * b.imag;
11380 z.real = z_r * cos(z_theta);
11381 z.imag = z_r * sin(z_theta);
11382 return z;
11383 }
11384 #endif
11385 #endif
11386
11387 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)11388 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
11389 const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
11390 const int is_unsigned = neg_one > const_zero;
11391 if (is_unsigned) {
11392 if (sizeof(enum NPY_TYPES) < sizeof(long)) {
11393 return PyInt_FromLong((long) value);
11394 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
11395 return PyLong_FromUnsignedLong((unsigned long) value);
11396 #ifdef HAVE_LONG_LONG
11397 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
11398 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
11399 #endif
11400 }
11401 } else {
11402 if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
11403 return PyInt_FromLong((long) value);
11404 #ifdef HAVE_LONG_LONG
11405 } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
11406 return PyLong_FromLongLong((PY_LONG_LONG) value);
11407 #endif
11408 }
11409 }
11410 {
11411 int one = 1; int little = (int)*(unsigned char *)&one;
11412 unsigned char *bytes = (unsigned char *)&value;
11413 return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
11414 little, !is_unsigned);
11415 }
11416 }
11417
11418 /* CIntFromPy */
__Pyx_PyInt_As_npy_int64(PyObject * x)11419 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) {
11420 const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
11421 const int is_unsigned = neg_one > const_zero;
11422 #if PY_MAJOR_VERSION < 3
11423 if (likely(PyInt_Check(x))) {
11424 if (sizeof(npy_int64) < sizeof(long)) {
11425 __PYX_VERIFY_RETURN_INT(npy_int64, long, PyInt_AS_LONG(x))
11426 } else {
11427 long val = PyInt_AS_LONG(x);
11428 if (is_unsigned && unlikely(val < 0)) {
11429 goto raise_neg_overflow;
11430 }
11431 return (npy_int64) val;
11432 }
11433 } else
11434 #endif
11435 if (likely(PyLong_Check(x))) {
11436 if (is_unsigned) {
11437 #if CYTHON_USE_PYLONG_INTERNALS
11438 const digit* digits = ((PyLongObject*)x)->ob_digit;
11439 switch (Py_SIZE(x)) {
11440 case 0: return (npy_int64) 0;
11441 case 1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, digits[0])
11442 case 2:
11443 if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
11444 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11445 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11446 } else if (8 * sizeof(npy_int64) >= 2 * PyLong_SHIFT) {
11447 return (npy_int64) (((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
11448 }
11449 }
11450 break;
11451 case 3:
11452 if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
11453 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11454 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11455 } else if (8 * sizeof(npy_int64) >= 3 * PyLong_SHIFT) {
11456 return (npy_int64) (((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
11457 }
11458 }
11459 break;
11460 case 4:
11461 if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
11462 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11463 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11464 } else if (8 * sizeof(npy_int64) >= 4 * PyLong_SHIFT) {
11465 return (npy_int64) (((((((((npy_int64)digits[3]) << PyLong_SHIFT) | (npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
11466 }
11467 }
11468 break;
11469 }
11470 #endif
11471 #if CYTHON_COMPILING_IN_CPYTHON
11472 if (unlikely(Py_SIZE(x) < 0)) {
11473 goto raise_neg_overflow;
11474 }
11475 #else
11476 {
11477 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
11478 if (unlikely(result < 0))
11479 return (npy_int64) -1;
11480 if (unlikely(result == 1))
11481 goto raise_neg_overflow;
11482 }
11483 #endif
11484 if (sizeof(npy_int64) <= sizeof(unsigned long)) {
11485 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned long, PyLong_AsUnsignedLong(x))
11486 #ifdef HAVE_LONG_LONG
11487 } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
11488 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
11489 #endif
11490 }
11491 } else {
11492 #if CYTHON_USE_PYLONG_INTERNALS
11493 const digit* digits = ((PyLongObject*)x)->ob_digit;
11494 switch (Py_SIZE(x)) {
11495 case 0: return (npy_int64) 0;
11496 case -1: __PYX_VERIFY_RETURN_INT(npy_int64, sdigit, (sdigit) (-(sdigit)digits[0]))
11497 case 1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, +digits[0])
11498 case -2:
11499 if (8 * sizeof(npy_int64) - 1 > 1 * PyLong_SHIFT) {
11500 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11501 __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11502 } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
11503 return (npy_int64) (((npy_int64)-1)*(((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
11504 }
11505 }
11506 break;
11507 case 2:
11508 if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
11509 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11510 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11511 } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
11512 return (npy_int64) ((((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
11513 }
11514 }
11515 break;
11516 case -3:
11517 if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
11518 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11519 __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11520 } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
11521 return (npy_int64) (((npy_int64)-1)*(((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
11522 }
11523 }
11524 break;
11525 case 3:
11526 if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
11527 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11528 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11529 } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
11530 return (npy_int64) ((((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
11531 }
11532 }
11533 break;
11534 case -4:
11535 if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
11536 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11537 __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11538 } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
11539 return (npy_int64) (((npy_int64)-1)*(((((((((npy_int64)digits[3]) << PyLong_SHIFT) | (npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
11540 }
11541 }
11542 break;
11543 case 4:
11544 if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
11545 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11546 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11547 } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
11548 return (npy_int64) ((((((((((npy_int64)digits[3]) << PyLong_SHIFT) | (npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
11549 }
11550 }
11551 break;
11552 }
11553 #endif
11554 if (sizeof(npy_int64) <= sizeof(long)) {
11555 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, long, PyLong_AsLong(x))
11556 #ifdef HAVE_LONG_LONG
11557 } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
11558 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, PY_LONG_LONG, PyLong_AsLongLong(x))
11559 #endif
11560 }
11561 }
11562 {
11563 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
11564 PyErr_SetString(PyExc_RuntimeError,
11565 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
11566 #else
11567 npy_int64 val;
11568 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
11569 #if PY_MAJOR_VERSION < 3
11570 if (likely(v) && !PyLong_Check(v)) {
11571 PyObject *tmp = v;
11572 v = PyNumber_Long(tmp);
11573 Py_DECREF(tmp);
11574 }
11575 #endif
11576 if (likely(v)) {
11577 int one = 1; int is_little = (int)*(unsigned char *)&one;
11578 unsigned char *bytes = (unsigned char *)&val;
11579 int ret = _PyLong_AsByteArray((PyLongObject *)v,
11580 bytes, sizeof(val),
11581 is_little, !is_unsigned);
11582 Py_DECREF(v);
11583 if (likely(!ret))
11584 return val;
11585 }
11586 #endif
11587 return (npy_int64) -1;
11588 }
11589 } else {
11590 npy_int64 val;
11591 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
11592 if (!tmp) return (npy_int64) -1;
11593 val = __Pyx_PyInt_As_npy_int64(tmp);
11594 Py_DECREF(tmp);
11595 return val;
11596 }
11597 raise_overflow:
11598 PyErr_SetString(PyExc_OverflowError,
11599 "value too large to convert to npy_int64");
11600 return (npy_int64) -1;
11601 raise_neg_overflow:
11602 PyErr_SetString(PyExc_OverflowError,
11603 "can't convert negative value to npy_int64");
11604 return (npy_int64) -1;
11605 }
11606
11607 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)11608 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
11609 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
11610 const int is_unsigned = neg_one > const_zero;
11611 #if PY_MAJOR_VERSION < 3
11612 if (likely(PyInt_Check(x))) {
11613 if (sizeof(int) < sizeof(long)) {
11614 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
11615 } else {
11616 long val = PyInt_AS_LONG(x);
11617 if (is_unsigned && unlikely(val < 0)) {
11618 goto raise_neg_overflow;
11619 }
11620 return (int) val;
11621 }
11622 } else
11623 #endif
11624 if (likely(PyLong_Check(x))) {
11625 if (is_unsigned) {
11626 #if CYTHON_USE_PYLONG_INTERNALS
11627 const digit* digits = ((PyLongObject*)x)->ob_digit;
11628 switch (Py_SIZE(x)) {
11629 case 0: return (int) 0;
11630 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
11631 case 2:
11632 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
11633 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11634 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11635 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
11636 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11637 }
11638 }
11639 break;
11640 case 3:
11641 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
11642 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11643 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11644 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
11645 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11646 }
11647 }
11648 break;
11649 case 4:
11650 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
11651 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11652 __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])))
11653 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
11654 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11655 }
11656 }
11657 break;
11658 }
11659 #endif
11660 #if CYTHON_COMPILING_IN_CPYTHON
11661 if (unlikely(Py_SIZE(x) < 0)) {
11662 goto raise_neg_overflow;
11663 }
11664 #else
11665 {
11666 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
11667 if (unlikely(result < 0))
11668 return (int) -1;
11669 if (unlikely(result == 1))
11670 goto raise_neg_overflow;
11671 }
11672 #endif
11673 if (sizeof(int) <= sizeof(unsigned long)) {
11674 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
11675 #ifdef HAVE_LONG_LONG
11676 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
11677 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
11678 #endif
11679 }
11680 } else {
11681 #if CYTHON_USE_PYLONG_INTERNALS
11682 const digit* digits = ((PyLongObject*)x)->ob_digit;
11683 switch (Py_SIZE(x)) {
11684 case 0: return (int) 0;
11685 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
11686 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
11687 case -2:
11688 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
11689 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11690 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11691 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11692 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11693 }
11694 }
11695 break;
11696 case 2:
11697 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
11698 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11699 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11700 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11701 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11702 }
11703 }
11704 break;
11705 case -3:
11706 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11707 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11708 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11709 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11710 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11711 }
11712 }
11713 break;
11714 case 3:
11715 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
11716 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11717 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11718 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11719 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11720 }
11721 }
11722 break;
11723 case -4:
11724 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11725 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11726 __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])))
11727 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
11728 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11729 }
11730 }
11731 break;
11732 case 4:
11733 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
11734 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11735 __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])))
11736 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
11737 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11738 }
11739 }
11740 break;
11741 }
11742 #endif
11743 if (sizeof(int) <= sizeof(long)) {
11744 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
11745 #ifdef HAVE_LONG_LONG
11746 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
11747 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
11748 #endif
11749 }
11750 }
11751 {
11752 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
11753 PyErr_SetString(PyExc_RuntimeError,
11754 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
11755 #else
11756 int val;
11757 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
11758 #if PY_MAJOR_VERSION < 3
11759 if (likely(v) && !PyLong_Check(v)) {
11760 PyObject *tmp = v;
11761 v = PyNumber_Long(tmp);
11762 Py_DECREF(tmp);
11763 }
11764 #endif
11765 if (likely(v)) {
11766 int one = 1; int is_little = (int)*(unsigned char *)&one;
11767 unsigned char *bytes = (unsigned char *)&val;
11768 int ret = _PyLong_AsByteArray((PyLongObject *)v,
11769 bytes, sizeof(val),
11770 is_little, !is_unsigned);
11771 Py_DECREF(v);
11772 if (likely(!ret))
11773 return val;
11774 }
11775 #endif
11776 return (int) -1;
11777 }
11778 } else {
11779 int val;
11780 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
11781 if (!tmp) return (int) -1;
11782 val = __Pyx_PyInt_As_int(tmp);
11783 Py_DECREF(tmp);
11784 return val;
11785 }
11786 raise_overflow:
11787 PyErr_SetString(PyExc_OverflowError,
11788 "value too large to convert to int");
11789 return (int) -1;
11790 raise_neg_overflow:
11791 PyErr_SetString(PyExc_OverflowError,
11792 "can't convert negative value to int");
11793 return (int) -1;
11794 }
11795
11796 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)11797 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
11798 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
11799 const int is_unsigned = neg_one > const_zero;
11800 #if PY_MAJOR_VERSION < 3
11801 if (likely(PyInt_Check(x))) {
11802 if (sizeof(long) < sizeof(long)) {
11803 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
11804 } else {
11805 long val = PyInt_AS_LONG(x);
11806 if (is_unsigned && unlikely(val < 0)) {
11807 goto raise_neg_overflow;
11808 }
11809 return (long) val;
11810 }
11811 } else
11812 #endif
11813 if (likely(PyLong_Check(x))) {
11814 if (is_unsigned) {
11815 #if CYTHON_USE_PYLONG_INTERNALS
11816 const digit* digits = ((PyLongObject*)x)->ob_digit;
11817 switch (Py_SIZE(x)) {
11818 case 0: return (long) 0;
11819 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
11820 case 2:
11821 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
11822 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11823 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11824 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
11825 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
11826 }
11827 }
11828 break;
11829 case 3:
11830 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
11831 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11832 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11833 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
11834 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
11835 }
11836 }
11837 break;
11838 case 4:
11839 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
11840 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11841 __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])))
11842 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
11843 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
11844 }
11845 }
11846 break;
11847 }
11848 #endif
11849 #if CYTHON_COMPILING_IN_CPYTHON
11850 if (unlikely(Py_SIZE(x) < 0)) {
11851 goto raise_neg_overflow;
11852 }
11853 #else
11854 {
11855 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
11856 if (unlikely(result < 0))
11857 return (long) -1;
11858 if (unlikely(result == 1))
11859 goto raise_neg_overflow;
11860 }
11861 #endif
11862 if (sizeof(long) <= sizeof(unsigned long)) {
11863 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
11864 #ifdef HAVE_LONG_LONG
11865 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
11866 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
11867 #endif
11868 }
11869 } else {
11870 #if CYTHON_USE_PYLONG_INTERNALS
11871 const digit* digits = ((PyLongObject*)x)->ob_digit;
11872 switch (Py_SIZE(x)) {
11873 case 0: return (long) 0;
11874 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
11875 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
11876 case -2:
11877 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
11878 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11879 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11880 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
11881 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11882 }
11883 }
11884 break;
11885 case 2:
11886 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
11887 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11888 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11889 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
11890 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11891 }
11892 }
11893 break;
11894 case -3:
11895 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
11896 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11897 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11898 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
11899 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11900 }
11901 }
11902 break;
11903 case 3:
11904 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
11905 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11906 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11907 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
11908 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11909 }
11910 }
11911 break;
11912 case -4:
11913 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
11914 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11915 __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])))
11916 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
11917 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11918 }
11919 }
11920 break;
11921 case 4:
11922 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
11923 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11924 __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])))
11925 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
11926 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11927 }
11928 }
11929 break;
11930 }
11931 #endif
11932 if (sizeof(long) <= sizeof(long)) {
11933 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
11934 #ifdef HAVE_LONG_LONG
11935 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
11936 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
11937 #endif
11938 }
11939 }
11940 {
11941 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
11942 PyErr_SetString(PyExc_RuntimeError,
11943 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
11944 #else
11945 long val;
11946 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
11947 #if PY_MAJOR_VERSION < 3
11948 if (likely(v) && !PyLong_Check(v)) {
11949 PyObject *tmp = v;
11950 v = PyNumber_Long(tmp);
11951 Py_DECREF(tmp);
11952 }
11953 #endif
11954 if (likely(v)) {
11955 int one = 1; int is_little = (int)*(unsigned char *)&one;
11956 unsigned char *bytes = (unsigned char *)&val;
11957 int ret = _PyLong_AsByteArray((PyLongObject *)v,
11958 bytes, sizeof(val),
11959 is_little, !is_unsigned);
11960 Py_DECREF(v);
11961 if (likely(!ret))
11962 return val;
11963 }
11964 #endif
11965 return (long) -1;
11966 }
11967 } else {
11968 long val;
11969 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
11970 if (!tmp) return (long) -1;
11971 val = __Pyx_PyInt_As_long(tmp);
11972 Py_DECREF(tmp);
11973 return val;
11974 }
11975 raise_overflow:
11976 PyErr_SetString(PyExc_OverflowError,
11977 "value too large to convert to long");
11978 return (long) -1;
11979 raise_neg_overflow:
11980 PyErr_SetString(PyExc_OverflowError,
11981 "can't convert negative value to long");
11982 return (long) -1;
11983 }
11984
11985 /* PrintOne */
11986 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_PrintOne(PyObject * f,PyObject * o)11987 static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
11988 if (!f) {
11989 if (!(f = __Pyx_GetStdout()))
11990 return -1;
11991 }
11992 Py_INCREF(f);
11993 if (PyFile_SoftSpace(f, 0)) {
11994 if (PyFile_WriteString(" ", f) < 0)
11995 goto error;
11996 }
11997 if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
11998 goto error;
11999 if (PyFile_WriteString("\n", f) < 0)
12000 goto error;
12001 Py_DECREF(f);
12002 return 0;
12003 error:
12004 Py_DECREF(f);
12005 return -1;
12006 /* the line below is just to avoid C compiler
12007 * warnings about unused functions */
12008 return __Pyx_Print(f, NULL, 0);
12009 }
12010 #else
__Pyx_PrintOne(PyObject * stream,PyObject * o)12011 static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
12012 int res;
12013 PyObject* arg_tuple = PyTuple_Pack(1, o);
12014 if (unlikely(!arg_tuple))
12015 return -1;
12016 res = __Pyx_Print(stream, arg_tuple, 1);
12017 Py_DECREF(arg_tuple);
12018 return res;
12019 }
12020 #endif
12021
12022 /* FastTypeChecks */
12023 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)12024 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
12025 while (a) {
12026 a = a->tp_base;
12027 if (a == b)
12028 return 1;
12029 }
12030 return b == &PyBaseObject_Type;
12031 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)12032 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
12033 PyObject *mro;
12034 if (a == b) return 1;
12035 mro = a->tp_mro;
12036 if (likely(mro)) {
12037 Py_ssize_t i, n;
12038 n = PyTuple_GET_SIZE(mro);
12039 for (i = 0; i < n; i++) {
12040 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
12041 return 1;
12042 }
12043 return 0;
12044 }
12045 return __Pyx_InBases(a, b);
12046 }
12047 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)12048 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
12049 PyObject *exception, *value, *tb;
12050 int res;
12051 __Pyx_PyThreadState_declare
12052 __Pyx_PyThreadState_assign
12053 __Pyx_ErrFetch(&exception, &value, &tb);
12054 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
12055 if (unlikely(res == -1)) {
12056 PyErr_WriteUnraisable(err);
12057 res = 0;
12058 }
12059 if (!res) {
12060 res = PyObject_IsSubclass(err, exc_type2);
12061 if (unlikely(res == -1)) {
12062 PyErr_WriteUnraisable(err);
12063 res = 0;
12064 }
12065 }
12066 __Pyx_ErrRestore(exception, value, tb);
12067 return res;
12068 }
12069 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)12070 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
12071 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
12072 if (!res) {
12073 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
12074 }
12075 return res;
12076 }
12077 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)12078 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
12079 Py_ssize_t i, n;
12080 assert(PyExceptionClass_Check(exc_type));
12081 n = PyTuple_GET_SIZE(tuple);
12082 #if PY_MAJOR_VERSION >= 3
12083 for (i=0; i<n; i++) {
12084 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
12085 }
12086 #endif
12087 for (i=0; i<n; i++) {
12088 PyObject *t = PyTuple_GET_ITEM(tuple, i);
12089 #if PY_MAJOR_VERSION < 3
12090 if (likely(exc_type == t)) return 1;
12091 #endif
12092 if (likely(PyExceptionClass_Check(t))) {
12093 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
12094 } else {
12095 }
12096 }
12097 return 0;
12098 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)12099 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
12100 if (likely(err == exc_type)) return 1;
12101 if (likely(PyExceptionClass_Check(err))) {
12102 if (likely(PyExceptionClass_Check(exc_type))) {
12103 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
12104 } else if (likely(PyTuple_Check(exc_type))) {
12105 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
12106 } else {
12107 }
12108 }
12109 return PyErr_GivenExceptionMatches(err, exc_type);
12110 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)12111 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
12112 assert(PyExceptionClass_Check(exc_type1));
12113 assert(PyExceptionClass_Check(exc_type2));
12114 if (likely(err == exc_type1 || err == exc_type2)) return 1;
12115 if (likely(PyExceptionClass_Check(err))) {
12116 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
12117 }
12118 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
12119 }
12120 #endif
12121
12122 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)12123 static int __Pyx_check_binary_version(void) {
12124 char ctversion[4], rtversion[4];
12125 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
12126 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
12127 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
12128 char message[200];
12129 PyOS_snprintf(message, sizeof(message),
12130 "compiletime version %s of module '%.100s' "
12131 "does not match runtime version %s",
12132 ctversion, __Pyx_MODULE_NAME, rtversion);
12133 return PyErr_WarnEx(NULL, message, 1);
12134 }
12135 return 0;
12136 }
12137
12138 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)12139 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
12140 while (t->p) {
12141 #if PY_MAJOR_VERSION < 3
12142 if (t->is_unicode) {
12143 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
12144 } else if (t->intern) {
12145 *t->p = PyString_InternFromString(t->s);
12146 } else {
12147 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
12148 }
12149 #else
12150 if (t->is_unicode | t->is_str) {
12151 if (t->intern) {
12152 *t->p = PyUnicode_InternFromString(t->s);
12153 } else if (t->encoding) {
12154 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
12155 } else {
12156 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
12157 }
12158 } else {
12159 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
12160 }
12161 #endif
12162 if (!*t->p)
12163 return -1;
12164 if (PyObject_Hash(*t->p) == -1)
12165 return -1;
12166 ++t;
12167 }
12168 return 0;
12169 }
12170
__Pyx_PyUnicode_FromString(const char * c_str)12171 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
12172 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
12173 }
__Pyx_PyObject_AsString(PyObject * o)12174 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
12175 Py_ssize_t ignore;
12176 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
12177 }
12178 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
12179 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)12180 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
12181 char* defenc_c;
12182 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
12183 if (!defenc) return NULL;
12184 defenc_c = PyBytes_AS_STRING(defenc);
12185 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
12186 {
12187 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
12188 char* c;
12189 for (c = defenc_c; c < end; c++) {
12190 if ((unsigned char) (*c) >= 128) {
12191 PyUnicode_AsASCIIString(o);
12192 return NULL;
12193 }
12194 }
12195 }
12196 #endif
12197 *length = PyBytes_GET_SIZE(defenc);
12198 return defenc_c;
12199 }
12200 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)12201 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
12202 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
12203 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
12204 if (likely(PyUnicode_IS_ASCII(o))) {
12205 *length = PyUnicode_GET_LENGTH(o);
12206 return PyUnicode_AsUTF8(o);
12207 } else {
12208 PyUnicode_AsASCIIString(o);
12209 return NULL;
12210 }
12211 #else
12212 return PyUnicode_AsUTF8AndSize(o, length);
12213 #endif
12214 }
12215 #endif
12216 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)12217 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
12218 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
12219 if (
12220 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
12221 __Pyx_sys_getdefaultencoding_not_ascii &&
12222 #endif
12223 PyUnicode_Check(o)) {
12224 return __Pyx_PyUnicode_AsStringAndSize(o, length);
12225 } else
12226 #endif
12227 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
12228 if (PyByteArray_Check(o)) {
12229 *length = PyByteArray_GET_SIZE(o);
12230 return PyByteArray_AS_STRING(o);
12231 } else
12232 #endif
12233 {
12234 char* result;
12235 int r = PyBytes_AsStringAndSize(o, &result, length);
12236 if (unlikely(r < 0)) {
12237 return NULL;
12238 } else {
12239 return result;
12240 }
12241 }
12242 }
__Pyx_PyObject_IsTrue(PyObject * x)12243 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
12244 int is_true = x == Py_True;
12245 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
12246 else return PyObject_IsTrue(x);
12247 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)12248 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
12249 int retval;
12250 if (unlikely(!x)) return -1;
12251 retval = __Pyx_PyObject_IsTrue(x);
12252 Py_DECREF(x);
12253 return retval;
12254 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)12255 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
12256 #if PY_MAJOR_VERSION >= 3
12257 if (PyLong_Check(result)) {
12258 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
12259 "__int__ returned non-int (type %.200s). "
12260 "The ability to return an instance of a strict subclass of int "
12261 "is deprecated, and may be removed in a future version of Python.",
12262 Py_TYPE(result)->tp_name)) {
12263 Py_DECREF(result);
12264 return NULL;
12265 }
12266 return result;
12267 }
12268 #endif
12269 PyErr_Format(PyExc_TypeError,
12270 "__%.4s__ returned non-%.4s (type %.200s)",
12271 type_name, type_name, Py_TYPE(result)->tp_name);
12272 Py_DECREF(result);
12273 return NULL;
12274 }
__Pyx_PyNumber_IntOrLong(PyObject * x)12275 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
12276 #if CYTHON_USE_TYPE_SLOTS
12277 PyNumberMethods *m;
12278 #endif
12279 const char *name = NULL;
12280 PyObject *res = NULL;
12281 #if PY_MAJOR_VERSION < 3
12282 if (likely(PyInt_Check(x) || PyLong_Check(x)))
12283 #else
12284 if (likely(PyLong_Check(x)))
12285 #endif
12286 return __Pyx_NewRef(x);
12287 #if CYTHON_USE_TYPE_SLOTS
12288 m = Py_TYPE(x)->tp_as_number;
12289 #if PY_MAJOR_VERSION < 3
12290 if (m && m->nb_int) {
12291 name = "int";
12292 res = m->nb_int(x);
12293 }
12294 else if (m && m->nb_long) {
12295 name = "long";
12296 res = m->nb_long(x);
12297 }
12298 #else
12299 if (likely(m && m->nb_int)) {
12300 name = "int";
12301 res = m->nb_int(x);
12302 }
12303 #endif
12304 #else
12305 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
12306 res = PyNumber_Int(x);
12307 }
12308 #endif
12309 if (likely(res)) {
12310 #if PY_MAJOR_VERSION < 3
12311 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
12312 #else
12313 if (unlikely(!PyLong_CheckExact(res))) {
12314 #endif
12315 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
12316 }
12317 }
12318 else if (!PyErr_Occurred()) {
12319 PyErr_SetString(PyExc_TypeError,
12320 "an integer is required");
12321 }
12322 return res;
12323 }
12324 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
12325 Py_ssize_t ival;
12326 PyObject *x;
12327 #if PY_MAJOR_VERSION < 3
12328 if (likely(PyInt_CheckExact(b))) {
12329 if (sizeof(Py_ssize_t) >= sizeof(long))
12330 return PyInt_AS_LONG(b);
12331 else
12332 return PyInt_AsSsize_t(b);
12333 }
12334 #endif
12335 if (likely(PyLong_CheckExact(b))) {
12336 #if CYTHON_USE_PYLONG_INTERNALS
12337 const digit* digits = ((PyLongObject*)b)->ob_digit;
12338 const Py_ssize_t size = Py_SIZE(b);
12339 if (likely(__Pyx_sst_abs(size) <= 1)) {
12340 ival = likely(size) ? digits[0] : 0;
12341 if (size == -1) ival = -ival;
12342 return ival;
12343 } else {
12344 switch (size) {
12345 case 2:
12346 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
12347 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
12348 }
12349 break;
12350 case -2:
12351 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
12352 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
12353 }
12354 break;
12355 case 3:
12356 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
12357 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
12358 }
12359 break;
12360 case -3:
12361 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
12362 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
12363 }
12364 break;
12365 case 4:
12366 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
12367 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]));
12368 }
12369 break;
12370 case -4:
12371 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
12372 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]));
12373 }
12374 break;
12375 }
12376 }
12377 #endif
12378 return PyLong_AsSsize_t(b);
12379 }
12380 x = PyNumber_Index(b);
12381 if (!x) return -1;
12382 ival = PyInt_AsSsize_t(x);
12383 Py_DECREF(x);
12384 return ival;
12385 }
12386 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
12387 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
12388 }
12389 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
12390 return PyInt_FromSize_t(ival);
12391 }
12392
12393
12394 #endif /* Py_PYTHON_H */
12395