1 /* Generated by Cython 0.29.12 */
2
3 /* BEGIN: Cython Metadata
4 {
5 "distutils": {
6 "depends": [
7 "yt/utilities/lib/platform_dep.h"
8 ],
9 "include_dirs": [
10 "yt/utilities/lib"
11 ],
12 "libraries": [
13 "m"
14 ],
15 "name": "yt.utilities.lib.quad_tree",
16 "sources": [
17 "yt/utilities/lib/quad_tree.pyx"
18 ]
19 },
20 "module_name": "yt.utilities.lib.quad_tree"
21 }
22 END: Cython Metadata */
23
24 #define PY_SSIZE_T_CLEAN
25 #include "Python.h"
26 #ifndef Py_PYTHON_H
27 #error Python headers needed to compile C extensions, please install development version of Python.
28 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
29 #error Cython requires Python 2.6+ or Python 3.3+.
30 #else
31 #define CYTHON_ABI "0_29_12"
32 #define CYTHON_HEX_VERSION 0x001D0CF0
33 #define CYTHON_FUTURE_DIVISION 0
34 #include <stddef.h>
35 #ifndef offsetof
36 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
37 #endif
38 #if !defined(WIN32) && !defined(MS_WINDOWS)
39 #ifndef __stdcall
40 #define __stdcall
41 #endif
42 #ifndef __cdecl
43 #define __cdecl
44 #endif
45 #ifndef __fastcall
46 #define __fastcall
47 #endif
48 #endif
49 #ifndef DL_IMPORT
50 #define DL_IMPORT(t) t
51 #endif
52 #ifndef DL_EXPORT
53 #define DL_EXPORT(t) t
54 #endif
55 #define __PYX_COMMA ,
56 #ifndef HAVE_LONG_LONG
57 #if PY_VERSION_HEX >= 0x02070000
58 #define HAVE_LONG_LONG
59 #endif
60 #endif
61 #ifndef PY_LONG_LONG
62 #define PY_LONG_LONG LONG_LONG
63 #endif
64 #ifndef Py_HUGE_VAL
65 #define Py_HUGE_VAL HUGE_VAL
66 #endif
67 #ifdef PYPY_VERSION
68 #define CYTHON_COMPILING_IN_PYPY 1
69 #define CYTHON_COMPILING_IN_PYSTON 0
70 #define CYTHON_COMPILING_IN_CPYTHON 0
71 #undef CYTHON_USE_TYPE_SLOTS
72 #define CYTHON_USE_TYPE_SLOTS 0
73 #undef CYTHON_USE_PYTYPE_LOOKUP
74 #define CYTHON_USE_PYTYPE_LOOKUP 0
75 #if PY_VERSION_HEX < 0x03050000
76 #undef CYTHON_USE_ASYNC_SLOTS
77 #define CYTHON_USE_ASYNC_SLOTS 0
78 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
79 #define CYTHON_USE_ASYNC_SLOTS 1
80 #endif
81 #undef CYTHON_USE_PYLIST_INTERNALS
82 #define CYTHON_USE_PYLIST_INTERNALS 0
83 #undef CYTHON_USE_UNICODE_INTERNALS
84 #define CYTHON_USE_UNICODE_INTERNALS 0
85 #undef CYTHON_USE_UNICODE_WRITER
86 #define CYTHON_USE_UNICODE_WRITER 0
87 #undef CYTHON_USE_PYLONG_INTERNALS
88 #define CYTHON_USE_PYLONG_INTERNALS 0
89 #undef CYTHON_AVOID_BORROWED_REFS
90 #define CYTHON_AVOID_BORROWED_REFS 1
91 #undef CYTHON_ASSUME_SAFE_MACROS
92 #define CYTHON_ASSUME_SAFE_MACROS 0
93 #undef CYTHON_UNPACK_METHODS
94 #define CYTHON_UNPACK_METHODS 0
95 #undef CYTHON_FAST_THREAD_STATE
96 #define CYTHON_FAST_THREAD_STATE 0
97 #undef CYTHON_FAST_PYCALL
98 #define CYTHON_FAST_PYCALL 0
99 #undef CYTHON_PEP489_MULTI_PHASE_INIT
100 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
101 #undef CYTHON_USE_TP_FINALIZE
102 #define CYTHON_USE_TP_FINALIZE 0
103 #undef CYTHON_USE_DICT_VERSIONS
104 #define CYTHON_USE_DICT_VERSIONS 0
105 #undef CYTHON_USE_EXC_INFO_STACK
106 #define CYTHON_USE_EXC_INFO_STACK 0
107 #elif defined(PYSTON_VERSION)
108 #define CYTHON_COMPILING_IN_PYPY 0
109 #define CYTHON_COMPILING_IN_PYSTON 1
110 #define CYTHON_COMPILING_IN_CPYTHON 0
111 #ifndef CYTHON_USE_TYPE_SLOTS
112 #define CYTHON_USE_TYPE_SLOTS 1
113 #endif
114 #undef CYTHON_USE_PYTYPE_LOOKUP
115 #define CYTHON_USE_PYTYPE_LOOKUP 0
116 #undef CYTHON_USE_ASYNC_SLOTS
117 #define CYTHON_USE_ASYNC_SLOTS 0
118 #undef CYTHON_USE_PYLIST_INTERNALS
119 #define CYTHON_USE_PYLIST_INTERNALS 0
120 #ifndef CYTHON_USE_UNICODE_INTERNALS
121 #define CYTHON_USE_UNICODE_INTERNALS 1
122 #endif
123 #undef CYTHON_USE_UNICODE_WRITER
124 #define CYTHON_USE_UNICODE_WRITER 0
125 #undef CYTHON_USE_PYLONG_INTERNALS
126 #define CYTHON_USE_PYLONG_INTERNALS 0
127 #ifndef CYTHON_AVOID_BORROWED_REFS
128 #define CYTHON_AVOID_BORROWED_REFS 0
129 #endif
130 #ifndef CYTHON_ASSUME_SAFE_MACROS
131 #define CYTHON_ASSUME_SAFE_MACROS 1
132 #endif
133 #ifndef CYTHON_UNPACK_METHODS
134 #define CYTHON_UNPACK_METHODS 1
135 #endif
136 #undef CYTHON_FAST_THREAD_STATE
137 #define CYTHON_FAST_THREAD_STATE 0
138 #undef CYTHON_FAST_PYCALL
139 #define CYTHON_FAST_PYCALL 0
140 #undef CYTHON_PEP489_MULTI_PHASE_INIT
141 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
142 #undef CYTHON_USE_TP_FINALIZE
143 #define CYTHON_USE_TP_FINALIZE 0
144 #undef CYTHON_USE_DICT_VERSIONS
145 #define CYTHON_USE_DICT_VERSIONS 0
146 #undef CYTHON_USE_EXC_INFO_STACK
147 #define CYTHON_USE_EXC_INFO_STACK 0
148 #else
149 #define CYTHON_COMPILING_IN_PYPY 0
150 #define CYTHON_COMPILING_IN_PYSTON 0
151 #define CYTHON_COMPILING_IN_CPYTHON 1
152 #ifndef CYTHON_USE_TYPE_SLOTS
153 #define CYTHON_USE_TYPE_SLOTS 1
154 #endif
155 #if PY_VERSION_HEX < 0x02070000
156 #undef CYTHON_USE_PYTYPE_LOOKUP
157 #define CYTHON_USE_PYTYPE_LOOKUP 0
158 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
159 #define CYTHON_USE_PYTYPE_LOOKUP 1
160 #endif
161 #if PY_MAJOR_VERSION < 3
162 #undef CYTHON_USE_ASYNC_SLOTS
163 #define CYTHON_USE_ASYNC_SLOTS 0
164 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
165 #define CYTHON_USE_ASYNC_SLOTS 1
166 #endif
167 #if PY_VERSION_HEX < 0x02070000
168 #undef CYTHON_USE_PYLONG_INTERNALS
169 #define CYTHON_USE_PYLONG_INTERNALS 0
170 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
171 #define CYTHON_USE_PYLONG_INTERNALS 1
172 #endif
173 #ifndef CYTHON_USE_PYLIST_INTERNALS
174 #define CYTHON_USE_PYLIST_INTERNALS 1
175 #endif
176 #ifndef CYTHON_USE_UNICODE_INTERNALS
177 #define CYTHON_USE_UNICODE_INTERNALS 1
178 #endif
179 #if PY_VERSION_HEX < 0x030300F0
180 #undef CYTHON_USE_UNICODE_WRITER
181 #define CYTHON_USE_UNICODE_WRITER 0
182 #elif !defined(CYTHON_USE_UNICODE_WRITER)
183 #define CYTHON_USE_UNICODE_WRITER 1
184 #endif
185 #ifndef CYTHON_AVOID_BORROWED_REFS
186 #define CYTHON_AVOID_BORROWED_REFS 0
187 #endif
188 #ifndef CYTHON_ASSUME_SAFE_MACROS
189 #define CYTHON_ASSUME_SAFE_MACROS 1
190 #endif
191 #ifndef CYTHON_UNPACK_METHODS
192 #define CYTHON_UNPACK_METHODS 1
193 #endif
194 #ifndef CYTHON_FAST_THREAD_STATE
195 #define CYTHON_FAST_THREAD_STATE 1
196 #endif
197 #ifndef CYTHON_FAST_PYCALL
198 #define CYTHON_FAST_PYCALL 1
199 #endif
200 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
201 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
202 #endif
203 #ifndef CYTHON_USE_TP_FINALIZE
204 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
205 #endif
206 #ifndef CYTHON_USE_DICT_VERSIONS
207 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
208 #endif
209 #ifndef CYTHON_USE_EXC_INFO_STACK
210 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
211 #endif
212 #endif
213 #if !defined(CYTHON_FAST_PYCCALL)
214 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
215 #endif
216 #if CYTHON_USE_PYLONG_INTERNALS
217 #include "longintrepr.h"
218 #undef SHIFT
219 #undef BASE
220 #undef MASK
221 #ifdef SIZEOF_VOID_P
222 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
223 #endif
224 #endif
225 #ifndef __has_attribute
226 #define __has_attribute(x) 0
227 #endif
228 #ifndef __has_cpp_attribute
229 #define __has_cpp_attribute(x) 0
230 #endif
231 #ifndef CYTHON_RESTRICT
232 #if defined(__GNUC__)
233 #define CYTHON_RESTRICT __restrict__
234 #elif defined(_MSC_VER) && _MSC_VER >= 1400
235 #define CYTHON_RESTRICT __restrict
236 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
237 #define CYTHON_RESTRICT restrict
238 #else
239 #define CYTHON_RESTRICT
240 #endif
241 #endif
242 #ifndef CYTHON_UNUSED
243 # if defined(__GNUC__)
244 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
245 # define CYTHON_UNUSED __attribute__ ((__unused__))
246 # else
247 # define CYTHON_UNUSED
248 # endif
249 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
250 # define CYTHON_UNUSED __attribute__ ((__unused__))
251 # else
252 # define CYTHON_UNUSED
253 # endif
254 #endif
255 #ifndef CYTHON_MAYBE_UNUSED_VAR
256 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)257 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
258 # else
259 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
260 # endif
261 #endif
262 #ifndef CYTHON_NCP_UNUSED
263 # if CYTHON_COMPILING_IN_CPYTHON
264 # define CYTHON_NCP_UNUSED
265 # else
266 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
267 # endif
268 #endif
269 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
270 #ifdef _MSC_VER
271 #ifndef _MSC_STDINT_H_
272 #if _MSC_VER < 1300
273 typedef unsigned char uint8_t;
274 typedef unsigned int uint32_t;
275 #else
276 typedef unsigned __int8 uint8_t;
277 typedef unsigned __int32 uint32_t;
278 #endif
279 #endif
280 #else
281 #include <stdint.h>
282 #endif
283 #ifndef CYTHON_FALLTHROUGH
284 #if defined(__cplusplus) && __cplusplus >= 201103L
285 #if __has_cpp_attribute(fallthrough)
286 #define CYTHON_FALLTHROUGH [[fallthrough]]
287 #elif __has_cpp_attribute(clang::fallthrough)
288 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
289 #elif __has_cpp_attribute(gnu::fallthrough)
290 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
291 #endif
292 #endif
293 #ifndef CYTHON_FALLTHROUGH
294 #if __has_attribute(fallthrough)
295 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
296 #else
297 #define CYTHON_FALLTHROUGH
298 #endif
299 #endif
300 #if defined(__clang__ ) && defined(__apple_build_version__)
301 #if __apple_build_version__ < 7000000
302 #undef CYTHON_FALLTHROUGH
303 #define CYTHON_FALLTHROUGH
304 #endif
305 #endif
306 #endif
307
308 #ifndef CYTHON_INLINE
309 #if defined(__clang__)
310 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
311 #elif defined(__GNUC__)
312 #define CYTHON_INLINE __inline__
313 #elif defined(_MSC_VER)
314 #define CYTHON_INLINE __inline
315 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
316 #define CYTHON_INLINE inline
317 #else
318 #define CYTHON_INLINE
319 #endif
320 #endif
321
322 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
323 #define Py_OptimizeFlag 0
324 #endif
325 #define __PYX_BUILD_PY_SSIZE_T "n"
326 #define CYTHON_FORMAT_SSIZE_T "z"
327 #if PY_MAJOR_VERSION < 3
328 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
329 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
330 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
331 #define __Pyx_DefaultClassType PyClass_Type
332 #else
333 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
334 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
335 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
336 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
337 #else
338 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
339 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
340 #endif
341 #define __Pyx_DefaultClassType PyType_Type
342 #endif
343 #ifndef Py_TPFLAGS_CHECKTYPES
344 #define Py_TPFLAGS_CHECKTYPES 0
345 #endif
346 #ifndef Py_TPFLAGS_HAVE_INDEX
347 #define Py_TPFLAGS_HAVE_INDEX 0
348 #endif
349 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
350 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
351 #endif
352 #ifndef Py_TPFLAGS_HAVE_FINALIZE
353 #define Py_TPFLAGS_HAVE_FINALIZE 0
354 #endif
355 #ifndef METH_STACKLESS
356 #define METH_STACKLESS 0
357 #endif
358 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
359 #ifndef METH_FASTCALL
360 #define METH_FASTCALL 0x80
361 #endif
362 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
363 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
364 Py_ssize_t nargs, PyObject *kwnames);
365 #else
366 #define __Pyx_PyCFunctionFast _PyCFunctionFast
367 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
368 #endif
369 #if CYTHON_FAST_PYCCALL
370 #define __Pyx_PyFastCFunction_Check(func)\
371 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
372 #else
373 #define __Pyx_PyFastCFunction_Check(func) 0
374 #endif
375 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
376 #define PyObject_Malloc(s) PyMem_Malloc(s)
377 #define PyObject_Free(p) PyMem_Free(p)
378 #define PyObject_Realloc(p) PyMem_Realloc(p)
379 #endif
380 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
381 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
382 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
383 #define PyMem_RawFree(p) PyMem_Free(p)
384 #endif
385 #if CYTHON_COMPILING_IN_PYSTON
386 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
387 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
388 #else
389 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
390 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
391 #endif
392 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
393 #define __Pyx_PyThreadState_Current PyThreadState_GET()
394 #elif PY_VERSION_HEX >= 0x03060000
395 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
396 #elif PY_VERSION_HEX >= 0x03000000
397 #define __Pyx_PyThreadState_Current PyThreadState_GET()
398 #else
399 #define __Pyx_PyThreadState_Current _PyThreadState_Current
400 #endif
401 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
402 #include "pythread.h"
403 #define Py_tss_NEEDS_INIT 0
404 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)405 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
406 *key = PyThread_create_key();
407 return 0;
408 }
PyThread_tss_alloc(void)409 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
410 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
411 *key = Py_tss_NEEDS_INIT;
412 return key;
413 }
PyThread_tss_free(Py_tss_t * key)414 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
415 PyObject_Free(key);
416 }
PyThread_tss_is_created(Py_tss_t * key)417 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
418 return *key != Py_tss_NEEDS_INIT;
419 }
PyThread_tss_delete(Py_tss_t * key)420 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
421 PyThread_delete_key(*key);
422 *key = Py_tss_NEEDS_INIT;
423 }
PyThread_tss_set(Py_tss_t * key,void * value)424 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
425 return PyThread_set_key_value(*key, value);
426 }
PyThread_tss_get(Py_tss_t * key)427 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
428 return PyThread_get_key_value(*key);
429 }
430 #endif
431 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
432 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
433 #else
434 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
435 #endif
436 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
437 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
438 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
439 #else
440 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
441 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
442 #endif
443 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
444 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
445 #else
446 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
447 #endif
448 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
449 #define CYTHON_PEP393_ENABLED 1
450 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
451 0 : _PyUnicode_Ready((PyObject *)(op)))
452 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
453 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
454 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
455 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
456 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
457 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
458 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
459 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
460 #else
461 #define CYTHON_PEP393_ENABLED 0
462 #define PyUnicode_1BYTE_KIND 1
463 #define PyUnicode_2BYTE_KIND 2
464 #define PyUnicode_4BYTE_KIND 4
465 #define __Pyx_PyUnicode_READY(op) (0)
466 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
467 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
468 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
469 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
470 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
471 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
472 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
473 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
474 #endif
475 #if CYTHON_COMPILING_IN_PYPY
476 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
477 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
478 #else
479 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
480 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
481 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
482 #endif
483 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
484 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
485 #endif
486 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
487 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
488 #endif
489 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
490 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
491 #endif
492 #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))
493 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
494 #if PY_MAJOR_VERSION >= 3
495 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
496 #else
497 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
498 #endif
499 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
500 #define PyObject_ASCII(o) PyObject_Repr(o)
501 #endif
502 #if PY_MAJOR_VERSION >= 3
503 #define PyBaseString_Type PyUnicode_Type
504 #define PyStringObject PyUnicodeObject
505 #define PyString_Type PyUnicode_Type
506 #define PyString_Check PyUnicode_Check
507 #define PyString_CheckExact PyUnicode_CheckExact
508 #define PyObject_Unicode PyObject_Str
509 #endif
510 #if PY_MAJOR_VERSION >= 3
511 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
512 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
513 #else
514 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
515 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
516 #endif
517 #ifndef PySet_CheckExact
518 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
519 #endif
520 #if CYTHON_ASSUME_SAFE_MACROS
521 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
522 #else
523 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
524 #endif
525 #if PY_MAJOR_VERSION >= 3
526 #define PyIntObject PyLongObject
527 #define PyInt_Type PyLong_Type
528 #define PyInt_Check(op) PyLong_Check(op)
529 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
530 #define PyInt_FromString PyLong_FromString
531 #define PyInt_FromUnicode PyLong_FromUnicode
532 #define PyInt_FromLong PyLong_FromLong
533 #define PyInt_FromSize_t PyLong_FromSize_t
534 #define PyInt_FromSsize_t PyLong_FromSsize_t
535 #define PyInt_AsLong PyLong_AsLong
536 #define PyInt_AS_LONG PyLong_AS_LONG
537 #define PyInt_AsSsize_t PyLong_AsSsize_t
538 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
539 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
540 #define PyNumber_Int PyNumber_Long
541 #endif
542 #if PY_MAJOR_VERSION >= 3
543 #define PyBoolObject PyLongObject
544 #endif
545 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
546 #ifndef PyUnicode_InternFromString
547 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
548 #endif
549 #endif
550 #if PY_VERSION_HEX < 0x030200A4
551 typedef long Py_hash_t;
552 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
553 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
554 #else
555 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
556 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
557 #endif
558 #if PY_MAJOR_VERSION >= 3
559 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
560 #else
561 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
562 #endif
563 #if CYTHON_USE_ASYNC_SLOTS
564 #if PY_VERSION_HEX >= 0x030500B1
565 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
566 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
567 #else
568 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
569 #endif
570 #else
571 #define __Pyx_PyType_AsAsync(obj) NULL
572 #endif
573 #ifndef __Pyx_PyAsyncMethodsStruct
574 typedef struct {
575 unaryfunc am_await;
576 unaryfunc am_aiter;
577 unaryfunc am_anext;
578 } __Pyx_PyAsyncMethodsStruct;
579 #endif
580
581 #if defined(WIN32) || defined(MS_WINDOWS)
582 #define _USE_MATH_DEFINES
583 #endif
584 #include <math.h>
585 #ifdef NAN
586 #define __PYX_NAN() ((float) NAN)
587 #else
__PYX_NAN()588 static CYTHON_INLINE float __PYX_NAN() {
589 float value;
590 memset(&value, 0xFF, sizeof(value));
591 return value;
592 }
593 #endif
594 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
595 #define __Pyx_truncl trunc
596 #else
597 #define __Pyx_truncl truncl
598 #endif
599
600
601 #define __PYX_ERR(f_index, lineno, Ln_error) \
602 { \
603 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
604 }
605
606 #ifndef __PYX_EXTERN_C
607 #ifdef __cplusplus
608 #define __PYX_EXTERN_C extern "C"
609 #else
610 #define __PYX_EXTERN_C extern
611 #endif
612 #endif
613
614 #define __PYX_HAVE__yt__utilities__lib__quad_tree
615 #define __PYX_HAVE_API__yt__utilities__lib__quad_tree
616 /* Early includes */
617 #include <string.h>
618 #include <stdio.h>
619 #include "numpy/arrayobject.h"
620 #include "numpy/ufuncobject.h"
621 #include <stdlib.h>
622 #include "platform_dep.h"
623 #ifdef _OPENMP
624 #include <omp.h>
625 #endif /* _OPENMP */
626
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
629 #endif
630
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
633
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
643 (sizeof(type) < sizeof(Py_ssize_t)) ||\
644 (sizeof(type) > sizeof(Py_ssize_t) &&\
645 likely(v < (type)PY_SSIZE_T_MAX ||\
646 v == (type)PY_SSIZE_T_MAX) &&\
647 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648 v == (type)PY_SSIZE_T_MIN))) ||\
649 (sizeof(type) == sizeof(Py_ssize_t) &&\
650 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653 return (size_t) i < (size_t) limit;
654 }
655 #if defined (__cplusplus) && __cplusplus >= 201103L
656 #include <cstdlib>
657 #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659 #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661 #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665 #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667 #define __Pyx_sst_abs(value) __builtin_llabs(value)
668 #else
669 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
670 #endif
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
680 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
681 #else
682 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
683 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
684 #endif
685 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702 const Py_UNICODE *u_end = u;
703 while (*u_end++) ;
704 return (size_t)(u_end - u - 1);
705 }
706 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
721 #else
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
723 #endif
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
727 #else
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
729 #endif
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
734 PyObject* sys;
735 PyObject* default_encoding = NULL;
736 PyObject* ascii_chars_u = NULL;
737 PyObject* ascii_chars_b = NULL;
738 const char* default_encoding_c;
739 sys = PyImport_ImportModule("sys");
740 if (!sys) goto bad;
741 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
742 Py_DECREF(sys);
743 if (!default_encoding) goto bad;
744 default_encoding_c = PyBytes_AsString(default_encoding);
745 if (!default_encoding_c) goto bad;
746 if (strcmp(default_encoding_c, "ascii") == 0) {
747 __Pyx_sys_getdefaultencoding_not_ascii = 0;
748 } else {
749 char ascii_chars[128];
750 int c;
751 for (c = 0; c < 128; c++) {
752 ascii_chars[c] = c;
753 }
754 __Pyx_sys_getdefaultencoding_not_ascii = 1;
755 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756 if (!ascii_chars_u) goto bad;
757 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
759 PyErr_Format(
760 PyExc_ValueError,
761 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
762 default_encoding_c);
763 goto bad;
764 }
765 Py_DECREF(ascii_chars_u);
766 Py_DECREF(ascii_chars_b);
767 }
768 Py_DECREF(default_encoding);
769 return 0;
770 bad:
771 Py_XDECREF(default_encoding);
772 Py_XDECREF(ascii_chars_u);
773 Py_XDECREF(ascii_chars_b);
774 return -1;
775 }
776 #endif
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
779 #else
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
784 PyObject* sys;
785 PyObject* default_encoding = NULL;
786 char* default_encoding_c;
787 sys = PyImport_ImportModule("sys");
788 if (!sys) goto bad;
789 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
790 Py_DECREF(sys);
791 if (!default_encoding) goto bad;
792 default_encoding_c = PyBytes_AsString(default_encoding);
793 if (!default_encoding_c) goto bad;
794 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797 Py_DECREF(default_encoding);
798 return 0;
799 bad:
800 Py_XDECREF(default_encoding);
801 return -1;
802 }
803 #endif
804 #endif
805
806
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809 #define likely(x) __builtin_expect(!!(x), 1)
810 #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812 #define likely(x) (x)
813 #define unlikely(x) (x)
814 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
816
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
828
829 /* Header.proto */
830 #if !defined(CYTHON_CCOMPLEX)
831 #if defined(__cplusplus)
832 #define CYTHON_CCOMPLEX 1
833 #elif defined(_Complex_I)
834 #define CYTHON_CCOMPLEX 1
835 #else
836 #define CYTHON_CCOMPLEX 0
837 #endif
838 #endif
839 #if CYTHON_CCOMPLEX
840 #ifdef __cplusplus
841 #include <complex>
842 #else
843 #include <complex.h>
844 #endif
845 #endif
846 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
847 #undef _Complex_I
848 #define _Complex_I 1.0fj
849 #endif
850
851
852 static const char *__pyx_f[] = {
853 "yt/utilities/lib/quad_tree.pyx",
854 "stringsource",
855 "__init__.pxd",
856 "yt/utilities/lib/fp_utils.pxd",
857 "type.pxd",
858 };
859 /* BufferFormatStructs.proto */
860 #define IS_UNSIGNED(type) (((type) -1) > 0)
861 struct __Pyx_StructField_;
862 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
863 typedef struct {
864 const char* name;
865 struct __Pyx_StructField_* fields;
866 size_t size;
867 size_t arraysize[8];
868 int ndim;
869 char typegroup;
870 char is_unsigned;
871 int flags;
872 } __Pyx_TypeInfo;
873 typedef struct __Pyx_StructField_ {
874 __Pyx_TypeInfo* type;
875 const char* name;
876 size_t offset;
877 } __Pyx_StructField;
878 typedef struct {
879 __Pyx_StructField* field;
880 size_t parent_offset;
881 } __Pyx_BufFmt_StackElem;
882 typedef struct {
883 __Pyx_StructField root;
884 __Pyx_BufFmt_StackElem* head;
885 size_t fmt_offset;
886 size_t new_count, enc_count;
887 size_t struct_alignment;
888 int is_complex;
889 char enc_type;
890 char new_packmode;
891 char enc_packmode;
892 char is_valid_array;
893 } __Pyx_BufFmt_Context;
894
895
896 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
897 * # in Cython to enable them only on the right systems.
898 *
899 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
900 * ctypedef npy_int16 int16_t
901 * ctypedef npy_int32 int32_t
902 */
903 typedef npy_int8 __pyx_t_5numpy_int8_t;
904
905 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
906 *
907 * ctypedef npy_int8 int8_t
908 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
909 * ctypedef npy_int32 int32_t
910 * ctypedef npy_int64 int64_t
911 */
912 typedef npy_int16 __pyx_t_5numpy_int16_t;
913
914 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
915 * ctypedef npy_int8 int8_t
916 * ctypedef npy_int16 int16_t
917 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
918 * ctypedef npy_int64 int64_t
919 * #ctypedef npy_int96 int96_t
920 */
921 typedef npy_int32 __pyx_t_5numpy_int32_t;
922
923 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
924 * ctypedef npy_int16 int16_t
925 * ctypedef npy_int32 int32_t
926 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
927 * #ctypedef npy_int96 int96_t
928 * #ctypedef npy_int128 int128_t
929 */
930 typedef npy_int64 __pyx_t_5numpy_int64_t;
931
932 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
933 * #ctypedef npy_int128 int128_t
934 *
935 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
936 * ctypedef npy_uint16 uint16_t
937 * ctypedef npy_uint32 uint32_t
938 */
939 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
940
941 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
942 *
943 * ctypedef npy_uint8 uint8_t
944 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
945 * ctypedef npy_uint32 uint32_t
946 * ctypedef npy_uint64 uint64_t
947 */
948 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
949
950 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
951 * ctypedef npy_uint8 uint8_t
952 * ctypedef npy_uint16 uint16_t
953 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
954 * ctypedef npy_uint64 uint64_t
955 * #ctypedef npy_uint96 uint96_t
956 */
957 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
958
959 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
960 * ctypedef npy_uint16 uint16_t
961 * ctypedef npy_uint32 uint32_t
962 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
963 * #ctypedef npy_uint96 uint96_t
964 * #ctypedef npy_uint128 uint128_t
965 */
966 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
967
968 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
969 * #ctypedef npy_uint128 uint128_t
970 *
971 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
972 * ctypedef npy_float64 float64_t
973 * #ctypedef npy_float80 float80_t
974 */
975 typedef npy_float32 __pyx_t_5numpy_float32_t;
976
977 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
978 *
979 * ctypedef npy_float32 float32_t
980 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
981 * #ctypedef npy_float80 float80_t
982 * #ctypedef npy_float128 float128_t
983 */
984 typedef npy_float64 __pyx_t_5numpy_float64_t;
985
986 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
987 * # The int types are mapped a bit surprising --
988 * # numpy.int corresponds to 'l' and numpy.long to 'q'
989 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
990 * ctypedef npy_longlong long_t
991 * ctypedef npy_longlong longlong_t
992 */
993 typedef npy_long __pyx_t_5numpy_int_t;
994
995 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
996 * # numpy.int corresponds to 'l' and numpy.long to 'q'
997 * ctypedef npy_long int_t
998 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
999 * ctypedef npy_longlong longlong_t
1000 *
1001 */
1002 typedef npy_longlong __pyx_t_5numpy_long_t;
1003
1004 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1005 * ctypedef npy_long int_t
1006 * ctypedef npy_longlong long_t
1007 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1008 *
1009 * ctypedef npy_ulong uint_t
1010 */
1011 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1012
1013 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1014 * ctypedef npy_longlong longlong_t
1015 *
1016 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1017 * ctypedef npy_ulonglong ulong_t
1018 * ctypedef npy_ulonglong ulonglong_t
1019 */
1020 typedef npy_ulong __pyx_t_5numpy_uint_t;
1021
1022 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1023 *
1024 * ctypedef npy_ulong uint_t
1025 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1026 * ctypedef npy_ulonglong ulonglong_t
1027 *
1028 */
1029 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1030
1031 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1032 * ctypedef npy_ulong uint_t
1033 * ctypedef npy_ulonglong ulong_t
1034 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1035 *
1036 * ctypedef npy_intp intp_t
1037 */
1038 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1039
1040 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1041 * ctypedef npy_ulonglong ulonglong_t
1042 *
1043 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1044 * ctypedef npy_uintp uintp_t
1045 *
1046 */
1047 typedef npy_intp __pyx_t_5numpy_intp_t;
1048
1049 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1050 *
1051 * ctypedef npy_intp intp_t
1052 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1053 *
1054 * ctypedef npy_double float_t
1055 */
1056 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1057
1058 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1059 * ctypedef npy_uintp uintp_t
1060 *
1061 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1062 * ctypedef npy_double double_t
1063 * ctypedef npy_longdouble longdouble_t
1064 */
1065 typedef npy_double __pyx_t_5numpy_float_t;
1066
1067 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1068 *
1069 * ctypedef npy_double float_t
1070 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1071 * ctypedef npy_longdouble longdouble_t
1072 *
1073 */
1074 typedef npy_double __pyx_t_5numpy_double_t;
1075
1076 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1077 * ctypedef npy_double float_t
1078 * ctypedef npy_double double_t
1079 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1080 *
1081 * ctypedef npy_cfloat cfloat_t
1082 */
1083 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1084 /* Declarations.proto */
1085 #if CYTHON_CCOMPLEX
1086 #ifdef __cplusplus
1087 typedef ::std::complex< float > __pyx_t_float_complex;
1088 #else
1089 typedef float _Complex __pyx_t_float_complex;
1090 #endif
1091 #else
1092 typedef struct { float real, imag; } __pyx_t_float_complex;
1093 #endif
1094 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1095
1096 /* Declarations.proto */
1097 #if CYTHON_CCOMPLEX
1098 #ifdef __cplusplus
1099 typedef ::std::complex< double > __pyx_t_double_complex;
1100 #else
1101 typedef double _Complex __pyx_t_double_complex;
1102 #endif
1103 #else
1104 typedef struct { double real, imag; } __pyx_t_double_complex;
1105 #endif
1106 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1107
1108
1109 /*--- Type declarations ---*/
1110 struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree;
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 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode;
1148 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position;
1149 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos;
1150
1151 /* "yt/utilities/lib/quad_tree.pyx":28
1152 * void *alloca(int)
1153 *
1154 * cdef struct QuadTreeNode: # <<<<<<<<<<<<<<
1155 * np.float64_t *val
1156 * np.float64_t weight_val
1157 */
1158 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode {
1159 __pyx_t_5numpy_float64_t *val;
1160 __pyx_t_5numpy_float64_t weight_val;
1161 __pyx_t_5numpy_int64_t pos[2];
1162 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *children[2][2];
1163 };
1164
1165 /* "yt/utilities/lib/quad_tree.pyx":34
1166 * QuadTreeNode *children[2][2]
1167 *
1168 * ctypedef void QTN_combine(QuadTreeNode *self, # <<<<<<<<<<<<<<
1169 * np.float64_t *val, np.float64_t weight_val,
1170 * int nvals)
1171 */
1172 typedef void __pyx_t_2yt_9utilities_3lib_9quad_tree_QTN_combine(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int);
1173
1174 /* "yt/utilities/lib/quad_tree.pyx":240
1175 * return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals)
1176 *
1177 * cdef int add_to_position(self, # <<<<<<<<<<<<<<
1178 * int level, np.int64_t pos[2],
1179 * np.float64_t *val,
1180 */
1181 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position {
1182 int __pyx_n;
1183 int skip;
1184 };
1185
1186 /* "yt/utilities/lib/quad_tree.pyx":486
1187 * @cython.wraparound(False)
1188 * @cython.cdivision(True)
1189 * cdef np.float64_t find_value_at_pos(self, np.float64_t pos[2], # <<<<<<<<<<<<<<
1190 * int val_index, np.float64_t opos[4],
1191 * np.float64_t *wval = NULL):
1192 */
1193 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos {
1194 int __pyx_n;
1195 __pyx_t_5numpy_float64_t *wval;
1196 };
1197
1198 /* "yt/utilities/lib/quad_tree.pyx":95
1199 * free(node)
1200 *
1201 * cdef class QuadTree: # <<<<<<<<<<<<<<
1202 * cdef int nvals
1203 * cdef QuadTreeNode ***root_nodes
1204 */
1205 struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree {
1206 PyObject_HEAD
1207 struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_vtab;
1208 int nvals;
1209 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode ***root_nodes;
1210 __pyx_t_5numpy_int64_t top_grid_dims[2];
1211 int merged;
1212 int num_cells;
1213 __pyx_t_2yt_9utilities_3lib_9quad_tree_QTN_combine *combine;
1214 __pyx_t_5numpy_float64_t bounds[4];
1215 __pyx_t_5numpy_float64_t dds[2];
1216 __pyx_t_5numpy_int64_t last_dims[2];
1217 int max_level;
1218 };
1219
1220
1221
1222 struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree {
1223 int (*count_total_cells)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *);
1224 int (*fill_buffer)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, int, PyArrayObject *, PyArrayObject *, PyArrayObject *);
1225 int (*unfill_buffer)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, int, PyArrayObject *, PyArrayObject *, PyArrayObject *);
1226 int (*add_to_position)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position *__pyx_optional_args);
1227 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *(*find_on_root_level)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, __pyx_t_5numpy_int64_t *, int);
1228 int (*count)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *);
1229 int (*fill)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_int64_t);
1230 __pyx_t_5numpy_float64_t (*find_value_at_pos)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, __pyx_t_5numpy_float64_t *, int, __pyx_t_5numpy_float64_t *, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos *__pyx_optional_args);
1231 };
1232 static struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_vtabptr_2yt_9utilities_3lib_9quad_tree_QuadTree;
1233
1234 /* --- Runtime support code (head) --- */
1235 /* Refnanny.proto */
1236 #ifndef CYTHON_REFNANNY
1237 #define CYTHON_REFNANNY 0
1238 #endif
1239 #if CYTHON_REFNANNY
1240 typedef struct {
1241 void (*INCREF)(void*, PyObject*, int);
1242 void (*DECREF)(void*, PyObject*, int);
1243 void (*GOTREF)(void*, PyObject*, int);
1244 void (*GIVEREF)(void*, PyObject*, int);
1245 void* (*SetupContext)(const char*, int, const char*);
1246 void (*FinishContext)(void**);
1247 } __Pyx_RefNannyAPIStruct;
1248 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1249 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1250 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1251 #ifdef WITH_THREAD
1252 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1253 if (acquire_gil) {\
1254 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1255 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1256 PyGILState_Release(__pyx_gilstate_save);\
1257 } else {\
1258 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1259 }
1260 #else
1261 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1262 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1263 #endif
1264 #define __Pyx_RefNannyFinishContext()\
1265 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1266 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1267 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1268 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1269 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1270 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1271 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1272 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1273 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1274 #else
1275 #define __Pyx_RefNannyDeclarations
1276 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1277 #define __Pyx_RefNannyFinishContext()
1278 #define __Pyx_INCREF(r) Py_INCREF(r)
1279 #define __Pyx_DECREF(r) Py_DECREF(r)
1280 #define __Pyx_GOTREF(r)
1281 #define __Pyx_GIVEREF(r)
1282 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1283 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1284 #define __Pyx_XGOTREF(r)
1285 #define __Pyx_XGIVEREF(r)
1286 #endif
1287 #define __Pyx_XDECREF_SET(r, v) do {\
1288 PyObject *tmp = (PyObject *) r;\
1289 r = v; __Pyx_XDECREF(tmp);\
1290 } while (0)
1291 #define __Pyx_DECREF_SET(r, v) do {\
1292 PyObject *tmp = (PyObject *) r;\
1293 r = v; __Pyx_DECREF(tmp);\
1294 } while (0)
1295 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1296 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1297
1298 /* PyObjectGetAttrStr.proto */
1299 #if CYTHON_USE_TYPE_SLOTS
1300 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1301 #else
1302 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1303 #endif
1304
1305 /* GetBuiltinName.proto */
1306 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1307
1308 /* RaiseArgTupleInvalid.proto */
1309 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1310 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1311
1312 /* RaiseDoubleKeywords.proto */
1313 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1314
1315 /* ParseKeywords.proto */
1316 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1317 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1318 const char* function_name);
1319
1320 /* ArgTypeTest.proto */
1321 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1322 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1323 __Pyx__ArgTypeTest(obj, type, name, exact))
1324 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1325
1326 /* IsLittleEndian.proto */
1327 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1328
1329 /* BufferFormatCheck.proto */
1330 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1331 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1332 __Pyx_BufFmt_StackElem* stack,
1333 __Pyx_TypeInfo* type);
1334
1335 /* BufferGetAndValidate.proto */
1336 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1337 ((obj == Py_None || obj == NULL) ?\
1338 (__Pyx_ZeroBuffer(buf), 0) :\
1339 __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1340 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1341 __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1342 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1343 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1344 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1345 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1346
1347 /* IncludeStringH.proto */
1348 #include <string.h>
1349
1350 /* BytesEquals.proto */
1351 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1352
1353 /* UnicodeEquals.proto */
1354 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1355
1356 /* StrEquals.proto */
1357 #if PY_MAJOR_VERSION >= 3
1358 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1359 #else
1360 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1361 #endif
1362
1363 /* PyThreadStateGet.proto */
1364 #if CYTHON_FAST_THREAD_STATE
1365 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1366 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1367 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1368 #else
1369 #define __Pyx_PyThreadState_declare
1370 #define __Pyx_PyThreadState_assign
1371 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1372 #endif
1373
1374 /* PyErrFetchRestore.proto */
1375 #if CYTHON_FAST_THREAD_STATE
1376 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1377 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1378 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1379 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1380 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1381 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1382 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1383 #if CYTHON_COMPILING_IN_CPYTHON
1384 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1385 #else
1386 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1387 #endif
1388 #else
1389 #define __Pyx_PyErr_Clear() PyErr_Clear()
1390 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1391 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1392 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1393 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1394 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1395 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1396 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1397 #endif
1398
1399 /* RaiseException.proto */
1400 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1401
1402 /* GetItemInt.proto */
1403 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1404 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1405 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1406 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1407 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1408 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1409 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1410 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1411 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1412 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1413 int wraparound, int boundscheck);
1414 #define __Pyx_GetItemInt_Tuple(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_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1417 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1418 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1419 int wraparound, int boundscheck);
1420 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1421 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1422 int is_list, int wraparound, int boundscheck);
1423
1424 /* BufferIndexError.proto */
1425 static void __Pyx_RaiseBufferIndexError(int axis);
1426
1427 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1428 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1429 /* WriteUnraisableException.proto */
1430 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1431 int lineno, const char *filename,
1432 int full_traceback, int nogil);
1433
1434 /* PyIntCompare.proto */
1435 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1436
1437 /* PyDictVersioning.proto */
1438 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1439 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1440 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1441 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1442 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1443 (cache_var) = (value);
1444 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1445 static PY_UINT64_T __pyx_dict_version = 0;\
1446 static PyObject *__pyx_dict_cached_value = NULL;\
1447 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1448 (VAR) = __pyx_dict_cached_value;\
1449 } else {\
1450 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1451 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1452 }\
1453 }
1454 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1455 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1456 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1457 #else
1458 #define __PYX_GET_DICT_VERSION(dict) (0)
1459 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1460 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1461 #endif
1462
1463 /* GetModuleGlobalName.proto */
1464 #if CYTHON_USE_DICT_VERSIONS
1465 #define __Pyx_GetModuleGlobalName(var, name) {\
1466 static PY_UINT64_T __pyx_dict_version = 0;\
1467 static PyObject *__pyx_dict_cached_value = NULL;\
1468 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1469 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1470 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1471 }
1472 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1473 PY_UINT64_T __pyx_dict_version;\
1474 PyObject *__pyx_dict_cached_value;\
1475 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1476 }
1477 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1478 #else
1479 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1480 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1481 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1482 #endif
1483
1484 /* PyObjectCall.proto */
1485 #if CYTHON_COMPILING_IN_CPYTHON
1486 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1487 #else
1488 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1489 #endif
1490
1491 /* ExtTypeTest.proto */
1492 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1493
1494 /* BufferFallbackError.proto */
1495 static void __Pyx_RaiseBufferFallbackError(void);
1496
1497 /* PyFunctionFastCall.proto */
1498 #if CYTHON_FAST_PYCALL
1499 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1500 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1501 #if 1 || PY_VERSION_HEX < 0x030600B1
1502 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1503 #else
1504 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1505 #endif
1506 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1507 (sizeof(char [1 - 2*!(cond)]) - 1)
1508 #ifndef Py_MEMBER_SIZE
1509 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1510 #endif
1511 static size_t __pyx_pyframe_localsplus_offset = 0;
1512 #include "frameobject.h"
1513 #define __Pxy_PyFrame_Initialize_Offsets()\
1514 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1515 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1516 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1517 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1518 #endif
1519
1520 /* PyCFunctionFastCall.proto */
1521 #if CYTHON_FAST_PYCCALL
1522 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1523 #else
1524 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1525 #endif
1526
1527 /* PyObjectCallMethO.proto */
1528 #if CYTHON_COMPILING_IN_CPYTHON
1529 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1530 #endif
1531
1532 /* PyObjectCallOneArg.proto */
1533 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1534
1535 /* DictGetItem.proto */
1536 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1537 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1538 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1539 (likely(PyDict_CheckExact(obj)) ?\
1540 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1541 #else
1542 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1543 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1544 #endif
1545
1546 /* RaiseTooManyValuesToUnpack.proto */
1547 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1548
1549 /* RaiseNeedMoreValuesToUnpack.proto */
1550 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1551
1552 /* RaiseNoneIterError.proto */
1553 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1554
1555 /* GetTopmostException.proto */
1556 #if CYTHON_USE_EXC_INFO_STACK
1557 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1558 #endif
1559
1560 /* SaveResetException.proto */
1561 #if CYTHON_FAST_THREAD_STATE
1562 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1563 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1564 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1565 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1566 #else
1567 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1568 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1569 #endif
1570
1571 /* PyErrExceptionMatches.proto */
1572 #if CYTHON_FAST_THREAD_STATE
1573 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1574 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1575 #else
1576 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1577 #endif
1578
1579 /* GetException.proto */
1580 #if CYTHON_FAST_THREAD_STATE
1581 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1582 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1583 #else
1584 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1585 #endif
1586
1587 /* GetAttr.proto */
1588 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1589
1590 /* HasAttr.proto */
1591 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1592
1593 /* PyObjectCall2Args.proto */
1594 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1595
1596 /* PyObject_GenericGetAttrNoDict.proto */
1597 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1598 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1599 #else
1600 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1601 #endif
1602
1603 /* PyObject_GenericGetAttr.proto */
1604 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1605 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1606 #else
1607 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1608 #endif
1609
1610 /* SetVTable.proto */
1611 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1612
1613 /* SetupReduce.proto */
1614 static int __Pyx_setup_reduce(PyObject* type_obj);
1615
1616 /* TypeImport.proto */
1617 #ifndef __PYX_HAVE_RT_ImportType_proto
1618 #define __PYX_HAVE_RT_ImportType_proto
1619 enum __Pyx_ImportType_CheckSize {
1620 __Pyx_ImportType_CheckSize_Error = 0,
1621 __Pyx_ImportType_CheckSize_Warn = 1,
1622 __Pyx_ImportType_CheckSize_Ignore = 2
1623 };
1624 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1625 #endif
1626
1627 /* Import.proto */
1628 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1629
1630 /* ImportFrom.proto */
1631 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1632
1633 /* CLineInTraceback.proto */
1634 #ifdef CYTHON_CLINE_IN_TRACEBACK
1635 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1636 #else
1637 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1638 #endif
1639
1640 /* CodeObjectCache.proto */
1641 typedef struct {
1642 PyCodeObject* code_object;
1643 int code_line;
1644 } __Pyx_CodeObjectCacheEntry;
1645 struct __Pyx_CodeObjectCache {
1646 int count;
1647 int max_count;
1648 __Pyx_CodeObjectCacheEntry* entries;
1649 };
1650 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1651 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1652 static PyCodeObject *__pyx_find_code_object(int code_line);
1653 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1654
1655 /* AddTraceback.proto */
1656 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1657 int py_line, const char *filename);
1658
1659 /* BufferStructDeclare.proto */
1660 typedef struct {
1661 Py_ssize_t shape, strides, suboffsets;
1662 } __Pyx_Buf_DimInfo;
1663 typedef struct {
1664 size_t refcount;
1665 Py_buffer pybuffer;
1666 } __Pyx_Buffer;
1667 typedef struct {
1668 __Pyx_Buffer *rcbuffer;
1669 char *data;
1670 __Pyx_Buf_DimInfo diminfo[8];
1671 } __Pyx_LocalBuf_ND;
1672
1673 #if PY_MAJOR_VERSION < 3
1674 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1675 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1676 #else
1677 #define __Pyx_GetBuffer PyObject_GetBuffer
1678 #define __Pyx_ReleaseBuffer PyBuffer_Release
1679 #endif
1680
1681
1682 /* CIntToPy.proto */
1683 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1684
1685 /* CIntToPy.proto */
1686 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
1687
1688 /* CIntToPy.proto */
1689 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1690
1691 /* None.proto */
1692 static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_pow___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t);
1693
1694 /* RealImag.proto */
1695 #if CYTHON_CCOMPLEX
1696 #ifdef __cplusplus
1697 #define __Pyx_CREAL(z) ((z).real())
1698 #define __Pyx_CIMAG(z) ((z).imag())
1699 #else
1700 #define __Pyx_CREAL(z) (__real__(z))
1701 #define __Pyx_CIMAG(z) (__imag__(z))
1702 #endif
1703 #else
1704 #define __Pyx_CREAL(z) ((z).real)
1705 #define __Pyx_CIMAG(z) ((z).imag)
1706 #endif
1707 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1708 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1709 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1710 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1711 #else
1712 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1713 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1714 #endif
1715
1716 /* Arithmetic.proto */
1717 #if CYTHON_CCOMPLEX
1718 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1719 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1720 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1721 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1722 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1723 #define __Pyx_c_neg_float(a) (-(a))
1724 #ifdef __cplusplus
1725 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1726 #define __Pyx_c_conj_float(z) (::std::conj(z))
1727 #if 1
1728 #define __Pyx_c_abs_float(z) (::std::abs(z))
1729 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1730 #endif
1731 #else
1732 #define __Pyx_c_is_zero_float(z) ((z)==0)
1733 #define __Pyx_c_conj_float(z) (conjf(z))
1734 #if 1
1735 #define __Pyx_c_abs_float(z) (cabsf(z))
1736 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1737 #endif
1738 #endif
1739 #else
1740 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1741 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1742 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1743 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1744 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1745 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1746 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1747 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1748 #if 1
1749 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1750 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1751 #endif
1752 #endif
1753
1754 /* Arithmetic.proto */
1755 #if CYTHON_CCOMPLEX
1756 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1757 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1758 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1759 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1760 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1761 #define __Pyx_c_neg_double(a) (-(a))
1762 #ifdef __cplusplus
1763 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1764 #define __Pyx_c_conj_double(z) (::std::conj(z))
1765 #if 1
1766 #define __Pyx_c_abs_double(z) (::std::abs(z))
1767 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1768 #endif
1769 #else
1770 #define __Pyx_c_is_zero_double(z) ((z)==0)
1771 #define __Pyx_c_conj_double(z) (conj(z))
1772 #if 1
1773 #define __Pyx_c_abs_double(z) (cabs(z))
1774 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1775 #endif
1776 #endif
1777 #else
1778 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1779 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1780 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1781 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1782 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1783 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1784 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1785 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1786 #if 1
1787 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1788 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1789 #endif
1790 #endif
1791
1792 /* CIntToPy.proto */
1793 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1794
1795 /* CIntFromPy.proto */
1796 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1797
1798 /* CIntFromPy.proto */
1799 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *);
1800
1801 /* CIntToPy.proto */
1802 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1803
1804 /* CIntFromPy.proto */
1805 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1806
1807 /* FastTypeChecks.proto */
1808 #if CYTHON_COMPILING_IN_CPYTHON
1809 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1810 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1811 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1812 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1813 #else
1814 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1815 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1816 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1817 #endif
1818 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1819
1820 /* CheckBinaryVersion.proto */
1821 static int __Pyx_check_binary_version(void);
1822
1823 /* InitStrings.proto */
1824 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1825
1826 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count_total_cells(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_root); /* proto*/
1827 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill_buffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_root, int __pyx_v_curpos, PyArrayObject *__pyx_v_refined, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_wval); /* proto*/
1828 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_unfill_buffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_root, int __pyx_v_curpos, PyArrayObject *__pyx_v_refined, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_wval); /* proto*/
1829 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, int __pyx_v_level, __pyx_t_5numpy_int64_t *__pyx_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position *__pyx_optional_args); /* proto*/
1830 static struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_on_root_level(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, __pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_level); /* proto*/
1831 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node); /* proto*/
1832 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node, __pyx_t_5numpy_int64_t __pyx_v_curpos, __pyx_t_5numpy_float64_t *__pyx_v_px, __pyx_t_5numpy_float64_t *__pyx_v_py, __pyx_t_5numpy_float64_t *__pyx_v_pdx, __pyx_t_5numpy_float64_t *__pyx_v_pdy, __pyx_t_5numpy_float64_t *__pyx_v_vdata, __pyx_t_5numpy_float64_t *__pyx_v_wdata, __pyx_t_5numpy_float64_t *__pyx_v_vtoadd, __pyx_t_5numpy_float64_t __pyx_v_wtoadd, __pyx_t_5numpy_int64_t __pyx_v_level); /* proto*/
1833 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_pos, int __pyx_v_val_index, __pyx_t_5numpy_float64_t *__pyx_v_opos, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos *__pyx_optional_args); /* proto*/
1834
1835 /* Module declarations from 'cython' */
1836
1837 /* Module declarations from 'cpython.buffer' */
1838
1839 /* Module declarations from 'libc.string' */
1840
1841 /* Module declarations from 'libc.stdio' */
1842
1843 /* Module declarations from '__builtin__' */
1844
1845 /* Module declarations from 'cpython.type' */
1846 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1847
1848 /* Module declarations from 'cpython' */
1849
1850 /* Module declarations from 'cpython.object' */
1851
1852 /* Module declarations from 'cpython.ref' */
1853
1854 /* Module declarations from 'cpython.mem' */
1855
1856 /* Module declarations from 'numpy' */
1857
1858 /* Module declarations from 'numpy' */
1859 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1860 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1861 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1862 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1863 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1864 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1865
1866 /* Module declarations from 'libc.stdlib' */
1867
1868 /* Module declarations from 'yt.utilities.lib.fp_utils' */
1869 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
1870 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
1871
1872 /* Module declarations from 'yt.utilities.lib.quad_tree' */
1873 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_9quad_tree_QuadTree = 0;
1874 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_add_value(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int); /*proto*/
1875 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_max_value(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int); /*proto*/
1876 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_refine(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, int); /*proto*/
1877 static struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_initialize(__pyx_t_5numpy_int64_t *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t); /*proto*/
1878 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_free(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *); /*proto*/
1879 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_merge_nodes(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, int, __pyx_t_2yt_9utilities_3lib_9quad_tree_QTN_combine *); /*proto*/
1880 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 };
1881 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 };
1882 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 };
1883 #define __Pyx_MODULE_NAME "yt.utilities.lib.quad_tree"
1884 extern int __pyx_module_is_main_yt__utilities__lib__quad_tree;
1885 int __pyx_module_is_main_yt__utilities__lib__quad_tree = 0;
1886
1887 /* Implementation of 'yt.utilities.lib.quad_tree' */
1888 static PyObject *__pyx_builtin_range;
1889 static PyObject *__pyx_builtin_NotImplementedError;
1890 static PyObject *__pyx_builtin_TypeError;
1891 static PyObject *__pyx_builtin_RuntimeError;
1892 static PyObject *__pyx_builtin_ValueError;
1893 static PyObject *__pyx_builtin_ImportError;
1894 static const char __pyx_k_i[] = "i";
1895 static const char __pyx_k_j[] = "j";
1896 static const char __pyx_k_np[] = "np";
1897 static const char __pyx_k_mip[] = "mip";
1898 static const char __pyx_k_pxs[] = "pxs";
1899 static const char __pyx_k_pys[] = "pys";
1900 static const char __pyx_k_qt1[] = "qt1";
1901 static const char __pyx_k_qt2[] = "qt2";
1902 static const char __pyx_k_func[] = "func";
1903 static const char __pyx_k_main[] = "__main__";
1904 static const char __pyx_k_name[] = "__name__";
1905 static const char __pyx_k_skip[] = "skip";
1906 static const char __pyx_k_test[] = "__test__";
1907 static const char __pyx_k_wval[] = "wval";
1908 static const char __pyx_k_dtype[] = "dtype";
1909 static const char __pyx_k_int32[] = "int32";
1910 static const char __pyx_k_level[] = "level";
1911 static const char __pyx_k_numpy[] = "numpy";
1912 static const char __pyx_k_nvals[] = "nvals";
1913 static const char __pyx_k_pvals[] = "pvals";
1914 static const char __pyx_k_range[] = "range";
1915 static const char __pyx_k_units[] = "units";
1916 static const char __pyx_k_zeros[] = "zeros";
1917 static const char __pyx_k_bounds[] = "bounds";
1918 static const char __pyx_k_buffer[] = "buffer";
1919 static const char __pyx_k_import[] = "__import__";
1920 static const char __pyx_k_method[] = "method";
1921 static const char __pyx_k_reduce[] = "__reduce__";
1922 static const char __pyx_k_values[] = "values";
1923 static const char __pyx_k_float64[] = "float64";
1924 static const char __pyx_k_refined[] = "refined";
1925 static const char __pyx_k_QuadTree[] = "QuadTree";
1926 static const char __pyx_k_bounds_2[] = "_bounds";
1927 static const char __pyx_k_getstate[] = "__getstate__";
1928 static const char __pyx_k_setstate[] = "__setstate__";
1929 static const char __pyx_k_weighted[] = "weighted";
1930 static const char __pyx_k_TypeError[] = "TypeError";
1931 static const char __pyx_k_integrate[] = "integrate";
1932 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1933 static const char __pyx_k_val_index[] = "val_index";
1934 static const char __pyx_k_ValueError[] = "ValueError";
1935 static const char __pyx_k_count_only[] = "count_only";
1936 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1937 static const char __pyx_k_ImportError[] = "ImportError";
1938 static const char __pyx_k_code_length[] = "code_length";
1939 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1940 static const char __pyx_k_pweight_vals[] = "pweight_vals";
1941 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1942 static const char __pyx_k_top_grid_dims[] = "top_grid_dims";
1943 static const char __pyx_k_merge_quadtrees[] = "merge_quadtrees";
1944 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1945 static const char __pyx_k_convert_to_units[] = "convert_to_units";
1946 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1947 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
1948 static const char __pyx_k_YTIntDomainOverflow[] = "YTIntDomainOverflow";
1949 static const char __pyx_k_yt_utilities_exceptions[] = "yt.utilities.exceptions";
1950 static const char __pyx_k_yt_utilities_lib_quad_tree[] = "yt.utilities.lib.quad_tree";
1951 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1952 static const char __pyx_k_yt_utilities_lib_quad_tree_pyx[] = "yt/utilities/lib/quad_tree.pyx";
1953 static const char __pyx_k_A_refine_by_two_AMR_specific_qu[] = "\nA refine-by-two AMR-specific quadtree\n\n\n\n";
1954 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1955 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1956 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1957 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1958 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1959 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1960 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1961 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1962 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1963 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1964 static PyObject *__pyx_n_s_ImportError;
1965 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1966 static PyObject *__pyx_n_s_NotImplementedError;
1967 static PyObject *__pyx_n_s_QuadTree;
1968 static PyObject *__pyx_n_s_RuntimeError;
1969 static PyObject *__pyx_n_s_TypeError;
1970 static PyObject *__pyx_n_s_ValueError;
1971 static PyObject *__pyx_n_s_YTIntDomainOverflow;
1972 static PyObject *__pyx_n_s_bounds;
1973 static PyObject *__pyx_n_s_bounds_2;
1974 static PyObject *__pyx_n_s_buffer;
1975 static PyObject *__pyx_n_s_cline_in_traceback;
1976 static PyObject *__pyx_n_s_code_length;
1977 static PyObject *__pyx_n_s_convert_to_units;
1978 static PyObject *__pyx_n_s_count_only;
1979 static PyObject *__pyx_n_s_dtype;
1980 static PyObject *__pyx_n_s_float64;
1981 static PyObject *__pyx_n_s_func;
1982 static PyObject *__pyx_n_s_getstate;
1983 static PyObject *__pyx_n_s_i;
1984 static PyObject *__pyx_n_s_import;
1985 static PyObject *__pyx_n_s_int32;
1986 static PyObject *__pyx_n_s_integrate;
1987 static PyObject *__pyx_n_s_j;
1988 static PyObject *__pyx_n_s_level;
1989 static PyObject *__pyx_n_s_main;
1990 static PyObject *__pyx_n_s_merge_quadtrees;
1991 static PyObject *__pyx_n_s_method;
1992 static PyObject *__pyx_n_s_mip;
1993 static PyObject *__pyx_n_s_name;
1994 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1995 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1996 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
1997 static PyObject *__pyx_n_s_np;
1998 static PyObject *__pyx_n_s_numpy;
1999 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2000 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2001 static PyObject *__pyx_n_s_nvals;
2002 static PyObject *__pyx_n_s_pvals;
2003 static PyObject *__pyx_n_s_pweight_vals;
2004 static PyObject *__pyx_n_s_pxs;
2005 static PyObject *__pyx_n_s_pys;
2006 static PyObject *__pyx_n_s_pyx_vtable;
2007 static PyObject *__pyx_n_s_qt1;
2008 static PyObject *__pyx_n_s_qt2;
2009 static PyObject *__pyx_n_s_range;
2010 static PyObject *__pyx_n_s_reduce;
2011 static PyObject *__pyx_n_s_reduce_cython;
2012 static PyObject *__pyx_n_s_reduce_ex;
2013 static PyObject *__pyx_n_s_refined;
2014 static PyObject *__pyx_n_s_setstate;
2015 static PyObject *__pyx_n_s_setstate_cython;
2016 static PyObject *__pyx_n_s_skip;
2017 static PyObject *__pyx_n_s_test;
2018 static PyObject *__pyx_n_s_top_grid_dims;
2019 static PyObject *__pyx_n_s_units;
2020 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2021 static PyObject *__pyx_n_s_val_index;
2022 static PyObject *__pyx_n_s_values;
2023 static PyObject *__pyx_n_s_weighted;
2024 static PyObject *__pyx_n_s_wval;
2025 static PyObject *__pyx_n_s_yt_utilities_exceptions;
2026 static PyObject *__pyx_n_s_yt_utilities_lib_quad_tree;
2027 static PyObject *__pyx_kp_s_yt_utilities_lib_quad_tree_pyx;
2028 static PyObject *__pyx_n_s_zeros;
2029 static int __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree___cinit__(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_top_grid_dims, int __pyx_v_nvals, PyObject *__pyx_v_bounds, PyObject *__pyx_v_method); /* proto */
2030 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_2frombuffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_refined, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_wval, PyObject *__pyx_v_method); /* proto */
2031 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_4tobuffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self); /* proto */
2032 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_6get_args(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self); /* proto */
2033 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_8add_array_to_tree(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, int __pyx_v_level, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_pvals, PyArrayObject *__pyx_v_pweight_vals, int __pyx_v_skip); /* proto */
2034 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_10add_chunk_to_tree(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_level, PyArrayObject *__pyx_v_pvals, PyArrayObject *__pyx_v_pweight_vals); /* proto */
2035 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_12initialize_chunk(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_level); /* proto */
2036 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_14get_all(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, int __pyx_v_count_only, int __pyx_v_method); /* proto */
2037 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_16fill_image(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_buffer, PyObject *__pyx_v__bounds, int __pyx_v_val_index, int __pyx_v_weighted); /* proto */
2038 static void __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_18__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self); /* proto */
2039 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self); /* proto */
2040 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2041 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_merge_quadtrees(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_qt1, struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_qt2, PyObject *__pyx_v_method); /* proto */
2042 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2043 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2044 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_9quad_tree_QuadTree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2045 static PyObject *__pyx_int_1;
2046 static PyObject *__pyx_int_neg_1;
2047 static PyObject *__pyx_tuple_;
2048 static PyObject *__pyx_tuple__2;
2049 static PyObject *__pyx_tuple__3;
2050 static PyObject *__pyx_tuple__4;
2051 static PyObject *__pyx_tuple__5;
2052 static PyObject *__pyx_tuple__6;
2053 static PyObject *__pyx_tuple__7;
2054 static PyObject *__pyx_tuple__8;
2055 static PyObject *__pyx_tuple__9;
2056 static PyObject *__pyx_tuple__10;
2057 static PyObject *__pyx_codeobj__11;
2058 /* Late includes */
2059
2060 /* "yt/utilities/lib/quad_tree.pyx":38
2061 * int nvals)
2062 *
2063 * cdef void QTN_add_value(QuadTreeNode *self, # <<<<<<<<<<<<<<
2064 * np.float64_t *val, np.float64_t weight_val,
2065 * int nvals):
2066 */
2067
__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_add_value(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_self,__pyx_t_5numpy_float64_t * __pyx_v_val,__pyx_t_5numpy_float64_t __pyx_v_weight_val,int __pyx_v_nvals)2068 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_add_value(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val, int __pyx_v_nvals) {
2069 int __pyx_v_i;
2070 __Pyx_RefNannyDeclarations
2071 int __pyx_t_1;
2072 int __pyx_t_2;
2073 int __pyx_t_3;
2074 int __pyx_t_4;
2075 __Pyx_RefNannySetupContext("QTN_add_value", 0);
2076
2077 /* "yt/utilities/lib/quad_tree.pyx":42
2078 * int nvals):
2079 * cdef int i
2080 * for i in range(nvals): # <<<<<<<<<<<<<<
2081 * self.val[i] += val[i]
2082 * self.weight_val += weight_val
2083 */
2084 __pyx_t_1 = __pyx_v_nvals;
2085 __pyx_t_2 = __pyx_t_1;
2086 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2087 __pyx_v_i = __pyx_t_3;
2088
2089 /* "yt/utilities/lib/quad_tree.pyx":43
2090 * cdef int i
2091 * for i in range(nvals):
2092 * self.val[i] += val[i] # <<<<<<<<<<<<<<
2093 * self.weight_val += weight_val
2094 *
2095 */
2096 __pyx_t_4 = __pyx_v_i;
2097 (__pyx_v_self->val[__pyx_t_4]) = ((__pyx_v_self->val[__pyx_t_4]) + (__pyx_v_val[__pyx_v_i]));
2098 }
2099
2100 /* "yt/utilities/lib/quad_tree.pyx":44
2101 * for i in range(nvals):
2102 * self.val[i] += val[i]
2103 * self.weight_val += weight_val # <<<<<<<<<<<<<<
2104 *
2105 * cdef void QTN_max_value(QuadTreeNode *self,
2106 */
2107 __pyx_v_self->weight_val = (__pyx_v_self->weight_val + __pyx_v_weight_val);
2108
2109 /* "yt/utilities/lib/quad_tree.pyx":38
2110 * int nvals)
2111 *
2112 * cdef void QTN_add_value(QuadTreeNode *self, # <<<<<<<<<<<<<<
2113 * np.float64_t *val, np.float64_t weight_val,
2114 * int nvals):
2115 */
2116
2117 /* function exit code */
2118 __Pyx_RefNannyFinishContext();
2119 }
2120
2121 /* "yt/utilities/lib/quad_tree.pyx":46
2122 * self.weight_val += weight_val
2123 *
2124 * cdef void QTN_max_value(QuadTreeNode *self, # <<<<<<<<<<<<<<
2125 * np.float64_t *val, np.float64_t weight_val,
2126 * int nvals):
2127 */
2128
__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_max_value(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_self,__pyx_t_5numpy_float64_t * __pyx_v_val,CYTHON_UNUSED __pyx_t_5numpy_float64_t __pyx_v_weight_val,int __pyx_v_nvals)2129 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_max_value(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_val, CYTHON_UNUSED __pyx_t_5numpy_float64_t __pyx_v_weight_val, int __pyx_v_nvals) {
2130 int __pyx_v_i;
2131 __Pyx_RefNannyDeclarations
2132 int __pyx_t_1;
2133 int __pyx_t_2;
2134 int __pyx_t_3;
2135 __Pyx_RefNannySetupContext("QTN_max_value", 0);
2136
2137 /* "yt/utilities/lib/quad_tree.pyx":50
2138 * int nvals):
2139 * cdef int i
2140 * for i in range(nvals): # <<<<<<<<<<<<<<
2141 * self.val[i] = fmax(val[i], self.val[i])
2142 * self.weight_val = 1.0
2143 */
2144 __pyx_t_1 = __pyx_v_nvals;
2145 __pyx_t_2 = __pyx_t_1;
2146 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2147 __pyx_v_i = __pyx_t_3;
2148
2149 /* "yt/utilities/lib/quad_tree.pyx":51
2150 * cdef int i
2151 * for i in range(nvals):
2152 * self.val[i] = fmax(val[i], self.val[i]) # <<<<<<<<<<<<<<
2153 * self.weight_val = 1.0
2154 *
2155 */
2156 (__pyx_v_self->val[__pyx_v_i]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax((__pyx_v_val[__pyx_v_i]), (__pyx_v_self->val[__pyx_v_i]));
2157 }
2158
2159 /* "yt/utilities/lib/quad_tree.pyx":52
2160 * for i in range(nvals):
2161 * self.val[i] = fmax(val[i], self.val[i])
2162 * self.weight_val = 1.0 # <<<<<<<<<<<<<<
2163 *
2164 * cdef void QTN_refine(QuadTreeNode *self, int nvals):
2165 */
2166 __pyx_v_self->weight_val = 1.0;
2167
2168 /* "yt/utilities/lib/quad_tree.pyx":46
2169 * self.weight_val += weight_val
2170 *
2171 * cdef void QTN_max_value(QuadTreeNode *self, # <<<<<<<<<<<<<<
2172 * np.float64_t *val, np.float64_t weight_val,
2173 * int nvals):
2174 */
2175
2176 /* function exit code */
2177 __Pyx_RefNannyFinishContext();
2178 }
2179
2180 /* "yt/utilities/lib/quad_tree.pyx":54
2181 * self.weight_val = 1.0
2182 *
2183 * cdef void QTN_refine(QuadTreeNode *self, int nvals): # <<<<<<<<<<<<<<
2184 * cdef int i, j
2185 * cdef np.int64_t npos[2]
2186 */
2187
__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_refine(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_self,int __pyx_v_nvals)2188 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_refine(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_self, int __pyx_v_nvals) {
2189 int __pyx_v_i;
2190 int __pyx_v_j;
2191 __pyx_t_5numpy_int64_t __pyx_v_npos[2];
2192 __pyx_t_5numpy_float64_t *__pyx_v_tvals;
2193 __Pyx_RefNannyDeclarations
2194 int __pyx_t_1;
2195 int __pyx_t_2;
2196 int __pyx_t_3;
2197 __Pyx_RefNannySetupContext("QTN_refine", 0);
2198
2199 /* "yt/utilities/lib/quad_tree.pyx":57
2200 * cdef int i, j
2201 * cdef np.int64_t npos[2]
2202 * cdef np.float64_t *tvals = <np.float64_t *> alloca( # <<<<<<<<<<<<<<
2203 * sizeof(np.float64_t) * nvals)
2204 * for i in range(nvals): tvals[i] = 0.0
2205 */
2206 __pyx_v_tvals = ((__pyx_t_5numpy_float64_t *)alloca(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nvals)));
2207
2208 /* "yt/utilities/lib/quad_tree.pyx":59
2209 * cdef np.float64_t *tvals = <np.float64_t *> alloca(
2210 * sizeof(np.float64_t) * nvals)
2211 * for i in range(nvals): tvals[i] = 0.0 # <<<<<<<<<<<<<<
2212 * for i in range(2):
2213 * npos[0] = self.pos[0] * 2 + i
2214 */
2215 __pyx_t_1 = __pyx_v_nvals;
2216 __pyx_t_2 = __pyx_t_1;
2217 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2218 __pyx_v_i = __pyx_t_3;
2219 (__pyx_v_tvals[__pyx_v_i]) = 0.0;
2220 }
2221
2222 /* "yt/utilities/lib/quad_tree.pyx":60
2223 * sizeof(np.float64_t) * nvals)
2224 * for i in range(nvals): tvals[i] = 0.0
2225 * for i in range(2): # <<<<<<<<<<<<<<
2226 * npos[0] = self.pos[0] * 2 + i
2227 * for j in range(2):
2228 */
2229 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
2230 __pyx_v_i = __pyx_t_1;
2231
2232 /* "yt/utilities/lib/quad_tree.pyx":61
2233 * for i in range(nvals): tvals[i] = 0.0
2234 * for i in range(2):
2235 * npos[0] = self.pos[0] * 2 + i # <<<<<<<<<<<<<<
2236 * for j in range(2):
2237 * npos[1] = self.pos[1] * 2 + j
2238 */
2239 (__pyx_v_npos[0]) = (((__pyx_v_self->pos[0]) * 2) + __pyx_v_i);
2240
2241 /* "yt/utilities/lib/quad_tree.pyx":62
2242 * for i in range(2):
2243 * npos[0] = self.pos[0] * 2 + i
2244 * for j in range(2): # <<<<<<<<<<<<<<
2245 * npos[1] = self.pos[1] * 2 + j
2246 * # We have to be careful with allocation...
2247 */
2248 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
2249 __pyx_v_j = __pyx_t_2;
2250
2251 /* "yt/utilities/lib/quad_tree.pyx":63
2252 * npos[0] = self.pos[0] * 2 + i
2253 * for j in range(2):
2254 * npos[1] = self.pos[1] * 2 + j # <<<<<<<<<<<<<<
2255 * # We have to be careful with allocation...
2256 * self.children[i][j] = QTN_initialize(
2257 */
2258 (__pyx_v_npos[1]) = (((__pyx_v_self->pos[1]) * 2) + __pyx_v_j);
2259
2260 /* "yt/utilities/lib/quad_tree.pyx":65
2261 * npos[1] = self.pos[1] * 2 + j
2262 * # We have to be careful with allocation...
2263 * self.children[i][j] = QTN_initialize( # <<<<<<<<<<<<<<
2264 * npos, nvals, tvals, 0.0)
2265 *
2266 */
2267 ((__pyx_v_self->children[__pyx_v_i])[__pyx_v_j]) = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_initialize(__pyx_v_npos, __pyx_v_nvals, __pyx_v_tvals, 0.0);
2268 }
2269 }
2270
2271 /* "yt/utilities/lib/quad_tree.pyx":54
2272 * self.weight_val = 1.0
2273 *
2274 * cdef void QTN_refine(QuadTreeNode *self, int nvals): # <<<<<<<<<<<<<<
2275 * cdef int i, j
2276 * cdef np.int64_t npos[2]
2277 */
2278
2279 /* function exit code */
2280 __Pyx_RefNannyFinishContext();
2281 }
2282
2283 /* "yt/utilities/lib/quad_tree.pyx":68
2284 * npos, nvals, tvals, 0.0)
2285 *
2286 * cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, # <<<<<<<<<<<<<<
2287 * np.float64_t *val, np.float64_t weight_val):
2288 * cdef QuadTreeNode *node
2289 */
2290
__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_initialize(__pyx_t_5numpy_int64_t * __pyx_v_pos,int __pyx_v_nvals,__pyx_t_5numpy_float64_t * __pyx_v_val,__pyx_t_5numpy_float64_t __pyx_v_weight_val)2291 static struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_initialize(__pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_nvals, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val) {
2292 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node;
2293 int __pyx_v_i;
2294 int __pyx_v_j;
2295 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_r;
2296 __Pyx_RefNannyDeclarations
2297 int __pyx_t_1;
2298 int __pyx_t_2;
2299 int __pyx_t_3;
2300 int __pyx_t_4;
2301 __Pyx_RefNannySetupContext("QTN_initialize", 0);
2302
2303 /* "yt/utilities/lib/quad_tree.pyx":72
2304 * cdef QuadTreeNode *node
2305 * cdef int i, j
2306 * node = <QuadTreeNode *> malloc(sizeof(QuadTreeNode)) # <<<<<<<<<<<<<<
2307 * node.pos[0] = pos[0]
2308 * node.pos[1] = pos[1]
2309 */
2310 __pyx_v_node = ((struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode))));
2311
2312 /* "yt/utilities/lib/quad_tree.pyx":73
2313 * cdef int i, j
2314 * node = <QuadTreeNode *> malloc(sizeof(QuadTreeNode))
2315 * node.pos[0] = pos[0] # <<<<<<<<<<<<<<
2316 * node.pos[1] = pos[1]
2317 * node.val = <np.float64_t *> malloc(
2318 */
2319 (__pyx_v_node->pos[0]) = (__pyx_v_pos[0]);
2320
2321 /* "yt/utilities/lib/quad_tree.pyx":74
2322 * node = <QuadTreeNode *> malloc(sizeof(QuadTreeNode))
2323 * node.pos[0] = pos[0]
2324 * node.pos[1] = pos[1] # <<<<<<<<<<<<<<
2325 * node.val = <np.float64_t *> malloc(
2326 * nvals * sizeof(np.float64_t))
2327 */
2328 (__pyx_v_node->pos[1]) = (__pyx_v_pos[1]);
2329
2330 /* "yt/utilities/lib/quad_tree.pyx":75
2331 * node.pos[0] = pos[0]
2332 * node.pos[1] = pos[1]
2333 * node.val = <np.float64_t *> malloc( # <<<<<<<<<<<<<<
2334 * nvals * sizeof(np.float64_t))
2335 * for i in range(2):
2336 */
2337 __pyx_v_node->val = ((__pyx_t_5numpy_float64_t *)malloc((__pyx_v_nvals * (sizeof(__pyx_t_5numpy_float64_t)))));
2338
2339 /* "yt/utilities/lib/quad_tree.pyx":77
2340 * node.val = <np.float64_t *> malloc(
2341 * nvals * sizeof(np.float64_t))
2342 * for i in range(2): # <<<<<<<<<<<<<<
2343 * for j in range(2):
2344 * node.children[i][j] = NULL
2345 */
2346 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
2347 __pyx_v_i = __pyx_t_1;
2348
2349 /* "yt/utilities/lib/quad_tree.pyx":78
2350 * nvals * sizeof(np.float64_t))
2351 * for i in range(2):
2352 * for j in range(2): # <<<<<<<<<<<<<<
2353 * node.children[i][j] = NULL
2354 * if val != NULL:
2355 */
2356 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
2357 __pyx_v_j = __pyx_t_2;
2358
2359 /* "yt/utilities/lib/quad_tree.pyx":79
2360 * for i in range(2):
2361 * for j in range(2):
2362 * node.children[i][j] = NULL # <<<<<<<<<<<<<<
2363 * if val != NULL:
2364 * for i in range(nvals):
2365 */
2366 ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]) = NULL;
2367 }
2368 }
2369
2370 /* "yt/utilities/lib/quad_tree.pyx":80
2371 * for j in range(2):
2372 * node.children[i][j] = NULL
2373 * if val != NULL: # <<<<<<<<<<<<<<
2374 * for i in range(nvals):
2375 * node.val[i] = val[i]
2376 */
2377 __pyx_t_3 = ((__pyx_v_val != NULL) != 0);
2378 if (__pyx_t_3) {
2379
2380 /* "yt/utilities/lib/quad_tree.pyx":81
2381 * node.children[i][j] = NULL
2382 * if val != NULL:
2383 * for i in range(nvals): # <<<<<<<<<<<<<<
2384 * node.val[i] = val[i]
2385 * node.weight_val = weight_val
2386 */
2387 __pyx_t_1 = __pyx_v_nvals;
2388 __pyx_t_2 = __pyx_t_1;
2389 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) {
2390 __pyx_v_i = __pyx_t_4;
2391
2392 /* "yt/utilities/lib/quad_tree.pyx":82
2393 * if val != NULL:
2394 * for i in range(nvals):
2395 * node.val[i] = val[i] # <<<<<<<<<<<<<<
2396 * node.weight_val = weight_val
2397 * return node
2398 */
2399 (__pyx_v_node->val[__pyx_v_i]) = (__pyx_v_val[__pyx_v_i]);
2400 }
2401
2402 /* "yt/utilities/lib/quad_tree.pyx":83
2403 * for i in range(nvals):
2404 * node.val[i] = val[i]
2405 * node.weight_val = weight_val # <<<<<<<<<<<<<<
2406 * return node
2407 *
2408 */
2409 __pyx_v_node->weight_val = __pyx_v_weight_val;
2410
2411 /* "yt/utilities/lib/quad_tree.pyx":80
2412 * for j in range(2):
2413 * node.children[i][j] = NULL
2414 * if val != NULL: # <<<<<<<<<<<<<<
2415 * for i in range(nvals):
2416 * node.val[i] = val[i]
2417 */
2418 }
2419
2420 /* "yt/utilities/lib/quad_tree.pyx":84
2421 * node.val[i] = val[i]
2422 * node.weight_val = weight_val
2423 * return node # <<<<<<<<<<<<<<
2424 *
2425 * cdef void QTN_free(QuadTreeNode *node):
2426 */
2427 __pyx_r = __pyx_v_node;
2428 goto __pyx_L0;
2429
2430 /* "yt/utilities/lib/quad_tree.pyx":68
2431 * npos, nvals, tvals, 0.0)
2432 *
2433 * cdef QuadTreeNode *QTN_initialize(np.int64_t pos[2], int nvals, # <<<<<<<<<<<<<<
2434 * np.float64_t *val, np.float64_t weight_val):
2435 * cdef QuadTreeNode *node
2436 */
2437
2438 /* function exit code */
2439 __pyx_L0:;
2440 __Pyx_RefNannyFinishContext();
2441 return __pyx_r;
2442 }
2443
2444 /* "yt/utilities/lib/quad_tree.pyx":86
2445 * return node
2446 *
2447 * cdef void QTN_free(QuadTreeNode *node): # <<<<<<<<<<<<<<
2448 * cdef int i, j
2449 * for i in range(2):
2450 */
2451
__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_free(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_node)2452 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_free(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node) {
2453 int __pyx_v_i;
2454 int __pyx_v_j;
2455 __Pyx_RefNannyDeclarations
2456 int __pyx_t_1;
2457 int __pyx_t_2;
2458 int __pyx_t_3;
2459 __Pyx_RefNannySetupContext("QTN_free", 0);
2460
2461 /* "yt/utilities/lib/quad_tree.pyx":88
2462 * cdef void QTN_free(QuadTreeNode *node):
2463 * cdef int i, j
2464 * for i in range(2): # <<<<<<<<<<<<<<
2465 * for j in range(2):
2466 * if node.children[i][j] == NULL: continue
2467 */
2468 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
2469 __pyx_v_i = __pyx_t_1;
2470
2471 /* "yt/utilities/lib/quad_tree.pyx":89
2472 * cdef int i, j
2473 * for i in range(2):
2474 * for j in range(2): # <<<<<<<<<<<<<<
2475 * if node.children[i][j] == NULL: continue
2476 * QTN_free(node.children[i][j])
2477 */
2478 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
2479 __pyx_v_j = __pyx_t_2;
2480
2481 /* "yt/utilities/lib/quad_tree.pyx":90
2482 * for i in range(2):
2483 * for j in range(2):
2484 * if node.children[i][j] == NULL: continue # <<<<<<<<<<<<<<
2485 * QTN_free(node.children[i][j])
2486 * free(node.val)
2487 */
2488 __pyx_t_3 = ((((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]) == NULL) != 0);
2489 if (__pyx_t_3) {
2490 goto __pyx_L5_continue;
2491 }
2492
2493 /* "yt/utilities/lib/quad_tree.pyx":91
2494 * for j in range(2):
2495 * if node.children[i][j] == NULL: continue
2496 * QTN_free(node.children[i][j]) # <<<<<<<<<<<<<<
2497 * free(node.val)
2498 * free(node)
2499 */
2500 __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_free(((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]));
2501 __pyx_L5_continue:;
2502 }
2503 }
2504
2505 /* "yt/utilities/lib/quad_tree.pyx":92
2506 * if node.children[i][j] == NULL: continue
2507 * QTN_free(node.children[i][j])
2508 * free(node.val) # <<<<<<<<<<<<<<
2509 * free(node)
2510 *
2511 */
2512 free(__pyx_v_node->val);
2513
2514 /* "yt/utilities/lib/quad_tree.pyx":93
2515 * QTN_free(node.children[i][j])
2516 * free(node.val)
2517 * free(node) # <<<<<<<<<<<<<<
2518 *
2519 * cdef class QuadTree:
2520 */
2521 free(__pyx_v_node);
2522
2523 /* "yt/utilities/lib/quad_tree.pyx":86
2524 * return node
2525 *
2526 * cdef void QTN_free(QuadTreeNode *node): # <<<<<<<<<<<<<<
2527 * cdef int i, j
2528 * for i in range(2):
2529 */
2530
2531 /* function exit code */
2532 __Pyx_RefNannyFinishContext();
2533 }
2534
2535 /* "yt/utilities/lib/quad_tree.pyx":107
2536 * cdef int max_level
2537 *
2538 * def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, # <<<<<<<<<<<<<<
2539 * int nvals, bounds, method = "integrate"):
2540 * if method == "integrate":
2541 */
2542
2543 /* Python wrapper */
2544 static int __pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2545 static int __pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2546 PyArrayObject *__pyx_v_top_grid_dims = 0;
2547 int __pyx_v_nvals;
2548 PyObject *__pyx_v_bounds = 0;
2549 PyObject *__pyx_v_method = 0;
2550 int __pyx_r;
2551 __Pyx_RefNannyDeclarations
2552 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2553 {
2554 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_top_grid_dims,&__pyx_n_s_nvals,&__pyx_n_s_bounds,&__pyx_n_s_method,0};
2555 PyObject* values[4] = {0,0,0,0};
2556 values[3] = ((PyObject *)__pyx_n_s_integrate);
2557 if (unlikely(__pyx_kwds)) {
2558 Py_ssize_t kw_args;
2559 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2560 switch (pos_args) {
2561 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2562 CYTHON_FALLTHROUGH;
2563 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2564 CYTHON_FALLTHROUGH;
2565 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2566 CYTHON_FALLTHROUGH;
2567 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2568 CYTHON_FALLTHROUGH;
2569 case 0: break;
2570 default: goto __pyx_L5_argtuple_error;
2571 }
2572 kw_args = PyDict_Size(__pyx_kwds);
2573 switch (pos_args) {
2574 case 0:
2575 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_top_grid_dims)) != 0)) kw_args--;
2576 else goto __pyx_L5_argtuple_error;
2577 CYTHON_FALLTHROUGH;
2578 case 1:
2579 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nvals)) != 0)) kw_args--;
2580 else {
2581 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 4, 1); __PYX_ERR(0, 107, __pyx_L3_error)
2582 }
2583 CYTHON_FALLTHROUGH;
2584 case 2:
2585 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bounds)) != 0)) kw_args--;
2586 else {
2587 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 4, 2); __PYX_ERR(0, 107, __pyx_L3_error)
2588 }
2589 CYTHON_FALLTHROUGH;
2590 case 3:
2591 if (kw_args > 0) {
2592 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method);
2593 if (value) { values[3] = value; kw_args--; }
2594 }
2595 }
2596 if (unlikely(kw_args > 0)) {
2597 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 107, __pyx_L3_error)
2598 }
2599 } else {
2600 switch (PyTuple_GET_SIZE(__pyx_args)) {
2601 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2602 CYTHON_FALLTHROUGH;
2603 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2604 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2605 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2606 break;
2607 default: goto __pyx_L5_argtuple_error;
2608 }
2609 }
2610 __pyx_v_top_grid_dims = ((PyArrayObject *)values[0]);
2611 __pyx_v_nvals = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nvals == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
2612 __pyx_v_bounds = values[2];
2613 __pyx_v_method = values[3];
2614 }
2615 goto __pyx_L4_argument_unpacking_done;
2616 __pyx_L5_argtuple_error:;
2617 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 107, __pyx_L3_error)
2618 __pyx_L3_error:;
2619 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2620 __Pyx_RefNannyFinishContext();
2621 return -1;
2622 __pyx_L4_argument_unpacking_done:;
2623 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "top_grid_dims", 0))) __PYX_ERR(0, 107, __pyx_L1_error)
2624 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_top_grid_dims, __pyx_v_nvals, __pyx_v_bounds, __pyx_v_method);
2625
2626 /* function exit code */
2627 goto __pyx_L0;
2628 __pyx_L1_error:;
2629 __pyx_r = -1;
2630 __pyx_L0:;
2631 __Pyx_RefNannyFinishContext();
2632 return __pyx_r;
2633 }
2634
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree___cinit__(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,PyArrayObject * __pyx_v_top_grid_dims,int __pyx_v_nvals,PyObject * __pyx_v_bounds,PyObject * __pyx_v_method)2635 static int __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree___cinit__(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_top_grid_dims, int __pyx_v_nvals, PyObject *__pyx_v_bounds, PyObject *__pyx_v_method) {
2636 int __pyx_v_i;
2637 int __pyx_v_j;
2638 __pyx_t_5numpy_int64_t __pyx_v_pos[2];
2639 __pyx_t_5numpy_float64_t *__pyx_v_vals;
2640 __pyx_t_5numpy_float64_t __pyx_v_weight_val;
2641 __Pyx_LocalBuf_ND __pyx_pybuffernd_top_grid_dims;
2642 __Pyx_Buffer __pyx_pybuffer_top_grid_dims;
2643 int __pyx_r;
2644 __Pyx_RefNannyDeclarations
2645 int __pyx_t_1;
2646 int __pyx_t_2;
2647 int __pyx_t_3;
2648 int __pyx_t_4;
2649 PyObject *__pyx_t_5 = NULL;
2650 __pyx_t_5numpy_float64_t __pyx_t_6;
2651 Py_ssize_t __pyx_t_7;
2652 Py_ssize_t __pyx_t_8;
2653 Py_ssize_t __pyx_t_9;
2654 Py_ssize_t __pyx_t_10;
2655 __pyx_t_5numpy_int64_t __pyx_t_11;
2656 __pyx_t_5numpy_int64_t __pyx_t_12;
2657 Py_ssize_t __pyx_t_13;
2658 Py_ssize_t __pyx_t_14;
2659 __pyx_t_5numpy_int64_t __pyx_t_15;
2660 __pyx_t_5numpy_int64_t __pyx_t_16;
2661 __Pyx_RefNannySetupContext("__cinit__", 0);
2662 __pyx_pybuffer_top_grid_dims.pybuffer.buf = NULL;
2663 __pyx_pybuffer_top_grid_dims.refcount = 0;
2664 __pyx_pybuffernd_top_grid_dims.data = NULL;
2665 __pyx_pybuffernd_top_grid_dims.rcbuffer = &__pyx_pybuffer_top_grid_dims;
2666 {
2667 __Pyx_BufFmt_StackElem __pyx_stack[1];
2668 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer, (PyObject*)__pyx_v_top_grid_dims, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 107, __pyx_L1_error)
2669 }
2670 __pyx_pybuffernd_top_grid_dims.diminfo[0].strides = __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_top_grid_dims.diminfo[0].shape = __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.shape[0];
2671
2672 /* "yt/utilities/lib/quad_tree.pyx":109
2673 * def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
2674 * int nvals, bounds, method = "integrate"):
2675 * if method == "integrate": # <<<<<<<<<<<<<<
2676 * self.combine = QTN_add_value
2677 * elif method == "mip":
2678 */
2679 __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_integrate, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
2680 if (__pyx_t_1) {
2681
2682 /* "yt/utilities/lib/quad_tree.pyx":110
2683 * int nvals, bounds, method = "integrate"):
2684 * if method == "integrate":
2685 * self.combine = QTN_add_value # <<<<<<<<<<<<<<
2686 * elif method == "mip":
2687 * self.combine = QTN_max_value
2688 */
2689 __pyx_v_self->combine = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_add_value;
2690
2691 /* "yt/utilities/lib/quad_tree.pyx":109
2692 * def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
2693 * int nvals, bounds, method = "integrate"):
2694 * if method == "integrate": # <<<<<<<<<<<<<<
2695 * self.combine = QTN_add_value
2696 * elif method == "mip":
2697 */
2698 goto __pyx_L3;
2699 }
2700
2701 /* "yt/utilities/lib/quad_tree.pyx":111
2702 * if method == "integrate":
2703 * self.combine = QTN_add_value
2704 * elif method == "mip": # <<<<<<<<<<<<<<
2705 * self.combine = QTN_max_value
2706 * else:
2707 */
2708 __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_mip, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
2709 if (likely(__pyx_t_1)) {
2710
2711 /* "yt/utilities/lib/quad_tree.pyx":112
2712 * self.combine = QTN_add_value
2713 * elif method == "mip":
2714 * self.combine = QTN_max_value # <<<<<<<<<<<<<<
2715 * else:
2716 * raise NotImplementedError
2717 */
2718 __pyx_v_self->combine = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_max_value;
2719
2720 /* "yt/utilities/lib/quad_tree.pyx":111
2721 * if method == "integrate":
2722 * self.combine = QTN_add_value
2723 * elif method == "mip": # <<<<<<<<<<<<<<
2724 * self.combine = QTN_max_value
2725 * else:
2726 */
2727 goto __pyx_L3;
2728 }
2729
2730 /* "yt/utilities/lib/quad_tree.pyx":114
2731 * self.combine = QTN_max_value
2732 * else:
2733 * raise NotImplementedError # <<<<<<<<<<<<<<
2734 * self.merged = 1
2735 * self.max_level = 0
2736 */
2737 /*else*/ {
2738 __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
2739 __PYX_ERR(0, 114, __pyx_L1_error)
2740 }
2741 __pyx_L3:;
2742
2743 /* "yt/utilities/lib/quad_tree.pyx":115
2744 * else:
2745 * raise NotImplementedError
2746 * self.merged = 1 # <<<<<<<<<<<<<<
2747 * self.max_level = 0
2748 * cdef int i, j
2749 */
2750 __pyx_v_self->merged = 1;
2751
2752 /* "yt/utilities/lib/quad_tree.pyx":116
2753 * raise NotImplementedError
2754 * self.merged = 1
2755 * self.max_level = 0 # <<<<<<<<<<<<<<
2756 * cdef int i, j
2757 * cdef np.int64_t pos[2]
2758 */
2759 __pyx_v_self->max_level = 0;
2760
2761 /* "yt/utilities/lib/quad_tree.pyx":119
2762 * cdef int i, j
2763 * cdef np.int64_t pos[2]
2764 * cdef np.float64_t *vals = <np.float64_t *> malloc( # <<<<<<<<<<<<<<
2765 * sizeof(np.float64_t)*nvals)
2766 * cdef np.float64_t weight_val = 0.0
2767 */
2768 __pyx_v_vals = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nvals)));
2769
2770 /* "yt/utilities/lib/quad_tree.pyx":121
2771 * cdef np.float64_t *vals = <np.float64_t *> malloc(
2772 * sizeof(np.float64_t)*nvals)
2773 * cdef np.float64_t weight_val = 0.0 # <<<<<<<<<<<<<<
2774 * self.nvals = nvals
2775 * for i in range(nvals): vals[i] = 0.0
2776 */
2777 __pyx_v_weight_val = 0.0;
2778
2779 /* "yt/utilities/lib/quad_tree.pyx":122
2780 * sizeof(np.float64_t)*nvals)
2781 * cdef np.float64_t weight_val = 0.0
2782 * self.nvals = nvals # <<<<<<<<<<<<<<
2783 * for i in range(nvals): vals[i] = 0.0
2784 * for i in range(4):
2785 */
2786 __pyx_v_self->nvals = __pyx_v_nvals;
2787
2788 /* "yt/utilities/lib/quad_tree.pyx":123
2789 * cdef np.float64_t weight_val = 0.0
2790 * self.nvals = nvals
2791 * for i in range(nvals): vals[i] = 0.0 # <<<<<<<<<<<<<<
2792 * for i in range(4):
2793 * self.bounds[i] = bounds[i]
2794 */
2795 __pyx_t_2 = __pyx_v_nvals;
2796 __pyx_t_3 = __pyx_t_2;
2797 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
2798 __pyx_v_i = __pyx_t_4;
2799 (__pyx_v_vals[__pyx_v_i]) = 0.0;
2800 }
2801
2802 /* "yt/utilities/lib/quad_tree.pyx":124
2803 * self.nvals = nvals
2804 * for i in range(nvals): vals[i] = 0.0
2805 * for i in range(4): # <<<<<<<<<<<<<<
2806 * self.bounds[i] = bounds[i]
2807 *
2808 */
2809 for (__pyx_t_2 = 0; __pyx_t_2 < 4; __pyx_t_2+=1) {
2810 __pyx_v_i = __pyx_t_2;
2811
2812 /* "yt/utilities/lib/quad_tree.pyx":125
2813 * for i in range(nvals): vals[i] = 0.0
2814 * for i in range(4):
2815 * self.bounds[i] = bounds[i] # <<<<<<<<<<<<<<
2816 *
2817 * self.top_grid_dims[0] = top_grid_dims[0]
2818 */
2819 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_bounds, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error)
2820 __Pyx_GOTREF(__pyx_t_5);
2821 __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
2822 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2823 (__pyx_v_self->bounds[__pyx_v_i]) = __pyx_t_6;
2824 }
2825
2826 /* "yt/utilities/lib/quad_tree.pyx":127
2827 * self.bounds[i] = bounds[i]
2828 *
2829 * self.top_grid_dims[0] = top_grid_dims[0] # <<<<<<<<<<<<<<
2830 * self.top_grid_dims[1] = top_grid_dims[1]
2831 * self.dds[0] = (self.bounds[1] - self.bounds[0])/self.top_grid_dims[0]
2832 */
2833 __pyx_t_7 = 0;
2834 __pyx_t_2 = -1;
2835 if (__pyx_t_7 < 0) {
2836 __pyx_t_7 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2837 if (unlikely(__pyx_t_7 < 0)) __pyx_t_2 = 0;
2838 } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_2 = 0;
2839 if (unlikely(__pyx_t_2 != -1)) {
2840 __Pyx_RaiseBufferIndexError(__pyx_t_2);
2841 __PYX_ERR(0, 127, __pyx_L1_error)
2842 }
2843 (__pyx_v_self->top_grid_dims[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
2844
2845 /* "yt/utilities/lib/quad_tree.pyx":128
2846 *
2847 * self.top_grid_dims[0] = top_grid_dims[0]
2848 * self.top_grid_dims[1] = top_grid_dims[1] # <<<<<<<<<<<<<<
2849 * self.dds[0] = (self.bounds[1] - self.bounds[0])/self.top_grid_dims[0]
2850 * self.dds[1] = (self.bounds[3] - self.bounds[2])/self.top_grid_dims[1]
2851 */
2852 __pyx_t_8 = 1;
2853 __pyx_t_2 = -1;
2854 if (__pyx_t_8 < 0) {
2855 __pyx_t_8 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2856 if (unlikely(__pyx_t_8 < 0)) __pyx_t_2 = 0;
2857 } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_2 = 0;
2858 if (unlikely(__pyx_t_2 != -1)) {
2859 __Pyx_RaiseBufferIndexError(__pyx_t_2);
2860 __PYX_ERR(0, 128, __pyx_L1_error)
2861 }
2862 (__pyx_v_self->top_grid_dims[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
2863
2864 /* "yt/utilities/lib/quad_tree.pyx":129
2865 * self.top_grid_dims[0] = top_grid_dims[0]
2866 * self.top_grid_dims[1] = top_grid_dims[1]
2867 * self.dds[0] = (self.bounds[1] - self.bounds[0])/self.top_grid_dims[0] # <<<<<<<<<<<<<<
2868 * self.dds[1] = (self.bounds[3] - self.bounds[2])/self.top_grid_dims[1]
2869 *
2870 */
2871 __pyx_t_6 = ((__pyx_v_self->bounds[1]) - (__pyx_v_self->bounds[0]));
2872 if (unlikely((__pyx_v_self->top_grid_dims[0]) == 0)) {
2873 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
2874 __PYX_ERR(0, 129, __pyx_L1_error)
2875 }
2876 (__pyx_v_self->dds[0]) = (__pyx_t_6 / (__pyx_v_self->top_grid_dims[0]));
2877
2878 /* "yt/utilities/lib/quad_tree.pyx":130
2879 * self.top_grid_dims[1] = top_grid_dims[1]
2880 * self.dds[0] = (self.bounds[1] - self.bounds[0])/self.top_grid_dims[0]
2881 * self.dds[1] = (self.bounds[3] - self.bounds[2])/self.top_grid_dims[1] # <<<<<<<<<<<<<<
2882 *
2883 * self.root_nodes = <QuadTreeNode ***> \
2884 */
2885 __pyx_t_6 = ((__pyx_v_self->bounds[3]) - (__pyx_v_self->bounds[2]));
2886 if (unlikely((__pyx_v_self->top_grid_dims[1]) == 0)) {
2887 PyErr_SetString(PyExc_ZeroDivisionError, "float division");
2888 __PYX_ERR(0, 130, __pyx_L1_error)
2889 }
2890 (__pyx_v_self->dds[1]) = (__pyx_t_6 / (__pyx_v_self->top_grid_dims[1]));
2891
2892 /* "yt/utilities/lib/quad_tree.pyx":133
2893 *
2894 * self.root_nodes = <QuadTreeNode ***> \
2895 * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0]) # <<<<<<<<<<<<<<
2896 *
2897 * # We initialize our root values to 0.0.
2898 */
2899 __pyx_t_9 = 0;
2900 __pyx_t_2 = -1;
2901 if (__pyx_t_9 < 0) {
2902 __pyx_t_9 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2903 if (unlikely(__pyx_t_9 < 0)) __pyx_t_2 = 0;
2904 } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_2 = 0;
2905 if (unlikely(__pyx_t_2 != -1)) {
2906 __Pyx_RaiseBufferIndexError(__pyx_t_2);
2907 __PYX_ERR(0, 133, __pyx_L1_error)
2908 }
2909
2910 /* "yt/utilities/lib/quad_tree.pyx":132
2911 * self.dds[1] = (self.bounds[3] - self.bounds[2])/self.top_grid_dims[1]
2912 *
2913 * self.root_nodes = <QuadTreeNode ***> \ # <<<<<<<<<<<<<<
2914 * malloc(sizeof(QuadTreeNode **) * top_grid_dims[0])
2915 *
2916 */
2917 __pyx_v_self->root_nodes = ((struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode ***)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode **)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides)))));
2918
2919 /* "yt/utilities/lib/quad_tree.pyx":136
2920 *
2921 * # We initialize our root values to 0.0.
2922 * for i in range(top_grid_dims[0]): # <<<<<<<<<<<<<<
2923 * pos[0] = i
2924 * self.root_nodes[i] = <QuadTreeNode **> \
2925 */
2926 __pyx_t_10 = 0;
2927 __pyx_t_2 = -1;
2928 if (__pyx_t_10 < 0) {
2929 __pyx_t_10 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2930 if (unlikely(__pyx_t_10 < 0)) __pyx_t_2 = 0;
2931 } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_2 = 0;
2932 if (unlikely(__pyx_t_2 != -1)) {
2933 __Pyx_RaiseBufferIndexError(__pyx_t_2);
2934 __PYX_ERR(0, 136, __pyx_L1_error)
2935 }
2936 __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
2937 __pyx_t_12 = __pyx_t_11;
2938 for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2+=1) {
2939 __pyx_v_i = __pyx_t_2;
2940
2941 /* "yt/utilities/lib/quad_tree.pyx":137
2942 * # We initialize our root values to 0.0.
2943 * for i in range(top_grid_dims[0]):
2944 * pos[0] = i # <<<<<<<<<<<<<<
2945 * self.root_nodes[i] = <QuadTreeNode **> \
2946 * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1])
2947 */
2948 (__pyx_v_pos[0]) = __pyx_v_i;
2949
2950 /* "yt/utilities/lib/quad_tree.pyx":139
2951 * pos[0] = i
2952 * self.root_nodes[i] = <QuadTreeNode **> \
2953 * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1]) # <<<<<<<<<<<<<<
2954 * for j in range(top_grid_dims[1]):
2955 * pos[1] = j
2956 */
2957 __pyx_t_13 = 1;
2958 __pyx_t_3 = -1;
2959 if (__pyx_t_13 < 0) {
2960 __pyx_t_13 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2961 if (unlikely(__pyx_t_13 < 0)) __pyx_t_3 = 0;
2962 } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_3 = 0;
2963 if (unlikely(__pyx_t_3 != -1)) {
2964 __Pyx_RaiseBufferIndexError(__pyx_t_3);
2965 __PYX_ERR(0, 139, __pyx_L1_error)
2966 }
2967
2968 /* "yt/utilities/lib/quad_tree.pyx":138
2969 * for i in range(top_grid_dims[0]):
2970 * pos[0] = i
2971 * self.root_nodes[i] = <QuadTreeNode **> \ # <<<<<<<<<<<<<<
2972 * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1])
2973 * for j in range(top_grid_dims[1]):
2974 */
2975 (__pyx_v_self->root_nodes[__pyx_v_i]) = ((struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode **)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides)))));
2976
2977 /* "yt/utilities/lib/quad_tree.pyx":140
2978 * self.root_nodes[i] = <QuadTreeNode **> \
2979 * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1])
2980 * for j in range(top_grid_dims[1]): # <<<<<<<<<<<<<<
2981 * pos[1] = j
2982 * self.root_nodes[i][j] = QTN_initialize(
2983 */
2984 __pyx_t_14 = 1;
2985 __pyx_t_3 = -1;
2986 if (__pyx_t_14 < 0) {
2987 __pyx_t_14 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2988 if (unlikely(__pyx_t_14 < 0)) __pyx_t_3 = 0;
2989 } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_3 = 0;
2990 if (unlikely(__pyx_t_3 != -1)) {
2991 __Pyx_RaiseBufferIndexError(__pyx_t_3);
2992 __PYX_ERR(0, 140, __pyx_L1_error)
2993 }
2994 __pyx_t_15 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
2995 __pyx_t_16 = __pyx_t_15;
2996 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_16; __pyx_t_3+=1) {
2997 __pyx_v_j = __pyx_t_3;
2998
2999 /* "yt/utilities/lib/quad_tree.pyx":141
3000 * malloc(sizeof(QuadTreeNode *) * top_grid_dims[1])
3001 * for j in range(top_grid_dims[1]):
3002 * pos[1] = j # <<<<<<<<<<<<<<
3003 * self.root_nodes[i][j] = QTN_initialize(
3004 * pos, nvals, vals, weight_val)
3005 */
3006 (__pyx_v_pos[1]) = __pyx_v_j;
3007
3008 /* "yt/utilities/lib/quad_tree.pyx":142
3009 * for j in range(top_grid_dims[1]):
3010 * pos[1] = j
3011 * self.root_nodes[i][j] = QTN_initialize( # <<<<<<<<<<<<<<
3012 * pos, nvals, vals, weight_val)
3013 * self.num_cells = self.top_grid_dims[0] * self.top_grid_dims[1]
3014 */
3015 ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]) = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_initialize(__pyx_v_pos, __pyx_v_nvals, __pyx_v_vals, __pyx_v_weight_val);
3016 }
3017 }
3018
3019 /* "yt/utilities/lib/quad_tree.pyx":144
3020 * self.root_nodes[i][j] = QTN_initialize(
3021 * pos, nvals, vals, weight_val)
3022 * self.num_cells = self.top_grid_dims[0] * self.top_grid_dims[1] # <<<<<<<<<<<<<<
3023 * free(vals)
3024 *
3025 */
3026 __pyx_v_self->num_cells = ((__pyx_v_self->top_grid_dims[0]) * (__pyx_v_self->top_grid_dims[1]));
3027
3028 /* "yt/utilities/lib/quad_tree.pyx":145
3029 * pos, nvals, vals, weight_val)
3030 * self.num_cells = self.top_grid_dims[0] * self.top_grid_dims[1]
3031 * free(vals) # <<<<<<<<<<<<<<
3032 *
3033 * cdef int count_total_cells(self, QuadTreeNode *root):
3034 */
3035 free(__pyx_v_vals);
3036
3037 /* "yt/utilities/lib/quad_tree.pyx":107
3038 * cdef int max_level
3039 *
3040 * def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims, # <<<<<<<<<<<<<<
3041 * int nvals, bounds, method = "integrate"):
3042 * if method == "integrate":
3043 */
3044
3045 /* function exit code */
3046 __pyx_r = 0;
3047 goto __pyx_L0;
3048 __pyx_L1_error:;
3049 __Pyx_XDECREF(__pyx_t_5);
3050 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3051 __Pyx_PyThreadState_declare
3052 __Pyx_PyThreadState_assign
3053 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3054 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer);
3055 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3056 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3057 __pyx_r = -1;
3058 goto __pyx_L2;
3059 __pyx_L0:;
3060 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer);
3061 __pyx_L2:;
3062 __Pyx_RefNannyFinishContext();
3063 return __pyx_r;
3064 }
3065
3066 /* "yt/utilities/lib/quad_tree.pyx":147
3067 * free(vals)
3068 *
3069 * cdef int count_total_cells(self, QuadTreeNode *root): # <<<<<<<<<<<<<<
3070 * cdef int total = 0
3071 * cdef int i, j
3072 */
3073
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count_total_cells(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_root)3074 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count_total_cells(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_root) {
3075 int __pyx_v_total;
3076 int __pyx_v_i;
3077 int __pyx_v_j;
3078 int __pyx_r;
3079 __Pyx_RefNannyDeclarations
3080 int __pyx_t_1;
3081 int __pyx_t_2;
3082 int __pyx_t_3;
3083 __Pyx_RefNannySetupContext("count_total_cells", 0);
3084
3085 /* "yt/utilities/lib/quad_tree.pyx":148
3086 *
3087 * cdef int count_total_cells(self, QuadTreeNode *root):
3088 * cdef int total = 0 # <<<<<<<<<<<<<<
3089 * cdef int i, j
3090 * if root.children[0][0] == NULL: return 1
3091 */
3092 __pyx_v_total = 0;
3093
3094 /* "yt/utilities/lib/quad_tree.pyx":150
3095 * cdef int total = 0
3096 * cdef int i, j
3097 * if root.children[0][0] == NULL: return 1 # <<<<<<<<<<<<<<
3098 * for i in range(2):
3099 * for j in range(2):
3100 */
3101 __pyx_t_1 = ((((__pyx_v_root->children[0])[0]) == NULL) != 0);
3102 if (__pyx_t_1) {
3103 __pyx_r = 1;
3104 goto __pyx_L0;
3105 }
3106
3107 /* "yt/utilities/lib/quad_tree.pyx":151
3108 * cdef int i, j
3109 * if root.children[0][0] == NULL: return 1
3110 * for i in range(2): # <<<<<<<<<<<<<<
3111 * for j in range(2):
3112 * total += self.count_total_cells(root.children[i][j])
3113 */
3114 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
3115 __pyx_v_i = __pyx_t_2;
3116
3117 /* "yt/utilities/lib/quad_tree.pyx":152
3118 * if root.children[0][0] == NULL: return 1
3119 * for i in range(2):
3120 * for j in range(2): # <<<<<<<<<<<<<<
3121 * total += self.count_total_cells(root.children[i][j])
3122 * return total + 1
3123 */
3124 for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
3125 __pyx_v_j = __pyx_t_3;
3126
3127 /* "yt/utilities/lib/quad_tree.pyx":153
3128 * for i in range(2):
3129 * for j in range(2):
3130 * total += self.count_total_cells(root.children[i][j]) # <<<<<<<<<<<<<<
3131 * return total + 1
3132 *
3133 */
3134 __pyx_v_total = (__pyx_v_total + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->count_total_cells(__pyx_v_self, ((__pyx_v_root->children[__pyx_v_i])[__pyx_v_j])));
3135 }
3136 }
3137
3138 /* "yt/utilities/lib/quad_tree.pyx":154
3139 * for j in range(2):
3140 * total += self.count_total_cells(root.children[i][j])
3141 * return total + 1 # <<<<<<<<<<<<<<
3142 *
3143 * @cython.boundscheck(False)
3144 */
3145 __pyx_r = (__pyx_v_total + 1);
3146 goto __pyx_L0;
3147
3148 /* "yt/utilities/lib/quad_tree.pyx":147
3149 * free(vals)
3150 *
3151 * cdef int count_total_cells(self, QuadTreeNode *root): # <<<<<<<<<<<<<<
3152 * cdef int total = 0
3153 * cdef int i, j
3154 */
3155
3156 /* function exit code */
3157 __pyx_L0:;
3158 __Pyx_RefNannyFinishContext();
3159 return __pyx_r;
3160 }
3161
3162 /* "yt/utilities/lib/quad_tree.pyx":158
3163 * @cython.boundscheck(False)
3164 * @cython.wraparound(False)
3165 * cdef int fill_buffer(self, QuadTreeNode *root, int curpos, # <<<<<<<<<<<<<<
3166 * np.ndarray[np.int32_t, ndim=1] refined,
3167 * np.ndarray[np.float64_t, ndim=2] values,
3168 */
3169
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill_buffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_root,int __pyx_v_curpos,PyArrayObject * __pyx_v_refined,PyArrayObject * __pyx_v_values,PyArrayObject * __pyx_v_wval)3170 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill_buffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_root, int __pyx_v_curpos, PyArrayObject *__pyx_v_refined, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_wval) {
3171 int __pyx_v_i;
3172 int __pyx_v_j;
3173 __Pyx_LocalBuf_ND __pyx_pybuffernd_refined;
3174 __Pyx_Buffer __pyx_pybuffer_refined;
3175 __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
3176 __Pyx_Buffer __pyx_pybuffer_values;
3177 __Pyx_LocalBuf_ND __pyx_pybuffernd_wval;
3178 __Pyx_Buffer __pyx_pybuffer_wval;
3179 int __pyx_r;
3180 __Pyx_RefNannyDeclarations
3181 int __pyx_t_1;
3182 int __pyx_t_2;
3183 int __pyx_t_3;
3184 Py_ssize_t __pyx_t_4;
3185 Py_ssize_t __pyx_t_5;
3186 __pyx_t_5numpy_float64_t __pyx_t_6;
3187 Py_ssize_t __pyx_t_7;
3188 int __pyx_t_8;
3189 Py_ssize_t __pyx_t_9;
3190 __Pyx_RefNannySetupContext("fill_buffer", 0);
3191 __pyx_pybuffer_refined.pybuffer.buf = NULL;
3192 __pyx_pybuffer_refined.refcount = 0;
3193 __pyx_pybuffernd_refined.data = NULL;
3194 __pyx_pybuffernd_refined.rcbuffer = &__pyx_pybuffer_refined;
3195 __pyx_pybuffer_values.pybuffer.buf = NULL;
3196 __pyx_pybuffer_values.refcount = 0;
3197 __pyx_pybuffernd_values.data = NULL;
3198 __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
3199 __pyx_pybuffer_wval.pybuffer.buf = NULL;
3200 __pyx_pybuffer_wval.refcount = 0;
3201 __pyx_pybuffernd_wval.data = NULL;
3202 __pyx_pybuffernd_wval.rcbuffer = &__pyx_pybuffer_wval;
3203 {
3204 __Pyx_BufFmt_StackElem __pyx_stack[1];
3205 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_refined.rcbuffer->pybuffer, (PyObject*)__pyx_v_refined, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 158, __pyx_L1_error)
3206 }
3207 __pyx_pybuffernd_refined.diminfo[0].strides = __pyx_pybuffernd_refined.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_refined.diminfo[0].shape = __pyx_pybuffernd_refined.rcbuffer->pybuffer.shape[0];
3208 {
3209 __Pyx_BufFmt_StackElem __pyx_stack[1];
3210 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 158, __pyx_L1_error)
3211 }
3212 __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
3213 {
3214 __Pyx_BufFmt_StackElem __pyx_stack[1];
3215 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wval.rcbuffer->pybuffer, (PyObject*)__pyx_v_wval, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 158, __pyx_L1_error)
3216 }
3217 __pyx_pybuffernd_wval.diminfo[0].strides = __pyx_pybuffernd_wval.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wval.diminfo[0].shape = __pyx_pybuffernd_wval.rcbuffer->pybuffer.shape[0];
3218
3219 /* "yt/utilities/lib/quad_tree.pyx":163
3220 * np.ndarray[np.float64_t, ndim=1] wval):
3221 * cdef int i, j
3222 * for i in range(self.nvals): # <<<<<<<<<<<<<<
3223 * values[curpos, i] = root.val[i]
3224 * wval[curpos] = root.weight_val
3225 */
3226 __pyx_t_1 = __pyx_v_self->nvals;
3227 __pyx_t_2 = __pyx_t_1;
3228 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3229 __pyx_v_i = __pyx_t_3;
3230
3231 /* "yt/utilities/lib/quad_tree.pyx":164
3232 * cdef int i, j
3233 * for i in range(self.nvals):
3234 * values[curpos, i] = root.val[i] # <<<<<<<<<<<<<<
3235 * wval[curpos] = root.weight_val
3236 * if root.children[0][0] != NULL: refined[curpos] = 1
3237 */
3238 __pyx_t_4 = __pyx_v_curpos;
3239 __pyx_t_5 = __pyx_v_i;
3240 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_values.diminfo[1].strides) = (__pyx_v_root->val[__pyx_v_i]);
3241 }
3242
3243 /* "yt/utilities/lib/quad_tree.pyx":165
3244 * for i in range(self.nvals):
3245 * values[curpos, i] = root.val[i]
3246 * wval[curpos] = root.weight_val # <<<<<<<<<<<<<<
3247 * if root.children[0][0] != NULL: refined[curpos] = 1
3248 * else: return curpos+1
3249 */
3250 __pyx_t_6 = __pyx_v_root->weight_val;
3251 __pyx_t_7 = __pyx_v_curpos;
3252 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_wval.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_wval.diminfo[0].strides) = __pyx_t_6;
3253
3254 /* "yt/utilities/lib/quad_tree.pyx":166
3255 * values[curpos, i] = root.val[i]
3256 * wval[curpos] = root.weight_val
3257 * if root.children[0][0] != NULL: refined[curpos] = 1 # <<<<<<<<<<<<<<
3258 * else: return curpos+1
3259 * curpos += 1
3260 */
3261 __pyx_t_8 = ((((__pyx_v_root->children[0])[0]) != NULL) != 0);
3262 if (__pyx_t_8) {
3263 __pyx_t_9 = __pyx_v_curpos;
3264 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_refined.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_refined.diminfo[0].strides) = 1;
3265 goto __pyx_L5;
3266 }
3267
3268 /* "yt/utilities/lib/quad_tree.pyx":167
3269 * wval[curpos] = root.weight_val
3270 * if root.children[0][0] != NULL: refined[curpos] = 1
3271 * else: return curpos+1 # <<<<<<<<<<<<<<
3272 * curpos += 1
3273 * for i in range(2):
3274 */
3275 /*else*/ {
3276 __pyx_r = (__pyx_v_curpos + 1);
3277 goto __pyx_L0;
3278 }
3279 __pyx_L5:;
3280
3281 /* "yt/utilities/lib/quad_tree.pyx":168
3282 * if root.children[0][0] != NULL: refined[curpos] = 1
3283 * else: return curpos+1
3284 * curpos += 1 # <<<<<<<<<<<<<<
3285 * for i in range(2):
3286 * for j in range(2):
3287 */
3288 __pyx_v_curpos = (__pyx_v_curpos + 1);
3289
3290 /* "yt/utilities/lib/quad_tree.pyx":169
3291 * else: return curpos+1
3292 * curpos += 1
3293 * for i in range(2): # <<<<<<<<<<<<<<
3294 * for j in range(2):
3295 * curpos = self.fill_buffer(root.children[i][j], curpos,
3296 */
3297 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
3298 __pyx_v_i = __pyx_t_1;
3299
3300 /* "yt/utilities/lib/quad_tree.pyx":170
3301 * curpos += 1
3302 * for i in range(2):
3303 * for j in range(2): # <<<<<<<<<<<<<<
3304 * curpos = self.fill_buffer(root.children[i][j], curpos,
3305 * refined, values, wval)
3306 */
3307 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
3308 __pyx_v_j = __pyx_t_2;
3309
3310 /* "yt/utilities/lib/quad_tree.pyx":171
3311 * for i in range(2):
3312 * for j in range(2):
3313 * curpos = self.fill_buffer(root.children[i][j], curpos, # <<<<<<<<<<<<<<
3314 * refined, values, wval)
3315 * return curpos
3316 */
3317 __pyx_v_curpos = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->fill_buffer(__pyx_v_self, ((__pyx_v_root->children[__pyx_v_i])[__pyx_v_j]), __pyx_v_curpos, __pyx_v_refined, __pyx_v_values, __pyx_v_wval);
3318 }
3319 }
3320
3321 /* "yt/utilities/lib/quad_tree.pyx":173
3322 * curpos = self.fill_buffer(root.children[i][j], curpos,
3323 * refined, values, wval)
3324 * return curpos # <<<<<<<<<<<<<<
3325 *
3326 * @cython.boundscheck(False)
3327 */
3328 __pyx_r = __pyx_v_curpos;
3329 goto __pyx_L0;
3330
3331 /* "yt/utilities/lib/quad_tree.pyx":158
3332 * @cython.boundscheck(False)
3333 * @cython.wraparound(False)
3334 * cdef int fill_buffer(self, QuadTreeNode *root, int curpos, # <<<<<<<<<<<<<<
3335 * np.ndarray[np.int32_t, ndim=1] refined,
3336 * np.ndarray[np.float64_t, ndim=2] values,
3337 */
3338
3339 /* function exit code */
3340 __pyx_L1_error:;
3341 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3342 __Pyx_PyThreadState_declare
3343 __Pyx_PyThreadState_assign
3344 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3345 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
3346 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
3347 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
3348 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3349 __Pyx_WriteUnraisable("yt.utilities.lib.quad_tree.QuadTree.fill_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3350 __pyx_r = 0;
3351 goto __pyx_L2;
3352 __pyx_L0:;
3353 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
3354 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
3355 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
3356 __pyx_L2:;
3357 __Pyx_RefNannyFinishContext();
3358 return __pyx_r;
3359 }
3360
3361 /* "yt/utilities/lib/quad_tree.pyx":177
3362 * @cython.boundscheck(False)
3363 * @cython.wraparound(False)
3364 * cdef int unfill_buffer(self, QuadTreeNode *root, int curpos, # <<<<<<<<<<<<<<
3365 * np.ndarray[np.int32_t, ndim=1] refined,
3366 * np.ndarray[np.float64_t, ndim=2] values,
3367 */
3368
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_unfill_buffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_root,int __pyx_v_curpos,PyArrayObject * __pyx_v_refined,PyArrayObject * __pyx_v_values,PyArrayObject * __pyx_v_wval)3369 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_unfill_buffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_root, int __pyx_v_curpos, PyArrayObject *__pyx_v_refined, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_wval) {
3370 int __pyx_v_i;
3371 int __pyx_v_j;
3372 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_child;
3373 __pyx_t_5numpy_int64_t __pyx_v_pos[2];
3374 __Pyx_LocalBuf_ND __pyx_pybuffernd_refined;
3375 __Pyx_Buffer __pyx_pybuffer_refined;
3376 __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
3377 __Pyx_Buffer __pyx_pybuffer_values;
3378 __Pyx_LocalBuf_ND __pyx_pybuffernd_wval;
3379 __Pyx_Buffer __pyx_pybuffer_wval;
3380 int __pyx_r;
3381 __Pyx_RefNannyDeclarations
3382 int __pyx_t_1;
3383 int __pyx_t_2;
3384 int __pyx_t_3;
3385 Py_ssize_t __pyx_t_4;
3386 Py_ssize_t __pyx_t_5;
3387 Py_ssize_t __pyx_t_6;
3388 Py_ssize_t __pyx_t_7;
3389 int __pyx_t_8;
3390 __Pyx_RefNannySetupContext("unfill_buffer", 0);
3391 __pyx_pybuffer_refined.pybuffer.buf = NULL;
3392 __pyx_pybuffer_refined.refcount = 0;
3393 __pyx_pybuffernd_refined.data = NULL;
3394 __pyx_pybuffernd_refined.rcbuffer = &__pyx_pybuffer_refined;
3395 __pyx_pybuffer_values.pybuffer.buf = NULL;
3396 __pyx_pybuffer_values.refcount = 0;
3397 __pyx_pybuffernd_values.data = NULL;
3398 __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
3399 __pyx_pybuffer_wval.pybuffer.buf = NULL;
3400 __pyx_pybuffer_wval.refcount = 0;
3401 __pyx_pybuffernd_wval.data = NULL;
3402 __pyx_pybuffernd_wval.rcbuffer = &__pyx_pybuffer_wval;
3403 {
3404 __Pyx_BufFmt_StackElem __pyx_stack[1];
3405 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_refined.rcbuffer->pybuffer, (PyObject*)__pyx_v_refined, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error)
3406 }
3407 __pyx_pybuffernd_refined.diminfo[0].strides = __pyx_pybuffernd_refined.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_refined.diminfo[0].shape = __pyx_pybuffernd_refined.rcbuffer->pybuffer.shape[0];
3408 {
3409 __Pyx_BufFmt_StackElem __pyx_stack[1];
3410 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error)
3411 }
3412 __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
3413 {
3414 __Pyx_BufFmt_StackElem __pyx_stack[1];
3415 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wval.rcbuffer->pybuffer, (PyObject*)__pyx_v_wval, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error)
3416 }
3417 __pyx_pybuffernd_wval.diminfo[0].strides = __pyx_pybuffernd_wval.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wval.diminfo[0].shape = __pyx_pybuffernd_wval.rcbuffer->pybuffer.shape[0];
3418
3419 /* "yt/utilities/lib/quad_tree.pyx":182
3420 * np.ndarray[np.float64_t, ndim=1] wval):
3421 * cdef int i, j
3422 * for i in range(self.nvals): # <<<<<<<<<<<<<<
3423 * root.val[i] = values[curpos, i]
3424 * root.weight_val = wval[curpos]
3425 */
3426 __pyx_t_1 = __pyx_v_self->nvals;
3427 __pyx_t_2 = __pyx_t_1;
3428 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3429 __pyx_v_i = __pyx_t_3;
3430
3431 /* "yt/utilities/lib/quad_tree.pyx":183
3432 * cdef int i, j
3433 * for i in range(self.nvals):
3434 * root.val[i] = values[curpos, i] # <<<<<<<<<<<<<<
3435 * root.weight_val = wval[curpos]
3436 * if refined[curpos] == 0: return curpos+1
3437 */
3438 __pyx_t_4 = __pyx_v_curpos;
3439 __pyx_t_5 = __pyx_v_i;
3440 (__pyx_v_root->val[__pyx_v_i]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_values.diminfo[1].strides));
3441 }
3442
3443 /* "yt/utilities/lib/quad_tree.pyx":184
3444 * for i in range(self.nvals):
3445 * root.val[i] = values[curpos, i]
3446 * root.weight_val = wval[curpos] # <<<<<<<<<<<<<<
3447 * if refined[curpos] == 0: return curpos+1
3448 * curpos += 1
3449 */
3450 __pyx_t_6 = __pyx_v_curpos;
3451 __pyx_v_root->weight_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_wval.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_wval.diminfo[0].strides));
3452
3453 /* "yt/utilities/lib/quad_tree.pyx":185
3454 * root.val[i] = values[curpos, i]
3455 * root.weight_val = wval[curpos]
3456 * if refined[curpos] == 0: return curpos+1 # <<<<<<<<<<<<<<
3457 * curpos += 1
3458 * cdef QuadTreeNode *child
3459 */
3460 __pyx_t_7 = __pyx_v_curpos;
3461 __pyx_t_8 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_refined.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_refined.diminfo[0].strides)) == 0) != 0);
3462 if (__pyx_t_8) {
3463 __pyx_r = (__pyx_v_curpos + 1);
3464 goto __pyx_L0;
3465 }
3466
3467 /* "yt/utilities/lib/quad_tree.pyx":186
3468 * root.weight_val = wval[curpos]
3469 * if refined[curpos] == 0: return curpos+1
3470 * curpos += 1 # <<<<<<<<<<<<<<
3471 * cdef QuadTreeNode *child
3472 * cdef np.int64_t pos[2]
3473 */
3474 __pyx_v_curpos = (__pyx_v_curpos + 1);
3475
3476 /* "yt/utilities/lib/quad_tree.pyx":189
3477 * cdef QuadTreeNode *child
3478 * cdef np.int64_t pos[2]
3479 * for i in range(2): # <<<<<<<<<<<<<<
3480 * for j in range(2):
3481 * pos[0] = root.pos[0]*2 + i
3482 */
3483 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
3484 __pyx_v_i = __pyx_t_1;
3485
3486 /* "yt/utilities/lib/quad_tree.pyx":190
3487 * cdef np.int64_t pos[2]
3488 * for i in range(2):
3489 * for j in range(2): # <<<<<<<<<<<<<<
3490 * pos[0] = root.pos[0]*2 + i
3491 * pos[1] = root.pos[1]*2 + j
3492 */
3493 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
3494 __pyx_v_j = __pyx_t_2;
3495
3496 /* "yt/utilities/lib/quad_tree.pyx":191
3497 * for i in range(2):
3498 * for j in range(2):
3499 * pos[0] = root.pos[0]*2 + i # <<<<<<<<<<<<<<
3500 * pos[1] = root.pos[1]*2 + j
3501 * child = QTN_initialize(pos, self.nvals, NULL, 0.0)
3502 */
3503 (__pyx_v_pos[0]) = (((__pyx_v_root->pos[0]) * 2) + __pyx_v_i);
3504
3505 /* "yt/utilities/lib/quad_tree.pyx":192
3506 * for j in range(2):
3507 * pos[0] = root.pos[0]*2 + i
3508 * pos[1] = root.pos[1]*2 + j # <<<<<<<<<<<<<<
3509 * child = QTN_initialize(pos, self.nvals, NULL, 0.0)
3510 * root.children[i][j] = child
3511 */
3512 (__pyx_v_pos[1]) = (((__pyx_v_root->pos[1]) * 2) + __pyx_v_j);
3513
3514 /* "yt/utilities/lib/quad_tree.pyx":193
3515 * pos[0] = root.pos[0]*2 + i
3516 * pos[1] = root.pos[1]*2 + j
3517 * child = QTN_initialize(pos, self.nvals, NULL, 0.0) # <<<<<<<<<<<<<<
3518 * root.children[i][j] = child
3519 * curpos = self.unfill_buffer(child, curpos, refined, values, wval)
3520 */
3521 __pyx_v_child = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_initialize(__pyx_v_pos, __pyx_v_self->nvals, NULL, 0.0);
3522
3523 /* "yt/utilities/lib/quad_tree.pyx":194
3524 * pos[1] = root.pos[1]*2 + j
3525 * child = QTN_initialize(pos, self.nvals, NULL, 0.0)
3526 * root.children[i][j] = child # <<<<<<<<<<<<<<
3527 * curpos = self.unfill_buffer(child, curpos, refined, values, wval)
3528 * return curpos
3529 */
3530 ((__pyx_v_root->children[__pyx_v_i])[__pyx_v_j]) = __pyx_v_child;
3531
3532 /* "yt/utilities/lib/quad_tree.pyx":195
3533 * child = QTN_initialize(pos, self.nvals, NULL, 0.0)
3534 * root.children[i][j] = child
3535 * curpos = self.unfill_buffer(child, curpos, refined, values, wval) # <<<<<<<<<<<<<<
3536 * return curpos
3537 *
3538 */
3539 __pyx_v_curpos = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->unfill_buffer(__pyx_v_self, __pyx_v_child, __pyx_v_curpos, __pyx_v_refined, __pyx_v_values, __pyx_v_wval);
3540 }
3541 }
3542
3543 /* "yt/utilities/lib/quad_tree.pyx":196
3544 * root.children[i][j] = child
3545 * curpos = self.unfill_buffer(child, curpos, refined, values, wval)
3546 * return curpos # <<<<<<<<<<<<<<
3547 *
3548 *
3549 */
3550 __pyx_r = __pyx_v_curpos;
3551 goto __pyx_L0;
3552
3553 /* "yt/utilities/lib/quad_tree.pyx":177
3554 * @cython.boundscheck(False)
3555 * @cython.wraparound(False)
3556 * cdef int unfill_buffer(self, QuadTreeNode *root, int curpos, # <<<<<<<<<<<<<<
3557 * np.ndarray[np.int32_t, ndim=1] refined,
3558 * np.ndarray[np.float64_t, ndim=2] values,
3559 */
3560
3561 /* function exit code */
3562 __pyx_L1_error:;
3563 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3564 __Pyx_PyThreadState_declare
3565 __Pyx_PyThreadState_assign
3566 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3567 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
3568 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
3569 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
3570 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3571 __Pyx_WriteUnraisable("yt.utilities.lib.quad_tree.QuadTree.unfill_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3572 __pyx_r = 0;
3573 goto __pyx_L2;
3574 __pyx_L0:;
3575 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
3576 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
3577 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
3578 __pyx_L2:;
3579 __Pyx_RefNannyFinishContext();
3580 return __pyx_r;
3581 }
3582
3583 /* "yt/utilities/lib/quad_tree.pyx":201
3584 * @cython.boundscheck(False)
3585 * @cython.wraparound(False)
3586 * def frombuffer(self, np.ndarray[np.int32_t, ndim=1] refined, # <<<<<<<<<<<<<<
3587 * np.ndarray[np.float64_t, ndim=2] values,
3588 * np.ndarray[np.float64_t, ndim=1] wval,
3589 */
3590
3591 /* Python wrapper */
3592 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_3frombuffer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_3frombuffer(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3593 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_3frombuffer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3594 PyArrayObject *__pyx_v_refined = 0;
3595 PyArrayObject *__pyx_v_values = 0;
3596 PyArrayObject *__pyx_v_wval = 0;
3597 PyObject *__pyx_v_method = 0;
3598 PyObject *__pyx_r = 0;
3599 __Pyx_RefNannyDeclarations
3600 __Pyx_RefNannySetupContext("frombuffer (wrapper)", 0);
3601 {
3602 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_refined,&__pyx_n_s_values,&__pyx_n_s_wval,&__pyx_n_s_method,0};
3603 PyObject* values[4] = {0,0,0,0};
3604 if (unlikely(__pyx_kwds)) {
3605 Py_ssize_t kw_args;
3606 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3607 switch (pos_args) {
3608 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3609 CYTHON_FALLTHROUGH;
3610 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3611 CYTHON_FALLTHROUGH;
3612 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3613 CYTHON_FALLTHROUGH;
3614 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3615 CYTHON_FALLTHROUGH;
3616 case 0: break;
3617 default: goto __pyx_L5_argtuple_error;
3618 }
3619 kw_args = PyDict_Size(__pyx_kwds);
3620 switch (pos_args) {
3621 case 0:
3622 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_refined)) != 0)) kw_args--;
3623 else goto __pyx_L5_argtuple_error;
3624 CYTHON_FALLTHROUGH;
3625 case 1:
3626 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_values)) != 0)) kw_args--;
3627 else {
3628 __Pyx_RaiseArgtupleInvalid("frombuffer", 1, 4, 4, 1); __PYX_ERR(0, 201, __pyx_L3_error)
3629 }
3630 CYTHON_FALLTHROUGH;
3631 case 2:
3632 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wval)) != 0)) kw_args--;
3633 else {
3634 __Pyx_RaiseArgtupleInvalid("frombuffer", 1, 4, 4, 2); __PYX_ERR(0, 201, __pyx_L3_error)
3635 }
3636 CYTHON_FALLTHROUGH;
3637 case 3:
3638 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method)) != 0)) kw_args--;
3639 else {
3640 __Pyx_RaiseArgtupleInvalid("frombuffer", 1, 4, 4, 3); __PYX_ERR(0, 201, __pyx_L3_error)
3641 }
3642 }
3643 if (unlikely(kw_args > 0)) {
3644 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frombuffer") < 0)) __PYX_ERR(0, 201, __pyx_L3_error)
3645 }
3646 } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3647 goto __pyx_L5_argtuple_error;
3648 } else {
3649 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3650 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3651 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3652 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3653 }
3654 __pyx_v_refined = ((PyArrayObject *)values[0]);
3655 __pyx_v_values = ((PyArrayObject *)values[1]);
3656 __pyx_v_wval = ((PyArrayObject *)values[2]);
3657 __pyx_v_method = values[3];
3658 }
3659 goto __pyx_L4_argument_unpacking_done;
3660 __pyx_L5_argtuple_error:;
3661 __Pyx_RaiseArgtupleInvalid("frombuffer", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 201, __pyx_L3_error)
3662 __pyx_L3_error:;
3663 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.frombuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
3664 __Pyx_RefNannyFinishContext();
3665 return NULL;
3666 __pyx_L4_argument_unpacking_done:;
3667 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_refined), __pyx_ptype_5numpy_ndarray, 1, "refined", 0))) __PYX_ERR(0, 201, __pyx_L1_error)
3668 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) __PYX_ERR(0, 202, __pyx_L1_error)
3669 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wval), __pyx_ptype_5numpy_ndarray, 1, "wval", 0))) __PYX_ERR(0, 203, __pyx_L1_error)
3670 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_2frombuffer(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_refined, __pyx_v_values, __pyx_v_wval, __pyx_v_method);
3671
3672 /* function exit code */
3673 goto __pyx_L0;
3674 __pyx_L1_error:;
3675 __pyx_r = NULL;
3676 __pyx_L0:;
3677 __Pyx_RefNannyFinishContext();
3678 return __pyx_r;
3679 }
3680
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_2frombuffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,PyArrayObject * __pyx_v_refined,PyArrayObject * __pyx_v_values,PyArrayObject * __pyx_v_wval,PyObject * __pyx_v_method)3681 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_2frombuffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_refined, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_wval, PyObject *__pyx_v_method) {
3682 int __pyx_v_curpos;
3683 __pyx_t_5numpy_int64_t __pyx_v_i;
3684 __pyx_t_5numpy_int64_t __pyx_v_j;
3685 __Pyx_LocalBuf_ND __pyx_pybuffernd_refined;
3686 __Pyx_Buffer __pyx_pybuffer_refined;
3687 __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
3688 __Pyx_Buffer __pyx_pybuffer_values;
3689 __Pyx_LocalBuf_ND __pyx_pybuffernd_wval;
3690 __Pyx_Buffer __pyx_pybuffer_wval;
3691 PyObject *__pyx_r = NULL;
3692 __Pyx_RefNannyDeclarations
3693 int __pyx_t_1;
3694 int __pyx_t_2;
3695 PyObject *__pyx_t_3 = NULL;
3696 __pyx_t_5numpy_int64_t __pyx_t_4;
3697 __pyx_t_5numpy_int64_t __pyx_t_5;
3698 __pyx_t_5numpy_int64_t __pyx_t_6;
3699 __pyx_t_5numpy_int64_t __pyx_t_7;
3700 __pyx_t_5numpy_int64_t __pyx_t_8;
3701 __pyx_t_5numpy_int64_t __pyx_t_9;
3702 __Pyx_RefNannySetupContext("frombuffer", 0);
3703 __pyx_pybuffer_refined.pybuffer.buf = NULL;
3704 __pyx_pybuffer_refined.refcount = 0;
3705 __pyx_pybuffernd_refined.data = NULL;
3706 __pyx_pybuffernd_refined.rcbuffer = &__pyx_pybuffer_refined;
3707 __pyx_pybuffer_values.pybuffer.buf = NULL;
3708 __pyx_pybuffer_values.refcount = 0;
3709 __pyx_pybuffernd_values.data = NULL;
3710 __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
3711 __pyx_pybuffer_wval.pybuffer.buf = NULL;
3712 __pyx_pybuffer_wval.refcount = 0;
3713 __pyx_pybuffernd_wval.data = NULL;
3714 __pyx_pybuffernd_wval.rcbuffer = &__pyx_pybuffer_wval;
3715 {
3716 __Pyx_BufFmt_StackElem __pyx_stack[1];
3717 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_refined.rcbuffer->pybuffer, (PyObject*)__pyx_v_refined, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 201, __pyx_L1_error)
3718 }
3719 __pyx_pybuffernd_refined.diminfo[0].strides = __pyx_pybuffernd_refined.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_refined.diminfo[0].shape = __pyx_pybuffernd_refined.rcbuffer->pybuffer.shape[0];
3720 {
3721 __Pyx_BufFmt_StackElem __pyx_stack[1];
3722 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 201, __pyx_L1_error)
3723 }
3724 __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
3725 {
3726 __Pyx_BufFmt_StackElem __pyx_stack[1];
3727 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wval.rcbuffer->pybuffer, (PyObject*)__pyx_v_wval, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 201, __pyx_L1_error)
3728 }
3729 __pyx_pybuffernd_wval.diminfo[0].strides = __pyx_pybuffernd_wval.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wval.diminfo[0].shape = __pyx_pybuffernd_wval.rcbuffer->pybuffer.shape[0];
3730
3731 /* "yt/utilities/lib/quad_tree.pyx":205
3732 * np.ndarray[np.float64_t, ndim=1] wval,
3733 * method):
3734 * if method == "mip" or method == -1: # <<<<<<<<<<<<<<
3735 * self.merged = -1
3736 * elif method == "integrate" or method == 1:
3737 */
3738 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_mip, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
3739 if (!__pyx_t_2) {
3740 } else {
3741 __pyx_t_1 = __pyx_t_2;
3742 goto __pyx_L4_bool_binop_done;
3743 }
3744 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_method, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
3745 __Pyx_GOTREF(__pyx_t_3);
3746 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 205, __pyx_L1_error)
3747 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3748 __pyx_t_1 = __pyx_t_2;
3749 __pyx_L4_bool_binop_done:;
3750 if (__pyx_t_1) {
3751
3752 /* "yt/utilities/lib/quad_tree.pyx":206
3753 * method):
3754 * if method == "mip" or method == -1:
3755 * self.merged = -1 # <<<<<<<<<<<<<<
3756 * elif method == "integrate" or method == 1:
3757 * self.merged = 1
3758 */
3759 __pyx_v_self->merged = -1;
3760
3761 /* "yt/utilities/lib/quad_tree.pyx":205
3762 * np.ndarray[np.float64_t, ndim=1] wval,
3763 * method):
3764 * if method == "mip" or method == -1: # <<<<<<<<<<<<<<
3765 * self.merged = -1
3766 * elif method == "integrate" or method == 1:
3767 */
3768 goto __pyx_L3;
3769 }
3770
3771 /* "yt/utilities/lib/quad_tree.pyx":207
3772 * if method == "mip" or method == -1:
3773 * self.merged = -1
3774 * elif method == "integrate" or method == 1: # <<<<<<<<<<<<<<
3775 * self.merged = 1
3776 * cdef int curpos = 0
3777 */
3778 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_integrate, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
3779 if (!__pyx_t_2) {
3780 } else {
3781 __pyx_t_1 = __pyx_t_2;
3782 goto __pyx_L6_bool_binop_done;
3783 }
3784 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_method, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error)
3785 __Pyx_GOTREF(__pyx_t_3);
3786 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
3787 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3788 __pyx_t_1 = __pyx_t_2;
3789 __pyx_L6_bool_binop_done:;
3790 if (__pyx_t_1) {
3791
3792 /* "yt/utilities/lib/quad_tree.pyx":208
3793 * self.merged = -1
3794 * elif method == "integrate" or method == 1:
3795 * self.merged = 1 # <<<<<<<<<<<<<<
3796 * cdef int curpos = 0
3797 * self.num_cells = wval.shape[0]
3798 */
3799 __pyx_v_self->merged = 1;
3800
3801 /* "yt/utilities/lib/quad_tree.pyx":207
3802 * if method == "mip" or method == -1:
3803 * self.merged = -1
3804 * elif method == "integrate" or method == 1: # <<<<<<<<<<<<<<
3805 * self.merged = 1
3806 * cdef int curpos = 0
3807 */
3808 }
3809 __pyx_L3:;
3810
3811 /* "yt/utilities/lib/quad_tree.pyx":209
3812 * elif method == "integrate" or method == 1:
3813 * self.merged = 1
3814 * cdef int curpos = 0 # <<<<<<<<<<<<<<
3815 * self.num_cells = wval.shape[0]
3816 * for i in range(self.top_grid_dims[0]):
3817 */
3818 __pyx_v_curpos = 0;
3819
3820 /* "yt/utilities/lib/quad_tree.pyx":210
3821 * self.merged = 1
3822 * cdef int curpos = 0
3823 * self.num_cells = wval.shape[0] # <<<<<<<<<<<<<<
3824 * for i in range(self.top_grid_dims[0]):
3825 * for j in range(self.top_grid_dims[1]):
3826 */
3827 __pyx_v_self->num_cells = (__pyx_v_wval->dimensions[0]);
3828
3829 /* "yt/utilities/lib/quad_tree.pyx":211
3830 * cdef int curpos = 0
3831 * self.num_cells = wval.shape[0]
3832 * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<<
3833 * for j in range(self.top_grid_dims[1]):
3834 * curpos = self.unfill_buffer(self.root_nodes[i][j], curpos,
3835 */
3836 __pyx_t_4 = (__pyx_v_self->top_grid_dims[0]);
3837 __pyx_t_5 = __pyx_t_4;
3838 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3839 __pyx_v_i = __pyx_t_6;
3840
3841 /* "yt/utilities/lib/quad_tree.pyx":212
3842 * self.num_cells = wval.shape[0]
3843 * for i in range(self.top_grid_dims[0]):
3844 * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<<
3845 * curpos = self.unfill_buffer(self.root_nodes[i][j], curpos,
3846 * refined, values, wval)
3847 */
3848 __pyx_t_7 = (__pyx_v_self->top_grid_dims[1]);
3849 __pyx_t_8 = __pyx_t_7;
3850 for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
3851 __pyx_v_j = __pyx_t_9;
3852
3853 /* "yt/utilities/lib/quad_tree.pyx":213
3854 * for i in range(self.top_grid_dims[0]):
3855 * for j in range(self.top_grid_dims[1]):
3856 * curpos = self.unfill_buffer(self.root_nodes[i][j], curpos, # <<<<<<<<<<<<<<
3857 * refined, values, wval)
3858 *
3859 */
3860 __pyx_v_curpos = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->unfill_buffer(__pyx_v_self, ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_curpos, ((PyArrayObject *)__pyx_v_refined), ((PyArrayObject *)__pyx_v_values), ((PyArrayObject *)__pyx_v_wval));
3861 }
3862 }
3863
3864 /* "yt/utilities/lib/quad_tree.pyx":201
3865 * @cython.boundscheck(False)
3866 * @cython.wraparound(False)
3867 * def frombuffer(self, np.ndarray[np.int32_t, ndim=1] refined, # <<<<<<<<<<<<<<
3868 * np.ndarray[np.float64_t, ndim=2] values,
3869 * np.ndarray[np.float64_t, ndim=1] wval,
3870 */
3871
3872 /* function exit code */
3873 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3874 goto __pyx_L0;
3875 __pyx_L1_error:;
3876 __Pyx_XDECREF(__pyx_t_3);
3877 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3878 __Pyx_PyThreadState_declare
3879 __Pyx_PyThreadState_assign
3880 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3881 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
3882 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
3883 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
3884 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3885 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.frombuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
3886 __pyx_r = NULL;
3887 goto __pyx_L2;
3888 __pyx_L0:;
3889 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
3890 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
3891 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
3892 __pyx_L2:;
3893 __Pyx_XGIVEREF(__pyx_r);
3894 __Pyx_RefNannyFinishContext();
3895 return __pyx_r;
3896 }
3897
3898 /* "yt/utilities/lib/quad_tree.pyx":218
3899 * @cython.boundscheck(False)
3900 * @cython.wraparound(False)
3901 * def tobuffer(self): # <<<<<<<<<<<<<<
3902 * cdef int total = self.num_cells
3903 * # We now have four buffers:
3904 */
3905
3906 /* Python wrapper */
3907 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_5tobuffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_5tobuffer(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3908 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_5tobuffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3909 PyObject *__pyx_r = 0;
3910 __Pyx_RefNannyDeclarations
3911 __Pyx_RefNannySetupContext("tobuffer (wrapper)", 0);
3912 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_4tobuffer(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self));
3913
3914 /* function exit code */
3915 __Pyx_RefNannyFinishContext();
3916 return __pyx_r;
3917 }
3918
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_4tobuffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self)3919 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_4tobuffer(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self) {
3920 int __pyx_v_total;
3921 PyArrayObject *__pyx_v_refined = 0;
3922 PyArrayObject *__pyx_v_values = 0;
3923 PyArrayObject *__pyx_v_wval = 0;
3924 int __pyx_v_curpos;
3925 __pyx_t_5numpy_int64_t __pyx_v_i;
3926 __pyx_t_5numpy_int64_t __pyx_v_j;
3927 __Pyx_LocalBuf_ND __pyx_pybuffernd_refined;
3928 __Pyx_Buffer __pyx_pybuffer_refined;
3929 __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
3930 __Pyx_Buffer __pyx_pybuffer_values;
3931 __Pyx_LocalBuf_ND __pyx_pybuffernd_wval;
3932 __Pyx_Buffer __pyx_pybuffer_wval;
3933 PyObject *__pyx_r = NULL;
3934 __Pyx_RefNannyDeclarations
3935 int __pyx_t_1;
3936 PyObject *__pyx_t_2 = NULL;
3937 PyObject *__pyx_t_3 = NULL;
3938 PyObject *__pyx_t_4 = NULL;
3939 PyObject *__pyx_t_5 = NULL;
3940 PyArrayObject *__pyx_t_6 = NULL;
3941 PyObject *__pyx_t_7 = NULL;
3942 PyObject *__pyx_t_8 = NULL;
3943 PyObject *__pyx_t_9 = NULL;
3944 PyArrayObject *__pyx_t_10 = NULL;
3945 PyArrayObject *__pyx_t_11 = NULL;
3946 __pyx_t_5numpy_int64_t __pyx_t_12;
3947 __pyx_t_5numpy_int64_t __pyx_t_13;
3948 __pyx_t_5numpy_int64_t __pyx_t_14;
3949 __pyx_t_5numpy_int64_t __pyx_t_15;
3950 __pyx_t_5numpy_int64_t __pyx_t_16;
3951 __pyx_t_5numpy_int64_t __pyx_t_17;
3952 __Pyx_RefNannySetupContext("tobuffer", 0);
3953 __pyx_pybuffer_refined.pybuffer.buf = NULL;
3954 __pyx_pybuffer_refined.refcount = 0;
3955 __pyx_pybuffernd_refined.data = NULL;
3956 __pyx_pybuffernd_refined.rcbuffer = &__pyx_pybuffer_refined;
3957 __pyx_pybuffer_values.pybuffer.buf = NULL;
3958 __pyx_pybuffer_values.refcount = 0;
3959 __pyx_pybuffernd_values.data = NULL;
3960 __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
3961 __pyx_pybuffer_wval.pybuffer.buf = NULL;
3962 __pyx_pybuffer_wval.refcount = 0;
3963 __pyx_pybuffernd_wval.data = NULL;
3964 __pyx_pybuffernd_wval.rcbuffer = &__pyx_pybuffer_wval;
3965
3966 /* "yt/utilities/lib/quad_tree.pyx":219
3967 * @cython.wraparound(False)
3968 * def tobuffer(self):
3969 * cdef int total = self.num_cells # <<<<<<<<<<<<<<
3970 * # We now have four buffers:
3971 * # Refined or not (total,) int32
3972 */
3973 __pyx_t_1 = __pyx_v_self->num_cells;
3974 __pyx_v_total = __pyx_t_1;
3975
3976 /* "yt/utilities/lib/quad_tree.pyx":225
3977 * # Weight values in each node (total,) float64
3978 * cdef np.ndarray[np.int32_t, ndim=1] refined
3979 * refined = np.zeros(total, dtype='int32') # <<<<<<<<<<<<<<
3980 * cdef np.ndarray[np.float64_t, ndim=2] values
3981 * values = np.zeros((total, self.nvals), dtype='float64')
3982 */
3983 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
3984 __Pyx_GOTREF(__pyx_t_2);
3985 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
3986 __Pyx_GOTREF(__pyx_t_3);
3987 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3988 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
3989 __Pyx_GOTREF(__pyx_t_2);
3990 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)
3991 __Pyx_GOTREF(__pyx_t_4);
3992 __Pyx_GIVEREF(__pyx_t_2);
3993 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3994 __pyx_t_2 = 0;
3995 __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error)
3996 __Pyx_GOTREF(__pyx_t_2);
3997 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_int32) < 0) __PYX_ERR(0, 225, __pyx_L1_error)
3998 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error)
3999 __Pyx_GOTREF(__pyx_t_5);
4000 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4001 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4002 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4003 if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 225, __pyx_L1_error)
4004 __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
4005 {
4006 __Pyx_BufFmt_StackElem __pyx_stack[1];
4007 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
4008 __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_refined.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
4009 if (unlikely(__pyx_t_1 < 0)) {
4010 PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
4011 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_refined.rcbuffer->pybuffer, (PyObject*)__pyx_v_refined, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
4012 Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
4013 __Pyx_RaiseBufferFallbackError();
4014 } else {
4015 PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
4016 }
4017 __pyx_t_7 = __pyx_t_8 = __pyx_t_9 = 0;
4018 }
4019 __pyx_pybuffernd_refined.diminfo[0].strides = __pyx_pybuffernd_refined.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_refined.diminfo[0].shape = __pyx_pybuffernd_refined.rcbuffer->pybuffer.shape[0];
4020 if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 225, __pyx_L1_error)
4021 }
4022 __pyx_t_6 = 0;
4023 __pyx_v_refined = ((PyArrayObject *)__pyx_t_5);
4024 __pyx_t_5 = 0;
4025
4026 /* "yt/utilities/lib/quad_tree.pyx":227
4027 * refined = np.zeros(total, dtype='int32')
4028 * cdef np.ndarray[np.float64_t, ndim=2] values
4029 * values = np.zeros((total, self.nvals), dtype='float64') # <<<<<<<<<<<<<<
4030 * cdef np.ndarray[np.float64_t, ndim=1] wval
4031 * wval = np.zeros(total, dtype='float64')
4032 */
4033 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
4034 __Pyx_GOTREF(__pyx_t_5);
4035 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
4036 __Pyx_GOTREF(__pyx_t_2);
4037 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4038 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
4039 __Pyx_GOTREF(__pyx_t_5);
4040 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->nvals); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
4041 __Pyx_GOTREF(__pyx_t_4);
4042 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
4043 __Pyx_GOTREF(__pyx_t_3);
4044 __Pyx_GIVEREF(__pyx_t_5);
4045 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
4046 __Pyx_GIVEREF(__pyx_t_4);
4047 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
4048 __pyx_t_5 = 0;
4049 __pyx_t_4 = 0;
4050 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
4051 __Pyx_GOTREF(__pyx_t_4);
4052 __Pyx_GIVEREF(__pyx_t_3);
4053 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
4054 __pyx_t_3 = 0;
4055 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
4056 __Pyx_GOTREF(__pyx_t_3);
4057 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 227, __pyx_L1_error)
4058 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
4059 __Pyx_GOTREF(__pyx_t_5);
4060 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4061 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4062 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4063 if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 227, __pyx_L1_error)
4064 __pyx_t_10 = ((PyArrayObject *)__pyx_t_5);
4065 {
4066 __Pyx_BufFmt_StackElem __pyx_stack[1];
4067 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
4068 __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
4069 if (unlikely(__pyx_t_1 < 0)) {
4070 PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
4071 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
4072 Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
4073 __Pyx_RaiseBufferFallbackError();
4074 } else {
4075 PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
4076 }
4077 __pyx_t_9 = __pyx_t_8 = __pyx_t_7 = 0;
4078 }
4079 __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
4080 if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 227, __pyx_L1_error)
4081 }
4082 __pyx_t_10 = 0;
4083 __pyx_v_values = ((PyArrayObject *)__pyx_t_5);
4084 __pyx_t_5 = 0;
4085
4086 /* "yt/utilities/lib/quad_tree.pyx":229
4087 * values = np.zeros((total, self.nvals), dtype='float64')
4088 * cdef np.ndarray[np.float64_t, ndim=1] wval
4089 * wval = np.zeros(total, dtype='float64') # <<<<<<<<<<<<<<
4090 * cdef int curpos = 0
4091 * for i in range(self.top_grid_dims[0]):
4092 */
4093 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
4094 __Pyx_GOTREF(__pyx_t_5);
4095 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error)
4096 __Pyx_GOTREF(__pyx_t_3);
4097 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4098 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
4099 __Pyx_GOTREF(__pyx_t_5);
4100 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error)
4101 __Pyx_GOTREF(__pyx_t_4);
4102 __Pyx_GIVEREF(__pyx_t_5);
4103 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
4104 __pyx_t_5 = 0;
4105 __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
4106 __Pyx_GOTREF(__pyx_t_5);
4107 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 229, __pyx_L1_error)
4108 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error)
4109 __Pyx_GOTREF(__pyx_t_2);
4110 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4111 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4112 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4113 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 229, __pyx_L1_error)
4114 __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
4115 {
4116 __Pyx_BufFmt_StackElem __pyx_stack[1];
4117 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
4118 __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wval.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
4119 if (unlikely(__pyx_t_1 < 0)) {
4120 PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
4121 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wval.rcbuffer->pybuffer, (PyObject*)__pyx_v_wval, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
4122 Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
4123 __Pyx_RaiseBufferFallbackError();
4124 } else {
4125 PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
4126 }
4127 __pyx_t_7 = __pyx_t_8 = __pyx_t_9 = 0;
4128 }
4129 __pyx_pybuffernd_wval.diminfo[0].strides = __pyx_pybuffernd_wval.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wval.diminfo[0].shape = __pyx_pybuffernd_wval.rcbuffer->pybuffer.shape[0];
4130 if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
4131 }
4132 __pyx_t_11 = 0;
4133 __pyx_v_wval = ((PyArrayObject *)__pyx_t_2);
4134 __pyx_t_2 = 0;
4135
4136 /* "yt/utilities/lib/quad_tree.pyx":230
4137 * cdef np.ndarray[np.float64_t, ndim=1] wval
4138 * wval = np.zeros(total, dtype='float64')
4139 * cdef int curpos = 0 # <<<<<<<<<<<<<<
4140 * for i in range(self.top_grid_dims[0]):
4141 * for j in range(self.top_grid_dims[1]):
4142 */
4143 __pyx_v_curpos = 0;
4144
4145 /* "yt/utilities/lib/quad_tree.pyx":231
4146 * wval = np.zeros(total, dtype='float64')
4147 * cdef int curpos = 0
4148 * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<<
4149 * for j in range(self.top_grid_dims[1]):
4150 * curpos = self.fill_buffer(self.root_nodes[i][j], curpos,
4151 */
4152 __pyx_t_12 = (__pyx_v_self->top_grid_dims[0]);
4153 __pyx_t_13 = __pyx_t_12;
4154 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
4155 __pyx_v_i = __pyx_t_14;
4156
4157 /* "yt/utilities/lib/quad_tree.pyx":232
4158 * cdef int curpos = 0
4159 * for i in range(self.top_grid_dims[0]):
4160 * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<<
4161 * curpos = self.fill_buffer(self.root_nodes[i][j], curpos,
4162 * refined, values, wval)
4163 */
4164 __pyx_t_15 = (__pyx_v_self->top_grid_dims[1]);
4165 __pyx_t_16 = __pyx_t_15;
4166 for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
4167 __pyx_v_j = __pyx_t_17;
4168
4169 /* "yt/utilities/lib/quad_tree.pyx":233
4170 * for i in range(self.top_grid_dims[0]):
4171 * for j in range(self.top_grid_dims[1]):
4172 * curpos = self.fill_buffer(self.root_nodes[i][j], curpos, # <<<<<<<<<<<<<<
4173 * refined, values, wval)
4174 * return (refined, values, wval)
4175 */
4176 __pyx_v_curpos = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->fill_buffer(__pyx_v_self, ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_curpos, ((PyArrayObject *)__pyx_v_refined), ((PyArrayObject *)__pyx_v_values), ((PyArrayObject *)__pyx_v_wval));
4177 }
4178 }
4179
4180 /* "yt/utilities/lib/quad_tree.pyx":235
4181 * curpos = self.fill_buffer(self.root_nodes[i][j], curpos,
4182 * refined, values, wval)
4183 * return (refined, values, wval) # <<<<<<<<<<<<<<
4184 *
4185 * def get_args(self):
4186 */
4187 __Pyx_XDECREF(__pyx_r);
4188 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
4189 __Pyx_GOTREF(__pyx_t_2);
4190 __Pyx_INCREF(((PyObject *)__pyx_v_refined));
4191 __Pyx_GIVEREF(((PyObject *)__pyx_v_refined));
4192 PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_refined));
4193 __Pyx_INCREF(((PyObject *)__pyx_v_values));
4194 __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
4195 PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_values));
4196 __Pyx_INCREF(((PyObject *)__pyx_v_wval));
4197 __Pyx_GIVEREF(((PyObject *)__pyx_v_wval));
4198 PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_wval));
4199 __pyx_r = __pyx_t_2;
4200 __pyx_t_2 = 0;
4201 goto __pyx_L0;
4202
4203 /* "yt/utilities/lib/quad_tree.pyx":218
4204 * @cython.boundscheck(False)
4205 * @cython.wraparound(False)
4206 * def tobuffer(self): # <<<<<<<<<<<<<<
4207 * cdef int total = self.num_cells
4208 * # We now have four buffers:
4209 */
4210
4211 /* function exit code */
4212 __pyx_L1_error:;
4213 __Pyx_XDECREF(__pyx_t_2);
4214 __Pyx_XDECREF(__pyx_t_3);
4215 __Pyx_XDECREF(__pyx_t_4);
4216 __Pyx_XDECREF(__pyx_t_5);
4217 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4218 __Pyx_PyThreadState_declare
4219 __Pyx_PyThreadState_assign
4220 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4221 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
4222 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
4223 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
4224 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4225 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.tobuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
4226 __pyx_r = NULL;
4227 goto __pyx_L2;
4228 __pyx_L0:;
4229 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_refined.rcbuffer->pybuffer);
4230 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
4231 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wval.rcbuffer->pybuffer);
4232 __pyx_L2:;
4233 __Pyx_XDECREF((PyObject *)__pyx_v_refined);
4234 __Pyx_XDECREF((PyObject *)__pyx_v_values);
4235 __Pyx_XDECREF((PyObject *)__pyx_v_wval);
4236 __Pyx_XGIVEREF(__pyx_r);
4237 __Pyx_RefNannyFinishContext();
4238 return __pyx_r;
4239 }
4240
4241 /* "yt/utilities/lib/quad_tree.pyx":237
4242 * return (refined, values, wval)
4243 *
4244 * def get_args(self): # <<<<<<<<<<<<<<
4245 * return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals)
4246 *
4247 */
4248
4249 /* Python wrapper */
4250 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_7get_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_7get_args(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4251 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_7get_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4252 PyObject *__pyx_r = 0;
4253 __Pyx_RefNannyDeclarations
4254 __Pyx_RefNannySetupContext("get_args (wrapper)", 0);
4255 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_6get_args(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self));
4256
4257 /* function exit code */
4258 __Pyx_RefNannyFinishContext();
4259 return __pyx_r;
4260 }
4261
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_6get_args(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self)4262 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_6get_args(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self) {
4263 PyObject *__pyx_r = NULL;
4264 __Pyx_RefNannyDeclarations
4265 PyObject *__pyx_t_1 = NULL;
4266 PyObject *__pyx_t_2 = NULL;
4267 PyObject *__pyx_t_3 = NULL;
4268 PyObject *__pyx_t_4 = NULL;
4269 __Pyx_RefNannySetupContext("get_args", 0);
4270
4271 /* "yt/utilities/lib/quad_tree.pyx":238
4272 *
4273 * def get_args(self):
4274 * return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals) # <<<<<<<<<<<<<<
4275 *
4276 * cdef int add_to_position(self,
4277 */
4278 __Pyx_XDECREF(__pyx_r);
4279 __pyx_t_1 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->top_grid_dims[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
4280 __Pyx_GOTREF(__pyx_t_1);
4281 __pyx_t_2 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->top_grid_dims[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
4282 __Pyx_GOTREF(__pyx_t_2);
4283 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->nvals); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
4284 __Pyx_GOTREF(__pyx_t_3);
4285 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
4286 __Pyx_GOTREF(__pyx_t_4);
4287 __Pyx_GIVEREF(__pyx_t_1);
4288 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
4289 __Pyx_GIVEREF(__pyx_t_2);
4290 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
4291 __Pyx_GIVEREF(__pyx_t_3);
4292 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
4293 __pyx_t_1 = 0;
4294 __pyx_t_2 = 0;
4295 __pyx_t_3 = 0;
4296 __pyx_r = __pyx_t_4;
4297 __pyx_t_4 = 0;
4298 goto __pyx_L0;
4299
4300 /* "yt/utilities/lib/quad_tree.pyx":237
4301 * return (refined, values, wval)
4302 *
4303 * def get_args(self): # <<<<<<<<<<<<<<
4304 * return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals)
4305 *
4306 */
4307
4308 /* function exit code */
4309 __pyx_L1_error:;
4310 __Pyx_XDECREF(__pyx_t_1);
4311 __Pyx_XDECREF(__pyx_t_2);
4312 __Pyx_XDECREF(__pyx_t_3);
4313 __Pyx_XDECREF(__pyx_t_4);
4314 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.get_args", __pyx_clineno, __pyx_lineno, __pyx_filename);
4315 __pyx_r = NULL;
4316 __pyx_L0:;
4317 __Pyx_XGIVEREF(__pyx_r);
4318 __Pyx_RefNannyFinishContext();
4319 return __pyx_r;
4320 }
4321
4322 /* "yt/utilities/lib/quad_tree.pyx":240
4323 * return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals)
4324 *
4325 * cdef int add_to_position(self, # <<<<<<<<<<<<<<
4326 * int level, np.int64_t pos[2],
4327 * np.float64_t *val,
4328 */
4329
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,int __pyx_v_level,__pyx_t_5numpy_int64_t * __pyx_v_pos,__pyx_t_5numpy_float64_t * __pyx_v_val,__pyx_t_5numpy_float64_t __pyx_v_weight_val,struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position * __pyx_optional_args)4330 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, int __pyx_v_level, __pyx_t_5numpy_int64_t *__pyx_v_pos, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position *__pyx_optional_args) {
4331 int __pyx_v_skip = ((int)0);
4332 int __pyx_v_i;
4333 int __pyx_v_j;
4334 int __pyx_v_L;
4335 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node;
4336 int __pyx_r;
4337 __Pyx_RefNannyDeclarations
4338 int __pyx_t_1;
4339 int __pyx_t_2;
4340 int __pyx_t_3;
4341 int __pyx_t_4;
4342 __Pyx_RefNannySetupContext("add_to_position", 0);
4343 if (__pyx_optional_args) {
4344 if (__pyx_optional_args->__pyx_n > 0) {
4345 __pyx_v_skip = __pyx_optional_args->skip;
4346 }
4347 }
4348
4349 /* "yt/utilities/lib/quad_tree.pyx":246
4350 * cdef int i, j, L
4351 * cdef QuadTreeNode *node
4352 * node = self.find_on_root_level(pos, level) # <<<<<<<<<<<<<<
4353 * if node == NULL:
4354 * return -1
4355 */
4356 __pyx_v_node = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->find_on_root_level(__pyx_v_self, __pyx_v_pos, __pyx_v_level);
4357
4358 /* "yt/utilities/lib/quad_tree.pyx":247
4359 * cdef QuadTreeNode *node
4360 * node = self.find_on_root_level(pos, level)
4361 * if node == NULL: # <<<<<<<<<<<<<<
4362 * return -1
4363 * if level > self.max_level:
4364 */
4365 __pyx_t_1 = ((__pyx_v_node == NULL) != 0);
4366 if (__pyx_t_1) {
4367
4368 /* "yt/utilities/lib/quad_tree.pyx":248
4369 * node = self.find_on_root_level(pos, level)
4370 * if node == NULL:
4371 * return -1 # <<<<<<<<<<<<<<
4372 * if level > self.max_level:
4373 * self.max_level = level
4374 */
4375 __pyx_r = -1;
4376 goto __pyx_L0;
4377
4378 /* "yt/utilities/lib/quad_tree.pyx":247
4379 * cdef QuadTreeNode *node
4380 * node = self.find_on_root_level(pos, level)
4381 * if node == NULL: # <<<<<<<<<<<<<<
4382 * return -1
4383 * if level > self.max_level:
4384 */
4385 }
4386
4387 /* "yt/utilities/lib/quad_tree.pyx":249
4388 * if node == NULL:
4389 * return -1
4390 * if level > self.max_level: # <<<<<<<<<<<<<<
4391 * self.max_level = level
4392 * for L in range(level):
4393 */
4394 __pyx_t_1 = ((__pyx_v_level > __pyx_v_self->max_level) != 0);
4395 if (__pyx_t_1) {
4396
4397 /* "yt/utilities/lib/quad_tree.pyx":250
4398 * return -1
4399 * if level > self.max_level:
4400 * self.max_level = level # <<<<<<<<<<<<<<
4401 * for L in range(level):
4402 * if node.children[0][0] == NULL:
4403 */
4404 __pyx_v_self->max_level = __pyx_v_level;
4405
4406 /* "yt/utilities/lib/quad_tree.pyx":249
4407 * if node == NULL:
4408 * return -1
4409 * if level > self.max_level: # <<<<<<<<<<<<<<
4410 * self.max_level = level
4411 * for L in range(level):
4412 */
4413 }
4414
4415 /* "yt/utilities/lib/quad_tree.pyx":251
4416 * if level > self.max_level:
4417 * self.max_level = level
4418 * for L in range(level): # <<<<<<<<<<<<<<
4419 * if node.children[0][0] == NULL:
4420 * QTN_refine(node, self.nvals)
4421 */
4422 __pyx_t_2 = __pyx_v_level;
4423 __pyx_t_3 = __pyx_t_2;
4424 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
4425 __pyx_v_L = __pyx_t_4;
4426
4427 /* "yt/utilities/lib/quad_tree.pyx":252
4428 * self.max_level = level
4429 * for L in range(level):
4430 * if node.children[0][0] == NULL: # <<<<<<<<<<<<<<
4431 * QTN_refine(node, self.nvals)
4432 * self.num_cells += 4
4433 */
4434 __pyx_t_1 = ((((__pyx_v_node->children[0])[0]) == NULL) != 0);
4435 if (__pyx_t_1) {
4436
4437 /* "yt/utilities/lib/quad_tree.pyx":253
4438 * for L in range(level):
4439 * if node.children[0][0] == NULL:
4440 * QTN_refine(node, self.nvals) # <<<<<<<<<<<<<<
4441 * self.num_cells += 4
4442 * # Maybe we should use bitwise operators?
4443 */
4444 __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_refine(__pyx_v_node, __pyx_v_self->nvals);
4445
4446 /* "yt/utilities/lib/quad_tree.pyx":254
4447 * if node.children[0][0] == NULL:
4448 * QTN_refine(node, self.nvals)
4449 * self.num_cells += 4 # <<<<<<<<<<<<<<
4450 * # Maybe we should use bitwise operators?
4451 * i = (pos[0] >> (level - L - 1)) & 1
4452 */
4453 __pyx_v_self->num_cells = (__pyx_v_self->num_cells + 4);
4454
4455 /* "yt/utilities/lib/quad_tree.pyx":252
4456 * self.max_level = level
4457 * for L in range(level):
4458 * if node.children[0][0] == NULL: # <<<<<<<<<<<<<<
4459 * QTN_refine(node, self.nvals)
4460 * self.num_cells += 4
4461 */
4462 }
4463
4464 /* "yt/utilities/lib/quad_tree.pyx":256
4465 * self.num_cells += 4
4466 * # Maybe we should use bitwise operators?
4467 * i = (pos[0] >> (level - L - 1)) & 1 # <<<<<<<<<<<<<<
4468 * j = (pos[1] >> (level - L - 1)) & 1
4469 * node = node.children[i][j]
4470 */
4471 __pyx_v_i = (((__pyx_v_pos[0]) >> ((__pyx_v_level - __pyx_v_L) - 1)) & 1);
4472
4473 /* "yt/utilities/lib/quad_tree.pyx":257
4474 * # Maybe we should use bitwise operators?
4475 * i = (pos[0] >> (level - L - 1)) & 1
4476 * j = (pos[1] >> (level - L - 1)) & 1 # <<<<<<<<<<<<<<
4477 * node = node.children[i][j]
4478 * if skip == 1: return 0
4479 */
4480 __pyx_v_j = (((__pyx_v_pos[1]) >> ((__pyx_v_level - __pyx_v_L) - 1)) & 1);
4481
4482 /* "yt/utilities/lib/quad_tree.pyx":258
4483 * i = (pos[0] >> (level - L - 1)) & 1
4484 * j = (pos[1] >> (level - L - 1)) & 1
4485 * node = node.children[i][j] # <<<<<<<<<<<<<<
4486 * if skip == 1: return 0
4487 * self.combine(node, val, weight_val, self.nvals)
4488 */
4489 __pyx_v_node = ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]);
4490 }
4491
4492 /* "yt/utilities/lib/quad_tree.pyx":259
4493 * j = (pos[1] >> (level - L - 1)) & 1
4494 * node = node.children[i][j]
4495 * if skip == 1: return 0 # <<<<<<<<<<<<<<
4496 * self.combine(node, val, weight_val, self.nvals)
4497 * return 0
4498 */
4499 __pyx_t_1 = ((__pyx_v_skip == 1) != 0);
4500 if (__pyx_t_1) {
4501 __pyx_r = 0;
4502 goto __pyx_L0;
4503 }
4504
4505 /* "yt/utilities/lib/quad_tree.pyx":260
4506 * node = node.children[i][j]
4507 * if skip == 1: return 0
4508 * self.combine(node, val, weight_val, self.nvals) # <<<<<<<<<<<<<<
4509 * return 0
4510 *
4511 */
4512 __pyx_v_self->combine(__pyx_v_node, __pyx_v_val, __pyx_v_weight_val, __pyx_v_self->nvals);
4513
4514 /* "yt/utilities/lib/quad_tree.pyx":261
4515 * if skip == 1: return 0
4516 * self.combine(node, val, weight_val, self.nvals)
4517 * return 0 # <<<<<<<<<<<<<<
4518 *
4519 * @cython.cdivision(True)
4520 */
4521 __pyx_r = 0;
4522 goto __pyx_L0;
4523
4524 /* "yt/utilities/lib/quad_tree.pyx":240
4525 * return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals)
4526 *
4527 * cdef int add_to_position(self, # <<<<<<<<<<<<<<
4528 * int level, np.int64_t pos[2],
4529 * np.float64_t *val,
4530 */
4531
4532 /* function exit code */
4533 __pyx_L0:;
4534 __Pyx_RefNannyFinishContext();
4535 return __pyx_r;
4536 }
4537
4538 /* "yt/utilities/lib/quad_tree.pyx":264
4539 *
4540 * @cython.cdivision(True)
4541 * cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): # <<<<<<<<<<<<<<
4542 * # We need this because the root level won't just have four children
4543 * # So we find on the root level, then we traverse the tree.
4544 */
4545
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_on_root_level(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,__pyx_t_5numpy_int64_t * __pyx_v_pos,int __pyx_v_level)4546 static struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_on_root_level(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, __pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_level) {
4547 __pyx_t_5numpy_int64_t __pyx_v_i;
4548 __pyx_t_5numpy_int64_t __pyx_v_j;
4549 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_r;
4550 __Pyx_RefNannyDeclarations
4551 int __pyx_t_1;
4552 int __pyx_t_2;
4553 __Pyx_RefNannySetupContext("find_on_root_level", 0);
4554
4555 /* "yt/utilities/lib/quad_tree.pyx":268
4556 * # So we find on the root level, then we traverse the tree.
4557 * cdef np.int64_t i, j
4558 * i = pos[0] >> level # <<<<<<<<<<<<<<
4559 * j = pos[1] >> level
4560 * if i >= self.top_grid_dims[0] or i < 0 or \
4561 */
4562 __pyx_v_i = ((__pyx_v_pos[0]) >> __pyx_v_level);
4563
4564 /* "yt/utilities/lib/quad_tree.pyx":269
4565 * cdef np.int64_t i, j
4566 * i = pos[0] >> level
4567 * j = pos[1] >> level # <<<<<<<<<<<<<<
4568 * if i >= self.top_grid_dims[0] or i < 0 or \
4569 * j >= self.top_grid_dims[1] or j < 0:
4570 */
4571 __pyx_v_j = ((__pyx_v_pos[1]) >> __pyx_v_level);
4572
4573 /* "yt/utilities/lib/quad_tree.pyx":270
4574 * i = pos[0] >> level
4575 * j = pos[1] >> level
4576 * if i >= self.top_grid_dims[0] or i < 0 or \ # <<<<<<<<<<<<<<
4577 * j >= self.top_grid_dims[1] or j < 0:
4578 * self.last_dims[0] = i
4579 */
4580 __pyx_t_2 = ((__pyx_v_i >= (__pyx_v_self->top_grid_dims[0])) != 0);
4581 if (!__pyx_t_2) {
4582 } else {
4583 __pyx_t_1 = __pyx_t_2;
4584 goto __pyx_L4_bool_binop_done;
4585 }
4586 __pyx_t_2 = ((__pyx_v_i < 0) != 0);
4587 if (!__pyx_t_2) {
4588 } else {
4589 __pyx_t_1 = __pyx_t_2;
4590 goto __pyx_L4_bool_binop_done;
4591 }
4592
4593 /* "yt/utilities/lib/quad_tree.pyx":271
4594 * j = pos[1] >> level
4595 * if i >= self.top_grid_dims[0] or i < 0 or \
4596 * j >= self.top_grid_dims[1] or j < 0: # <<<<<<<<<<<<<<
4597 * self.last_dims[0] = i
4598 * self.last_dims[1] = j
4599 */
4600 __pyx_t_2 = ((__pyx_v_j >= (__pyx_v_self->top_grid_dims[1])) != 0);
4601 if (!__pyx_t_2) {
4602 } else {
4603 __pyx_t_1 = __pyx_t_2;
4604 goto __pyx_L4_bool_binop_done;
4605 }
4606 __pyx_t_2 = ((__pyx_v_j < 0) != 0);
4607 __pyx_t_1 = __pyx_t_2;
4608 __pyx_L4_bool_binop_done:;
4609
4610 /* "yt/utilities/lib/quad_tree.pyx":270
4611 * i = pos[0] >> level
4612 * j = pos[1] >> level
4613 * if i >= self.top_grid_dims[0] or i < 0 or \ # <<<<<<<<<<<<<<
4614 * j >= self.top_grid_dims[1] or j < 0:
4615 * self.last_dims[0] = i
4616 */
4617 if (__pyx_t_1) {
4618
4619 /* "yt/utilities/lib/quad_tree.pyx":272
4620 * if i >= self.top_grid_dims[0] or i < 0 or \
4621 * j >= self.top_grid_dims[1] or j < 0:
4622 * self.last_dims[0] = i # <<<<<<<<<<<<<<
4623 * self.last_dims[1] = j
4624 * return NULL
4625 */
4626 (__pyx_v_self->last_dims[0]) = __pyx_v_i;
4627
4628 /* "yt/utilities/lib/quad_tree.pyx":273
4629 * j >= self.top_grid_dims[1] or j < 0:
4630 * self.last_dims[0] = i
4631 * self.last_dims[1] = j # <<<<<<<<<<<<<<
4632 * return NULL
4633 * return self.root_nodes[i][j]
4634 */
4635 (__pyx_v_self->last_dims[1]) = __pyx_v_j;
4636
4637 /* "yt/utilities/lib/quad_tree.pyx":274
4638 * self.last_dims[0] = i
4639 * self.last_dims[1] = j
4640 * return NULL # <<<<<<<<<<<<<<
4641 * return self.root_nodes[i][j]
4642 *
4643 */
4644 __pyx_r = NULL;
4645 goto __pyx_L0;
4646
4647 /* "yt/utilities/lib/quad_tree.pyx":270
4648 * i = pos[0] >> level
4649 * j = pos[1] >> level
4650 * if i >= self.top_grid_dims[0] or i < 0 or \ # <<<<<<<<<<<<<<
4651 * j >= self.top_grid_dims[1] or j < 0:
4652 * self.last_dims[0] = i
4653 */
4654 }
4655
4656 /* "yt/utilities/lib/quad_tree.pyx":275
4657 * self.last_dims[1] = j
4658 * return NULL
4659 * return self.root_nodes[i][j] # <<<<<<<<<<<<<<
4660 *
4661 * @cython.boundscheck(False)
4662 */
4663 __pyx_r = ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]);
4664 goto __pyx_L0;
4665
4666 /* "yt/utilities/lib/quad_tree.pyx":264
4667 *
4668 * @cython.cdivision(True)
4669 * cdef QuadTreeNode *find_on_root_level(self, np.int64_t pos[2], int level): # <<<<<<<<<<<<<<
4670 * # We need this because the root level won't just have four children
4671 * # So we find on the root level, then we traverse the tree.
4672 */
4673
4674 /* function exit code */
4675 __pyx_L0:;
4676 __Pyx_RefNannyFinishContext();
4677 return __pyx_r;
4678 }
4679
4680 /* "yt/utilities/lib/quad_tree.pyx":279
4681 * @cython.boundscheck(False)
4682 * @cython.wraparound(False)
4683 * def add_array_to_tree(self, int level, np.ndarray[np.int64_t, ndim=1] pxs, # <<<<<<<<<<<<<<
4684 * np.ndarray[np.int64_t, ndim=1] pys,
4685 * np.ndarray[np.float64_t, ndim=2] pvals,
4686 */
4687
4688 /* Python wrapper */
4689 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_9add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_9add_array_to_tree(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4690 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_9add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4691 int __pyx_v_level;
4692 PyArrayObject *__pyx_v_pxs = 0;
4693 PyArrayObject *__pyx_v_pys = 0;
4694 PyArrayObject *__pyx_v_pvals = 0;
4695 PyArrayObject *__pyx_v_pweight_vals = 0;
4696 int __pyx_v_skip;
4697 PyObject *__pyx_r = 0;
4698 __Pyx_RefNannyDeclarations
4699 __Pyx_RefNannySetupContext("add_array_to_tree (wrapper)", 0);
4700 {
4701 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_pxs,&__pyx_n_s_pys,&__pyx_n_s_pvals,&__pyx_n_s_pweight_vals,&__pyx_n_s_skip,0};
4702 PyObject* values[6] = {0,0,0,0,0,0};
4703 if (unlikely(__pyx_kwds)) {
4704 Py_ssize_t kw_args;
4705 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4706 switch (pos_args) {
4707 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4708 CYTHON_FALLTHROUGH;
4709 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4710 CYTHON_FALLTHROUGH;
4711 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4712 CYTHON_FALLTHROUGH;
4713 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4714 CYTHON_FALLTHROUGH;
4715 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4716 CYTHON_FALLTHROUGH;
4717 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4718 CYTHON_FALLTHROUGH;
4719 case 0: break;
4720 default: goto __pyx_L5_argtuple_error;
4721 }
4722 kw_args = PyDict_Size(__pyx_kwds);
4723 switch (pos_args) {
4724 case 0:
4725 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
4726 else goto __pyx_L5_argtuple_error;
4727 CYTHON_FALLTHROUGH;
4728 case 1:
4729 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pxs)) != 0)) kw_args--;
4730 else {
4731 __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 5, 6, 1); __PYX_ERR(0, 279, __pyx_L3_error)
4732 }
4733 CYTHON_FALLTHROUGH;
4734 case 2:
4735 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pys)) != 0)) kw_args--;
4736 else {
4737 __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 5, 6, 2); __PYX_ERR(0, 279, __pyx_L3_error)
4738 }
4739 CYTHON_FALLTHROUGH;
4740 case 3:
4741 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pvals)) != 0)) kw_args--;
4742 else {
4743 __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 5, 6, 3); __PYX_ERR(0, 279, __pyx_L3_error)
4744 }
4745 CYTHON_FALLTHROUGH;
4746 case 4:
4747 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pweight_vals)) != 0)) kw_args--;
4748 else {
4749 __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 5, 6, 4); __PYX_ERR(0, 279, __pyx_L3_error)
4750 }
4751 CYTHON_FALLTHROUGH;
4752 case 5:
4753 if (kw_args > 0) {
4754 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_skip);
4755 if (value) { values[5] = value; kw_args--; }
4756 }
4757 }
4758 if (unlikely(kw_args > 0)) {
4759 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_array_to_tree") < 0)) __PYX_ERR(0, 279, __pyx_L3_error)
4760 }
4761 } else {
4762 switch (PyTuple_GET_SIZE(__pyx_args)) {
4763 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4764 CYTHON_FALLTHROUGH;
4765 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4766 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4767 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4768 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4769 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4770 break;
4771 default: goto __pyx_L5_argtuple_error;
4772 }
4773 }
4774 __pyx_v_level = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L3_error)
4775 __pyx_v_pxs = ((PyArrayObject *)values[1]);
4776 __pyx_v_pys = ((PyArrayObject *)values[2]);
4777 __pyx_v_pvals = ((PyArrayObject *)values[3]);
4778 __pyx_v_pweight_vals = ((PyArrayObject *)values[4]);
4779 if (values[5]) {
4780 __pyx_v_skip = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_skip == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L3_error)
4781 } else {
4782 __pyx_v_skip = ((int)0);
4783 }
4784 }
4785 goto __pyx_L4_argument_unpacking_done;
4786 __pyx_L5_argtuple_error:;
4787 __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 279, __pyx_L3_error)
4788 __pyx_L3_error:;
4789 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.add_array_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
4790 __Pyx_RefNannyFinishContext();
4791 return NULL;
4792 __pyx_L4_argument_unpacking_done:;
4793 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pxs), __pyx_ptype_5numpy_ndarray, 1, "pxs", 0))) __PYX_ERR(0, 279, __pyx_L1_error)
4794 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pys), __pyx_ptype_5numpy_ndarray, 1, "pys", 0))) __PYX_ERR(0, 280, __pyx_L1_error)
4795 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) __PYX_ERR(0, 281, __pyx_L1_error)
4796 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pweight_vals), __pyx_ptype_5numpy_ndarray, 1, "pweight_vals", 0))) __PYX_ERR(0, 282, __pyx_L1_error)
4797 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_8add_array_to_tree(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_level, __pyx_v_pxs, __pyx_v_pys, __pyx_v_pvals, __pyx_v_pweight_vals, __pyx_v_skip);
4798
4799 /* function exit code */
4800 goto __pyx_L0;
4801 __pyx_L1_error:;
4802 __pyx_r = NULL;
4803 __pyx_L0:;
4804 __Pyx_RefNannyFinishContext();
4805 return __pyx_r;
4806 }
4807
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_8add_array_to_tree(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,int __pyx_v_level,PyArrayObject * __pyx_v_pxs,PyArrayObject * __pyx_v_pys,PyArrayObject * __pyx_v_pvals,PyArrayObject * __pyx_v_pweight_vals,int __pyx_v_skip)4808 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_8add_array_to_tree(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, int __pyx_v_level, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_pvals, PyArrayObject *__pyx_v_pweight_vals, int __pyx_v_skip) {
4809 int __pyx_v_p;
4810 __pyx_t_5numpy_float64_t *__pyx_v_vals;
4811 __pyx_t_5numpy_float64_t *__pyx_v_data;
4812 __pyx_t_5numpy_int64_t __pyx_v_pos[2];
4813 __Pyx_LocalBuf_ND __pyx_pybuffernd_pvals;
4814 __Pyx_Buffer __pyx_pybuffer_pvals;
4815 __Pyx_LocalBuf_ND __pyx_pybuffernd_pweight_vals;
4816 __Pyx_Buffer __pyx_pybuffer_pweight_vals;
4817 __Pyx_LocalBuf_ND __pyx_pybuffernd_pxs;
4818 __Pyx_Buffer __pyx_pybuffer_pxs;
4819 __Pyx_LocalBuf_ND __pyx_pybuffernd_pys;
4820 __Pyx_Buffer __pyx_pybuffer_pys;
4821 PyObject *__pyx_r = NULL;
4822 __Pyx_RefNannyDeclarations
4823 npy_intp __pyx_t_1;
4824 npy_intp __pyx_t_2;
4825 int __pyx_t_3;
4826 Py_ssize_t __pyx_t_4;
4827 Py_ssize_t __pyx_t_5;
4828 Py_ssize_t __pyx_t_6;
4829 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position __pyx_t_7;
4830 __Pyx_RefNannySetupContext("add_array_to_tree", 0);
4831 __pyx_pybuffer_pxs.pybuffer.buf = NULL;
4832 __pyx_pybuffer_pxs.refcount = 0;
4833 __pyx_pybuffernd_pxs.data = NULL;
4834 __pyx_pybuffernd_pxs.rcbuffer = &__pyx_pybuffer_pxs;
4835 __pyx_pybuffer_pys.pybuffer.buf = NULL;
4836 __pyx_pybuffer_pys.refcount = 0;
4837 __pyx_pybuffernd_pys.data = NULL;
4838 __pyx_pybuffernd_pys.rcbuffer = &__pyx_pybuffer_pys;
4839 __pyx_pybuffer_pvals.pybuffer.buf = NULL;
4840 __pyx_pybuffer_pvals.refcount = 0;
4841 __pyx_pybuffernd_pvals.data = NULL;
4842 __pyx_pybuffernd_pvals.rcbuffer = &__pyx_pybuffer_pvals;
4843 __pyx_pybuffer_pweight_vals.pybuffer.buf = NULL;
4844 __pyx_pybuffer_pweight_vals.refcount = 0;
4845 __pyx_pybuffernd_pweight_vals.data = NULL;
4846 __pyx_pybuffernd_pweight_vals.rcbuffer = &__pyx_pybuffer_pweight_vals;
4847 {
4848 __Pyx_BufFmt_StackElem __pyx_stack[1];
4849 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer, (PyObject*)__pyx_v_pxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 279, __pyx_L1_error)
4850 }
4851 __pyx_pybuffernd_pxs.diminfo[0].strides = __pyx_pybuffernd_pxs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pxs.diminfo[0].shape = __pyx_pybuffernd_pxs.rcbuffer->pybuffer.shape[0];
4852 {
4853 __Pyx_BufFmt_StackElem __pyx_stack[1];
4854 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pys.rcbuffer->pybuffer, (PyObject*)__pyx_v_pys, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 279, __pyx_L1_error)
4855 }
4856 __pyx_pybuffernd_pys.diminfo[0].strides = __pyx_pybuffernd_pys.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pys.diminfo[0].shape = __pyx_pybuffernd_pys.rcbuffer->pybuffer.shape[0];
4857 {
4858 __Pyx_BufFmt_StackElem __pyx_stack[1];
4859 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer, (PyObject*)__pyx_v_pvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 279, __pyx_L1_error)
4860 }
4861 __pyx_pybuffernd_pvals.diminfo[0].strides = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pvals.diminfo[0].shape = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pvals.diminfo[1].strides = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pvals.diminfo[1].shape = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.shape[1];
4862 {
4863 __Pyx_BufFmt_StackElem __pyx_stack[1];
4864 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_pweight_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 279, __pyx_L1_error)
4865 }
4866 __pyx_pybuffernd_pweight_vals.diminfo[0].strides = __pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pweight_vals.diminfo[0].shape = __pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer.shape[0];
4867
4868 /* "yt/utilities/lib/quad_tree.pyx":286
4869 * cdef int p
4870 * cdef np.float64_t *vals
4871 * cdef np.float64_t *data = <np.float64_t *> pvals.data # <<<<<<<<<<<<<<
4872 * cdef np.int64_t pos[2]
4873 * for p in range(pxs.shape[0]):
4874 */
4875 __pyx_v_data = ((__pyx_t_5numpy_float64_t *)__pyx_v_pvals->data);
4876
4877 /* "yt/utilities/lib/quad_tree.pyx":288
4878 * cdef np.float64_t *data = <np.float64_t *> pvals.data
4879 * cdef np.int64_t pos[2]
4880 * for p in range(pxs.shape[0]): # <<<<<<<<<<<<<<
4881 * vals = data + self.nvals*p
4882 * pos[0] = pxs[p]
4883 */
4884 __pyx_t_1 = (__pyx_v_pxs->dimensions[0]);
4885 __pyx_t_2 = __pyx_t_1;
4886 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4887 __pyx_v_p = __pyx_t_3;
4888
4889 /* "yt/utilities/lib/quad_tree.pyx":289
4890 * cdef np.int64_t pos[2]
4891 * for p in range(pxs.shape[0]):
4892 * vals = data + self.nvals*p # <<<<<<<<<<<<<<
4893 * pos[0] = pxs[p]
4894 * pos[1] = pys[p]
4895 */
4896 __pyx_v_vals = (__pyx_v_data + (__pyx_v_self->nvals * __pyx_v_p));
4897
4898 /* "yt/utilities/lib/quad_tree.pyx":290
4899 * for p in range(pxs.shape[0]):
4900 * vals = data + self.nvals*p
4901 * pos[0] = pxs[p] # <<<<<<<<<<<<<<
4902 * pos[1] = pys[p]
4903 * self.add_to_position(level, pos, vals, pweight_vals[p], skip)
4904 */
4905 __pyx_t_4 = __pyx_v_p;
4906 (__pyx_v_pos[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pxs.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pxs.diminfo[0].strides));
4907
4908 /* "yt/utilities/lib/quad_tree.pyx":291
4909 * vals = data + self.nvals*p
4910 * pos[0] = pxs[p]
4911 * pos[1] = pys[p] # <<<<<<<<<<<<<<
4912 * self.add_to_position(level, pos, vals, pweight_vals[p], skip)
4913 * return
4914 */
4915 __pyx_t_5 = __pyx_v_p;
4916 (__pyx_v_pos[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pys.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pys.diminfo[0].strides));
4917
4918 /* "yt/utilities/lib/quad_tree.pyx":292
4919 * pos[0] = pxs[p]
4920 * pos[1] = pys[p]
4921 * self.add_to_position(level, pos, vals, pweight_vals[p], skip) # <<<<<<<<<<<<<<
4922 * return
4923 *
4924 */
4925 __pyx_t_6 = __pyx_v_p;
4926 __pyx_t_7.__pyx_n = 1;
4927 __pyx_t_7.skip = __pyx_v_skip;
4928 ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->add_to_position(__pyx_v_self, __pyx_v_level, __pyx_v_pos, __pyx_v_vals, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_pweight_vals.diminfo[0].strides)), &__pyx_t_7);
4929 }
4930
4931 /* "yt/utilities/lib/quad_tree.pyx":293
4932 * pos[1] = pys[p]
4933 * self.add_to_position(level, pos, vals, pweight_vals[p], skip)
4934 * return # <<<<<<<<<<<<<<
4935 *
4936 * @cython.boundscheck(False)
4937 */
4938 __Pyx_XDECREF(__pyx_r);
4939 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4940 goto __pyx_L0;
4941
4942 /* "yt/utilities/lib/quad_tree.pyx":279
4943 * @cython.boundscheck(False)
4944 * @cython.wraparound(False)
4945 * def add_array_to_tree(self, int level, np.ndarray[np.int64_t, ndim=1] pxs, # <<<<<<<<<<<<<<
4946 * np.ndarray[np.int64_t, ndim=1] pys,
4947 * np.ndarray[np.float64_t, ndim=2] pvals,
4948 */
4949
4950 /* function exit code */
4951 __pyx_L1_error:;
4952 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4953 __Pyx_PyThreadState_declare
4954 __Pyx_PyThreadState_assign
4955 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4956 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
4957 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer);
4958 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
4959 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
4960 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4961 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.add_array_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
4962 __pyx_r = NULL;
4963 goto __pyx_L2;
4964 __pyx_L0:;
4965 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
4966 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer);
4967 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
4968 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
4969 __pyx_L2:;
4970 __Pyx_XGIVEREF(__pyx_r);
4971 __Pyx_RefNannyFinishContext();
4972 return __pyx_r;
4973 }
4974
4975 /* "yt/utilities/lib/quad_tree.pyx":297
4976 * @cython.boundscheck(False)
4977 * @cython.wraparound(False)
4978 * def add_chunk_to_tree(self, # <<<<<<<<<<<<<<
4979 * np.ndarray[np.int64_t, ndim=1] pxs,
4980 * np.ndarray[np.int64_t, ndim=1] pys,
4981 */
4982
4983 /* Python wrapper */
4984 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_11add_chunk_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_11add_chunk_to_tree(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4985 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_11add_chunk_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4986 PyArrayObject *__pyx_v_pxs = 0;
4987 PyArrayObject *__pyx_v_pys = 0;
4988 PyArrayObject *__pyx_v_level = 0;
4989 PyArrayObject *__pyx_v_pvals = 0;
4990 PyArrayObject *__pyx_v_pweight_vals = 0;
4991 PyObject *__pyx_r = 0;
4992 __Pyx_RefNannyDeclarations
4993 __Pyx_RefNannySetupContext("add_chunk_to_tree (wrapper)", 0);
4994 {
4995 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pxs,&__pyx_n_s_pys,&__pyx_n_s_level,&__pyx_n_s_pvals,&__pyx_n_s_pweight_vals,0};
4996 PyObject* values[5] = {0,0,0,0,0};
4997 if (unlikely(__pyx_kwds)) {
4998 Py_ssize_t kw_args;
4999 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5000 switch (pos_args) {
5001 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5002 CYTHON_FALLTHROUGH;
5003 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5004 CYTHON_FALLTHROUGH;
5005 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5006 CYTHON_FALLTHROUGH;
5007 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5008 CYTHON_FALLTHROUGH;
5009 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5010 CYTHON_FALLTHROUGH;
5011 case 0: break;
5012 default: goto __pyx_L5_argtuple_error;
5013 }
5014 kw_args = PyDict_Size(__pyx_kwds);
5015 switch (pos_args) {
5016 case 0:
5017 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pxs)) != 0)) kw_args--;
5018 else goto __pyx_L5_argtuple_error;
5019 CYTHON_FALLTHROUGH;
5020 case 1:
5021 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pys)) != 0)) kw_args--;
5022 else {
5023 __Pyx_RaiseArgtupleInvalid("add_chunk_to_tree", 1, 5, 5, 1); __PYX_ERR(0, 297, __pyx_L3_error)
5024 }
5025 CYTHON_FALLTHROUGH;
5026 case 2:
5027 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
5028 else {
5029 __Pyx_RaiseArgtupleInvalid("add_chunk_to_tree", 1, 5, 5, 2); __PYX_ERR(0, 297, __pyx_L3_error)
5030 }
5031 CYTHON_FALLTHROUGH;
5032 case 3:
5033 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pvals)) != 0)) kw_args--;
5034 else {
5035 __Pyx_RaiseArgtupleInvalid("add_chunk_to_tree", 1, 5, 5, 3); __PYX_ERR(0, 297, __pyx_L3_error)
5036 }
5037 CYTHON_FALLTHROUGH;
5038 case 4:
5039 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pweight_vals)) != 0)) kw_args--;
5040 else {
5041 __Pyx_RaiseArgtupleInvalid("add_chunk_to_tree", 1, 5, 5, 4); __PYX_ERR(0, 297, __pyx_L3_error)
5042 }
5043 }
5044 if (unlikely(kw_args > 0)) {
5045 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_chunk_to_tree") < 0)) __PYX_ERR(0, 297, __pyx_L3_error)
5046 }
5047 } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5048 goto __pyx_L5_argtuple_error;
5049 } else {
5050 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5051 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5052 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5053 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5054 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5055 }
5056 __pyx_v_pxs = ((PyArrayObject *)values[0]);
5057 __pyx_v_pys = ((PyArrayObject *)values[1]);
5058 __pyx_v_level = ((PyArrayObject *)values[2]);
5059 __pyx_v_pvals = ((PyArrayObject *)values[3]);
5060 __pyx_v_pweight_vals = ((PyArrayObject *)values[4]);
5061 }
5062 goto __pyx_L4_argument_unpacking_done;
5063 __pyx_L5_argtuple_error:;
5064 __Pyx_RaiseArgtupleInvalid("add_chunk_to_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 297, __pyx_L3_error)
5065 __pyx_L3_error:;
5066 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.add_chunk_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
5067 __Pyx_RefNannyFinishContext();
5068 return NULL;
5069 __pyx_L4_argument_unpacking_done:;
5070 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pxs), __pyx_ptype_5numpy_ndarray, 1, "pxs", 0))) __PYX_ERR(0, 298, __pyx_L1_error)
5071 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pys), __pyx_ptype_5numpy_ndarray, 1, "pys", 0))) __PYX_ERR(0, 299, __pyx_L1_error)
5072 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_level), __pyx_ptype_5numpy_ndarray, 1, "level", 0))) __PYX_ERR(0, 300, __pyx_L1_error)
5073 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) __PYX_ERR(0, 301, __pyx_L1_error)
5074 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pweight_vals), __pyx_ptype_5numpy_ndarray, 1, "pweight_vals", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
5075 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_10add_chunk_to_tree(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_pxs, __pyx_v_pys, __pyx_v_level, __pyx_v_pvals, __pyx_v_pweight_vals);
5076
5077 /* function exit code */
5078 goto __pyx_L0;
5079 __pyx_L1_error:;
5080 __pyx_r = NULL;
5081 __pyx_L0:;
5082 __Pyx_RefNannyFinishContext();
5083 return __pyx_r;
5084 }
5085
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_10add_chunk_to_tree(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,PyArrayObject * __pyx_v_pxs,PyArrayObject * __pyx_v_pys,PyArrayObject * __pyx_v_level,PyArrayObject * __pyx_v_pvals,PyArrayObject * __pyx_v_pweight_vals)5086 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_10add_chunk_to_tree(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_level, PyArrayObject *__pyx_v_pvals, PyArrayObject *__pyx_v_pweight_vals) {
5087 int __pyx_v_ps;
5088 int __pyx_v_p;
5089 int __pyx_v_rv;
5090 __pyx_t_5numpy_float64_t *__pyx_v_vals;
5091 __pyx_t_5numpy_float64_t *__pyx_v_data;
5092 __pyx_t_5numpy_int64_t __pyx_v_pos[2];
5093 __Pyx_LocalBuf_ND __pyx_pybuffernd_level;
5094 __Pyx_Buffer __pyx_pybuffer_level;
5095 __Pyx_LocalBuf_ND __pyx_pybuffernd_pvals;
5096 __Pyx_Buffer __pyx_pybuffer_pvals;
5097 __Pyx_LocalBuf_ND __pyx_pybuffernd_pweight_vals;
5098 __Pyx_Buffer __pyx_pybuffer_pweight_vals;
5099 __Pyx_LocalBuf_ND __pyx_pybuffernd_pxs;
5100 __Pyx_Buffer __pyx_pybuffer_pxs;
5101 __Pyx_LocalBuf_ND __pyx_pybuffernd_pys;
5102 __Pyx_Buffer __pyx_pybuffer_pys;
5103 PyObject *__pyx_r = NULL;
5104 __Pyx_RefNannyDeclarations
5105 int __pyx_t_1;
5106 int __pyx_t_2;
5107 int __pyx_t_3;
5108 Py_ssize_t __pyx_t_4;
5109 Py_ssize_t __pyx_t_5;
5110 Py_ssize_t __pyx_t_6;
5111 Py_ssize_t __pyx_t_7;
5112 int __pyx_t_8;
5113 PyObject *__pyx_t_9 = NULL;
5114 PyObject *__pyx_t_10 = NULL;
5115 PyObject *__pyx_t_11 = NULL;
5116 PyObject *__pyx_t_12 = NULL;
5117 PyObject *__pyx_t_13 = NULL;
5118 PyObject *__pyx_t_14 = NULL;
5119 int __pyx_t_15;
5120 __Pyx_RefNannySetupContext("add_chunk_to_tree", 0);
5121 __pyx_pybuffer_pxs.pybuffer.buf = NULL;
5122 __pyx_pybuffer_pxs.refcount = 0;
5123 __pyx_pybuffernd_pxs.data = NULL;
5124 __pyx_pybuffernd_pxs.rcbuffer = &__pyx_pybuffer_pxs;
5125 __pyx_pybuffer_pys.pybuffer.buf = NULL;
5126 __pyx_pybuffer_pys.refcount = 0;
5127 __pyx_pybuffernd_pys.data = NULL;
5128 __pyx_pybuffernd_pys.rcbuffer = &__pyx_pybuffer_pys;
5129 __pyx_pybuffer_level.pybuffer.buf = NULL;
5130 __pyx_pybuffer_level.refcount = 0;
5131 __pyx_pybuffernd_level.data = NULL;
5132 __pyx_pybuffernd_level.rcbuffer = &__pyx_pybuffer_level;
5133 __pyx_pybuffer_pvals.pybuffer.buf = NULL;
5134 __pyx_pybuffer_pvals.refcount = 0;
5135 __pyx_pybuffernd_pvals.data = NULL;
5136 __pyx_pybuffernd_pvals.rcbuffer = &__pyx_pybuffer_pvals;
5137 __pyx_pybuffer_pweight_vals.pybuffer.buf = NULL;
5138 __pyx_pybuffer_pweight_vals.refcount = 0;
5139 __pyx_pybuffernd_pweight_vals.data = NULL;
5140 __pyx_pybuffernd_pweight_vals.rcbuffer = &__pyx_pybuffer_pweight_vals;
5141 {
5142 __Pyx_BufFmt_StackElem __pyx_stack[1];
5143 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer, (PyObject*)__pyx_v_pxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 297, __pyx_L1_error)
5144 }
5145 __pyx_pybuffernd_pxs.diminfo[0].strides = __pyx_pybuffernd_pxs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pxs.diminfo[0].shape = __pyx_pybuffernd_pxs.rcbuffer->pybuffer.shape[0];
5146 {
5147 __Pyx_BufFmt_StackElem __pyx_stack[1];
5148 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pys.rcbuffer->pybuffer, (PyObject*)__pyx_v_pys, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 297, __pyx_L1_error)
5149 }
5150 __pyx_pybuffernd_pys.diminfo[0].strides = __pyx_pybuffernd_pys.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pys.diminfo[0].shape = __pyx_pybuffernd_pys.rcbuffer->pybuffer.shape[0];
5151 {
5152 __Pyx_BufFmt_StackElem __pyx_stack[1];
5153 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_level.rcbuffer->pybuffer, (PyObject*)__pyx_v_level, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 297, __pyx_L1_error)
5154 }
5155 __pyx_pybuffernd_level.diminfo[0].strides = __pyx_pybuffernd_level.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_level.diminfo[0].shape = __pyx_pybuffernd_level.rcbuffer->pybuffer.shape[0];
5156 {
5157 __Pyx_BufFmt_StackElem __pyx_stack[1];
5158 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer, (PyObject*)__pyx_v_pvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 297, __pyx_L1_error)
5159 }
5160 __pyx_pybuffernd_pvals.diminfo[0].strides = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pvals.diminfo[0].shape = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pvals.diminfo[1].strides = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pvals.diminfo[1].shape = __pyx_pybuffernd_pvals.rcbuffer->pybuffer.shape[1];
5161 {
5162 __Pyx_BufFmt_StackElem __pyx_stack[1];
5163 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_pweight_vals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 297, __pyx_L1_error)
5164 }
5165 __pyx_pybuffernd_pweight_vals.diminfo[0].strides = __pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pweight_vals.diminfo[0].shape = __pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer.shape[0];
5166
5167 /* "yt/utilities/lib/quad_tree.pyx":303
5168 * np.ndarray[np.float64_t, ndim=2] pvals,
5169 * np.ndarray[np.float64_t, ndim=1] pweight_vals):
5170 * cdef int ps = pxs.shape[0] # <<<<<<<<<<<<<<
5171 * cdef int p, rv
5172 * cdef np.float64_t *vals
5173 */
5174 __pyx_v_ps = (__pyx_v_pxs->dimensions[0]);
5175
5176 /* "yt/utilities/lib/quad_tree.pyx":306
5177 * cdef int p, rv
5178 * cdef np.float64_t *vals
5179 * cdef np.float64_t *data = <np.float64_t *> pvals.data # <<<<<<<<<<<<<<
5180 * cdef np.int64_t pos[2]
5181 * for p in range(ps):
5182 */
5183 __pyx_v_data = ((__pyx_t_5numpy_float64_t *)__pyx_v_pvals->data);
5184
5185 /* "yt/utilities/lib/quad_tree.pyx":308
5186 * cdef np.float64_t *data = <np.float64_t *> pvals.data
5187 * cdef np.int64_t pos[2]
5188 * for p in range(ps): # <<<<<<<<<<<<<<
5189 * vals = data + self.nvals*p
5190 * pos[0] = pxs[p]
5191 */
5192 __pyx_t_1 = __pyx_v_ps;
5193 __pyx_t_2 = __pyx_t_1;
5194 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5195 __pyx_v_p = __pyx_t_3;
5196
5197 /* "yt/utilities/lib/quad_tree.pyx":309
5198 * cdef np.int64_t pos[2]
5199 * for p in range(ps):
5200 * vals = data + self.nvals*p # <<<<<<<<<<<<<<
5201 * pos[0] = pxs[p]
5202 * pos[1] = pys[p]
5203 */
5204 __pyx_v_vals = (__pyx_v_data + (__pyx_v_self->nvals * __pyx_v_p));
5205
5206 /* "yt/utilities/lib/quad_tree.pyx":310
5207 * for p in range(ps):
5208 * vals = data + self.nvals*p
5209 * pos[0] = pxs[p] # <<<<<<<<<<<<<<
5210 * pos[1] = pys[p]
5211 * rv = self.add_to_position(level[p], pos, vals, pweight_vals[p])
5212 */
5213 __pyx_t_4 = __pyx_v_p;
5214 (__pyx_v_pos[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pxs.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pxs.diminfo[0].strides));
5215
5216 /* "yt/utilities/lib/quad_tree.pyx":311
5217 * vals = data + self.nvals*p
5218 * pos[0] = pxs[p]
5219 * pos[1] = pys[p] # <<<<<<<<<<<<<<
5220 * rv = self.add_to_position(level[p], pos, vals, pweight_vals[p])
5221 * if rv == -1:
5222 */
5223 __pyx_t_5 = __pyx_v_p;
5224 (__pyx_v_pos[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pys.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pys.diminfo[0].strides));
5225
5226 /* "yt/utilities/lib/quad_tree.pyx":312
5227 * pos[0] = pxs[p]
5228 * pos[1] = pys[p]
5229 * rv = self.add_to_position(level[p], pos, vals, pweight_vals[p]) # <<<<<<<<<<<<<<
5230 * if rv == -1:
5231 * raise YTIntDomainOverflow(
5232 */
5233 __pyx_t_6 = __pyx_v_p;
5234 __pyx_t_7 = __pyx_v_p;
5235 __pyx_v_rv = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->add_to_position(__pyx_v_self, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_level.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_level.diminfo[0].strides)), __pyx_v_pos, __pyx_v_vals, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_pweight_vals.diminfo[0].strides)), NULL);
5236
5237 /* "yt/utilities/lib/quad_tree.pyx":313
5238 * pos[1] = pys[p]
5239 * rv = self.add_to_position(level[p], pos, vals, pweight_vals[p])
5240 * if rv == -1: # <<<<<<<<<<<<<<
5241 * raise YTIntDomainOverflow(
5242 * (self.last_dims[0], self.last_dims[1]),
5243 */
5244 __pyx_t_8 = ((__pyx_v_rv == -1L) != 0);
5245 if (unlikely(__pyx_t_8)) {
5246
5247 /* "yt/utilities/lib/quad_tree.pyx":314
5248 * rv = self.add_to_position(level[p], pos, vals, pweight_vals[p])
5249 * if rv == -1:
5250 * raise YTIntDomainOverflow( # <<<<<<<<<<<<<<
5251 * (self.last_dims[0], self.last_dims[1]),
5252 * (self.top_grid_dims[0], self.top_grid_dims[1]))
5253 */
5254 __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_YTIntDomainOverflow); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 314, __pyx_L1_error)
5255 __Pyx_GOTREF(__pyx_t_10);
5256
5257 /* "yt/utilities/lib/quad_tree.pyx":315
5258 * if rv == -1:
5259 * raise YTIntDomainOverflow(
5260 * (self.last_dims[0], self.last_dims[1]), # <<<<<<<<<<<<<<
5261 * (self.top_grid_dims[0], self.top_grid_dims[1]))
5262 * return
5263 */
5264 __pyx_t_11 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->last_dims[0])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
5265 __Pyx_GOTREF(__pyx_t_11);
5266 __pyx_t_12 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->last_dims[1])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 315, __pyx_L1_error)
5267 __Pyx_GOTREF(__pyx_t_12);
5268 __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 315, __pyx_L1_error)
5269 __Pyx_GOTREF(__pyx_t_13);
5270 __Pyx_GIVEREF(__pyx_t_11);
5271 PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
5272 __Pyx_GIVEREF(__pyx_t_12);
5273 PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
5274 __pyx_t_11 = 0;
5275 __pyx_t_12 = 0;
5276
5277 /* "yt/utilities/lib/quad_tree.pyx":316
5278 * raise YTIntDomainOverflow(
5279 * (self.last_dims[0], self.last_dims[1]),
5280 * (self.top_grid_dims[0], self.top_grid_dims[1])) # <<<<<<<<<<<<<<
5281 * return
5282 *
5283 */
5284 __pyx_t_12 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->top_grid_dims[0])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 316, __pyx_L1_error)
5285 __Pyx_GOTREF(__pyx_t_12);
5286 __pyx_t_11 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->top_grid_dims[1])); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 316, __pyx_L1_error)
5287 __Pyx_GOTREF(__pyx_t_11);
5288 __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 316, __pyx_L1_error)
5289 __Pyx_GOTREF(__pyx_t_14);
5290 __Pyx_GIVEREF(__pyx_t_12);
5291 PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12);
5292 __Pyx_GIVEREF(__pyx_t_11);
5293 PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_11);
5294 __pyx_t_12 = 0;
5295 __pyx_t_11 = 0;
5296 __pyx_t_11 = NULL;
5297 __pyx_t_15 = 0;
5298 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5299 __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
5300 if (likely(__pyx_t_11)) {
5301 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5302 __Pyx_INCREF(__pyx_t_11);
5303 __Pyx_INCREF(function);
5304 __Pyx_DECREF_SET(__pyx_t_10, function);
5305 __pyx_t_15 = 1;
5306 }
5307 }
5308 #if CYTHON_FAST_PYCALL
5309 if (PyFunction_Check(__pyx_t_10)) {
5310 PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
5311 __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 314, __pyx_L1_error)
5312 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
5313 __Pyx_GOTREF(__pyx_t_9);
5314 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5315 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5316 } else
5317 #endif
5318 #if CYTHON_FAST_PYCCALL
5319 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5320 PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
5321 __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 314, __pyx_L1_error)
5322 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
5323 __Pyx_GOTREF(__pyx_t_9);
5324 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5325 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5326 } else
5327 #endif
5328 {
5329 __pyx_t_12 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 314, __pyx_L1_error)
5330 __Pyx_GOTREF(__pyx_t_12);
5331 if (__pyx_t_11) {
5332 __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
5333 }
5334 __Pyx_GIVEREF(__pyx_t_13);
5335 PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_15, __pyx_t_13);
5336 __Pyx_GIVEREF(__pyx_t_14);
5337 PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_15, __pyx_t_14);
5338 __pyx_t_13 = 0;
5339 __pyx_t_14 = 0;
5340 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 314, __pyx_L1_error)
5341 __Pyx_GOTREF(__pyx_t_9);
5342 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5343 }
5344 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5345 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
5346 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5347 __PYX_ERR(0, 314, __pyx_L1_error)
5348
5349 /* "yt/utilities/lib/quad_tree.pyx":313
5350 * pos[1] = pys[p]
5351 * rv = self.add_to_position(level[p], pos, vals, pweight_vals[p])
5352 * if rv == -1: # <<<<<<<<<<<<<<
5353 * raise YTIntDomainOverflow(
5354 * (self.last_dims[0], self.last_dims[1]),
5355 */
5356 }
5357 }
5358
5359 /* "yt/utilities/lib/quad_tree.pyx":317
5360 * (self.last_dims[0], self.last_dims[1]),
5361 * (self.top_grid_dims[0], self.top_grid_dims[1]))
5362 * return # <<<<<<<<<<<<<<
5363 *
5364 * @cython.boundscheck(False)
5365 */
5366 __Pyx_XDECREF(__pyx_r);
5367 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5368 goto __pyx_L0;
5369
5370 /* "yt/utilities/lib/quad_tree.pyx":297
5371 * @cython.boundscheck(False)
5372 * @cython.wraparound(False)
5373 * def add_chunk_to_tree(self, # <<<<<<<<<<<<<<
5374 * np.ndarray[np.int64_t, ndim=1] pxs,
5375 * np.ndarray[np.int64_t, ndim=1] pys,
5376 */
5377
5378 /* function exit code */
5379 __pyx_L1_error:;
5380 __Pyx_XDECREF(__pyx_t_9);
5381 __Pyx_XDECREF(__pyx_t_10);
5382 __Pyx_XDECREF(__pyx_t_11);
5383 __Pyx_XDECREF(__pyx_t_12);
5384 __Pyx_XDECREF(__pyx_t_13);
5385 __Pyx_XDECREF(__pyx_t_14);
5386 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5387 __Pyx_PyThreadState_declare
5388 __Pyx_PyThreadState_assign
5389 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5390 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level.rcbuffer->pybuffer);
5391 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
5392 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer);
5393 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
5394 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
5395 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5396 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.add_chunk_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
5397 __pyx_r = NULL;
5398 goto __pyx_L2;
5399 __pyx_L0:;
5400 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level.rcbuffer->pybuffer);
5401 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
5402 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer);
5403 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
5404 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
5405 __pyx_L2:;
5406 __Pyx_XGIVEREF(__pyx_r);
5407 __Pyx_RefNannyFinishContext();
5408 return __pyx_r;
5409 }
5410
5411 /* "yt/utilities/lib/quad_tree.pyx":321
5412 * @cython.boundscheck(False)
5413 * @cython.wraparound(False)
5414 * def initialize_chunk(self, # <<<<<<<<<<<<<<
5415 * np.ndarray[np.int64_t, ndim=1] pxs,
5416 * np.ndarray[np.int64_t, ndim=1] pys,
5417 */
5418
5419 /* Python wrapper */
5420 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_13initialize_chunk(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_13initialize_chunk(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5421 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_13initialize_chunk(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5422 PyArrayObject *__pyx_v_pxs = 0;
5423 PyArrayObject *__pyx_v_pys = 0;
5424 PyArrayObject *__pyx_v_level = 0;
5425 PyObject *__pyx_r = 0;
5426 __Pyx_RefNannyDeclarations
5427 __Pyx_RefNannySetupContext("initialize_chunk (wrapper)", 0);
5428 {
5429 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pxs,&__pyx_n_s_pys,&__pyx_n_s_level,0};
5430 PyObject* values[3] = {0,0,0};
5431 if (unlikely(__pyx_kwds)) {
5432 Py_ssize_t kw_args;
5433 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5434 switch (pos_args) {
5435 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5436 CYTHON_FALLTHROUGH;
5437 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5438 CYTHON_FALLTHROUGH;
5439 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5440 CYTHON_FALLTHROUGH;
5441 case 0: break;
5442 default: goto __pyx_L5_argtuple_error;
5443 }
5444 kw_args = PyDict_Size(__pyx_kwds);
5445 switch (pos_args) {
5446 case 0:
5447 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pxs)) != 0)) kw_args--;
5448 else goto __pyx_L5_argtuple_error;
5449 CYTHON_FALLTHROUGH;
5450 case 1:
5451 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pys)) != 0)) kw_args--;
5452 else {
5453 __Pyx_RaiseArgtupleInvalid("initialize_chunk", 1, 3, 3, 1); __PYX_ERR(0, 321, __pyx_L3_error)
5454 }
5455 CYTHON_FALLTHROUGH;
5456 case 2:
5457 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
5458 else {
5459 __Pyx_RaiseArgtupleInvalid("initialize_chunk", 1, 3, 3, 2); __PYX_ERR(0, 321, __pyx_L3_error)
5460 }
5461 }
5462 if (unlikely(kw_args > 0)) {
5463 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize_chunk") < 0)) __PYX_ERR(0, 321, __pyx_L3_error)
5464 }
5465 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5466 goto __pyx_L5_argtuple_error;
5467 } else {
5468 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5469 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5470 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5471 }
5472 __pyx_v_pxs = ((PyArrayObject *)values[0]);
5473 __pyx_v_pys = ((PyArrayObject *)values[1]);
5474 __pyx_v_level = ((PyArrayObject *)values[2]);
5475 }
5476 goto __pyx_L4_argument_unpacking_done;
5477 __pyx_L5_argtuple_error:;
5478 __Pyx_RaiseArgtupleInvalid("initialize_chunk", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 321, __pyx_L3_error)
5479 __pyx_L3_error:;
5480 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.initialize_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
5481 __Pyx_RefNannyFinishContext();
5482 return NULL;
5483 __pyx_L4_argument_unpacking_done:;
5484 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pxs), __pyx_ptype_5numpy_ndarray, 1, "pxs", 0))) __PYX_ERR(0, 322, __pyx_L1_error)
5485 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pys), __pyx_ptype_5numpy_ndarray, 1, "pys", 0))) __PYX_ERR(0, 323, __pyx_L1_error)
5486 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_level), __pyx_ptype_5numpy_ndarray, 1, "level", 0))) __PYX_ERR(0, 324, __pyx_L1_error)
5487 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_12initialize_chunk(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_pxs, __pyx_v_pys, __pyx_v_level);
5488
5489 /* function exit code */
5490 goto __pyx_L0;
5491 __pyx_L1_error:;
5492 __pyx_r = NULL;
5493 __pyx_L0:;
5494 __Pyx_RefNannyFinishContext();
5495 return __pyx_r;
5496 }
5497
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_12initialize_chunk(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,PyArrayObject * __pyx_v_pxs,PyArrayObject * __pyx_v_pys,PyArrayObject * __pyx_v_level)5498 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_12initialize_chunk(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_level) {
5499 int __pyx_v_num;
5500 int __pyx_v_p;
5501 int __pyx_v_rv;
5502 __pyx_t_5numpy_int64_t __pyx_v_pos[2];
5503 __Pyx_LocalBuf_ND __pyx_pybuffernd_level;
5504 __Pyx_Buffer __pyx_pybuffer_level;
5505 __Pyx_LocalBuf_ND __pyx_pybuffernd_pxs;
5506 __Pyx_Buffer __pyx_pybuffer_pxs;
5507 __Pyx_LocalBuf_ND __pyx_pybuffernd_pys;
5508 __Pyx_Buffer __pyx_pybuffer_pys;
5509 PyObject *__pyx_r = NULL;
5510 __Pyx_RefNannyDeclarations
5511 int __pyx_t_1;
5512 int __pyx_t_2;
5513 int __pyx_t_3;
5514 Py_ssize_t __pyx_t_4;
5515 Py_ssize_t __pyx_t_5;
5516 Py_ssize_t __pyx_t_6;
5517 int __pyx_t_7;
5518 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position __pyx_t_8;
5519 int __pyx_t_9;
5520 PyObject *__pyx_t_10 = NULL;
5521 PyObject *__pyx_t_11 = NULL;
5522 PyObject *__pyx_t_12 = NULL;
5523 PyObject *__pyx_t_13 = NULL;
5524 PyObject *__pyx_t_14 = NULL;
5525 PyObject *__pyx_t_15 = NULL;
5526 __Pyx_RefNannySetupContext("initialize_chunk", 0);
5527 __pyx_pybuffer_pxs.pybuffer.buf = NULL;
5528 __pyx_pybuffer_pxs.refcount = 0;
5529 __pyx_pybuffernd_pxs.data = NULL;
5530 __pyx_pybuffernd_pxs.rcbuffer = &__pyx_pybuffer_pxs;
5531 __pyx_pybuffer_pys.pybuffer.buf = NULL;
5532 __pyx_pybuffer_pys.refcount = 0;
5533 __pyx_pybuffernd_pys.data = NULL;
5534 __pyx_pybuffernd_pys.rcbuffer = &__pyx_pybuffer_pys;
5535 __pyx_pybuffer_level.pybuffer.buf = NULL;
5536 __pyx_pybuffer_level.refcount = 0;
5537 __pyx_pybuffernd_level.data = NULL;
5538 __pyx_pybuffernd_level.rcbuffer = &__pyx_pybuffer_level;
5539 {
5540 __Pyx_BufFmt_StackElem __pyx_stack[1];
5541 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer, (PyObject*)__pyx_v_pxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 321, __pyx_L1_error)
5542 }
5543 __pyx_pybuffernd_pxs.diminfo[0].strides = __pyx_pybuffernd_pxs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pxs.diminfo[0].shape = __pyx_pybuffernd_pxs.rcbuffer->pybuffer.shape[0];
5544 {
5545 __Pyx_BufFmt_StackElem __pyx_stack[1];
5546 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pys.rcbuffer->pybuffer, (PyObject*)__pyx_v_pys, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 321, __pyx_L1_error)
5547 }
5548 __pyx_pybuffernd_pys.diminfo[0].strides = __pyx_pybuffernd_pys.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pys.diminfo[0].shape = __pyx_pybuffernd_pys.rcbuffer->pybuffer.shape[0];
5549 {
5550 __Pyx_BufFmt_StackElem __pyx_stack[1];
5551 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_level.rcbuffer->pybuffer, (PyObject*)__pyx_v_level, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 321, __pyx_L1_error)
5552 }
5553 __pyx_pybuffernd_level.diminfo[0].strides = __pyx_pybuffernd_level.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_level.diminfo[0].shape = __pyx_pybuffernd_level.rcbuffer->pybuffer.shape[0];
5554
5555 /* "yt/utilities/lib/quad_tree.pyx":325
5556 * np.ndarray[np.int64_t, ndim=1] pys,
5557 * np.ndarray[np.int64_t, ndim=1] level):
5558 * cdef int num = pxs.shape[0] # <<<<<<<<<<<<<<
5559 * cdef int p, rv
5560 * cdef np.int64_t pos[2]
5561 */
5562 __pyx_v_num = (__pyx_v_pxs->dimensions[0]);
5563
5564 /* "yt/utilities/lib/quad_tree.pyx":328
5565 * cdef int p, rv
5566 * cdef np.int64_t pos[2]
5567 * for p in range(num): # <<<<<<<<<<<<<<
5568 * pos[0] = pxs[p]
5569 * pos[1] = pys[p]
5570 */
5571 __pyx_t_1 = __pyx_v_num;
5572 __pyx_t_2 = __pyx_t_1;
5573 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5574 __pyx_v_p = __pyx_t_3;
5575
5576 /* "yt/utilities/lib/quad_tree.pyx":329
5577 * cdef np.int64_t pos[2]
5578 * for p in range(num):
5579 * pos[0] = pxs[p] # <<<<<<<<<<<<<<
5580 * pos[1] = pys[p]
5581 * rv = self.add_to_position(level[p], pos, NULL, 0.0, 1)
5582 */
5583 __pyx_t_4 = __pyx_v_p;
5584 (__pyx_v_pos[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pxs.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pxs.diminfo[0].strides));
5585
5586 /* "yt/utilities/lib/quad_tree.pyx":330
5587 * for p in range(num):
5588 * pos[0] = pxs[p]
5589 * pos[1] = pys[p] # <<<<<<<<<<<<<<
5590 * rv = self.add_to_position(level[p], pos, NULL, 0.0, 1)
5591 * if rv == -1:
5592 */
5593 __pyx_t_5 = __pyx_v_p;
5594 (__pyx_v_pos[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pys.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pys.diminfo[0].strides));
5595
5596 /* "yt/utilities/lib/quad_tree.pyx":331
5597 * pos[0] = pxs[p]
5598 * pos[1] = pys[p]
5599 * rv = self.add_to_position(level[p], pos, NULL, 0.0, 1) # <<<<<<<<<<<<<<
5600 * if rv == -1:
5601 * raise YTIntDomainOverflow(
5602 */
5603 __pyx_t_6 = __pyx_v_p;
5604 __pyx_t_8.__pyx_n = 1;
5605 __pyx_t_8.skip = 1;
5606 __pyx_t_7 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->add_to_position(__pyx_v_self, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_level.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_level.diminfo[0].strides)), __pyx_v_pos, NULL, 0.0, &__pyx_t_8);
5607 __pyx_v_rv = __pyx_t_7;
5608
5609 /* "yt/utilities/lib/quad_tree.pyx":332
5610 * pos[1] = pys[p]
5611 * rv = self.add_to_position(level[p], pos, NULL, 0.0, 1)
5612 * if rv == -1: # <<<<<<<<<<<<<<
5613 * raise YTIntDomainOverflow(
5614 * (self.last_dims[0], self.last_dims[1]),
5615 */
5616 __pyx_t_9 = ((__pyx_v_rv == -1L) != 0);
5617 if (unlikely(__pyx_t_9)) {
5618
5619 /* "yt/utilities/lib/quad_tree.pyx":333
5620 * rv = self.add_to_position(level[p], pos, NULL, 0.0, 1)
5621 * if rv == -1:
5622 * raise YTIntDomainOverflow( # <<<<<<<<<<<<<<
5623 * (self.last_dims[0], self.last_dims[1]),
5624 * (self.top_grid_dims[0], self.top_grid_dims[1]))
5625 */
5626 __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_YTIntDomainOverflow); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 333, __pyx_L1_error)
5627 __Pyx_GOTREF(__pyx_t_11);
5628
5629 /* "yt/utilities/lib/quad_tree.pyx":334
5630 * if rv == -1:
5631 * raise YTIntDomainOverflow(
5632 * (self.last_dims[0], self.last_dims[1]), # <<<<<<<<<<<<<<
5633 * (self.top_grid_dims[0], self.top_grid_dims[1]))
5634 * return
5635 */
5636 __pyx_t_12 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->last_dims[0])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 334, __pyx_L1_error)
5637 __Pyx_GOTREF(__pyx_t_12);
5638 __pyx_t_13 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->last_dims[1])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 334, __pyx_L1_error)
5639 __Pyx_GOTREF(__pyx_t_13);
5640 __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 334, __pyx_L1_error)
5641 __Pyx_GOTREF(__pyx_t_14);
5642 __Pyx_GIVEREF(__pyx_t_12);
5643 PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12);
5644 __Pyx_GIVEREF(__pyx_t_13);
5645 PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
5646 __pyx_t_12 = 0;
5647 __pyx_t_13 = 0;
5648
5649 /* "yt/utilities/lib/quad_tree.pyx":335
5650 * raise YTIntDomainOverflow(
5651 * (self.last_dims[0], self.last_dims[1]),
5652 * (self.top_grid_dims[0], self.top_grid_dims[1])) # <<<<<<<<<<<<<<
5653 * return
5654 *
5655 */
5656 __pyx_t_13 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->top_grid_dims[0])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 335, __pyx_L1_error)
5657 __Pyx_GOTREF(__pyx_t_13);
5658 __pyx_t_12 = __Pyx_PyInt_From_npy_int64((__pyx_v_self->top_grid_dims[1])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 335, __pyx_L1_error)
5659 __Pyx_GOTREF(__pyx_t_12);
5660 __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 335, __pyx_L1_error)
5661 __Pyx_GOTREF(__pyx_t_15);
5662 __Pyx_GIVEREF(__pyx_t_13);
5663 PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13);
5664 __Pyx_GIVEREF(__pyx_t_12);
5665 PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_12);
5666 __pyx_t_13 = 0;
5667 __pyx_t_12 = 0;
5668 __pyx_t_12 = NULL;
5669 __pyx_t_7 = 0;
5670 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
5671 __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
5672 if (likely(__pyx_t_12)) {
5673 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
5674 __Pyx_INCREF(__pyx_t_12);
5675 __Pyx_INCREF(function);
5676 __Pyx_DECREF_SET(__pyx_t_11, function);
5677 __pyx_t_7 = 1;
5678 }
5679 }
5680 #if CYTHON_FAST_PYCALL
5681 if (PyFunction_Check(__pyx_t_11)) {
5682 PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_14, __pyx_t_15};
5683 __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 333, __pyx_L1_error)
5684 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
5685 __Pyx_GOTREF(__pyx_t_10);
5686 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5687 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5688 } else
5689 #endif
5690 #if CYTHON_FAST_PYCCALL
5691 if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
5692 PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_14, __pyx_t_15};
5693 __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 333, __pyx_L1_error)
5694 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
5695 __Pyx_GOTREF(__pyx_t_10);
5696 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5697 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5698 } else
5699 #endif
5700 {
5701 __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 333, __pyx_L1_error)
5702 __Pyx_GOTREF(__pyx_t_13);
5703 if (__pyx_t_12) {
5704 __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
5705 }
5706 __Pyx_GIVEREF(__pyx_t_14);
5707 PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_t_14);
5708 __Pyx_GIVEREF(__pyx_t_15);
5709 PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_15);
5710 __pyx_t_14 = 0;
5711 __pyx_t_15 = 0;
5712 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 333, __pyx_L1_error)
5713 __Pyx_GOTREF(__pyx_t_10);
5714 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
5715 }
5716 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5717 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
5718 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5719 __PYX_ERR(0, 333, __pyx_L1_error)
5720
5721 /* "yt/utilities/lib/quad_tree.pyx":332
5722 * pos[1] = pys[p]
5723 * rv = self.add_to_position(level[p], pos, NULL, 0.0, 1)
5724 * if rv == -1: # <<<<<<<<<<<<<<
5725 * raise YTIntDomainOverflow(
5726 * (self.last_dims[0], self.last_dims[1]),
5727 */
5728 }
5729 }
5730
5731 /* "yt/utilities/lib/quad_tree.pyx":336
5732 * (self.last_dims[0], self.last_dims[1]),
5733 * (self.top_grid_dims[0], self.top_grid_dims[1]))
5734 * return # <<<<<<<<<<<<<<
5735 *
5736 * @cython.boundscheck(False)
5737 */
5738 __Pyx_XDECREF(__pyx_r);
5739 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5740 goto __pyx_L0;
5741
5742 /* "yt/utilities/lib/quad_tree.pyx":321
5743 * @cython.boundscheck(False)
5744 * @cython.wraparound(False)
5745 * def initialize_chunk(self, # <<<<<<<<<<<<<<
5746 * np.ndarray[np.int64_t, ndim=1] pxs,
5747 * np.ndarray[np.int64_t, ndim=1] pys,
5748 */
5749
5750 /* function exit code */
5751 __pyx_L1_error:;
5752 __Pyx_XDECREF(__pyx_t_10);
5753 __Pyx_XDECREF(__pyx_t_11);
5754 __Pyx_XDECREF(__pyx_t_12);
5755 __Pyx_XDECREF(__pyx_t_13);
5756 __Pyx_XDECREF(__pyx_t_14);
5757 __Pyx_XDECREF(__pyx_t_15);
5758 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5759 __Pyx_PyThreadState_declare
5760 __Pyx_PyThreadState_assign
5761 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5762 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level.rcbuffer->pybuffer);
5763 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
5764 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
5765 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5766 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.initialize_chunk", __pyx_clineno, __pyx_lineno, __pyx_filename);
5767 __pyx_r = NULL;
5768 goto __pyx_L2;
5769 __pyx_L0:;
5770 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_level.rcbuffer->pybuffer);
5771 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
5772 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
5773 __pyx_L2:;
5774 __Pyx_XGIVEREF(__pyx_r);
5775 __Pyx_RefNannyFinishContext();
5776 return __pyx_r;
5777 }
5778
5779 /* "yt/utilities/lib/quad_tree.pyx":341
5780 * @cython.wraparound(False)
5781 * @cython.cdivision(True)
5782 * def get_all(self, int count_only = 0, int method = 1): # <<<<<<<<<<<<<<
5783 * cdef int i, j, vi
5784 * cdef int total = 0
5785 */
5786
5787 /* Python wrapper */
5788 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_15get_all(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_15get_all(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5789 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_15get_all(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5790 int __pyx_v_count_only;
5791 int __pyx_v_method;
5792 PyObject *__pyx_r = 0;
5793 __Pyx_RefNannyDeclarations
5794 __Pyx_RefNannySetupContext("get_all (wrapper)", 0);
5795 {
5796 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_count_only,&__pyx_n_s_method,0};
5797 PyObject* values[2] = {0,0};
5798 if (unlikely(__pyx_kwds)) {
5799 Py_ssize_t kw_args;
5800 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5801 switch (pos_args) {
5802 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5803 CYTHON_FALLTHROUGH;
5804 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5805 CYTHON_FALLTHROUGH;
5806 case 0: break;
5807 default: goto __pyx_L5_argtuple_error;
5808 }
5809 kw_args = PyDict_Size(__pyx_kwds);
5810 switch (pos_args) {
5811 case 0:
5812 if (kw_args > 0) {
5813 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count_only);
5814 if (value) { values[0] = value; kw_args--; }
5815 }
5816 CYTHON_FALLTHROUGH;
5817 case 1:
5818 if (kw_args > 0) {
5819 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method);
5820 if (value) { values[1] = value; kw_args--; }
5821 }
5822 }
5823 if (unlikely(kw_args > 0)) {
5824 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_all") < 0)) __PYX_ERR(0, 341, __pyx_L3_error)
5825 }
5826 } else {
5827 switch (PyTuple_GET_SIZE(__pyx_args)) {
5828 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5829 CYTHON_FALLTHROUGH;
5830 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5831 CYTHON_FALLTHROUGH;
5832 case 0: break;
5833 default: goto __pyx_L5_argtuple_error;
5834 }
5835 }
5836 if (values[0]) {
5837 __pyx_v_count_only = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_count_only == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L3_error)
5838 } else {
5839 __pyx_v_count_only = ((int)0);
5840 }
5841 if (values[1]) {
5842 __pyx_v_method = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_method == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 341, __pyx_L3_error)
5843 } else {
5844 __pyx_v_method = ((int)1);
5845 }
5846 }
5847 goto __pyx_L4_argument_unpacking_done;
5848 __pyx_L5_argtuple_error:;
5849 __Pyx_RaiseArgtupleInvalid("get_all", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 341, __pyx_L3_error)
5850 __pyx_L3_error:;
5851 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.get_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
5852 __Pyx_RefNannyFinishContext();
5853 return NULL;
5854 __pyx_L4_argument_unpacking_done:;
5855 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_14get_all(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_count_only, __pyx_v_method);
5856
5857 /* function exit code */
5858 __Pyx_RefNannyFinishContext();
5859 return __pyx_r;
5860 }
5861
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_14get_all(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,int __pyx_v_count_only,int __pyx_v_method)5862 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_14get_all(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, int __pyx_v_count_only, int __pyx_v_method) {
5863 int __pyx_v_i;
5864 int __pyx_v_j;
5865 int __pyx_v_vi;
5866 int __pyx_v_total;
5867 PyArrayObject *__pyx_v_opx = 0;
5868 PyArrayObject *__pyx_v_opy = 0;
5869 PyArrayObject *__pyx_v_opdx = 0;
5870 PyArrayObject *__pyx_v_opdy = 0;
5871 PyArrayObject *__pyx_v_nvals = 0;
5872 PyArrayObject *__pyx_v_nwvals = 0;
5873 __pyx_t_5numpy_int64_t __pyx_v_curpos;
5874 __pyx_t_5numpy_float64_t *__pyx_v_px;
5875 __pyx_t_5numpy_float64_t *__pyx_v_py;
5876 __pyx_t_5numpy_float64_t *__pyx_v_pdx;
5877 __pyx_t_5numpy_float64_t *__pyx_v_pdy;
5878 __pyx_t_5numpy_float64_t *__pyx_v_vdata;
5879 __pyx_t_5numpy_float64_t *__pyx_v_wdata;
5880 __pyx_t_5numpy_float64_t __pyx_v_wtoadd;
5881 __pyx_t_5numpy_float64_t *__pyx_v_vtoadd;
5882 __Pyx_LocalBuf_ND __pyx_pybuffernd_nvals;
5883 __Pyx_Buffer __pyx_pybuffer_nvals;
5884 __Pyx_LocalBuf_ND __pyx_pybuffernd_nwvals;
5885 __Pyx_Buffer __pyx_pybuffer_nwvals;
5886 __Pyx_LocalBuf_ND __pyx_pybuffernd_opdx;
5887 __Pyx_Buffer __pyx_pybuffer_opdx;
5888 __Pyx_LocalBuf_ND __pyx_pybuffernd_opdy;
5889 __Pyx_Buffer __pyx_pybuffer_opdy;
5890 __Pyx_LocalBuf_ND __pyx_pybuffernd_opx;
5891 __Pyx_Buffer __pyx_pybuffer_opx;
5892 __Pyx_LocalBuf_ND __pyx_pybuffernd_opy;
5893 __Pyx_Buffer __pyx_pybuffer_opy;
5894 PyObject *__pyx_r = NULL;
5895 __Pyx_RefNannyDeclarations
5896 __pyx_t_5numpy_int64_t __pyx_t_1;
5897 __pyx_t_5numpy_int64_t __pyx_t_2;
5898 int __pyx_t_3;
5899 __pyx_t_5numpy_int64_t __pyx_t_4;
5900 __pyx_t_5numpy_int64_t __pyx_t_5;
5901 int __pyx_t_6;
5902 int __pyx_t_7;
5903 PyObject *__pyx_t_8 = NULL;
5904 PyObject *__pyx_t_9 = NULL;
5905 PyObject *__pyx_t_10 = NULL;
5906 PyObject *__pyx_t_11 = NULL;
5907 PyArrayObject *__pyx_t_12 = NULL;
5908 PyObject *__pyx_t_13 = NULL;
5909 PyObject *__pyx_t_14 = NULL;
5910 PyObject *__pyx_t_15 = NULL;
5911 PyArrayObject *__pyx_t_16 = NULL;
5912 PyArrayObject *__pyx_t_17 = NULL;
5913 PyArrayObject *__pyx_t_18 = NULL;
5914 PyArrayObject *__pyx_t_19 = NULL;
5915 PyArrayObject *__pyx_t_20 = NULL;
5916 int __pyx_t_21;
5917 int __pyx_t_22;
5918 int __pyx_t_23;
5919 __Pyx_RefNannySetupContext("get_all", 0);
5920 __pyx_pybuffer_opx.pybuffer.buf = NULL;
5921 __pyx_pybuffer_opx.refcount = 0;
5922 __pyx_pybuffernd_opx.data = NULL;
5923 __pyx_pybuffernd_opx.rcbuffer = &__pyx_pybuffer_opx;
5924 __pyx_pybuffer_opy.pybuffer.buf = NULL;
5925 __pyx_pybuffer_opy.refcount = 0;
5926 __pyx_pybuffernd_opy.data = NULL;
5927 __pyx_pybuffernd_opy.rcbuffer = &__pyx_pybuffer_opy;
5928 __pyx_pybuffer_opdx.pybuffer.buf = NULL;
5929 __pyx_pybuffer_opdx.refcount = 0;
5930 __pyx_pybuffernd_opdx.data = NULL;
5931 __pyx_pybuffernd_opdx.rcbuffer = &__pyx_pybuffer_opdx;
5932 __pyx_pybuffer_opdy.pybuffer.buf = NULL;
5933 __pyx_pybuffer_opdy.refcount = 0;
5934 __pyx_pybuffernd_opdy.data = NULL;
5935 __pyx_pybuffernd_opdy.rcbuffer = &__pyx_pybuffer_opdy;
5936 __pyx_pybuffer_nvals.pybuffer.buf = NULL;
5937 __pyx_pybuffer_nvals.refcount = 0;
5938 __pyx_pybuffernd_nvals.data = NULL;
5939 __pyx_pybuffernd_nvals.rcbuffer = &__pyx_pybuffer_nvals;
5940 __pyx_pybuffer_nwvals.pybuffer.buf = NULL;
5941 __pyx_pybuffer_nwvals.refcount = 0;
5942 __pyx_pybuffernd_nwvals.data = NULL;
5943 __pyx_pybuffernd_nwvals.rcbuffer = &__pyx_pybuffer_nwvals;
5944
5945 /* "yt/utilities/lib/quad_tree.pyx":343
5946 * def get_all(self, int count_only = 0, int method = 1):
5947 * cdef int i, j, vi
5948 * cdef int total = 0 # <<<<<<<<<<<<<<
5949 * self.merged = method
5950 * for i in range(self.top_grid_dims[0]):
5951 */
5952 __pyx_v_total = 0;
5953
5954 /* "yt/utilities/lib/quad_tree.pyx":344
5955 * cdef int i, j, vi
5956 * cdef int total = 0
5957 * self.merged = method # <<<<<<<<<<<<<<
5958 * for i in range(self.top_grid_dims[0]):
5959 * for j in range(self.top_grid_dims[1]):
5960 */
5961 __pyx_v_self->merged = __pyx_v_method;
5962
5963 /* "yt/utilities/lib/quad_tree.pyx":345
5964 * cdef int total = 0
5965 * self.merged = method
5966 * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<<
5967 * for j in range(self.top_grid_dims[1]):
5968 * total += self.count(self.root_nodes[i][j])
5969 */
5970 __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
5971 __pyx_t_2 = __pyx_t_1;
5972 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5973 __pyx_v_i = __pyx_t_3;
5974
5975 /* "yt/utilities/lib/quad_tree.pyx":346
5976 * self.merged = method
5977 * for i in range(self.top_grid_dims[0]):
5978 * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<<
5979 * total += self.count(self.root_nodes[i][j])
5980 * if count_only: return total
5981 */
5982 __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
5983 __pyx_t_5 = __pyx_t_4;
5984 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
5985 __pyx_v_j = __pyx_t_6;
5986
5987 /* "yt/utilities/lib/quad_tree.pyx":347
5988 * for i in range(self.top_grid_dims[0]):
5989 * for j in range(self.top_grid_dims[1]):
5990 * total += self.count(self.root_nodes[i][j]) # <<<<<<<<<<<<<<
5991 * if count_only: return total
5992 * # Allocate our array
5993 */
5994 __pyx_v_total = (__pyx_v_total + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->count(__pyx_v_self, ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])));
5995 }
5996 }
5997
5998 /* "yt/utilities/lib/quad_tree.pyx":348
5999 * for j in range(self.top_grid_dims[1]):
6000 * total += self.count(self.root_nodes[i][j])
6001 * if count_only: return total # <<<<<<<<<<<<<<
6002 * # Allocate our array
6003 * cdef np.ndarray[np.float64_t, ndim=1] opx
6004 */
6005 __pyx_t_7 = (__pyx_v_count_only != 0);
6006 if (__pyx_t_7) {
6007 __Pyx_XDECREF(__pyx_r);
6008 __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error)
6009 __Pyx_GOTREF(__pyx_t_8);
6010 __pyx_r = __pyx_t_8;
6011 __pyx_t_8 = 0;
6012 goto __pyx_L0;
6013 }
6014
6015 /* "yt/utilities/lib/quad_tree.pyx":356
6016 * cdef np.ndarray[np.float64_t, ndim=2] nvals
6017 * cdef np.ndarray[np.float64_t, ndim=1] nwvals
6018 * opx = np.zeros(total, dtype='float64') # <<<<<<<<<<<<<<
6019 * opy = np.zeros(total, dtype='float64')
6020 * opdx = np.zeros(total, dtype='float64')
6021 */
6022 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error)
6023 __Pyx_GOTREF(__pyx_t_8);
6024 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error)
6025 __Pyx_GOTREF(__pyx_t_9);
6026 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6027 __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error)
6028 __Pyx_GOTREF(__pyx_t_8);
6029 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 356, __pyx_L1_error)
6030 __Pyx_GOTREF(__pyx_t_10);
6031 __Pyx_GIVEREF(__pyx_t_8);
6032 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
6033 __pyx_t_8 = 0;
6034 __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error)
6035 __Pyx_GOTREF(__pyx_t_8);
6036 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 356, __pyx_L1_error)
6037 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 356, __pyx_L1_error)
6038 __Pyx_GOTREF(__pyx_t_11);
6039 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6040 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6041 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6042 if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 356, __pyx_L1_error)
6043 __pyx_t_12 = ((PyArrayObject *)__pyx_t_11);
6044 {
6045 __Pyx_BufFmt_StackElem __pyx_stack[1];
6046 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opx.rcbuffer->pybuffer);
6047 __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opx.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6048 if (unlikely(__pyx_t_3 < 0)) {
6049 PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
6050 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opx.rcbuffer->pybuffer, (PyObject*)__pyx_v_opx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6051 Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
6052 __Pyx_RaiseBufferFallbackError();
6053 } else {
6054 PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
6055 }
6056 __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
6057 }
6058 __pyx_pybuffernd_opx.diminfo[0].strides = __pyx_pybuffernd_opx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_opx.diminfo[0].shape = __pyx_pybuffernd_opx.rcbuffer->pybuffer.shape[0];
6059 if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
6060 }
6061 __pyx_t_12 = 0;
6062 __pyx_v_opx = ((PyArrayObject *)__pyx_t_11);
6063 __pyx_t_11 = 0;
6064
6065 /* "yt/utilities/lib/quad_tree.pyx":357
6066 * cdef np.ndarray[np.float64_t, ndim=1] nwvals
6067 * opx = np.zeros(total, dtype='float64')
6068 * opy = np.zeros(total, dtype='float64') # <<<<<<<<<<<<<<
6069 * opdx = np.zeros(total, dtype='float64')
6070 * opdy = np.zeros(total, dtype='float64')
6071 */
6072 __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 357, __pyx_L1_error)
6073 __Pyx_GOTREF(__pyx_t_11);
6074 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 357, __pyx_L1_error)
6075 __Pyx_GOTREF(__pyx_t_8);
6076 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6077 __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 357, __pyx_L1_error)
6078 __Pyx_GOTREF(__pyx_t_11);
6079 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 357, __pyx_L1_error)
6080 __Pyx_GOTREF(__pyx_t_10);
6081 __Pyx_GIVEREF(__pyx_t_11);
6082 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
6083 __pyx_t_11 = 0;
6084 __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 357, __pyx_L1_error)
6085 __Pyx_GOTREF(__pyx_t_11);
6086 if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 357, __pyx_L1_error)
6087 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 357, __pyx_L1_error)
6088 __Pyx_GOTREF(__pyx_t_9);
6089 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6090 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6091 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6092 if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 357, __pyx_L1_error)
6093 __pyx_t_16 = ((PyArrayObject *)__pyx_t_9);
6094 {
6095 __Pyx_BufFmt_StackElem __pyx_stack[1];
6096 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opy.rcbuffer->pybuffer);
6097 __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opy.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6098 if (unlikely(__pyx_t_3 < 0)) {
6099 PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
6100 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opy.rcbuffer->pybuffer, (PyObject*)__pyx_v_opy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6101 Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
6102 __Pyx_RaiseBufferFallbackError();
6103 } else {
6104 PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
6105 }
6106 __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
6107 }
6108 __pyx_pybuffernd_opy.diminfo[0].strides = __pyx_pybuffernd_opy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_opy.diminfo[0].shape = __pyx_pybuffernd_opy.rcbuffer->pybuffer.shape[0];
6109 if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 357, __pyx_L1_error)
6110 }
6111 __pyx_t_16 = 0;
6112 __pyx_v_opy = ((PyArrayObject *)__pyx_t_9);
6113 __pyx_t_9 = 0;
6114
6115 /* "yt/utilities/lib/quad_tree.pyx":358
6116 * opx = np.zeros(total, dtype='float64')
6117 * opy = np.zeros(total, dtype='float64')
6118 * opdx = np.zeros(total, dtype='float64') # <<<<<<<<<<<<<<
6119 * opdy = np.zeros(total, dtype='float64')
6120 * nvals = np.zeros( (total, self.nvals), dtype='float64')
6121 */
6122 __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 358, __pyx_L1_error)
6123 __Pyx_GOTREF(__pyx_t_9);
6124 __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 358, __pyx_L1_error)
6125 __Pyx_GOTREF(__pyx_t_11);
6126 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6127 __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 358, __pyx_L1_error)
6128 __Pyx_GOTREF(__pyx_t_9);
6129 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 358, __pyx_L1_error)
6130 __Pyx_GOTREF(__pyx_t_10);
6131 __Pyx_GIVEREF(__pyx_t_9);
6132 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
6133 __pyx_t_9 = 0;
6134 __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 358, __pyx_L1_error)
6135 __Pyx_GOTREF(__pyx_t_9);
6136 if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 358, __pyx_L1_error)
6137 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
6138 __Pyx_GOTREF(__pyx_t_8);
6139 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6140 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6141 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6142 if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 358, __pyx_L1_error)
6143 __pyx_t_17 = ((PyArrayObject *)__pyx_t_8);
6144 {
6145 __Pyx_BufFmt_StackElem __pyx_stack[1];
6146 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opdx.rcbuffer->pybuffer);
6147 __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opdx.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6148 if (unlikely(__pyx_t_3 < 0)) {
6149 PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
6150 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opdx.rcbuffer->pybuffer, (PyObject*)__pyx_v_opdx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6151 Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
6152 __Pyx_RaiseBufferFallbackError();
6153 } else {
6154 PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
6155 }
6156 __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
6157 }
6158 __pyx_pybuffernd_opdx.diminfo[0].strides = __pyx_pybuffernd_opdx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_opdx.diminfo[0].shape = __pyx_pybuffernd_opdx.rcbuffer->pybuffer.shape[0];
6159 if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
6160 }
6161 __pyx_t_17 = 0;
6162 __pyx_v_opdx = ((PyArrayObject *)__pyx_t_8);
6163 __pyx_t_8 = 0;
6164
6165 /* "yt/utilities/lib/quad_tree.pyx":359
6166 * opy = np.zeros(total, dtype='float64')
6167 * opdx = np.zeros(total, dtype='float64')
6168 * opdy = np.zeros(total, dtype='float64') # <<<<<<<<<<<<<<
6169 * nvals = np.zeros( (total, self.nvals), dtype='float64')
6170 * nwvals = np.zeros( total, dtype='float64')
6171 */
6172 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error)
6173 __Pyx_GOTREF(__pyx_t_8);
6174 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 359, __pyx_L1_error)
6175 __Pyx_GOTREF(__pyx_t_9);
6176 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6177 __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error)
6178 __Pyx_GOTREF(__pyx_t_8);
6179 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 359, __pyx_L1_error)
6180 __Pyx_GOTREF(__pyx_t_10);
6181 __Pyx_GIVEREF(__pyx_t_8);
6182 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
6183 __pyx_t_8 = 0;
6184 __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error)
6185 __Pyx_GOTREF(__pyx_t_8);
6186 if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
6187 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 359, __pyx_L1_error)
6188 __Pyx_GOTREF(__pyx_t_11);
6189 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6190 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6191 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6192 if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 359, __pyx_L1_error)
6193 __pyx_t_18 = ((PyArrayObject *)__pyx_t_11);
6194 {
6195 __Pyx_BufFmt_StackElem __pyx_stack[1];
6196 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opdy.rcbuffer->pybuffer);
6197 __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opdy.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6198 if (unlikely(__pyx_t_3 < 0)) {
6199 PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
6200 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_opdy.rcbuffer->pybuffer, (PyObject*)__pyx_v_opdy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6201 Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
6202 __Pyx_RaiseBufferFallbackError();
6203 } else {
6204 PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
6205 }
6206 __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
6207 }
6208 __pyx_pybuffernd_opdy.diminfo[0].strides = __pyx_pybuffernd_opdy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_opdy.diminfo[0].shape = __pyx_pybuffernd_opdy.rcbuffer->pybuffer.shape[0];
6209 if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 359, __pyx_L1_error)
6210 }
6211 __pyx_t_18 = 0;
6212 __pyx_v_opdy = ((PyArrayObject *)__pyx_t_11);
6213 __pyx_t_11 = 0;
6214
6215 /* "yt/utilities/lib/quad_tree.pyx":360
6216 * opdx = np.zeros(total, dtype='float64')
6217 * opdy = np.zeros(total, dtype='float64')
6218 * nvals = np.zeros( (total, self.nvals), dtype='float64') # <<<<<<<<<<<<<<
6219 * nwvals = np.zeros( total, dtype='float64')
6220 * cdef np.int64_t curpos = 0
6221 */
6222 __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error)
6223 __Pyx_GOTREF(__pyx_t_11);
6224 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 360, __pyx_L1_error)
6225 __Pyx_GOTREF(__pyx_t_8);
6226 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6227 __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error)
6228 __Pyx_GOTREF(__pyx_t_11);
6229 __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_self->nvals); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 360, __pyx_L1_error)
6230 __Pyx_GOTREF(__pyx_t_10);
6231 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 360, __pyx_L1_error)
6232 __Pyx_GOTREF(__pyx_t_9);
6233 __Pyx_GIVEREF(__pyx_t_11);
6234 PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
6235 __Pyx_GIVEREF(__pyx_t_10);
6236 PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
6237 __pyx_t_11 = 0;
6238 __pyx_t_10 = 0;
6239 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 360, __pyx_L1_error)
6240 __Pyx_GOTREF(__pyx_t_10);
6241 __Pyx_GIVEREF(__pyx_t_9);
6242 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
6243 __pyx_t_9 = 0;
6244 __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 360, __pyx_L1_error)
6245 __Pyx_GOTREF(__pyx_t_9);
6246 if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
6247 __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 360, __pyx_L1_error)
6248 __Pyx_GOTREF(__pyx_t_11);
6249 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6250 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6251 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6252 if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 360, __pyx_L1_error)
6253 __pyx_t_19 = ((PyArrayObject *)__pyx_t_11);
6254 {
6255 __Pyx_BufFmt_StackElem __pyx_stack[1];
6256 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer);
6257 __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
6258 if (unlikely(__pyx_t_3 < 0)) {
6259 PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
6260 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer, (PyObject*)__pyx_v_nvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
6261 Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
6262 __Pyx_RaiseBufferFallbackError();
6263 } else {
6264 PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
6265 }
6266 __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
6267 }
6268 __pyx_pybuffernd_nvals.diminfo[0].strides = __pyx_pybuffernd_nvals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nvals.diminfo[0].shape = __pyx_pybuffernd_nvals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nvals.diminfo[1].strides = __pyx_pybuffernd_nvals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nvals.diminfo[1].shape = __pyx_pybuffernd_nvals.rcbuffer->pybuffer.shape[1];
6269 if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 360, __pyx_L1_error)
6270 }
6271 __pyx_t_19 = 0;
6272 __pyx_v_nvals = ((PyArrayObject *)__pyx_t_11);
6273 __pyx_t_11 = 0;
6274
6275 /* "yt/utilities/lib/quad_tree.pyx":361
6276 * opdy = np.zeros(total, dtype='float64')
6277 * nvals = np.zeros( (total, self.nvals), dtype='float64')
6278 * nwvals = np.zeros( total, dtype='float64') # <<<<<<<<<<<<<<
6279 * cdef np.int64_t curpos = 0
6280 * cdef np.float64_t *px = <np.float64_t *> opx.data
6281 */
6282 __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error)
6283 __Pyx_GOTREF(__pyx_t_11);
6284 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 361, __pyx_L1_error)
6285 __Pyx_GOTREF(__pyx_t_9);
6286 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6287 __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error)
6288 __Pyx_GOTREF(__pyx_t_11);
6289 __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 361, __pyx_L1_error)
6290 __Pyx_GOTREF(__pyx_t_10);
6291 __Pyx_GIVEREF(__pyx_t_11);
6292 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
6293 __pyx_t_11 = 0;
6294 __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 361, __pyx_L1_error)
6295 __Pyx_GOTREF(__pyx_t_11);
6296 if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 361, __pyx_L1_error)
6297 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L1_error)
6298 __Pyx_GOTREF(__pyx_t_8);
6299 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6300 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6301 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6302 if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 361, __pyx_L1_error)
6303 __pyx_t_20 = ((PyArrayObject *)__pyx_t_8);
6304 {
6305 __Pyx_BufFmt_StackElem __pyx_stack[1];
6306 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer);
6307 __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6308 if (unlikely(__pyx_t_3 < 0)) {
6309 PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
6310 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer, (PyObject*)__pyx_v_nwvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6311 Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
6312 __Pyx_RaiseBufferFallbackError();
6313 } else {
6314 PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
6315 }
6316 __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
6317 }
6318 __pyx_pybuffernd_nwvals.diminfo[0].strides = __pyx_pybuffernd_nwvals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nwvals.diminfo[0].shape = __pyx_pybuffernd_nwvals.rcbuffer->pybuffer.shape[0];
6319 if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 361, __pyx_L1_error)
6320 }
6321 __pyx_t_20 = 0;
6322 __pyx_v_nwvals = ((PyArrayObject *)__pyx_t_8);
6323 __pyx_t_8 = 0;
6324
6325 /* "yt/utilities/lib/quad_tree.pyx":362
6326 * nvals = np.zeros( (total, self.nvals), dtype='float64')
6327 * nwvals = np.zeros( total, dtype='float64')
6328 * cdef np.int64_t curpos = 0 # <<<<<<<<<<<<<<
6329 * cdef np.float64_t *px = <np.float64_t *> opx.data
6330 * cdef np.float64_t *py = <np.float64_t *> opy.data
6331 */
6332 __pyx_v_curpos = 0;
6333
6334 /* "yt/utilities/lib/quad_tree.pyx":363
6335 * nwvals = np.zeros( total, dtype='float64')
6336 * cdef np.int64_t curpos = 0
6337 * cdef np.float64_t *px = <np.float64_t *> opx.data # <<<<<<<<<<<<<<
6338 * cdef np.float64_t *py = <np.float64_t *> opy.data
6339 * cdef np.float64_t *pdx = <np.float64_t *> opdx.data
6340 */
6341 __pyx_v_px = ((__pyx_t_5numpy_float64_t *)__pyx_v_opx->data);
6342
6343 /* "yt/utilities/lib/quad_tree.pyx":364
6344 * cdef np.int64_t curpos = 0
6345 * cdef np.float64_t *px = <np.float64_t *> opx.data
6346 * cdef np.float64_t *py = <np.float64_t *> opy.data # <<<<<<<<<<<<<<
6347 * cdef np.float64_t *pdx = <np.float64_t *> opdx.data
6348 * cdef np.float64_t *pdy = <np.float64_t *> opdy.data
6349 */
6350 __pyx_v_py = ((__pyx_t_5numpy_float64_t *)__pyx_v_opy->data);
6351
6352 /* "yt/utilities/lib/quad_tree.pyx":365
6353 * cdef np.float64_t *px = <np.float64_t *> opx.data
6354 * cdef np.float64_t *py = <np.float64_t *> opy.data
6355 * cdef np.float64_t *pdx = <np.float64_t *> opdx.data # <<<<<<<<<<<<<<
6356 * cdef np.float64_t *pdy = <np.float64_t *> opdy.data
6357 * cdef np.float64_t *vdata = <np.float64_t *> nvals.data
6358 */
6359 __pyx_v_pdx = ((__pyx_t_5numpy_float64_t *)__pyx_v_opdx->data);
6360
6361 /* "yt/utilities/lib/quad_tree.pyx":366
6362 * cdef np.float64_t *py = <np.float64_t *> opy.data
6363 * cdef np.float64_t *pdx = <np.float64_t *> opdx.data
6364 * cdef np.float64_t *pdy = <np.float64_t *> opdy.data # <<<<<<<<<<<<<<
6365 * cdef np.float64_t *vdata = <np.float64_t *> nvals.data
6366 * cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
6367 */
6368 __pyx_v_pdy = ((__pyx_t_5numpy_float64_t *)__pyx_v_opdy->data);
6369
6370 /* "yt/utilities/lib/quad_tree.pyx":367
6371 * cdef np.float64_t *pdx = <np.float64_t *> opdx.data
6372 * cdef np.float64_t *pdy = <np.float64_t *> opdy.data
6373 * cdef np.float64_t *vdata = <np.float64_t *> nvals.data # <<<<<<<<<<<<<<
6374 * cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
6375 * cdef np.float64_t wtoadd
6376 */
6377 __pyx_v_vdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nvals->data);
6378
6379 /* "yt/utilities/lib/quad_tree.pyx":368
6380 * cdef np.float64_t *pdy = <np.float64_t *> opdy.data
6381 * cdef np.float64_t *vdata = <np.float64_t *> nvals.data
6382 * cdef np.float64_t *wdata = <np.float64_t *> nwvals.data # <<<<<<<<<<<<<<
6383 * cdef np.float64_t wtoadd
6384 * cdef np.float64_t *vtoadd = <np.float64_t *> malloc(
6385 */
6386 __pyx_v_wdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nwvals->data);
6387
6388 /* "yt/utilities/lib/quad_tree.pyx":370
6389 * cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
6390 * cdef np.float64_t wtoadd
6391 * cdef np.float64_t *vtoadd = <np.float64_t *> malloc( # <<<<<<<<<<<<<<
6392 * sizeof(np.float64_t)*self.nvals)
6393 * for i in range(self.top_grid_dims[0]):
6394 */
6395 __pyx_v_vtoadd = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_self->nvals)));
6396
6397 /* "yt/utilities/lib/quad_tree.pyx":372
6398 * cdef np.float64_t *vtoadd = <np.float64_t *> malloc(
6399 * sizeof(np.float64_t)*self.nvals)
6400 * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<<
6401 * for j in range(self.top_grid_dims[1]):
6402 * for vi in range(self.nvals): vtoadd[vi] = 0.0
6403 */
6404 __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
6405 __pyx_t_2 = __pyx_t_1;
6406 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6407 __pyx_v_i = __pyx_t_3;
6408
6409 /* "yt/utilities/lib/quad_tree.pyx":373
6410 * sizeof(np.float64_t)*self.nvals)
6411 * for i in range(self.top_grid_dims[0]):
6412 * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<<
6413 * for vi in range(self.nvals): vtoadd[vi] = 0.0
6414 * wtoadd = 0.0
6415 */
6416 __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
6417 __pyx_t_5 = __pyx_t_4;
6418 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6419 __pyx_v_j = __pyx_t_6;
6420
6421 /* "yt/utilities/lib/quad_tree.pyx":374
6422 * for i in range(self.top_grid_dims[0]):
6423 * for j in range(self.top_grid_dims[1]):
6424 * for vi in range(self.nvals): vtoadd[vi] = 0.0 # <<<<<<<<<<<<<<
6425 * wtoadd = 0.0
6426 * curpos += self.fill(self.root_nodes[i][j],
6427 */
6428 __pyx_t_21 = __pyx_v_self->nvals;
6429 __pyx_t_22 = __pyx_t_21;
6430 for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
6431 __pyx_v_vi = __pyx_t_23;
6432 (__pyx_v_vtoadd[__pyx_v_vi]) = 0.0;
6433 }
6434
6435 /* "yt/utilities/lib/quad_tree.pyx":375
6436 * for j in range(self.top_grid_dims[1]):
6437 * for vi in range(self.nvals): vtoadd[vi] = 0.0
6438 * wtoadd = 0.0 # <<<<<<<<<<<<<<
6439 * curpos += self.fill(self.root_nodes[i][j],
6440 * curpos, px, py, pdx, pdy, vdata, wdata, vtoadd, wtoadd, 0)
6441 */
6442 __pyx_v_wtoadd = 0.0;
6443
6444 /* "yt/utilities/lib/quad_tree.pyx":376
6445 * for vi in range(self.nvals): vtoadd[vi] = 0.0
6446 * wtoadd = 0.0
6447 * curpos += self.fill(self.root_nodes[i][j], # <<<<<<<<<<<<<<
6448 * curpos, px, py, pdx, pdy, vdata, wdata, vtoadd, wtoadd, 0)
6449 * free(vtoadd)
6450 */
6451 __pyx_v_curpos = (__pyx_v_curpos + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->fill(__pyx_v_self, ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_curpos, __pyx_v_px, __pyx_v_py, __pyx_v_pdx, __pyx_v_pdy, __pyx_v_vdata, __pyx_v_wdata, __pyx_v_vtoadd, __pyx_v_wtoadd, 0));
6452 }
6453 }
6454
6455 /* "yt/utilities/lib/quad_tree.pyx":378
6456 * curpos += self.fill(self.root_nodes[i][j],
6457 * curpos, px, py, pdx, pdy, vdata, wdata, vtoadd, wtoadd, 0)
6458 * free(vtoadd) # <<<<<<<<<<<<<<
6459 * return opx, opy, opdx, opdy, nvals, nwvals
6460 *
6461 */
6462 free(__pyx_v_vtoadd);
6463
6464 /* "yt/utilities/lib/quad_tree.pyx":379
6465 * curpos, px, py, pdx, pdy, vdata, wdata, vtoadd, wtoadd, 0)
6466 * free(vtoadd)
6467 * return opx, opy, opdx, opdy, nvals, nwvals # <<<<<<<<<<<<<<
6468 *
6469 * cdef int count(self, QuadTreeNode *node):
6470 */
6471 __Pyx_XDECREF(__pyx_r);
6472 __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 379, __pyx_L1_error)
6473 __Pyx_GOTREF(__pyx_t_8);
6474 __Pyx_INCREF(((PyObject *)__pyx_v_opx));
6475 __Pyx_GIVEREF(((PyObject *)__pyx_v_opx));
6476 PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_opx));
6477 __Pyx_INCREF(((PyObject *)__pyx_v_opy));
6478 __Pyx_GIVEREF(((PyObject *)__pyx_v_opy));
6479 PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_opy));
6480 __Pyx_INCREF(((PyObject *)__pyx_v_opdx));
6481 __Pyx_GIVEREF(((PyObject *)__pyx_v_opdx));
6482 PyTuple_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_v_opdx));
6483 __Pyx_INCREF(((PyObject *)__pyx_v_opdy));
6484 __Pyx_GIVEREF(((PyObject *)__pyx_v_opdy));
6485 PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_v_opdy));
6486 __Pyx_INCREF(((PyObject *)__pyx_v_nvals));
6487 __Pyx_GIVEREF(((PyObject *)__pyx_v_nvals));
6488 PyTuple_SET_ITEM(__pyx_t_8, 4, ((PyObject *)__pyx_v_nvals));
6489 __Pyx_INCREF(((PyObject *)__pyx_v_nwvals));
6490 __Pyx_GIVEREF(((PyObject *)__pyx_v_nwvals));
6491 PyTuple_SET_ITEM(__pyx_t_8, 5, ((PyObject *)__pyx_v_nwvals));
6492 __pyx_r = __pyx_t_8;
6493 __pyx_t_8 = 0;
6494 goto __pyx_L0;
6495
6496 /* "yt/utilities/lib/quad_tree.pyx":341
6497 * @cython.wraparound(False)
6498 * @cython.cdivision(True)
6499 * def get_all(self, int count_only = 0, int method = 1): # <<<<<<<<<<<<<<
6500 * cdef int i, j, vi
6501 * cdef int total = 0
6502 */
6503
6504 /* function exit code */
6505 __pyx_L1_error:;
6506 __Pyx_XDECREF(__pyx_t_8);
6507 __Pyx_XDECREF(__pyx_t_9);
6508 __Pyx_XDECREF(__pyx_t_10);
6509 __Pyx_XDECREF(__pyx_t_11);
6510 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6511 __Pyx_PyThreadState_declare
6512 __Pyx_PyThreadState_assign
6513 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6514 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer);
6515 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer);
6516 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opdx.rcbuffer->pybuffer);
6517 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opdy.rcbuffer->pybuffer);
6518 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opx.rcbuffer->pybuffer);
6519 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opy.rcbuffer->pybuffer);
6520 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6521 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.get_all", __pyx_clineno, __pyx_lineno, __pyx_filename);
6522 __pyx_r = NULL;
6523 goto __pyx_L2;
6524 __pyx_L0:;
6525 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer);
6526 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer);
6527 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opdx.rcbuffer->pybuffer);
6528 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opdy.rcbuffer->pybuffer);
6529 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opx.rcbuffer->pybuffer);
6530 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_opy.rcbuffer->pybuffer);
6531 __pyx_L2:;
6532 __Pyx_XDECREF((PyObject *)__pyx_v_opx);
6533 __Pyx_XDECREF((PyObject *)__pyx_v_opy);
6534 __Pyx_XDECREF((PyObject *)__pyx_v_opdx);
6535 __Pyx_XDECREF((PyObject *)__pyx_v_opdy);
6536 __Pyx_XDECREF((PyObject *)__pyx_v_nvals);
6537 __Pyx_XDECREF((PyObject *)__pyx_v_nwvals);
6538 __Pyx_XGIVEREF(__pyx_r);
6539 __Pyx_RefNannyFinishContext();
6540 return __pyx_r;
6541 }
6542
6543 /* "yt/utilities/lib/quad_tree.pyx":381
6544 * return opx, opy, opdx, opdy, nvals, nwvals
6545 *
6546 * cdef int count(self, QuadTreeNode *node): # <<<<<<<<<<<<<<
6547 * cdef int i, j
6548 * cdef int count = 0
6549 */
6550
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_node)6551 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node) {
6552 int __pyx_v_i;
6553 int __pyx_v_j;
6554 int __pyx_v_count;
6555 int __pyx_r;
6556 __Pyx_RefNannyDeclarations
6557 int __pyx_t_1;
6558 int __pyx_t_2;
6559 int __pyx_t_3;
6560 __Pyx_RefNannySetupContext("count", 0);
6561
6562 /* "yt/utilities/lib/quad_tree.pyx":383
6563 * cdef int count(self, QuadTreeNode *node):
6564 * cdef int i, j
6565 * cdef int count = 0 # <<<<<<<<<<<<<<
6566 * if node.children[0][0] == NULL: return 1
6567 * for i in range(2):
6568 */
6569 __pyx_v_count = 0;
6570
6571 /* "yt/utilities/lib/quad_tree.pyx":384
6572 * cdef int i, j
6573 * cdef int count = 0
6574 * if node.children[0][0] == NULL: return 1 # <<<<<<<<<<<<<<
6575 * for i in range(2):
6576 * for j in range(2):
6577 */
6578 __pyx_t_1 = ((((__pyx_v_node->children[0])[0]) == NULL) != 0);
6579 if (__pyx_t_1) {
6580 __pyx_r = 1;
6581 goto __pyx_L0;
6582 }
6583
6584 /* "yt/utilities/lib/quad_tree.pyx":385
6585 * cdef int count = 0
6586 * if node.children[0][0] == NULL: return 1
6587 * for i in range(2): # <<<<<<<<<<<<<<
6588 * for j in range(2):
6589 * count += self.count(node.children[i][j])
6590 */
6591 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
6592 __pyx_v_i = __pyx_t_2;
6593
6594 /* "yt/utilities/lib/quad_tree.pyx":386
6595 * if node.children[0][0] == NULL: return 1
6596 * for i in range(2):
6597 * for j in range(2): # <<<<<<<<<<<<<<
6598 * count += self.count(node.children[i][j])
6599 * return count
6600 */
6601 for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
6602 __pyx_v_j = __pyx_t_3;
6603
6604 /* "yt/utilities/lib/quad_tree.pyx":387
6605 * for i in range(2):
6606 * for j in range(2):
6607 * count += self.count(node.children[i][j]) # <<<<<<<<<<<<<<
6608 * return count
6609 *
6610 */
6611 __pyx_v_count = (__pyx_v_count + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->count(__pyx_v_self, ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])));
6612 }
6613 }
6614
6615 /* "yt/utilities/lib/quad_tree.pyx":388
6616 * for j in range(2):
6617 * count += self.count(node.children[i][j])
6618 * return count # <<<<<<<<<<<<<<
6619 *
6620 * @cython.cdivision(True)
6621 */
6622 __pyx_r = __pyx_v_count;
6623 goto __pyx_L0;
6624
6625 /* "yt/utilities/lib/quad_tree.pyx":381
6626 * return opx, opy, opdx, opdy, nvals, nwvals
6627 *
6628 * cdef int count(self, QuadTreeNode *node): # <<<<<<<<<<<<<<
6629 * cdef int i, j
6630 * cdef int count = 0
6631 */
6632
6633 /* function exit code */
6634 __pyx_L0:;
6635 __Pyx_RefNannyFinishContext();
6636 return __pyx_r;
6637 }
6638
6639 /* "yt/utilities/lib/quad_tree.pyx":391
6640 *
6641 * @cython.cdivision(True)
6642 * cdef int fill(self, QuadTreeNode *node, # <<<<<<<<<<<<<<
6643 * np.int64_t curpos,
6644 * np.float64_t *px,
6645 */
6646
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_node,__pyx_t_5numpy_int64_t __pyx_v_curpos,__pyx_t_5numpy_float64_t * __pyx_v_px,__pyx_t_5numpy_float64_t * __pyx_v_py,__pyx_t_5numpy_float64_t * __pyx_v_pdx,__pyx_t_5numpy_float64_t * __pyx_v_pdy,__pyx_t_5numpy_float64_t * __pyx_v_vdata,__pyx_t_5numpy_float64_t * __pyx_v_wdata,__pyx_t_5numpy_float64_t * __pyx_v_vtoadd,__pyx_t_5numpy_float64_t __pyx_v_wtoadd,__pyx_t_5numpy_int64_t __pyx_v_level)6647 static int __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_node, __pyx_t_5numpy_int64_t __pyx_v_curpos, __pyx_t_5numpy_float64_t *__pyx_v_px, __pyx_t_5numpy_float64_t *__pyx_v_py, __pyx_t_5numpy_float64_t *__pyx_v_pdx, __pyx_t_5numpy_float64_t *__pyx_v_pdy, __pyx_t_5numpy_float64_t *__pyx_v_vdata, __pyx_t_5numpy_float64_t *__pyx_v_wdata, __pyx_t_5numpy_float64_t *__pyx_v_vtoadd, __pyx_t_5numpy_float64_t __pyx_v_wtoadd, __pyx_t_5numpy_int64_t __pyx_v_level) {
6648 int __pyx_v_i;
6649 int __pyx_v_j;
6650 int __pyx_v_n;
6651 __pyx_t_5numpy_float64_t *__pyx_v_vorig;
6652 __pyx_t_5numpy_int64_t __pyx_v_added;
6653 int __pyx_r;
6654 __Pyx_RefNannyDeclarations
6655 int __pyx_t_1;
6656 int __pyx_t_2;
6657 int __pyx_t_3;
6658 int __pyx_t_4;
6659 __pyx_t_5numpy_int64_t __pyx_t_5;
6660 int __pyx_t_6;
6661 int __pyx_t_7;
6662 __Pyx_RefNannySetupContext("fill", 0);
6663
6664 /* "yt/utilities/lib/quad_tree.pyx":404
6665 * cdef int i, j, n
6666 * cdef np.float64_t *vorig
6667 * vorig = <np.float64_t *> malloc(sizeof(np.float64_t) * self.nvals) # <<<<<<<<<<<<<<
6668 * if node.children[0][0] == NULL:
6669 * if self.merged == -1:
6670 */
6671 __pyx_v_vorig = ((__pyx_t_5numpy_float64_t *)malloc(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_self->nvals)));
6672
6673 /* "yt/utilities/lib/quad_tree.pyx":405
6674 * cdef np.float64_t *vorig
6675 * vorig = <np.float64_t *> malloc(sizeof(np.float64_t) * self.nvals)
6676 * if node.children[0][0] == NULL: # <<<<<<<<<<<<<<
6677 * if self.merged == -1:
6678 * for i in range(self.nvals):
6679 */
6680 __pyx_t_1 = ((((__pyx_v_node->children[0])[0]) == NULL) != 0);
6681 if (__pyx_t_1) {
6682
6683 /* "yt/utilities/lib/quad_tree.pyx":406
6684 * vorig = <np.float64_t *> malloc(sizeof(np.float64_t) * self.nvals)
6685 * if node.children[0][0] == NULL:
6686 * if self.merged == -1: # <<<<<<<<<<<<<<
6687 * for i in range(self.nvals):
6688 * vdata[self.nvals * curpos + i] = fmax(node.val[i], vtoadd[i])
6689 */
6690 __pyx_t_1 = ((__pyx_v_self->merged == -1L) != 0);
6691 if (__pyx_t_1) {
6692
6693 /* "yt/utilities/lib/quad_tree.pyx":407
6694 * if node.children[0][0] == NULL:
6695 * if self.merged == -1:
6696 * for i in range(self.nvals): # <<<<<<<<<<<<<<
6697 * vdata[self.nvals * curpos + i] = fmax(node.val[i], vtoadd[i])
6698 * wdata[curpos] = 1.0
6699 */
6700 __pyx_t_2 = __pyx_v_self->nvals;
6701 __pyx_t_3 = __pyx_t_2;
6702 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
6703 __pyx_v_i = __pyx_t_4;
6704
6705 /* "yt/utilities/lib/quad_tree.pyx":408
6706 * if self.merged == -1:
6707 * for i in range(self.nvals):
6708 * vdata[self.nvals * curpos + i] = fmax(node.val[i], vtoadd[i]) # <<<<<<<<<<<<<<
6709 * wdata[curpos] = 1.0
6710 * else:
6711 */
6712 (__pyx_v_vdata[((__pyx_v_self->nvals * __pyx_v_curpos) + __pyx_v_i)]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax((__pyx_v_node->val[__pyx_v_i]), (__pyx_v_vtoadd[__pyx_v_i]));
6713 }
6714
6715 /* "yt/utilities/lib/quad_tree.pyx":409
6716 * for i in range(self.nvals):
6717 * vdata[self.nvals * curpos + i] = fmax(node.val[i], vtoadd[i])
6718 * wdata[curpos] = 1.0 # <<<<<<<<<<<<<<
6719 * else:
6720 * for i in range(self.nvals):
6721 */
6722 (__pyx_v_wdata[__pyx_v_curpos]) = 1.0;
6723
6724 /* "yt/utilities/lib/quad_tree.pyx":406
6725 * vorig = <np.float64_t *> malloc(sizeof(np.float64_t) * self.nvals)
6726 * if node.children[0][0] == NULL:
6727 * if self.merged == -1: # <<<<<<<<<<<<<<
6728 * for i in range(self.nvals):
6729 * vdata[self.nvals * curpos + i] = fmax(node.val[i], vtoadd[i])
6730 */
6731 goto __pyx_L4;
6732 }
6733
6734 /* "yt/utilities/lib/quad_tree.pyx":411
6735 * wdata[curpos] = 1.0
6736 * else:
6737 * for i in range(self.nvals): # <<<<<<<<<<<<<<
6738 * vdata[self.nvals * curpos + i] = node.val[i] + vtoadd[i]
6739 * wdata[curpos] = node.weight_val + wtoadd
6740 */
6741 /*else*/ {
6742 __pyx_t_2 = __pyx_v_self->nvals;
6743 __pyx_t_3 = __pyx_t_2;
6744 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
6745 __pyx_v_i = __pyx_t_4;
6746
6747 /* "yt/utilities/lib/quad_tree.pyx":412
6748 * else:
6749 * for i in range(self.nvals):
6750 * vdata[self.nvals * curpos + i] = node.val[i] + vtoadd[i] # <<<<<<<<<<<<<<
6751 * wdata[curpos] = node.weight_val + wtoadd
6752 * pdx[curpos] = 1.0 / (self.top_grid_dims[0]*2**level)
6753 */
6754 (__pyx_v_vdata[((__pyx_v_self->nvals * __pyx_v_curpos) + __pyx_v_i)]) = ((__pyx_v_node->val[__pyx_v_i]) + (__pyx_v_vtoadd[__pyx_v_i]));
6755 }
6756
6757 /* "yt/utilities/lib/quad_tree.pyx":413
6758 * for i in range(self.nvals):
6759 * vdata[self.nvals * curpos + i] = node.val[i] + vtoadd[i]
6760 * wdata[curpos] = node.weight_val + wtoadd # <<<<<<<<<<<<<<
6761 * pdx[curpos] = 1.0 / (self.top_grid_dims[0]*2**level)
6762 * pdy[curpos] = 1.0 / (self.top_grid_dims[1]*2**level)
6763 */
6764 (__pyx_v_wdata[__pyx_v_curpos]) = (__pyx_v_node->weight_val + __pyx_v_wtoadd);
6765 }
6766 __pyx_L4:;
6767
6768 /* "yt/utilities/lib/quad_tree.pyx":414
6769 * vdata[self.nvals * curpos + i] = node.val[i] + vtoadd[i]
6770 * wdata[curpos] = node.weight_val + wtoadd
6771 * pdx[curpos] = 1.0 / (self.top_grid_dims[0]*2**level) # <<<<<<<<<<<<<<
6772 * pdy[curpos] = 1.0 / (self.top_grid_dims[1]*2**level)
6773 * px[curpos] = (0.5 + node.pos[0]) * pdx[curpos]
6774 */
6775 (__pyx_v_pdx[__pyx_v_curpos]) = (1.0 / ((__pyx_v_self->top_grid_dims[0]) * __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_level)));
6776
6777 /* "yt/utilities/lib/quad_tree.pyx":415
6778 * wdata[curpos] = node.weight_val + wtoadd
6779 * pdx[curpos] = 1.0 / (self.top_grid_dims[0]*2**level)
6780 * pdy[curpos] = 1.0 / (self.top_grid_dims[1]*2**level) # <<<<<<<<<<<<<<
6781 * px[curpos] = (0.5 + node.pos[0]) * pdx[curpos]
6782 * py[curpos] = (0.5 + node.pos[1]) * pdy[curpos]
6783 */
6784 (__pyx_v_pdy[__pyx_v_curpos]) = (1.0 / ((__pyx_v_self->top_grid_dims[1]) * __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_level)));
6785
6786 /* "yt/utilities/lib/quad_tree.pyx":416
6787 * pdx[curpos] = 1.0 / (self.top_grid_dims[0]*2**level)
6788 * pdy[curpos] = 1.0 / (self.top_grid_dims[1]*2**level)
6789 * px[curpos] = (0.5 + node.pos[0]) * pdx[curpos] # <<<<<<<<<<<<<<
6790 * py[curpos] = (0.5 + node.pos[1]) * pdy[curpos]
6791 * pdx[curpos] /= 2.0
6792 */
6793 (__pyx_v_px[__pyx_v_curpos]) = ((0.5 + (__pyx_v_node->pos[0])) * (__pyx_v_pdx[__pyx_v_curpos]));
6794
6795 /* "yt/utilities/lib/quad_tree.pyx":417
6796 * pdy[curpos] = 1.0 / (self.top_grid_dims[1]*2**level)
6797 * px[curpos] = (0.5 + node.pos[0]) * pdx[curpos]
6798 * py[curpos] = (0.5 + node.pos[1]) * pdy[curpos] # <<<<<<<<<<<<<<
6799 * pdx[curpos] /= 2.0
6800 * pdy[curpos] /= 2.0
6801 */
6802 (__pyx_v_py[__pyx_v_curpos]) = ((0.5 + (__pyx_v_node->pos[1])) * (__pyx_v_pdy[__pyx_v_curpos]));
6803
6804 /* "yt/utilities/lib/quad_tree.pyx":418
6805 * px[curpos] = (0.5 + node.pos[0]) * pdx[curpos]
6806 * py[curpos] = (0.5 + node.pos[1]) * pdy[curpos]
6807 * pdx[curpos] /= 2.0 # <<<<<<<<<<<<<<
6808 * pdy[curpos] /= 2.0
6809 * return 1
6810 */
6811 __pyx_t_5 = __pyx_v_curpos;
6812 (__pyx_v_pdx[__pyx_t_5]) = ((__pyx_v_pdx[__pyx_t_5]) / 2.0);
6813
6814 /* "yt/utilities/lib/quad_tree.pyx":419
6815 * py[curpos] = (0.5 + node.pos[1]) * pdy[curpos]
6816 * pdx[curpos] /= 2.0
6817 * pdy[curpos] /= 2.0 # <<<<<<<<<<<<<<
6818 * return 1
6819 * cdef np.int64_t added = 0
6820 */
6821 __pyx_t_5 = __pyx_v_curpos;
6822 (__pyx_v_pdy[__pyx_t_5]) = ((__pyx_v_pdy[__pyx_t_5]) / 2.0);
6823
6824 /* "yt/utilities/lib/quad_tree.pyx":420
6825 * pdx[curpos] /= 2.0
6826 * pdy[curpos] /= 2.0
6827 * return 1 # <<<<<<<<<<<<<<
6828 * cdef np.int64_t added = 0
6829 * if self.merged == 1:
6830 */
6831 __pyx_r = 1;
6832 goto __pyx_L0;
6833
6834 /* "yt/utilities/lib/quad_tree.pyx":405
6835 * cdef np.float64_t *vorig
6836 * vorig = <np.float64_t *> malloc(sizeof(np.float64_t) * self.nvals)
6837 * if node.children[0][0] == NULL: # <<<<<<<<<<<<<<
6838 * if self.merged == -1:
6839 * for i in range(self.nvals):
6840 */
6841 }
6842
6843 /* "yt/utilities/lib/quad_tree.pyx":421
6844 * pdy[curpos] /= 2.0
6845 * return 1
6846 * cdef np.int64_t added = 0 # <<<<<<<<<<<<<<
6847 * if self.merged == 1:
6848 * for i in range(self.nvals):
6849 */
6850 __pyx_v_added = 0;
6851
6852 /* "yt/utilities/lib/quad_tree.pyx":422
6853 * return 1
6854 * cdef np.int64_t added = 0
6855 * if self.merged == 1: # <<<<<<<<<<<<<<
6856 * for i in range(self.nvals):
6857 * vorig[i] = vtoadd[i]
6858 */
6859 switch (__pyx_v_self->merged) {
6860 case 1:
6861
6862 /* "yt/utilities/lib/quad_tree.pyx":423
6863 * cdef np.int64_t added = 0
6864 * if self.merged == 1:
6865 * for i in range(self.nvals): # <<<<<<<<<<<<<<
6866 * vorig[i] = vtoadd[i]
6867 * vtoadd[i] += node.val[i]
6868 */
6869 __pyx_t_2 = __pyx_v_self->nvals;
6870 __pyx_t_3 = __pyx_t_2;
6871 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
6872 __pyx_v_i = __pyx_t_4;
6873
6874 /* "yt/utilities/lib/quad_tree.pyx":424
6875 * if self.merged == 1:
6876 * for i in range(self.nvals):
6877 * vorig[i] = vtoadd[i] # <<<<<<<<<<<<<<
6878 * vtoadd[i] += node.val[i]
6879 * wtoadd += node.weight_val
6880 */
6881 (__pyx_v_vorig[__pyx_v_i]) = (__pyx_v_vtoadd[__pyx_v_i]);
6882
6883 /* "yt/utilities/lib/quad_tree.pyx":425
6884 * for i in range(self.nvals):
6885 * vorig[i] = vtoadd[i]
6886 * vtoadd[i] += node.val[i] # <<<<<<<<<<<<<<
6887 * wtoadd += node.weight_val
6888 * elif self.merged == -1:
6889 */
6890 __pyx_t_6 = __pyx_v_i;
6891 (__pyx_v_vtoadd[__pyx_t_6]) = ((__pyx_v_vtoadd[__pyx_t_6]) + (__pyx_v_node->val[__pyx_v_i]));
6892 }
6893
6894 /* "yt/utilities/lib/quad_tree.pyx":426
6895 * vorig[i] = vtoadd[i]
6896 * vtoadd[i] += node.val[i]
6897 * wtoadd += node.weight_val # <<<<<<<<<<<<<<
6898 * elif self.merged == -1:
6899 * for i in range(self.nvals):
6900 */
6901 __pyx_v_wtoadd = (__pyx_v_wtoadd + __pyx_v_node->weight_val);
6902
6903 /* "yt/utilities/lib/quad_tree.pyx":422
6904 * return 1
6905 * cdef np.int64_t added = 0
6906 * if self.merged == 1: # <<<<<<<<<<<<<<
6907 * for i in range(self.nvals):
6908 * vorig[i] = vtoadd[i]
6909 */
6910 break;
6911 case -1L:
6912
6913 /* "yt/utilities/lib/quad_tree.pyx":428
6914 * wtoadd += node.weight_val
6915 * elif self.merged == -1:
6916 * for i in range(self.nvals): # <<<<<<<<<<<<<<
6917 * vtoadd[i] = node.val[i]
6918 * for i in range(2):
6919 */
6920 __pyx_t_2 = __pyx_v_self->nvals;
6921 __pyx_t_3 = __pyx_t_2;
6922 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
6923 __pyx_v_i = __pyx_t_4;
6924
6925 /* "yt/utilities/lib/quad_tree.pyx":429
6926 * elif self.merged == -1:
6927 * for i in range(self.nvals):
6928 * vtoadd[i] = node.val[i] # <<<<<<<<<<<<<<
6929 * for i in range(2):
6930 * for j in range(2):
6931 */
6932 (__pyx_v_vtoadd[__pyx_v_i]) = (__pyx_v_node->val[__pyx_v_i]);
6933 }
6934
6935 /* "yt/utilities/lib/quad_tree.pyx":427
6936 * vtoadd[i] += node.val[i]
6937 * wtoadd += node.weight_val
6938 * elif self.merged == -1: # <<<<<<<<<<<<<<
6939 * for i in range(self.nvals):
6940 * vtoadd[i] = node.val[i]
6941 */
6942 break;
6943 default: break;
6944 }
6945
6946 /* "yt/utilities/lib/quad_tree.pyx":430
6947 * for i in range(self.nvals):
6948 * vtoadd[i] = node.val[i]
6949 * for i in range(2): # <<<<<<<<<<<<<<
6950 * for j in range(2):
6951 * if self.merged == -1:
6952 */
6953 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
6954 __pyx_v_i = __pyx_t_2;
6955
6956 /* "yt/utilities/lib/quad_tree.pyx":431
6957 * vtoadd[i] = node.val[i]
6958 * for i in range(2):
6959 * for j in range(2): # <<<<<<<<<<<<<<
6960 * if self.merged == -1:
6961 * for n in range(self.nvals):
6962 */
6963 for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
6964 __pyx_v_j = __pyx_t_3;
6965
6966 /* "yt/utilities/lib/quad_tree.pyx":432
6967 * for i in range(2):
6968 * for j in range(2):
6969 * if self.merged == -1: # <<<<<<<<<<<<<<
6970 * for n in range(self.nvals):
6971 * vtoadd[n] = node.val[n]
6972 */
6973 __pyx_t_1 = ((__pyx_v_self->merged == -1L) != 0);
6974 if (__pyx_t_1) {
6975
6976 /* "yt/utilities/lib/quad_tree.pyx":433
6977 * for j in range(2):
6978 * if self.merged == -1:
6979 * for n in range(self.nvals): # <<<<<<<<<<<<<<
6980 * vtoadd[n] = node.val[n]
6981 * added += self.fill(node.children[i][j],
6982 */
6983 __pyx_t_4 = __pyx_v_self->nvals;
6984 __pyx_t_6 = __pyx_t_4;
6985 for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
6986 __pyx_v_n = __pyx_t_7;
6987
6988 /* "yt/utilities/lib/quad_tree.pyx":434
6989 * if self.merged == -1:
6990 * for n in range(self.nvals):
6991 * vtoadd[n] = node.val[n] # <<<<<<<<<<<<<<
6992 * added += self.fill(node.children[i][j],
6993 * curpos + added, px, py, pdx, pdy, vdata, wdata,
6994 */
6995 (__pyx_v_vtoadd[__pyx_v_n]) = (__pyx_v_node->val[__pyx_v_n]);
6996 }
6997
6998 /* "yt/utilities/lib/quad_tree.pyx":432
6999 * for i in range(2):
7000 * for j in range(2):
7001 * if self.merged == -1: # <<<<<<<<<<<<<<
7002 * for n in range(self.nvals):
7003 * vtoadd[n] = node.val[n]
7004 */
7005 }
7006
7007 /* "yt/utilities/lib/quad_tree.pyx":435
7008 * for n in range(self.nvals):
7009 * vtoadd[n] = node.val[n]
7010 * added += self.fill(node.children[i][j], # <<<<<<<<<<<<<<
7011 * curpos + added, px, py, pdx, pdy, vdata, wdata,
7012 * vtoadd, wtoadd, level + 1)
7013 */
7014 __pyx_v_added = (__pyx_v_added + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->fill(__pyx_v_self, ((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j]), (__pyx_v_curpos + __pyx_v_added), __pyx_v_px, __pyx_v_py, __pyx_v_pdx, __pyx_v_pdy, __pyx_v_vdata, __pyx_v_wdata, __pyx_v_vtoadd, __pyx_v_wtoadd, (__pyx_v_level + 1)));
7015 }
7016 }
7017
7018 /* "yt/utilities/lib/quad_tree.pyx":438
7019 * curpos + added, px, py, pdx, pdy, vdata, wdata,
7020 * vtoadd, wtoadd, level + 1)
7021 * if self.merged == 1: # <<<<<<<<<<<<<<
7022 * for i in range(self.nvals):
7023 * vtoadd[i] = vorig[i]
7024 */
7025 __pyx_t_1 = ((__pyx_v_self->merged == 1) != 0);
7026 if (__pyx_t_1) {
7027
7028 /* "yt/utilities/lib/quad_tree.pyx":439
7029 * vtoadd, wtoadd, level + 1)
7030 * if self.merged == 1:
7031 * for i in range(self.nvals): # <<<<<<<<<<<<<<
7032 * vtoadd[i] = vorig[i]
7033 * wtoadd -= node.weight_val
7034 */
7035 __pyx_t_2 = __pyx_v_self->nvals;
7036 __pyx_t_3 = __pyx_t_2;
7037 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
7038 __pyx_v_i = __pyx_t_4;
7039
7040 /* "yt/utilities/lib/quad_tree.pyx":440
7041 * if self.merged == 1:
7042 * for i in range(self.nvals):
7043 * vtoadd[i] = vorig[i] # <<<<<<<<<<<<<<
7044 * wtoadd -= node.weight_val
7045 * free(vorig)
7046 */
7047 (__pyx_v_vtoadd[__pyx_v_i]) = (__pyx_v_vorig[__pyx_v_i]);
7048 }
7049
7050 /* "yt/utilities/lib/quad_tree.pyx":441
7051 * for i in range(self.nvals):
7052 * vtoadd[i] = vorig[i]
7053 * wtoadd -= node.weight_val # <<<<<<<<<<<<<<
7054 * free(vorig)
7055 * return added
7056 */
7057 __pyx_v_wtoadd = (__pyx_v_wtoadd - __pyx_v_node->weight_val);
7058
7059 /* "yt/utilities/lib/quad_tree.pyx":438
7060 * curpos + added, px, py, pdx, pdy, vdata, wdata,
7061 * vtoadd, wtoadd, level + 1)
7062 * if self.merged == 1: # <<<<<<<<<<<<<<
7063 * for i in range(self.nvals):
7064 * vtoadd[i] = vorig[i]
7065 */
7066 }
7067
7068 /* "yt/utilities/lib/quad_tree.pyx":442
7069 * vtoadd[i] = vorig[i]
7070 * wtoadd -= node.weight_val
7071 * free(vorig) # <<<<<<<<<<<<<<
7072 * return added
7073 *
7074 */
7075 free(__pyx_v_vorig);
7076
7077 /* "yt/utilities/lib/quad_tree.pyx":443
7078 * wtoadd -= node.weight_val
7079 * free(vorig)
7080 * return added # <<<<<<<<<<<<<<
7081 *
7082 * @cython.boundscheck(False)
7083 */
7084 __pyx_r = __pyx_v_added;
7085 goto __pyx_L0;
7086
7087 /* "yt/utilities/lib/quad_tree.pyx":391
7088 *
7089 * @cython.cdivision(True)
7090 * cdef int fill(self, QuadTreeNode *node, # <<<<<<<<<<<<<<
7091 * np.int64_t curpos,
7092 * np.float64_t *px,
7093 */
7094
7095 /* function exit code */
7096 __pyx_L0:;
7097 __Pyx_RefNannyFinishContext();
7098 return __pyx_r;
7099 }
7100
7101 /* "yt/utilities/lib/quad_tree.pyx":448
7102 * @cython.wraparound(False)
7103 * @cython.cdivision(True)
7104 * def fill_image(self, np.ndarray[np.float64_t, ndim=2] buffer, _bounds, # <<<<<<<<<<<<<<
7105 * int val_index = 0, int weighted = 0):
7106 * cdef np.float64_t pos[2]
7107 */
7108
7109 /* Python wrapper */
7110 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_17fill_image(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_17fill_image(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7111 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_17fill_image(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7112 PyArrayObject *__pyx_v_buffer = 0;
7113 PyObject *__pyx_v__bounds = 0;
7114 int __pyx_v_val_index;
7115 int __pyx_v_weighted;
7116 PyObject *__pyx_r = 0;
7117 __Pyx_RefNannyDeclarations
7118 __Pyx_RefNannySetupContext("fill_image (wrapper)", 0);
7119 {
7120 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_bounds_2,&__pyx_n_s_val_index,&__pyx_n_s_weighted,0};
7121 PyObject* values[4] = {0,0,0,0};
7122 if (unlikely(__pyx_kwds)) {
7123 Py_ssize_t kw_args;
7124 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7125 switch (pos_args) {
7126 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7127 CYTHON_FALLTHROUGH;
7128 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7129 CYTHON_FALLTHROUGH;
7130 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7131 CYTHON_FALLTHROUGH;
7132 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7133 CYTHON_FALLTHROUGH;
7134 case 0: break;
7135 default: goto __pyx_L5_argtuple_error;
7136 }
7137 kw_args = PyDict_Size(__pyx_kwds);
7138 switch (pos_args) {
7139 case 0:
7140 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--;
7141 else goto __pyx_L5_argtuple_error;
7142 CYTHON_FALLTHROUGH;
7143 case 1:
7144 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bounds_2)) != 0)) kw_args--;
7145 else {
7146 __Pyx_RaiseArgtupleInvalid("fill_image", 0, 2, 4, 1); __PYX_ERR(0, 448, __pyx_L3_error)
7147 }
7148 CYTHON_FALLTHROUGH;
7149 case 2:
7150 if (kw_args > 0) {
7151 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val_index);
7152 if (value) { values[2] = value; kw_args--; }
7153 }
7154 CYTHON_FALLTHROUGH;
7155 case 3:
7156 if (kw_args > 0) {
7157 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weighted);
7158 if (value) { values[3] = value; kw_args--; }
7159 }
7160 }
7161 if (unlikely(kw_args > 0)) {
7162 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_image") < 0)) __PYX_ERR(0, 448, __pyx_L3_error)
7163 }
7164 } else {
7165 switch (PyTuple_GET_SIZE(__pyx_args)) {
7166 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7167 CYTHON_FALLTHROUGH;
7168 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7169 CYTHON_FALLTHROUGH;
7170 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7171 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7172 break;
7173 default: goto __pyx_L5_argtuple_error;
7174 }
7175 }
7176 __pyx_v_buffer = ((PyArrayObject *)values[0]);
7177 __pyx_v__bounds = values[1];
7178 if (values[2]) {
7179 __pyx_v_val_index = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_val_index == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L3_error)
7180 } else {
7181 __pyx_v_val_index = ((int)0);
7182 }
7183 if (values[3]) {
7184 __pyx_v_weighted = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_weighted == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L3_error)
7185 } else {
7186 __pyx_v_weighted = ((int)0);
7187 }
7188 }
7189 goto __pyx_L4_argument_unpacking_done;
7190 __pyx_L5_argtuple_error:;
7191 __Pyx_RaiseArgtupleInvalid("fill_image", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 448, __pyx_L3_error)
7192 __pyx_L3_error:;
7193 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.fill_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
7194 __Pyx_RefNannyFinishContext();
7195 return NULL;
7196 __pyx_L4_argument_unpacking_done:;
7197 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_5numpy_ndarray, 1, "buffer", 0))) __PYX_ERR(0, 448, __pyx_L1_error)
7198 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_16fill_image(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), __pyx_v_buffer, __pyx_v__bounds, __pyx_v_val_index, __pyx_v_weighted);
7199
7200 /* function exit code */
7201 goto __pyx_L0;
7202 __pyx_L1_error:;
7203 __pyx_r = NULL;
7204 __pyx_L0:;
7205 __Pyx_RefNannyFinishContext();
7206 return __pyx_r;
7207 }
7208
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_16fill_image(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,PyArrayObject * __pyx_v_buffer,PyObject * __pyx_v__bounds,int __pyx_v_val_index,int __pyx_v_weighted)7209 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_16fill_image(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, PyArrayObject *__pyx_v_buffer, PyObject *__pyx_v__bounds, int __pyx_v_val_index, int __pyx_v_weighted) {
7210 __pyx_t_5numpy_float64_t __pyx_v_pos[2];
7211 __pyx_t_5numpy_float64_t __pyx_v_dds[2];
7212 int __pyx_v_nn[2];
7213 int __pyx_v_i;
7214 int __pyx_v_j;
7215 __pyx_t_5numpy_float64_t __pyx_v_bounds[4];
7216 __pyx_t_5numpy_float64_t __pyx_v_opos[4];
7217 __pyx_t_5numpy_float64_t __pyx_v_weight;
7218 __pyx_t_5numpy_float64_t __pyx_v_value;
7219 __pyx_t_5numpy_float64_t *__pyx_v_wval;
7220 __Pyx_LocalBuf_ND __pyx_pybuffernd_buffer;
7221 __Pyx_Buffer __pyx_pybuffer_buffer;
7222 PyObject *__pyx_r = NULL;
7223 __Pyx_RefNannyDeclarations
7224 int __pyx_t_1;
7225 int __pyx_t_2;
7226 PyObject *__pyx_t_3 = NULL;
7227 __pyx_t_5numpy_float64_t __pyx_t_4;
7228 int __pyx_t_5;
7229 int __pyx_t_6;
7230 int __pyx_t_7;
7231 int __pyx_t_8;
7232 int __pyx_t_9;
7233 int __pyx_t_10;
7234 int __pyx_t_11;
7235 struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos __pyx_t_12;
7236 Py_ssize_t __pyx_t_13;
7237 Py_ssize_t __pyx_t_14;
7238 Py_ssize_t __pyx_t_15;
7239 Py_ssize_t __pyx_t_16;
7240 long __pyx_t_17;
7241 __Pyx_RefNannySetupContext("fill_image", 0);
7242 __pyx_pybuffer_buffer.pybuffer.buf = NULL;
7243 __pyx_pybuffer_buffer.refcount = 0;
7244 __pyx_pybuffernd_buffer.data = NULL;
7245 __pyx_pybuffernd_buffer.rcbuffer = &__pyx_pybuffer_buffer;
7246 {
7247 __Pyx_BufFmt_StackElem __pyx_stack[1];
7248 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_v_buffer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 448, __pyx_L1_error)
7249 }
7250 __pyx_pybuffernd_buffer.diminfo[0].strides = __pyx_pybuffernd_buffer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_buffer.diminfo[0].shape = __pyx_pybuffernd_buffer.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_buffer.diminfo[1].strides = __pyx_pybuffernd_buffer.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_buffer.diminfo[1].shape = __pyx_pybuffernd_buffer.rcbuffer->pybuffer.shape[1];
7251
7252 /* "yt/utilities/lib/quad_tree.pyx":456
7253 * cdef np.float64_t bounds[4]
7254 * cdef np.float64_t opos[4]
7255 * cdef np.float64_t weight = 0.0, value = 0.0 # <<<<<<<<<<<<<<
7256 * cdef np.float64_t *wval = NULL
7257 * if weighted == 1:
7258 */
7259 __pyx_v_weight = 0.0;
7260 __pyx_v_value = 0.0;
7261
7262 /* "yt/utilities/lib/quad_tree.pyx":457
7263 * cdef np.float64_t opos[4]
7264 * cdef np.float64_t weight = 0.0, value = 0.0
7265 * cdef np.float64_t *wval = NULL # <<<<<<<<<<<<<<
7266 * if weighted == 1:
7267 * wval = &weight
7268 */
7269 __pyx_v_wval = NULL;
7270
7271 /* "yt/utilities/lib/quad_tree.pyx":458
7272 * cdef np.float64_t weight = 0.0, value = 0.0
7273 * cdef np.float64_t *wval = NULL
7274 * if weighted == 1: # <<<<<<<<<<<<<<
7275 * wval = &weight
7276 * for i in range(4):
7277 */
7278 __pyx_t_1 = ((__pyx_v_weighted == 1) != 0);
7279 if (__pyx_t_1) {
7280
7281 /* "yt/utilities/lib/quad_tree.pyx":459
7282 * cdef np.float64_t *wval = NULL
7283 * if weighted == 1:
7284 * wval = &weight # <<<<<<<<<<<<<<
7285 * for i in range(4):
7286 * bounds[i] = _bounds[i]
7287 */
7288 __pyx_v_wval = (&__pyx_v_weight);
7289
7290 /* "yt/utilities/lib/quad_tree.pyx":458
7291 * cdef np.float64_t weight = 0.0, value = 0.0
7292 * cdef np.float64_t *wval = NULL
7293 * if weighted == 1: # <<<<<<<<<<<<<<
7294 * wval = &weight
7295 * for i in range(4):
7296 */
7297 }
7298
7299 /* "yt/utilities/lib/quad_tree.pyx":460
7300 * if weighted == 1:
7301 * wval = &weight
7302 * for i in range(4): # <<<<<<<<<<<<<<
7303 * bounds[i] = _bounds[i]
7304 * for i in range(2):
7305 */
7306 for (__pyx_t_2 = 0; __pyx_t_2 < 4; __pyx_t_2+=1) {
7307 __pyx_v_i = __pyx_t_2;
7308
7309 /* "yt/utilities/lib/quad_tree.pyx":461
7310 * wval = &weight
7311 * for i in range(4):
7312 * bounds[i] = _bounds[i] # <<<<<<<<<<<<<<
7313 * for i in range(2):
7314 * nn[i] = buffer.shape[i]
7315 */
7316 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v__bounds, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error)
7317 __Pyx_GOTREF(__pyx_t_3);
7318 __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L1_error)
7319 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7320 (__pyx_v_bounds[__pyx_v_i]) = __pyx_t_4;
7321 }
7322
7323 /* "yt/utilities/lib/quad_tree.pyx":462
7324 * for i in range(4):
7325 * bounds[i] = _bounds[i]
7326 * for i in range(2): # <<<<<<<<<<<<<<
7327 * nn[i] = buffer.shape[i]
7328 * dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i]
7329 */
7330 for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
7331 __pyx_v_i = __pyx_t_2;
7332
7333 /* "yt/utilities/lib/quad_tree.pyx":463
7334 * bounds[i] = _bounds[i]
7335 * for i in range(2):
7336 * nn[i] = buffer.shape[i] # <<<<<<<<<<<<<<
7337 * dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i]
7338 * pos[0] = bounds[0]
7339 */
7340 (__pyx_v_nn[__pyx_v_i]) = (__pyx_v_buffer->dimensions[__pyx_v_i]);
7341
7342 /* "yt/utilities/lib/quad_tree.pyx":464
7343 * for i in range(2):
7344 * nn[i] = buffer.shape[i]
7345 * dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i] # <<<<<<<<<<<<<<
7346 * pos[0] = bounds[0]
7347 * opos[0] = opos[1] = pos[0] + dds[0]
7348 */
7349 (__pyx_v_dds[__pyx_v_i]) = (((__pyx_v_bounds[((__pyx_v_i * 2) + 1)]) - (__pyx_v_bounds[(__pyx_v_i * 2)])) / (__pyx_v_nn[__pyx_v_i]));
7350 }
7351
7352 /* "yt/utilities/lib/quad_tree.pyx":465
7353 * nn[i] = buffer.shape[i]
7354 * dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i]
7355 * pos[0] = bounds[0] # <<<<<<<<<<<<<<
7356 * opos[0] = opos[1] = pos[0] + dds[0]
7357 * for i in range(nn[0]):
7358 */
7359 (__pyx_v_pos[0]) = (__pyx_v_bounds[0]);
7360
7361 /* "yt/utilities/lib/quad_tree.pyx":466
7362 * dds[i] = (bounds[i*2 + 1] - bounds[i*2])/nn[i]
7363 * pos[0] = bounds[0]
7364 * opos[0] = opos[1] = pos[0] + dds[0] # <<<<<<<<<<<<<<
7365 * for i in range(nn[0]):
7366 * pos[1] = bounds[2]
7367 */
7368 __pyx_t_4 = ((__pyx_v_pos[0]) + (__pyx_v_dds[0]));
7369 (__pyx_v_opos[0]) = __pyx_t_4;
7370 (__pyx_v_opos[1]) = __pyx_t_4;
7371
7372 /* "yt/utilities/lib/quad_tree.pyx":467
7373 * pos[0] = bounds[0]
7374 * opos[0] = opos[1] = pos[0] + dds[0]
7375 * for i in range(nn[0]): # <<<<<<<<<<<<<<
7376 * pos[1] = bounds[2]
7377 * opos[2] = opos[3] = pos[1] + dds[1]
7378 */
7379 __pyx_t_2 = (__pyx_v_nn[0]);
7380 __pyx_t_5 = __pyx_t_2;
7381 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
7382 __pyx_v_i = __pyx_t_6;
7383
7384 /* "yt/utilities/lib/quad_tree.pyx":468
7385 * opos[0] = opos[1] = pos[0] + dds[0]
7386 * for i in range(nn[0]):
7387 * pos[1] = bounds[2] # <<<<<<<<<<<<<<
7388 * opos[2] = opos[3] = pos[1] + dds[1]
7389 * for j in range(nn[1]):
7390 */
7391 (__pyx_v_pos[1]) = (__pyx_v_bounds[2]);
7392
7393 /* "yt/utilities/lib/quad_tree.pyx":469
7394 * for i in range(nn[0]):
7395 * pos[1] = bounds[2]
7396 * opos[2] = opos[3] = pos[1] + dds[1] # <<<<<<<<<<<<<<
7397 * for j in range(nn[1]):
7398 * # We start at level zero. In the future we could optimize by
7399 */
7400 __pyx_t_4 = ((__pyx_v_pos[1]) + (__pyx_v_dds[1]));
7401 (__pyx_v_opos[2]) = __pyx_t_4;
7402 (__pyx_v_opos[3]) = __pyx_t_4;
7403
7404 /* "yt/utilities/lib/quad_tree.pyx":470
7405 * pos[1] = bounds[2]
7406 * opos[2] = opos[3] = pos[1] + dds[1]
7407 * for j in range(nn[1]): # <<<<<<<<<<<<<<
7408 * # We start at level zero. In the future we could optimize by
7409 * # retaining oct information from previous cells.
7410 */
7411 __pyx_t_7 = (__pyx_v_nn[1]);
7412 __pyx_t_8 = __pyx_t_7;
7413 for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
7414 __pyx_v_j = __pyx_t_9;
7415
7416 /* "yt/utilities/lib/quad_tree.pyx":473
7417 * # We start at level zero. In the future we could optimize by
7418 * # retaining oct information from previous cells.
7419 * if not ((opos[0] <= pos[0] <= opos[1]) and # <<<<<<<<<<<<<<
7420 * (opos[2] <= pos[1] <= opos[3])):
7421 * value = self.find_value_at_pos(pos, val_index,
7422 */
7423 __pyx_t_10 = ((__pyx_v_opos[0]) <= (__pyx_v_pos[0]));
7424 if (__pyx_t_10) {
7425 __pyx_t_10 = ((__pyx_v_pos[0]) <= (__pyx_v_opos[1]));
7426 }
7427 __pyx_t_11 = (__pyx_t_10 != 0);
7428 if (__pyx_t_11) {
7429 } else {
7430 __pyx_t_1 = __pyx_t_11;
7431 goto __pyx_L13_bool_binop_done;
7432 }
7433
7434 /* "yt/utilities/lib/quad_tree.pyx":474
7435 * # retaining oct information from previous cells.
7436 * if not ((opos[0] <= pos[0] <= opos[1]) and
7437 * (opos[2] <= pos[1] <= opos[3])): # <<<<<<<<<<<<<<
7438 * value = self.find_value_at_pos(pos, val_index,
7439 * opos, wval)
7440 */
7441 __pyx_t_11 = ((__pyx_v_opos[2]) <= (__pyx_v_pos[1]));
7442 if (__pyx_t_11) {
7443 __pyx_t_11 = ((__pyx_v_pos[1]) <= (__pyx_v_opos[3]));
7444 }
7445 __pyx_t_10 = (__pyx_t_11 != 0);
7446 __pyx_t_1 = __pyx_t_10;
7447 __pyx_L13_bool_binop_done:;
7448
7449 /* "yt/utilities/lib/quad_tree.pyx":473
7450 * # We start at level zero. In the future we could optimize by
7451 * # retaining oct information from previous cells.
7452 * if not ((opos[0] <= pos[0] <= opos[1]) and # <<<<<<<<<<<<<<
7453 * (opos[2] <= pos[1] <= opos[3])):
7454 * value = self.find_value_at_pos(pos, val_index,
7455 */
7456 __pyx_t_10 = ((!__pyx_t_1) != 0);
7457 if (__pyx_t_10) {
7458
7459 /* "yt/utilities/lib/quad_tree.pyx":475
7460 * if not ((opos[0] <= pos[0] <= opos[1]) and
7461 * (opos[2] <= pos[1] <= opos[3])):
7462 * value = self.find_value_at_pos(pos, val_index, # <<<<<<<<<<<<<<
7463 * opos, wval)
7464 * buffer[i,j] = value
7465 */
7466 __pyx_t_12.__pyx_n = 1;
7467 __pyx_t_12.wval = __pyx_v_wval;
7468 __pyx_t_4 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self->__pyx_vtab)->find_value_at_pos(__pyx_v_self, __pyx_v_pos, __pyx_v_val_index, __pyx_v_opos, &__pyx_t_12);
7469 __pyx_v_value = __pyx_t_4;
7470
7471 /* "yt/utilities/lib/quad_tree.pyx":473
7472 * # We start at level zero. In the future we could optimize by
7473 * # retaining oct information from previous cells.
7474 * if not ((opos[0] <= pos[0] <= opos[1]) and # <<<<<<<<<<<<<<
7475 * (opos[2] <= pos[1] <= opos[3])):
7476 * value = self.find_value_at_pos(pos, val_index,
7477 */
7478 }
7479
7480 /* "yt/utilities/lib/quad_tree.pyx":477
7481 * value = self.find_value_at_pos(pos, val_index,
7482 * opos, wval)
7483 * buffer[i,j] = value # <<<<<<<<<<<<<<
7484 * if weighted == 1:
7485 * buffer[i,j] /= weight
7486 */
7487 __pyx_t_13 = __pyx_v_i;
7488 __pyx_t_14 = __pyx_v_j;
7489 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_buffer.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_buffer.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_buffer.diminfo[1].strides) = __pyx_v_value;
7490
7491 /* "yt/utilities/lib/quad_tree.pyx":478
7492 * opos, wval)
7493 * buffer[i,j] = value
7494 * if weighted == 1: # <<<<<<<<<<<<<<
7495 * buffer[i,j] /= weight
7496 * pos[1] += dds[1]
7497 */
7498 __pyx_t_10 = ((__pyx_v_weighted == 1) != 0);
7499 if (__pyx_t_10) {
7500
7501 /* "yt/utilities/lib/quad_tree.pyx":479
7502 * buffer[i,j] = value
7503 * if weighted == 1:
7504 * buffer[i,j] /= weight # <<<<<<<<<<<<<<
7505 * pos[1] += dds[1]
7506 * pos[0] += dds[0]
7507 */
7508 __pyx_t_15 = __pyx_v_i;
7509 __pyx_t_16 = __pyx_v_j;
7510 *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_buffer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_buffer.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_buffer.diminfo[1].strides) /= __pyx_v_weight;
7511
7512 /* "yt/utilities/lib/quad_tree.pyx":478
7513 * opos, wval)
7514 * buffer[i,j] = value
7515 * if weighted == 1: # <<<<<<<<<<<<<<
7516 * buffer[i,j] /= weight
7517 * pos[1] += dds[1]
7518 */
7519 }
7520
7521 /* "yt/utilities/lib/quad_tree.pyx":480
7522 * if weighted == 1:
7523 * buffer[i,j] /= weight
7524 * pos[1] += dds[1] # <<<<<<<<<<<<<<
7525 * pos[0] += dds[0]
7526 *
7527 */
7528 __pyx_t_17 = 1;
7529 (__pyx_v_pos[__pyx_t_17]) = ((__pyx_v_pos[__pyx_t_17]) + (__pyx_v_dds[1]));
7530 }
7531
7532 /* "yt/utilities/lib/quad_tree.pyx":481
7533 * buffer[i,j] /= weight
7534 * pos[1] += dds[1]
7535 * pos[0] += dds[0] # <<<<<<<<<<<<<<
7536 *
7537 * @cython.boundscheck(False)
7538 */
7539 __pyx_t_17 = 0;
7540 (__pyx_v_pos[__pyx_t_17]) = ((__pyx_v_pos[__pyx_t_17]) + (__pyx_v_dds[0]));
7541 }
7542
7543 /* "yt/utilities/lib/quad_tree.pyx":448
7544 * @cython.wraparound(False)
7545 * @cython.cdivision(True)
7546 * def fill_image(self, np.ndarray[np.float64_t, ndim=2] buffer, _bounds, # <<<<<<<<<<<<<<
7547 * int val_index = 0, int weighted = 0):
7548 * cdef np.float64_t pos[2]
7549 */
7550
7551 /* function exit code */
7552 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7553 goto __pyx_L0;
7554 __pyx_L1_error:;
7555 __Pyx_XDECREF(__pyx_t_3);
7556 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7557 __Pyx_PyThreadState_declare
7558 __Pyx_PyThreadState_assign
7559 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7560 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buffer.rcbuffer->pybuffer);
7561 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7562 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.fill_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
7563 __pyx_r = NULL;
7564 goto __pyx_L2;
7565 __pyx_L0:;
7566 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_buffer.rcbuffer->pybuffer);
7567 __pyx_L2:;
7568 __Pyx_XGIVEREF(__pyx_r);
7569 __Pyx_RefNannyFinishContext();
7570 return __pyx_r;
7571 }
7572
7573 /* "yt/utilities/lib/quad_tree.pyx":486
7574 * @cython.wraparound(False)
7575 * @cython.cdivision(True)
7576 * cdef np.float64_t find_value_at_pos(self, np.float64_t pos[2], # <<<<<<<<<<<<<<
7577 * int val_index, np.float64_t opos[4],
7578 * np.float64_t *wval = NULL):
7579 */
7580
__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,__pyx_t_5numpy_float64_t * __pyx_v_pos,int __pyx_v_val_index,__pyx_t_5numpy_float64_t * __pyx_v_opos,struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos * __pyx_optional_args)7581 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_pos, int __pyx_v_val_index, __pyx_t_5numpy_float64_t *__pyx_v_opos, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos *__pyx_optional_args) {
7582
7583 /* "yt/utilities/lib/quad_tree.pyx":488
7584 * cdef np.float64_t find_value_at_pos(self, np.float64_t pos[2],
7585 * int val_index, np.float64_t opos[4],
7586 * np.float64_t *wval = NULL): # <<<<<<<<<<<<<<
7587 * cdef int i
7588 * cdef np.int64_t ind[2]
7589 */
7590 __pyx_t_5numpy_float64_t *__pyx_v_wval = ((__pyx_t_5numpy_float64_t *)NULL);
7591 int __pyx_v_i;
7592 __pyx_t_5numpy_int64_t __pyx_v_ind[2];
7593 __pyx_t_5numpy_float64_t __pyx_v_cp[2];
7594 __pyx_t_5numpy_float64_t __pyx_v_dds[2];
7595 __pyx_t_5numpy_float64_t __pyx_v_value;
7596 __pyx_t_5numpy_float64_t __pyx_v_weight;
7597 struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_cur;
7598 __pyx_t_5numpy_float64_t __pyx_r;
7599 __Pyx_RefNannyDeclarations
7600 int __pyx_t_1;
7601 int __pyx_t_2;
7602 int __pyx_t_3;
7603 __Pyx_RefNannySetupContext("find_value_at_pos", 0);
7604 if (__pyx_optional_args) {
7605 if (__pyx_optional_args->__pyx_n > 0) {
7606 __pyx_v_wval = __pyx_optional_args->wval;
7607 }
7608 }
7609
7610 /* "yt/utilities/lib/quad_tree.pyx":493
7611 * cdef np.float64_t cp[2]
7612 * cdef np.float64_t dds[2]
7613 * cdef np.float64_t value = 0.0 # <<<<<<<<<<<<<<
7614 * cdef np.float64_t weight = 0.0
7615 * cdef QuadTreeNode *cur
7616 */
7617 __pyx_v_value = 0.0;
7618
7619 /* "yt/utilities/lib/quad_tree.pyx":494
7620 * cdef np.float64_t dds[2]
7621 * cdef np.float64_t value = 0.0
7622 * cdef np.float64_t weight = 0.0 # <<<<<<<<<<<<<<
7623 * cdef QuadTreeNode *cur
7624 * for i in range(2):
7625 */
7626 __pyx_v_weight = 0.0;
7627
7628 /* "yt/utilities/lib/quad_tree.pyx":496
7629 * cdef np.float64_t weight = 0.0
7630 * cdef QuadTreeNode *cur
7631 * for i in range(2): # <<<<<<<<<<<<<<
7632 * ind[i] = <np.int64_t> (pos[i]/self.dds[i])
7633 * cp[i] = (ind[i] + 0.5) * self.dds[i]
7634 */
7635 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
7636 __pyx_v_i = __pyx_t_1;
7637
7638 /* "yt/utilities/lib/quad_tree.pyx":497
7639 * cdef QuadTreeNode *cur
7640 * for i in range(2):
7641 * ind[i] = <np.int64_t> (pos[i]/self.dds[i]) # <<<<<<<<<<<<<<
7642 * cp[i] = (ind[i] + 0.5) * self.dds[i]
7643 * dds[i] = self.dds[i]
7644 */
7645 (__pyx_v_ind[__pyx_v_i]) = ((__pyx_t_5numpy_int64_t)((__pyx_v_pos[__pyx_v_i]) / (__pyx_v_self->dds[__pyx_v_i])));
7646
7647 /* "yt/utilities/lib/quad_tree.pyx":498
7648 * for i in range(2):
7649 * ind[i] = <np.int64_t> (pos[i]/self.dds[i])
7650 * cp[i] = (ind[i] + 0.5) * self.dds[i] # <<<<<<<<<<<<<<
7651 * dds[i] = self.dds[i]
7652 * cur = self.root_nodes[ind[0]][ind[1]]
7653 */
7654 (__pyx_v_cp[__pyx_v_i]) = (((__pyx_v_ind[__pyx_v_i]) + 0.5) * (__pyx_v_self->dds[__pyx_v_i]));
7655
7656 /* "yt/utilities/lib/quad_tree.pyx":499
7657 * ind[i] = <np.int64_t> (pos[i]/self.dds[i])
7658 * cp[i] = (ind[i] + 0.5) * self.dds[i]
7659 * dds[i] = self.dds[i] # <<<<<<<<<<<<<<
7660 * cur = self.root_nodes[ind[0]][ind[1]]
7661 * value += cur.val[val_index]
7662 */
7663 (__pyx_v_dds[__pyx_v_i]) = (__pyx_v_self->dds[__pyx_v_i]);
7664 }
7665
7666 /* "yt/utilities/lib/quad_tree.pyx":500
7667 * cp[i] = (ind[i] + 0.5) * self.dds[i]
7668 * dds[i] = self.dds[i]
7669 * cur = self.root_nodes[ind[0]][ind[1]] # <<<<<<<<<<<<<<
7670 * value += cur.val[val_index]
7671 * weight += cur.weight_val
7672 */
7673 __pyx_v_cur = ((__pyx_v_self->root_nodes[(__pyx_v_ind[0])])[(__pyx_v_ind[1])]);
7674
7675 /* "yt/utilities/lib/quad_tree.pyx":501
7676 * dds[i] = self.dds[i]
7677 * cur = self.root_nodes[ind[0]][ind[1]]
7678 * value += cur.val[val_index] # <<<<<<<<<<<<<<
7679 * weight += cur.weight_val
7680 * while cur.children[0][0] != NULL:
7681 */
7682 __pyx_v_value = (__pyx_v_value + (__pyx_v_cur->val[__pyx_v_val_index]));
7683
7684 /* "yt/utilities/lib/quad_tree.pyx":502
7685 * cur = self.root_nodes[ind[0]][ind[1]]
7686 * value += cur.val[val_index]
7687 * weight += cur.weight_val # <<<<<<<<<<<<<<
7688 * while cur.children[0][0] != NULL:
7689 * for i in range(2):
7690 */
7691 __pyx_v_weight = (__pyx_v_weight + __pyx_v_cur->weight_val);
7692
7693 /* "yt/utilities/lib/quad_tree.pyx":503
7694 * value += cur.val[val_index]
7695 * weight += cur.weight_val
7696 * while cur.children[0][0] != NULL: # <<<<<<<<<<<<<<
7697 * for i in range(2):
7698 * # Note that below offset by half a dx for center, after
7699 */
7700 while (1) {
7701 __pyx_t_2 = ((((__pyx_v_cur->children[0])[0]) != NULL) != 0);
7702 if (!__pyx_t_2) break;
7703
7704 /* "yt/utilities/lib/quad_tree.pyx":504
7705 * weight += cur.weight_val
7706 * while cur.children[0][0] != NULL:
7707 * for i in range(2): # <<<<<<<<<<<<<<
7708 * # Note that below offset by half a dx for center, after
7709 * # updating to the next level
7710 */
7711 for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
7712 __pyx_v_i = __pyx_t_1;
7713
7714 /* "yt/utilities/lib/quad_tree.pyx":507
7715 * # Note that below offset by half a dx for center, after
7716 * # updating to the next level
7717 * dds[i] = dds[i] * 0.5 # <<<<<<<<<<<<<<
7718 * if cp[i] >= pos[i]:
7719 * ind[i] = 0
7720 */
7721 (__pyx_v_dds[__pyx_v_i]) = ((__pyx_v_dds[__pyx_v_i]) * 0.5);
7722
7723 /* "yt/utilities/lib/quad_tree.pyx":508
7724 * # updating to the next level
7725 * dds[i] = dds[i] * 0.5
7726 * if cp[i] >= pos[i]: # <<<<<<<<<<<<<<
7727 * ind[i] = 0
7728 * cp[i] -= dds[i] * 0.5
7729 */
7730 __pyx_t_2 = (((__pyx_v_cp[__pyx_v_i]) >= (__pyx_v_pos[__pyx_v_i])) != 0);
7731 if (__pyx_t_2) {
7732
7733 /* "yt/utilities/lib/quad_tree.pyx":509
7734 * dds[i] = dds[i] * 0.5
7735 * if cp[i] >= pos[i]:
7736 * ind[i] = 0 # <<<<<<<<<<<<<<
7737 * cp[i] -= dds[i] * 0.5
7738 * else:
7739 */
7740 (__pyx_v_ind[__pyx_v_i]) = 0;
7741
7742 /* "yt/utilities/lib/quad_tree.pyx":510
7743 * if cp[i] >= pos[i]:
7744 * ind[i] = 0
7745 * cp[i] -= dds[i] * 0.5 # <<<<<<<<<<<<<<
7746 * else:
7747 * ind[i] = 1
7748 */
7749 __pyx_t_3 = __pyx_v_i;
7750 (__pyx_v_cp[__pyx_t_3]) = ((__pyx_v_cp[__pyx_t_3]) - ((__pyx_v_dds[__pyx_v_i]) * 0.5));
7751
7752 /* "yt/utilities/lib/quad_tree.pyx":508
7753 * # updating to the next level
7754 * dds[i] = dds[i] * 0.5
7755 * if cp[i] >= pos[i]: # <<<<<<<<<<<<<<
7756 * ind[i] = 0
7757 * cp[i] -= dds[i] * 0.5
7758 */
7759 goto __pyx_L9;
7760 }
7761
7762 /* "yt/utilities/lib/quad_tree.pyx":512
7763 * cp[i] -= dds[i] * 0.5
7764 * else:
7765 * ind[i] = 1 # <<<<<<<<<<<<<<
7766 * cp[i] += dds[i] * 0.5
7767 * cur = cur.children[ind[0]][ind[1]]
7768 */
7769 /*else*/ {
7770 (__pyx_v_ind[__pyx_v_i]) = 1;
7771
7772 /* "yt/utilities/lib/quad_tree.pyx":513
7773 * else:
7774 * ind[i] = 1
7775 * cp[i] += dds[i] * 0.5 # <<<<<<<<<<<<<<
7776 * cur = cur.children[ind[0]][ind[1]]
7777 * value += cur.val[val_index]
7778 */
7779 __pyx_t_3 = __pyx_v_i;
7780 (__pyx_v_cp[__pyx_t_3]) = ((__pyx_v_cp[__pyx_t_3]) + ((__pyx_v_dds[__pyx_v_i]) * 0.5));
7781 }
7782 __pyx_L9:;
7783 }
7784
7785 /* "yt/utilities/lib/quad_tree.pyx":514
7786 * ind[i] = 1
7787 * cp[i] += dds[i] * 0.5
7788 * cur = cur.children[ind[0]][ind[1]] # <<<<<<<<<<<<<<
7789 * value += cur.val[val_index]
7790 * weight += cur.weight_val
7791 */
7792 __pyx_v_cur = ((__pyx_v_cur->children[(__pyx_v_ind[0])])[(__pyx_v_ind[1])]);
7793
7794 /* "yt/utilities/lib/quad_tree.pyx":515
7795 * cp[i] += dds[i] * 0.5
7796 * cur = cur.children[ind[0]][ind[1]]
7797 * value += cur.val[val_index] # <<<<<<<<<<<<<<
7798 * weight += cur.weight_val
7799 * opos[0] = cp[0] - dds[0] * 0.5
7800 */
7801 __pyx_v_value = (__pyx_v_value + (__pyx_v_cur->val[__pyx_v_val_index]));
7802
7803 /* "yt/utilities/lib/quad_tree.pyx":516
7804 * cur = cur.children[ind[0]][ind[1]]
7805 * value += cur.val[val_index]
7806 * weight += cur.weight_val # <<<<<<<<<<<<<<
7807 * opos[0] = cp[0] - dds[0] * 0.5
7808 * opos[1] = cp[0] + dds[0] * 0.5
7809 */
7810 __pyx_v_weight = (__pyx_v_weight + __pyx_v_cur->weight_val);
7811 }
7812
7813 /* "yt/utilities/lib/quad_tree.pyx":517
7814 * value += cur.val[val_index]
7815 * weight += cur.weight_val
7816 * opos[0] = cp[0] - dds[0] * 0.5 # <<<<<<<<<<<<<<
7817 * opos[1] = cp[0] + dds[0] * 0.5
7818 * opos[2] = cp[1] - dds[1] * 0.5
7819 */
7820 (__pyx_v_opos[0]) = ((__pyx_v_cp[0]) - ((__pyx_v_dds[0]) * 0.5));
7821
7822 /* "yt/utilities/lib/quad_tree.pyx":518
7823 * weight += cur.weight_val
7824 * opos[0] = cp[0] - dds[0] * 0.5
7825 * opos[1] = cp[0] + dds[0] * 0.5 # <<<<<<<<<<<<<<
7826 * opos[2] = cp[1] - dds[1] * 0.5
7827 * opos[3] = cp[1] + dds[1] * 0.5
7828 */
7829 (__pyx_v_opos[1]) = ((__pyx_v_cp[0]) + ((__pyx_v_dds[0]) * 0.5));
7830
7831 /* "yt/utilities/lib/quad_tree.pyx":519
7832 * opos[0] = cp[0] - dds[0] * 0.5
7833 * opos[1] = cp[0] + dds[0] * 0.5
7834 * opos[2] = cp[1] - dds[1] * 0.5 # <<<<<<<<<<<<<<
7835 * opos[3] = cp[1] + dds[1] * 0.5
7836 * if wval != NULL:
7837 */
7838 (__pyx_v_opos[2]) = ((__pyx_v_cp[1]) - ((__pyx_v_dds[1]) * 0.5));
7839
7840 /* "yt/utilities/lib/quad_tree.pyx":520
7841 * opos[1] = cp[0] + dds[0] * 0.5
7842 * opos[2] = cp[1] - dds[1] * 0.5
7843 * opos[3] = cp[1] + dds[1] * 0.5 # <<<<<<<<<<<<<<
7844 * if wval != NULL:
7845 * wval[0] = weight
7846 */
7847 (__pyx_v_opos[3]) = ((__pyx_v_cp[1]) + ((__pyx_v_dds[1]) * 0.5));
7848
7849 /* "yt/utilities/lib/quad_tree.pyx":521
7850 * opos[2] = cp[1] - dds[1] * 0.5
7851 * opos[3] = cp[1] + dds[1] * 0.5
7852 * if wval != NULL: # <<<<<<<<<<<<<<
7853 * wval[0] = weight
7854 * return value
7855 */
7856 __pyx_t_2 = ((__pyx_v_wval != NULL) != 0);
7857 if (__pyx_t_2) {
7858
7859 /* "yt/utilities/lib/quad_tree.pyx":522
7860 * opos[3] = cp[1] + dds[1] * 0.5
7861 * if wval != NULL:
7862 * wval[0] = weight # <<<<<<<<<<<<<<
7863 * return value
7864 *
7865 */
7866 (__pyx_v_wval[0]) = __pyx_v_weight;
7867
7868 /* "yt/utilities/lib/quad_tree.pyx":521
7869 * opos[2] = cp[1] - dds[1] * 0.5
7870 * opos[3] = cp[1] + dds[1] * 0.5
7871 * if wval != NULL: # <<<<<<<<<<<<<<
7872 * wval[0] = weight
7873 * return value
7874 */
7875 }
7876
7877 /* "yt/utilities/lib/quad_tree.pyx":523
7878 * if wval != NULL:
7879 * wval[0] = weight
7880 * return value # <<<<<<<<<<<<<<
7881 *
7882 * def __dealloc__(self):
7883 */
7884 __pyx_r = __pyx_v_value;
7885 goto __pyx_L0;
7886
7887 /* "yt/utilities/lib/quad_tree.pyx":486
7888 * @cython.wraparound(False)
7889 * @cython.cdivision(True)
7890 * cdef np.float64_t find_value_at_pos(self, np.float64_t pos[2], # <<<<<<<<<<<<<<
7891 * int val_index, np.float64_t opos[4],
7892 * np.float64_t *wval = NULL):
7893 */
7894
7895 /* function exit code */
7896 __pyx_L0:;
7897 __Pyx_RefNannyFinishContext();
7898 return __pyx_r;
7899 }
7900
7901 /* "yt/utilities/lib/quad_tree.pyx":525
7902 * return value
7903 *
7904 * def __dealloc__(self): # <<<<<<<<<<<<<<
7905 * cdef int i, j
7906 * for i in range(self.top_grid_dims[0]):
7907 */
7908
7909 /* Python wrapper */
7910 static void __pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_19__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_19__dealloc__(PyObject * __pyx_v_self)7911 static void __pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_19__dealloc__(PyObject *__pyx_v_self) {
7912 __Pyx_RefNannyDeclarations
7913 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7914 __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_18__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self));
7915
7916 /* function exit code */
7917 __Pyx_RefNannyFinishContext();
7918 }
7919
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_18__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self)7920 static void __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_18__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self) {
7921 int __pyx_v_i;
7922 int __pyx_v_j;
7923 __Pyx_RefNannyDeclarations
7924 __pyx_t_5numpy_int64_t __pyx_t_1;
7925 __pyx_t_5numpy_int64_t __pyx_t_2;
7926 int __pyx_t_3;
7927 __pyx_t_5numpy_int64_t __pyx_t_4;
7928 __pyx_t_5numpy_int64_t __pyx_t_5;
7929 int __pyx_t_6;
7930 __Pyx_RefNannySetupContext("__dealloc__", 0);
7931
7932 /* "yt/utilities/lib/quad_tree.pyx":527
7933 * def __dealloc__(self):
7934 * cdef int i, j
7935 * for i in range(self.top_grid_dims[0]): # <<<<<<<<<<<<<<
7936 * for j in range(self.top_grid_dims[1]):
7937 * QTN_free(self.root_nodes[i][j])
7938 */
7939 __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
7940 __pyx_t_2 = __pyx_t_1;
7941 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7942 __pyx_v_i = __pyx_t_3;
7943
7944 /* "yt/utilities/lib/quad_tree.pyx":528
7945 * cdef int i, j
7946 * for i in range(self.top_grid_dims[0]):
7947 * for j in range(self.top_grid_dims[1]): # <<<<<<<<<<<<<<
7948 * QTN_free(self.root_nodes[i][j])
7949 * free(self.root_nodes[i])
7950 */
7951 __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
7952 __pyx_t_5 = __pyx_t_4;
7953 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
7954 __pyx_v_j = __pyx_t_6;
7955
7956 /* "yt/utilities/lib/quad_tree.pyx":529
7957 * for i in range(self.top_grid_dims[0]):
7958 * for j in range(self.top_grid_dims[1]):
7959 * QTN_free(self.root_nodes[i][j]) # <<<<<<<<<<<<<<
7960 * free(self.root_nodes[i])
7961 * free(self.root_nodes)
7962 */
7963 __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_free(((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]));
7964 }
7965
7966 /* "yt/utilities/lib/quad_tree.pyx":530
7967 * for j in range(self.top_grid_dims[1]):
7968 * QTN_free(self.root_nodes[i][j])
7969 * free(self.root_nodes[i]) # <<<<<<<<<<<<<<
7970 * free(self.root_nodes)
7971 *
7972 */
7973 free((__pyx_v_self->root_nodes[__pyx_v_i]));
7974 }
7975
7976 /* "yt/utilities/lib/quad_tree.pyx":531
7977 * QTN_free(self.root_nodes[i][j])
7978 * free(self.root_nodes[i])
7979 * free(self.root_nodes) # <<<<<<<<<<<<<<
7980 *
7981 * cdef void QTN_merge_nodes(QuadTreeNode *n1, QuadTreeNode *n2, int nvals,
7982 */
7983 free(__pyx_v_self->root_nodes);
7984
7985 /* "yt/utilities/lib/quad_tree.pyx":525
7986 * return value
7987 *
7988 * def __dealloc__(self): # <<<<<<<<<<<<<<
7989 * cdef int i, j
7990 * for i in range(self.top_grid_dims[0]):
7991 */
7992
7993 /* function exit code */
7994 __Pyx_RefNannyFinishContext();
7995 }
7996
7997 /* "(tree fragment)":1
7998 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
7999 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8000 * def __setstate_cython__(self, __pyx_state):
8001 */
8002
8003 /* Python wrapper */
8004 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_21__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8005 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8006 PyObject *__pyx_r = 0;
8007 __Pyx_RefNannyDeclarations
8008 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8009 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_20__reduce_cython__(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self));
8010
8011 /* function exit code */
8012 __Pyx_RefNannyFinishContext();
8013 return __pyx_r;
8014 }
8015
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self)8016 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self) {
8017 PyObject *__pyx_r = NULL;
8018 __Pyx_RefNannyDeclarations
8019 PyObject *__pyx_t_1 = NULL;
8020 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8021
8022 /* "(tree fragment)":2
8023 * def __reduce_cython__(self):
8024 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8025 * def __setstate_cython__(self, __pyx_state):
8026 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8027 */
8028 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8029 __Pyx_GOTREF(__pyx_t_1);
8030 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8031 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8032 __PYX_ERR(1, 2, __pyx_L1_error)
8033
8034 /* "(tree fragment)":1
8035 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
8036 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8037 * def __setstate_cython__(self, __pyx_state):
8038 */
8039
8040 /* function exit code */
8041 __pyx_L1_error:;
8042 __Pyx_XDECREF(__pyx_t_1);
8043 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8044 __pyx_r = NULL;
8045 __Pyx_XGIVEREF(__pyx_r);
8046 __Pyx_RefNannyFinishContext();
8047 return __pyx_r;
8048 }
8049
8050 /* "(tree fragment)":3
8051 * def __reduce_cython__(self):
8052 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8053 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8054 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8055 */
8056
8057 /* Python wrapper */
8058 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_23__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8059 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8060 PyObject *__pyx_r = 0;
8061 __Pyx_RefNannyDeclarations
8062 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8063 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_22__setstate_cython__(((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8064
8065 /* function exit code */
8066 __Pyx_RefNannyFinishContext();
8067 return __pyx_r;
8068 }
8069
__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8070 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_8QuadTree_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8071 PyObject *__pyx_r = NULL;
8072 __Pyx_RefNannyDeclarations
8073 PyObject *__pyx_t_1 = NULL;
8074 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8075
8076 /* "(tree fragment)":4
8077 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8078 * def __setstate_cython__(self, __pyx_state):
8079 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
8080 */
8081 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8082 __Pyx_GOTREF(__pyx_t_1);
8083 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8084 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8085 __PYX_ERR(1, 4, __pyx_L1_error)
8086
8087 /* "(tree fragment)":3
8088 * def __reduce_cython__(self):
8089 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8090 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
8091 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8092 */
8093
8094 /* function exit code */
8095 __pyx_L1_error:;
8096 __Pyx_XDECREF(__pyx_t_1);
8097 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.QuadTree.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8098 __pyx_r = NULL;
8099 __Pyx_XGIVEREF(__pyx_r);
8100 __Pyx_RefNannyFinishContext();
8101 return __pyx_r;
8102 }
8103
8104 /* "yt/utilities/lib/quad_tree.pyx":533
8105 * free(self.root_nodes)
8106 *
8107 * cdef void QTN_merge_nodes(QuadTreeNode *n1, QuadTreeNode *n2, int nvals, # <<<<<<<<<<<<<<
8108 * QTN_combine *func):
8109 * # We have four choices when merging nodes.
8110 */
8111
__pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_merge_nodes(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_n1,struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode * __pyx_v_n2,int __pyx_v_nvals,__pyx_t_2yt_9utilities_3lib_9quad_tree_QTN_combine * __pyx_v_func)8112 static void __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_merge_nodes(struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_n1, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *__pyx_v_n2, int __pyx_v_nvals, __pyx_t_2yt_9utilities_3lib_9quad_tree_QTN_combine *__pyx_v_func) {
8113 int __pyx_v_i;
8114 int __pyx_v_j;
8115 __Pyx_RefNannyDeclarations
8116 int __pyx_t_1;
8117 int __pyx_t_2;
8118 int __pyx_t_3;
8119 int __pyx_t_4;
8120 __Pyx_RefNannySetupContext("QTN_merge_nodes", 0);
8121
8122 /* "yt/utilities/lib/quad_tree.pyx":543
8123 * cdef int i, j
8124 *
8125 * func(n1, n2.val, n2.weight_val, nvals) # <<<<<<<<<<<<<<
8126 * if n1.children[0][0] == n2.children[0][0] == NULL:
8127 * pass
8128 */
8129 __pyx_v_func(__pyx_v_n1, __pyx_v_n2->val, __pyx_v_n2->weight_val, __pyx_v_nvals);
8130
8131 /* "yt/utilities/lib/quad_tree.pyx":544
8132 *
8133 * func(n1, n2.val, n2.weight_val, nvals)
8134 * if n1.children[0][0] == n2.children[0][0] == NULL: # <<<<<<<<<<<<<<
8135 * pass
8136 * elif n1.children[0][0] != NULL and n2.children[0][0] != NULL:
8137 */
8138 __pyx_t_1 = (((__pyx_v_n1->children[0])[0]) == ((__pyx_v_n2->children[0])[0]));
8139 if (__pyx_t_1) {
8140 __pyx_t_1 = (((__pyx_v_n2->children[0])[0]) == NULL);
8141 }
8142 __pyx_t_2 = (__pyx_t_1 != 0);
8143 if (__pyx_t_2) {
8144 goto __pyx_L3;
8145 }
8146
8147 /* "yt/utilities/lib/quad_tree.pyx":546
8148 * if n1.children[0][0] == n2.children[0][0] == NULL:
8149 * pass
8150 * elif n1.children[0][0] != NULL and n2.children[0][0] != NULL: # <<<<<<<<<<<<<<
8151 * for i in range(2):
8152 * for j in range(2):
8153 */
8154 __pyx_t_1 = ((((__pyx_v_n1->children[0])[0]) != NULL) != 0);
8155 if (__pyx_t_1) {
8156 } else {
8157 __pyx_t_2 = __pyx_t_1;
8158 goto __pyx_L4_bool_binop_done;
8159 }
8160 __pyx_t_1 = ((((__pyx_v_n2->children[0])[0]) != NULL) != 0);
8161 __pyx_t_2 = __pyx_t_1;
8162 __pyx_L4_bool_binop_done:;
8163 if (__pyx_t_2) {
8164
8165 /* "yt/utilities/lib/quad_tree.pyx":547
8166 * pass
8167 * elif n1.children[0][0] != NULL and n2.children[0][0] != NULL:
8168 * for i in range(2): # <<<<<<<<<<<<<<
8169 * for j in range(2):
8170 * QTN_merge_nodes(n1.children[i][j], n2.children[i][j], nvals, func)
8171 */
8172 for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
8173 __pyx_v_i = __pyx_t_3;
8174
8175 /* "yt/utilities/lib/quad_tree.pyx":548
8176 * elif n1.children[0][0] != NULL and n2.children[0][0] != NULL:
8177 * for i in range(2):
8178 * for j in range(2): # <<<<<<<<<<<<<<
8179 * QTN_merge_nodes(n1.children[i][j], n2.children[i][j], nvals, func)
8180 * elif n1.children[0][0] == NULL and n2.children[0][0] != NULL:
8181 */
8182 for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
8183 __pyx_v_j = __pyx_t_4;
8184
8185 /* "yt/utilities/lib/quad_tree.pyx":549
8186 * for i in range(2):
8187 * for j in range(2):
8188 * QTN_merge_nodes(n1.children[i][j], n2.children[i][j], nvals, func) # <<<<<<<<<<<<<<
8189 * elif n1.children[0][0] == NULL and n2.children[0][0] != NULL:
8190 * for i in range(2):
8191 */
8192 __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_merge_nodes(((__pyx_v_n1->children[__pyx_v_i])[__pyx_v_j]), ((__pyx_v_n2->children[__pyx_v_i])[__pyx_v_j]), __pyx_v_nvals, __pyx_v_func);
8193 }
8194 }
8195
8196 /* "yt/utilities/lib/quad_tree.pyx":546
8197 * if n1.children[0][0] == n2.children[0][0] == NULL:
8198 * pass
8199 * elif n1.children[0][0] != NULL and n2.children[0][0] != NULL: # <<<<<<<<<<<<<<
8200 * for i in range(2):
8201 * for j in range(2):
8202 */
8203 goto __pyx_L3;
8204 }
8205
8206 /* "yt/utilities/lib/quad_tree.pyx":550
8207 * for j in range(2):
8208 * QTN_merge_nodes(n1.children[i][j], n2.children[i][j], nvals, func)
8209 * elif n1.children[0][0] == NULL and n2.children[0][0] != NULL: # <<<<<<<<<<<<<<
8210 * for i in range(2):
8211 * for j in range(2):
8212 */
8213 __pyx_t_1 = ((((__pyx_v_n1->children[0])[0]) == NULL) != 0);
8214 if (__pyx_t_1) {
8215 } else {
8216 __pyx_t_2 = __pyx_t_1;
8217 goto __pyx_L10_bool_binop_done;
8218 }
8219 __pyx_t_1 = ((((__pyx_v_n2->children[0])[0]) != NULL) != 0);
8220 __pyx_t_2 = __pyx_t_1;
8221 __pyx_L10_bool_binop_done:;
8222 if (__pyx_t_2) {
8223
8224 /* "yt/utilities/lib/quad_tree.pyx":551
8225 * QTN_merge_nodes(n1.children[i][j], n2.children[i][j], nvals, func)
8226 * elif n1.children[0][0] == NULL and n2.children[0][0] != NULL:
8227 * for i in range(2): # <<<<<<<<<<<<<<
8228 * for j in range(2):
8229 * n1.children[i][j] = n2.children[i][j]
8230 */
8231 for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
8232 __pyx_v_i = __pyx_t_3;
8233
8234 /* "yt/utilities/lib/quad_tree.pyx":552
8235 * elif n1.children[0][0] == NULL and n2.children[0][0] != NULL:
8236 * for i in range(2):
8237 * for j in range(2): # <<<<<<<<<<<<<<
8238 * n1.children[i][j] = n2.children[i][j]
8239 * n2.children[i][j] = NULL
8240 */
8241 for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
8242 __pyx_v_j = __pyx_t_4;
8243
8244 /* "yt/utilities/lib/quad_tree.pyx":553
8245 * for i in range(2):
8246 * for j in range(2):
8247 * n1.children[i][j] = n2.children[i][j] # <<<<<<<<<<<<<<
8248 * n2.children[i][j] = NULL
8249 * elif n1.children[0][0] != NULL and n2.children[0][0] == NULL:
8250 */
8251 ((__pyx_v_n1->children[__pyx_v_i])[__pyx_v_j]) = ((__pyx_v_n2->children[__pyx_v_i])[__pyx_v_j]);
8252
8253 /* "yt/utilities/lib/quad_tree.pyx":554
8254 * for j in range(2):
8255 * n1.children[i][j] = n2.children[i][j]
8256 * n2.children[i][j] = NULL # <<<<<<<<<<<<<<
8257 * elif n1.children[0][0] != NULL and n2.children[0][0] == NULL:
8258 * pass
8259 */
8260 ((__pyx_v_n2->children[__pyx_v_i])[__pyx_v_j]) = NULL;
8261 }
8262 }
8263
8264 /* "yt/utilities/lib/quad_tree.pyx":550
8265 * for j in range(2):
8266 * QTN_merge_nodes(n1.children[i][j], n2.children[i][j], nvals, func)
8267 * elif n1.children[0][0] == NULL and n2.children[0][0] != NULL: # <<<<<<<<<<<<<<
8268 * for i in range(2):
8269 * for j in range(2):
8270 */
8271 goto __pyx_L3;
8272 }
8273
8274 /* "yt/utilities/lib/quad_tree.pyx":555
8275 * n1.children[i][j] = n2.children[i][j]
8276 * n2.children[i][j] = NULL
8277 * elif n1.children[0][0] != NULL and n2.children[0][0] == NULL: # <<<<<<<<<<<<<<
8278 * pass
8279 * else:
8280 */
8281 __pyx_t_1 = ((((__pyx_v_n1->children[0])[0]) != NULL) != 0);
8282 if (__pyx_t_1) {
8283 } else {
8284 __pyx_t_2 = __pyx_t_1;
8285 goto __pyx_L16_bool_binop_done;
8286 }
8287 __pyx_t_1 = ((((__pyx_v_n2->children[0])[0]) == NULL) != 0);
8288 __pyx_t_2 = __pyx_t_1;
8289 __pyx_L16_bool_binop_done:;
8290 if (likely(__pyx_t_2)) {
8291 goto __pyx_L3;
8292 }
8293
8294 /* "yt/utilities/lib/quad_tree.pyx":558
8295 * pass
8296 * else:
8297 * raise RuntimeError # <<<<<<<<<<<<<<
8298 *
8299 * def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1):
8300 */
8301 /*else*/ {
8302 __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0, 0);
8303 __PYX_ERR(0, 558, __pyx_L1_error)
8304 }
8305 __pyx_L3:;
8306
8307 /* "yt/utilities/lib/quad_tree.pyx":533
8308 * free(self.root_nodes)
8309 *
8310 * cdef void QTN_merge_nodes(QuadTreeNode *n1, QuadTreeNode *n2, int nvals, # <<<<<<<<<<<<<<
8311 * QTN_combine *func):
8312 * # We have four choices when merging nodes.
8313 */
8314
8315 /* function exit code */
8316 goto __pyx_L0;
8317 __pyx_L1_error:;
8318 __Pyx_WriteUnraisable("yt.utilities.lib.quad_tree.QTN_merge_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
8319 __pyx_L0:;
8320 __Pyx_RefNannyFinishContext();
8321 }
8322
8323 /* "yt/utilities/lib/quad_tree.pyx":560
8324 * raise RuntimeError
8325 *
8326 * def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1): # <<<<<<<<<<<<<<
8327 * cdef int i, j
8328 * qt1.num_cells = 0
8329 */
8330
8331 /* Python wrapper */
8332 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_1merge_quadtrees(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8333 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_9quad_tree_1merge_quadtrees = {"merge_quadtrees", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_1merge_quadtrees, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_9quad_tree_1merge_quadtrees(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8334 static PyObject *__pyx_pw_2yt_9utilities_3lib_9quad_tree_1merge_quadtrees(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8335 struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_qt1 = 0;
8336 struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_qt2 = 0;
8337 PyObject *__pyx_v_method = 0;
8338 PyObject *__pyx_r = 0;
8339 __Pyx_RefNannyDeclarations
8340 __Pyx_RefNannySetupContext("merge_quadtrees (wrapper)", 0);
8341 {
8342 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qt1,&__pyx_n_s_qt2,&__pyx_n_s_method,0};
8343 PyObject* values[3] = {0,0,0};
8344 values[2] = ((PyObject *)__pyx_int_1);
8345 if (unlikely(__pyx_kwds)) {
8346 Py_ssize_t kw_args;
8347 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8348 switch (pos_args) {
8349 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8350 CYTHON_FALLTHROUGH;
8351 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8352 CYTHON_FALLTHROUGH;
8353 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8354 CYTHON_FALLTHROUGH;
8355 case 0: break;
8356 default: goto __pyx_L5_argtuple_error;
8357 }
8358 kw_args = PyDict_Size(__pyx_kwds);
8359 switch (pos_args) {
8360 case 0:
8361 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qt1)) != 0)) kw_args--;
8362 else goto __pyx_L5_argtuple_error;
8363 CYTHON_FALLTHROUGH;
8364 case 1:
8365 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_qt2)) != 0)) kw_args--;
8366 else {
8367 __Pyx_RaiseArgtupleInvalid("merge_quadtrees", 0, 2, 3, 1); __PYX_ERR(0, 560, __pyx_L3_error)
8368 }
8369 CYTHON_FALLTHROUGH;
8370 case 2:
8371 if (kw_args > 0) {
8372 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_method);
8373 if (value) { values[2] = value; kw_args--; }
8374 }
8375 }
8376 if (unlikely(kw_args > 0)) {
8377 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge_quadtrees") < 0)) __PYX_ERR(0, 560, __pyx_L3_error)
8378 }
8379 } else {
8380 switch (PyTuple_GET_SIZE(__pyx_args)) {
8381 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8382 CYTHON_FALLTHROUGH;
8383 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8384 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8385 break;
8386 default: goto __pyx_L5_argtuple_error;
8387 }
8388 }
8389 __pyx_v_qt1 = ((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)values[0]);
8390 __pyx_v_qt2 = ((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)values[1]);
8391 __pyx_v_method = values[2];
8392 }
8393 goto __pyx_L4_argument_unpacking_done;
8394 __pyx_L5_argtuple_error:;
8395 __Pyx_RaiseArgtupleInvalid("merge_quadtrees", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 560, __pyx_L3_error)
8396 __pyx_L3_error:;
8397 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.merge_quadtrees", __pyx_clineno, __pyx_lineno, __pyx_filename);
8398 __Pyx_RefNannyFinishContext();
8399 return NULL;
8400 __pyx_L4_argument_unpacking_done:;
8401 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qt1), __pyx_ptype_2yt_9utilities_3lib_9quad_tree_QuadTree, 1, "qt1", 0))) __PYX_ERR(0, 560, __pyx_L1_error)
8402 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qt2), __pyx_ptype_2yt_9utilities_3lib_9quad_tree_QuadTree, 1, "qt2", 0))) __PYX_ERR(0, 560, __pyx_L1_error)
8403 __pyx_r = __pyx_pf_2yt_9utilities_3lib_9quad_tree_merge_quadtrees(__pyx_self, __pyx_v_qt1, __pyx_v_qt2, __pyx_v_method);
8404
8405 /* function exit code */
8406 goto __pyx_L0;
8407 __pyx_L1_error:;
8408 __pyx_r = NULL;
8409 __pyx_L0:;
8410 __Pyx_RefNannyFinishContext();
8411 return __pyx_r;
8412 }
8413
__pyx_pf_2yt_9utilities_3lib_9quad_tree_merge_quadtrees(CYTHON_UNUSED PyObject * __pyx_self,struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_qt1,struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree * __pyx_v_qt2,PyObject * __pyx_v_method)8414 static PyObject *__pyx_pf_2yt_9utilities_3lib_9quad_tree_merge_quadtrees(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_qt1, struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *__pyx_v_qt2, PyObject *__pyx_v_method) {
8415 int __pyx_v_i;
8416 int __pyx_v_j;
8417 __pyx_t_2yt_9utilities_3lib_9quad_tree_QTN_combine *__pyx_v_func;
8418 PyObject *__pyx_r = NULL;
8419 __Pyx_RefNannyDeclarations
8420 PyObject *__pyx_t_1 = NULL;
8421 int __pyx_t_2;
8422 int __pyx_t_3;
8423 __pyx_t_5numpy_int64_t __pyx_t_4;
8424 __pyx_t_5numpy_int64_t __pyx_t_5;
8425 int __pyx_t_6;
8426 __pyx_t_5numpy_int64_t __pyx_t_7;
8427 __pyx_t_5numpy_int64_t __pyx_t_8;
8428 int __pyx_t_9;
8429 __Pyx_RefNannySetupContext("merge_quadtrees", 0);
8430
8431 /* "yt/utilities/lib/quad_tree.pyx":562
8432 * def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1):
8433 * cdef int i, j
8434 * qt1.num_cells = 0 # <<<<<<<<<<<<<<
8435 * cdef QTN_combine *func
8436 * if method == 1:
8437 */
8438 __pyx_v_qt1->num_cells = 0;
8439
8440 /* "yt/utilities/lib/quad_tree.pyx":564
8441 * qt1.num_cells = 0
8442 * cdef QTN_combine *func
8443 * if method == 1: # <<<<<<<<<<<<<<
8444 * qt1.merged = 1
8445 * func = QTN_add_value
8446 */
8447 __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_method, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
8448 __Pyx_GOTREF(__pyx_t_1);
8449 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 564, __pyx_L1_error)
8450 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8451 if (__pyx_t_2) {
8452
8453 /* "yt/utilities/lib/quad_tree.pyx":565
8454 * cdef QTN_combine *func
8455 * if method == 1:
8456 * qt1.merged = 1 # <<<<<<<<<<<<<<
8457 * func = QTN_add_value
8458 * elif method == -1:
8459 */
8460 __pyx_v_qt1->merged = 1;
8461
8462 /* "yt/utilities/lib/quad_tree.pyx":566
8463 * if method == 1:
8464 * qt1.merged = 1
8465 * func = QTN_add_value # <<<<<<<<<<<<<<
8466 * elif method == -1:
8467 * qt1.merged = -1
8468 */
8469 __pyx_v_func = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_add_value;
8470
8471 /* "yt/utilities/lib/quad_tree.pyx":564
8472 * qt1.num_cells = 0
8473 * cdef QTN_combine *func
8474 * if method == 1: # <<<<<<<<<<<<<<
8475 * qt1.merged = 1
8476 * func = QTN_add_value
8477 */
8478 goto __pyx_L3;
8479 }
8480
8481 /* "yt/utilities/lib/quad_tree.pyx":567
8482 * qt1.merged = 1
8483 * func = QTN_add_value
8484 * elif method == -1: # <<<<<<<<<<<<<<
8485 * qt1.merged = -1
8486 * func = QTN_max_value
8487 */
8488 __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_method, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
8489 __Pyx_GOTREF(__pyx_t_1);
8490 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 567, __pyx_L1_error)
8491 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8492 if (likely(__pyx_t_2)) {
8493
8494 /* "yt/utilities/lib/quad_tree.pyx":568
8495 * func = QTN_add_value
8496 * elif method == -1:
8497 * qt1.merged = -1 # <<<<<<<<<<<<<<
8498 * func = QTN_max_value
8499 * else:
8500 */
8501 __pyx_v_qt1->merged = -1;
8502
8503 /* "yt/utilities/lib/quad_tree.pyx":569
8504 * elif method == -1:
8505 * qt1.merged = -1
8506 * func = QTN_max_value # <<<<<<<<<<<<<<
8507 * else:
8508 * raise NotImplementedError
8509 */
8510 __pyx_v_func = __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_max_value;
8511
8512 /* "yt/utilities/lib/quad_tree.pyx":567
8513 * qt1.merged = 1
8514 * func = QTN_add_value
8515 * elif method == -1: # <<<<<<<<<<<<<<
8516 * qt1.merged = -1
8517 * func = QTN_max_value
8518 */
8519 goto __pyx_L3;
8520 }
8521
8522 /* "yt/utilities/lib/quad_tree.pyx":571
8523 * func = QTN_max_value
8524 * else:
8525 * raise NotImplementedError # <<<<<<<<<<<<<<
8526 * if qt1.merged != 0 or qt2.merged != 0:
8527 * assert(qt1.merged == qt2.merged)
8528 */
8529 /*else*/ {
8530 __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
8531 __PYX_ERR(0, 571, __pyx_L1_error)
8532 }
8533 __pyx_L3:;
8534
8535 /* "yt/utilities/lib/quad_tree.pyx":572
8536 * else:
8537 * raise NotImplementedError
8538 * if qt1.merged != 0 or qt2.merged != 0: # <<<<<<<<<<<<<<
8539 * assert(qt1.merged == qt2.merged)
8540 * for i in range(qt1.top_grid_dims[0]):
8541 */
8542 __pyx_t_3 = ((__pyx_v_qt1->merged != 0) != 0);
8543 if (!__pyx_t_3) {
8544 } else {
8545 __pyx_t_2 = __pyx_t_3;
8546 goto __pyx_L5_bool_binop_done;
8547 }
8548 __pyx_t_3 = ((__pyx_v_qt2->merged != 0) != 0);
8549 __pyx_t_2 = __pyx_t_3;
8550 __pyx_L5_bool_binop_done:;
8551 if (__pyx_t_2) {
8552
8553 /* "yt/utilities/lib/quad_tree.pyx":573
8554 * raise NotImplementedError
8555 * if qt1.merged != 0 or qt2.merged != 0:
8556 * assert(qt1.merged == qt2.merged) # <<<<<<<<<<<<<<
8557 * for i in range(qt1.top_grid_dims[0]):
8558 * for j in range(qt1.top_grid_dims[1]):
8559 */
8560 #ifndef CYTHON_WITHOUT_ASSERTIONS
8561 if (unlikely(!Py_OptimizeFlag)) {
8562 if (unlikely(!((__pyx_v_qt1->merged == __pyx_v_qt2->merged) != 0))) {
8563 PyErr_SetNone(PyExc_AssertionError);
8564 __PYX_ERR(0, 573, __pyx_L1_error)
8565 }
8566 }
8567 #endif
8568
8569 /* "yt/utilities/lib/quad_tree.pyx":572
8570 * else:
8571 * raise NotImplementedError
8572 * if qt1.merged != 0 or qt2.merged != 0: # <<<<<<<<<<<<<<
8573 * assert(qt1.merged == qt2.merged)
8574 * for i in range(qt1.top_grid_dims[0]):
8575 */
8576 }
8577
8578 /* "yt/utilities/lib/quad_tree.pyx":574
8579 * if qt1.merged != 0 or qt2.merged != 0:
8580 * assert(qt1.merged == qt2.merged)
8581 * for i in range(qt1.top_grid_dims[0]): # <<<<<<<<<<<<<<
8582 * for j in range(qt1.top_grid_dims[1]):
8583 * QTN_merge_nodes(qt1.root_nodes[i][j],
8584 */
8585 __pyx_t_4 = (__pyx_v_qt1->top_grid_dims[0]);
8586 __pyx_t_5 = __pyx_t_4;
8587 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
8588 __pyx_v_i = __pyx_t_6;
8589
8590 /* "yt/utilities/lib/quad_tree.pyx":575
8591 * assert(qt1.merged == qt2.merged)
8592 * for i in range(qt1.top_grid_dims[0]):
8593 * for j in range(qt1.top_grid_dims[1]): # <<<<<<<<<<<<<<
8594 * QTN_merge_nodes(qt1.root_nodes[i][j],
8595 * qt2.root_nodes[i][j],
8596 */
8597 __pyx_t_7 = (__pyx_v_qt1->top_grid_dims[1]);
8598 __pyx_t_8 = __pyx_t_7;
8599 for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
8600 __pyx_v_j = __pyx_t_9;
8601
8602 /* "yt/utilities/lib/quad_tree.pyx":576
8603 * for i in range(qt1.top_grid_dims[0]):
8604 * for j in range(qt1.top_grid_dims[1]):
8605 * QTN_merge_nodes(qt1.root_nodes[i][j], # <<<<<<<<<<<<<<
8606 * qt2.root_nodes[i][j],
8607 * qt1.nvals, func)
8608 */
8609 __pyx_f_2yt_9utilities_3lib_9quad_tree_QTN_merge_nodes(((__pyx_v_qt1->root_nodes[__pyx_v_i])[__pyx_v_j]), ((__pyx_v_qt2->root_nodes[__pyx_v_i])[__pyx_v_j]), __pyx_v_qt1->nvals, __pyx_v_func);
8610
8611 /* "yt/utilities/lib/quad_tree.pyx":579
8612 * qt2.root_nodes[i][j],
8613 * qt1.nvals, func)
8614 * qt1.num_cells += qt1.count_total_cells( # <<<<<<<<<<<<<<
8615 * qt1.root_nodes[i][j])
8616 */
8617 __pyx_v_qt1->num_cells = (__pyx_v_qt1->num_cells + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree *)__pyx_v_qt1->__pyx_vtab)->count_total_cells(__pyx_v_qt1, ((__pyx_v_qt1->root_nodes[__pyx_v_i])[__pyx_v_j])));
8618 }
8619 }
8620
8621 /* "yt/utilities/lib/quad_tree.pyx":560
8622 * raise RuntimeError
8623 *
8624 * def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1): # <<<<<<<<<<<<<<
8625 * cdef int i, j
8626 * qt1.num_cells = 0
8627 */
8628
8629 /* function exit code */
8630 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8631 goto __pyx_L0;
8632 __pyx_L1_error:;
8633 __Pyx_XDECREF(__pyx_t_1);
8634 __Pyx_AddTraceback("yt.utilities.lib.quad_tree.merge_quadtrees", __pyx_clineno, __pyx_lineno, __pyx_filename);
8635 __pyx_r = NULL;
8636 __pyx_L0:;
8637 __Pyx_XGIVEREF(__pyx_r);
8638 __Pyx_RefNannyFinishContext();
8639 return __pyx_r;
8640 }
8641
8642 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
8643 * # experimental exception made for __getbuffer__ and __releasebuffer__
8644 * # -- the details of this may change.
8645 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
8646 * # This implementation of getbuffer is geared towards Cython
8647 * # requirements, and does not yet fulfill the PEP.
8648 */
8649
8650 /* Python wrapper */
8651 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)8652 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
8653 int __pyx_r;
8654 __Pyx_RefNannyDeclarations
8655 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
8656 __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
8657
8658 /* function exit code */
8659 __Pyx_RefNannyFinishContext();
8660 return __pyx_r;
8661 }
8662
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)8663 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
8664 int __pyx_v_i;
8665 int __pyx_v_ndim;
8666 int __pyx_v_endian_detector;
8667 int __pyx_v_little_endian;
8668 int __pyx_v_t;
8669 char *__pyx_v_f;
8670 PyArray_Descr *__pyx_v_descr = 0;
8671 int __pyx_v_offset;
8672 int __pyx_r;
8673 __Pyx_RefNannyDeclarations
8674 int __pyx_t_1;
8675 int __pyx_t_2;
8676 PyObject *__pyx_t_3 = NULL;
8677 int __pyx_t_4;
8678 int __pyx_t_5;
8679 int __pyx_t_6;
8680 PyArray_Descr *__pyx_t_7;
8681 PyObject *__pyx_t_8 = NULL;
8682 char *__pyx_t_9;
8683 if (__pyx_v_info == NULL) {
8684 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
8685 return -1;
8686 }
8687 __Pyx_RefNannySetupContext("__getbuffer__", 0);
8688 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
8689 __Pyx_GIVEREF(__pyx_v_info->obj);
8690
8691 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
8692 *
8693 * cdef int i, ndim
8694 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
8695 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8696 *
8697 */
8698 __pyx_v_endian_detector = 1;
8699
8700 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
8701 * cdef int i, ndim
8702 * cdef int endian_detector = 1
8703 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
8704 *
8705 * ndim = PyArray_NDIM(self)
8706 */
8707 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
8708
8709 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
8710 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8711 *
8712 * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
8713 *
8714 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8715 */
8716 __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
8717
8718 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
8719 * ndim = PyArray_NDIM(self)
8720 *
8721 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
8722 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
8723 * raise ValueError(u"ndarray is not C contiguous")
8724 */
8725 __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
8726 if (__pyx_t_2) {
8727 } else {
8728 __pyx_t_1 = __pyx_t_2;
8729 goto __pyx_L4_bool_binop_done;
8730 }
8731
8732 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
8733 *
8734 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8735 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
8736 * raise ValueError(u"ndarray is not C contiguous")
8737 *
8738 */
8739 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
8740 __pyx_t_1 = __pyx_t_2;
8741 __pyx_L4_bool_binop_done:;
8742
8743 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
8744 * ndim = PyArray_NDIM(self)
8745 *
8746 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
8747 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
8748 * raise ValueError(u"ndarray is not C contiguous")
8749 */
8750 if (unlikely(__pyx_t_1)) {
8751
8752 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
8753 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8754 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
8755 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
8756 *
8757 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8758 */
8759 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
8760 __Pyx_GOTREF(__pyx_t_3);
8761 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8762 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8763 __PYX_ERR(2, 272, __pyx_L1_error)
8764
8765 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
8766 * ndim = PyArray_NDIM(self)
8767 *
8768 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
8769 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
8770 * raise ValueError(u"ndarray is not C contiguous")
8771 */
8772 }
8773
8774 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
8775 * raise ValueError(u"ndarray is not C contiguous")
8776 *
8777 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
8778 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
8779 * raise ValueError(u"ndarray is not Fortran contiguous")
8780 */
8781 __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
8782 if (__pyx_t_2) {
8783 } else {
8784 __pyx_t_1 = __pyx_t_2;
8785 goto __pyx_L7_bool_binop_done;
8786 }
8787
8788 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
8789 *
8790 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8791 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
8792 * raise ValueError(u"ndarray is not Fortran contiguous")
8793 *
8794 */
8795 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
8796 __pyx_t_1 = __pyx_t_2;
8797 __pyx_L7_bool_binop_done:;
8798
8799 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
8800 * raise ValueError(u"ndarray is not C contiguous")
8801 *
8802 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
8803 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
8804 * raise ValueError(u"ndarray is not Fortran contiguous")
8805 */
8806 if (unlikely(__pyx_t_1)) {
8807
8808 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
8809 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8810 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
8811 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
8812 *
8813 * info.buf = PyArray_DATA(self)
8814 */
8815 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
8816 __Pyx_GOTREF(__pyx_t_3);
8817 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8818 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8819 __PYX_ERR(2, 276, __pyx_L1_error)
8820
8821 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
8822 * raise ValueError(u"ndarray is not C contiguous")
8823 *
8824 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
8825 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
8826 * raise ValueError(u"ndarray is not Fortran contiguous")
8827 */
8828 }
8829
8830 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
8831 * raise ValueError(u"ndarray is not Fortran contiguous")
8832 *
8833 * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
8834 * info.ndim = ndim
8835 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
8836 */
8837 __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
8838
8839 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
8840 *
8841 * info.buf = PyArray_DATA(self)
8842 * info.ndim = ndim # <<<<<<<<<<<<<<
8843 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
8844 * # Allocate new buffer for strides and shape info.
8845 */
8846 __pyx_v_info->ndim = __pyx_v_ndim;
8847
8848 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
8849 * info.buf = PyArray_DATA(self)
8850 * info.ndim = ndim
8851 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
8852 * # Allocate new buffer for strides and shape info.
8853 * # This is allocated as one block, strides first.
8854 */
8855 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
8856 if (__pyx_t_1) {
8857
8858 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
8859 * # Allocate new buffer for strides and shape info.
8860 * # This is allocated as one block, strides first.
8861 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
8862 * info.shape = info.strides + ndim
8863 * for i in range(ndim):
8864 */
8865 __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
8866
8867 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
8868 * # This is allocated as one block, strides first.
8869 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
8870 * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
8871 * for i in range(ndim):
8872 * info.strides[i] = PyArray_STRIDES(self)[i]
8873 */
8874 __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
8875
8876 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
8877 * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
8878 * info.shape = info.strides + ndim
8879 * for i in range(ndim): # <<<<<<<<<<<<<<
8880 * info.strides[i] = PyArray_STRIDES(self)[i]
8881 * info.shape[i] = PyArray_DIMS(self)[i]
8882 */
8883 __pyx_t_4 = __pyx_v_ndim;
8884 __pyx_t_5 = __pyx_t_4;
8885 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
8886 __pyx_v_i = __pyx_t_6;
8887
8888 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
8889 * info.shape = info.strides + ndim
8890 * for i in range(ndim):
8891 * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
8892 * info.shape[i] = PyArray_DIMS(self)[i]
8893 * else:
8894 */
8895 (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
8896
8897 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
8898 * for i in range(ndim):
8899 * info.strides[i] = PyArray_STRIDES(self)[i]
8900 * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
8901 * else:
8902 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8903 */
8904 (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
8905 }
8906
8907 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
8908 * info.buf = PyArray_DATA(self)
8909 * info.ndim = ndim
8910 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
8911 * # Allocate new buffer for strides and shape info.
8912 * # This is allocated as one block, strides first.
8913 */
8914 goto __pyx_L9;
8915 }
8916
8917 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
8918 * info.shape[i] = PyArray_DIMS(self)[i]
8919 * else:
8920 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
8921 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8922 * info.suboffsets = NULL
8923 */
8924 /*else*/ {
8925 __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
8926
8927 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
8928 * else:
8929 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8930 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
8931 * info.suboffsets = NULL
8932 * info.itemsize = PyArray_ITEMSIZE(self)
8933 */
8934 __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
8935 }
8936 __pyx_L9:;
8937
8938 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
8939 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8940 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8941 * info.suboffsets = NULL # <<<<<<<<<<<<<<
8942 * info.itemsize = PyArray_ITEMSIZE(self)
8943 * info.readonly = not PyArray_ISWRITEABLE(self)
8944 */
8945 __pyx_v_info->suboffsets = NULL;
8946
8947 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
8948 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8949 * info.suboffsets = NULL
8950 * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
8951 * info.readonly = not PyArray_ISWRITEABLE(self)
8952 *
8953 */
8954 __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
8955
8956 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
8957 * info.suboffsets = NULL
8958 * info.itemsize = PyArray_ITEMSIZE(self)
8959 * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
8960 *
8961 * cdef int t
8962 */
8963 __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
8964
8965 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
8966 *
8967 * cdef int t
8968 * cdef char* f = NULL # <<<<<<<<<<<<<<
8969 * cdef dtype descr = <dtype>PyArray_DESCR(self)
8970 * cdef int offset
8971 */
8972 __pyx_v_f = NULL;
8973
8974 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
8975 * cdef int t
8976 * cdef char* f = NULL
8977 * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
8978 * cdef int offset
8979 *
8980 */
8981 __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
8982 __pyx_t_3 = ((PyObject *)__pyx_t_7);
8983 __Pyx_INCREF(__pyx_t_3);
8984 __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
8985 __pyx_t_3 = 0;
8986
8987 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
8988 * cdef int offset
8989 *
8990 * info.obj = self # <<<<<<<<<<<<<<
8991 *
8992 * if not PyDataType_HASFIELDS(descr):
8993 */
8994 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8995 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8996 __Pyx_GOTREF(__pyx_v_info->obj);
8997 __Pyx_DECREF(__pyx_v_info->obj);
8998 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8999
9000 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
9001 * info.obj = self
9002 *
9003 * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
9004 * t = descr.type_num
9005 * if ((descr.byteorder == c'>' and little_endian) or
9006 */
9007 __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
9008 if (__pyx_t_1) {
9009
9010 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
9011 *
9012 * if not PyDataType_HASFIELDS(descr):
9013 * t = descr.type_num # <<<<<<<<<<<<<<
9014 * if ((descr.byteorder == c'>' and little_endian) or
9015 * (descr.byteorder == c'<' and not little_endian)):
9016 */
9017 __pyx_t_4 = __pyx_v_descr->type_num;
9018 __pyx_v_t = __pyx_t_4;
9019
9020 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
9021 * if not PyDataType_HASFIELDS(descr):
9022 * t = descr.type_num
9023 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9024 * (descr.byteorder == c'<' and not little_endian)):
9025 * raise ValueError(u"Non-native byte order not supported")
9026 */
9027 __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
9028 if (!__pyx_t_2) {
9029 goto __pyx_L15_next_or;
9030 } else {
9031 }
9032 __pyx_t_2 = (__pyx_v_little_endian != 0);
9033 if (!__pyx_t_2) {
9034 } else {
9035 __pyx_t_1 = __pyx_t_2;
9036 goto __pyx_L14_bool_binop_done;
9037 }
9038 __pyx_L15_next_or:;
9039
9040 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
9041 * t = descr.type_num
9042 * if ((descr.byteorder == c'>' and little_endian) or
9043 * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
9044 * raise ValueError(u"Non-native byte order not supported")
9045 * if t == NPY_BYTE: f = "b"
9046 */
9047 __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
9048 if (__pyx_t_2) {
9049 } else {
9050 __pyx_t_1 = __pyx_t_2;
9051 goto __pyx_L14_bool_binop_done;
9052 }
9053 __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
9054 __pyx_t_1 = __pyx_t_2;
9055 __pyx_L14_bool_binop_done:;
9056
9057 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
9058 * if not PyDataType_HASFIELDS(descr):
9059 * t = descr.type_num
9060 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9061 * (descr.byteorder == c'<' and not little_endian)):
9062 * raise ValueError(u"Non-native byte order not supported")
9063 */
9064 if (unlikely(__pyx_t_1)) {
9065
9066 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
9067 * if ((descr.byteorder == c'>' and little_endian) or
9068 * (descr.byteorder == c'<' and not little_endian)):
9069 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
9070 * if t == NPY_BYTE: f = "b"
9071 * elif t == NPY_UBYTE: f = "B"
9072 */
9073 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
9074 __Pyx_GOTREF(__pyx_t_3);
9075 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9076 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9077 __PYX_ERR(2, 306, __pyx_L1_error)
9078
9079 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
9080 * if not PyDataType_HASFIELDS(descr):
9081 * t = descr.type_num
9082 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9083 * (descr.byteorder == c'<' and not little_endian)):
9084 * raise ValueError(u"Non-native byte order not supported")
9085 */
9086 }
9087
9088 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
9089 * (descr.byteorder == c'<' and not little_endian)):
9090 * raise ValueError(u"Non-native byte order not supported")
9091 * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
9092 * elif t == NPY_UBYTE: f = "B"
9093 * elif t == NPY_SHORT: f = "h"
9094 */
9095 switch (__pyx_v_t) {
9096 case NPY_BYTE:
9097 __pyx_v_f = ((char *)"b");
9098 break;
9099 case NPY_UBYTE:
9100
9101 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
9102 * raise ValueError(u"Non-native byte order not supported")
9103 * if t == NPY_BYTE: f = "b"
9104 * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
9105 * elif t == NPY_SHORT: f = "h"
9106 * elif t == NPY_USHORT: f = "H"
9107 */
9108 __pyx_v_f = ((char *)"B");
9109 break;
9110 case NPY_SHORT:
9111
9112 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
9113 * if t == NPY_BYTE: f = "b"
9114 * elif t == NPY_UBYTE: f = "B"
9115 * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
9116 * elif t == NPY_USHORT: f = "H"
9117 * elif t == NPY_INT: f = "i"
9118 */
9119 __pyx_v_f = ((char *)"h");
9120 break;
9121 case NPY_USHORT:
9122
9123 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
9124 * elif t == NPY_UBYTE: f = "B"
9125 * elif t == NPY_SHORT: f = "h"
9126 * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
9127 * elif t == NPY_INT: f = "i"
9128 * elif t == NPY_UINT: f = "I"
9129 */
9130 __pyx_v_f = ((char *)"H");
9131 break;
9132 case NPY_INT:
9133
9134 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
9135 * elif t == NPY_SHORT: f = "h"
9136 * elif t == NPY_USHORT: f = "H"
9137 * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
9138 * elif t == NPY_UINT: f = "I"
9139 * elif t == NPY_LONG: f = "l"
9140 */
9141 __pyx_v_f = ((char *)"i");
9142 break;
9143 case NPY_UINT:
9144
9145 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
9146 * elif t == NPY_USHORT: f = "H"
9147 * elif t == NPY_INT: f = "i"
9148 * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
9149 * elif t == NPY_LONG: f = "l"
9150 * elif t == NPY_ULONG: f = "L"
9151 */
9152 __pyx_v_f = ((char *)"I");
9153 break;
9154 case NPY_LONG:
9155
9156 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
9157 * elif t == NPY_INT: f = "i"
9158 * elif t == NPY_UINT: f = "I"
9159 * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
9160 * elif t == NPY_ULONG: f = "L"
9161 * elif t == NPY_LONGLONG: f = "q"
9162 */
9163 __pyx_v_f = ((char *)"l");
9164 break;
9165 case NPY_ULONG:
9166
9167 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
9168 * elif t == NPY_UINT: f = "I"
9169 * elif t == NPY_LONG: f = "l"
9170 * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
9171 * elif t == NPY_LONGLONG: f = "q"
9172 * elif t == NPY_ULONGLONG: f = "Q"
9173 */
9174 __pyx_v_f = ((char *)"L");
9175 break;
9176 case NPY_LONGLONG:
9177
9178 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
9179 * elif t == NPY_LONG: f = "l"
9180 * elif t == NPY_ULONG: f = "L"
9181 * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
9182 * elif t == NPY_ULONGLONG: f = "Q"
9183 * elif t == NPY_FLOAT: f = "f"
9184 */
9185 __pyx_v_f = ((char *)"q");
9186 break;
9187 case NPY_ULONGLONG:
9188
9189 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
9190 * elif t == NPY_ULONG: f = "L"
9191 * elif t == NPY_LONGLONG: f = "q"
9192 * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
9193 * elif t == NPY_FLOAT: f = "f"
9194 * elif t == NPY_DOUBLE: f = "d"
9195 */
9196 __pyx_v_f = ((char *)"Q");
9197 break;
9198 case NPY_FLOAT:
9199
9200 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
9201 * elif t == NPY_LONGLONG: f = "q"
9202 * elif t == NPY_ULONGLONG: f = "Q"
9203 * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
9204 * elif t == NPY_DOUBLE: f = "d"
9205 * elif t == NPY_LONGDOUBLE: f = "g"
9206 */
9207 __pyx_v_f = ((char *)"f");
9208 break;
9209 case NPY_DOUBLE:
9210
9211 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
9212 * elif t == NPY_ULONGLONG: f = "Q"
9213 * elif t == NPY_FLOAT: f = "f"
9214 * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
9215 * elif t == NPY_LONGDOUBLE: f = "g"
9216 * elif t == NPY_CFLOAT: f = "Zf"
9217 */
9218 __pyx_v_f = ((char *)"d");
9219 break;
9220 case NPY_LONGDOUBLE:
9221
9222 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
9223 * elif t == NPY_FLOAT: f = "f"
9224 * elif t == NPY_DOUBLE: f = "d"
9225 * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
9226 * elif t == NPY_CFLOAT: f = "Zf"
9227 * elif t == NPY_CDOUBLE: f = "Zd"
9228 */
9229 __pyx_v_f = ((char *)"g");
9230 break;
9231 case NPY_CFLOAT:
9232
9233 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
9234 * elif t == NPY_DOUBLE: f = "d"
9235 * elif t == NPY_LONGDOUBLE: f = "g"
9236 * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
9237 * elif t == NPY_CDOUBLE: f = "Zd"
9238 * elif t == NPY_CLONGDOUBLE: f = "Zg"
9239 */
9240 __pyx_v_f = ((char *)"Zf");
9241 break;
9242 case NPY_CDOUBLE:
9243
9244 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
9245 * elif t == NPY_LONGDOUBLE: f = "g"
9246 * elif t == NPY_CFLOAT: f = "Zf"
9247 * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
9248 * elif t == NPY_CLONGDOUBLE: f = "Zg"
9249 * elif t == NPY_OBJECT: f = "O"
9250 */
9251 __pyx_v_f = ((char *)"Zd");
9252 break;
9253 case NPY_CLONGDOUBLE:
9254
9255 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
9256 * elif t == NPY_CFLOAT: f = "Zf"
9257 * elif t == NPY_CDOUBLE: f = "Zd"
9258 * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
9259 * elif t == NPY_OBJECT: f = "O"
9260 * else:
9261 */
9262 __pyx_v_f = ((char *)"Zg");
9263 break;
9264 case NPY_OBJECT:
9265
9266 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
9267 * elif t == NPY_CDOUBLE: f = "Zd"
9268 * elif t == NPY_CLONGDOUBLE: f = "Zg"
9269 * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
9270 * else:
9271 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9272 */
9273 __pyx_v_f = ((char *)"O");
9274 break;
9275 default:
9276
9277 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
9278 * elif t == NPY_OBJECT: f = "O"
9279 * else:
9280 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
9281 * info.format = f
9282 * return
9283 */
9284 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
9285 __Pyx_GOTREF(__pyx_t_3);
9286 __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
9287 __Pyx_GOTREF(__pyx_t_8);
9288 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9289 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
9290 __Pyx_GOTREF(__pyx_t_3);
9291 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9292 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9293 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9294 __PYX_ERR(2, 325, __pyx_L1_error)
9295 break;
9296 }
9297
9298 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
9299 * else:
9300 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9301 * info.format = f # <<<<<<<<<<<<<<
9302 * return
9303 * else:
9304 */
9305 __pyx_v_info->format = __pyx_v_f;
9306
9307 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
9308 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9309 * info.format = f
9310 * return # <<<<<<<<<<<<<<
9311 * else:
9312 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
9313 */
9314 __pyx_r = 0;
9315 goto __pyx_L0;
9316
9317 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
9318 * info.obj = self
9319 *
9320 * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
9321 * t = descr.type_num
9322 * if ((descr.byteorder == c'>' and little_endian) or
9323 */
9324 }
9325
9326 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
9327 * return
9328 * else:
9329 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
9330 * info.format[0] = c'^' # Native data types, manual alignment
9331 * offset = 0
9332 */
9333 /*else*/ {
9334 __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
9335
9336 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
9337 * else:
9338 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
9339 * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
9340 * offset = 0
9341 * f = _util_dtypestring(descr, info.format + 1,
9342 */
9343 (__pyx_v_info->format[0]) = '^';
9344
9345 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
9346 * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
9347 * info.format[0] = c'^' # Native data types, manual alignment
9348 * offset = 0 # <<<<<<<<<<<<<<
9349 * f = _util_dtypestring(descr, info.format + 1,
9350 * info.format + _buffer_format_string_len,
9351 */
9352 __pyx_v_offset = 0;
9353
9354 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
9355 * info.format[0] = c'^' # Native data types, manual alignment
9356 * offset = 0
9357 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
9358 * info.format + _buffer_format_string_len,
9359 * &offset)
9360 */
9361 __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(2, 332, __pyx_L1_error)
9362 __pyx_v_f = __pyx_t_9;
9363
9364 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
9365 * info.format + _buffer_format_string_len,
9366 * &offset)
9367 * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
9368 *
9369 * def __releasebuffer__(ndarray self, Py_buffer* info):
9370 */
9371 (__pyx_v_f[0]) = '\x00';
9372 }
9373
9374 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
9375 * # experimental exception made for __getbuffer__ and __releasebuffer__
9376 * # -- the details of this may change.
9377 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
9378 * # This implementation of getbuffer is geared towards Cython
9379 * # requirements, and does not yet fulfill the PEP.
9380 */
9381
9382 /* function exit code */
9383 __pyx_r = 0;
9384 goto __pyx_L0;
9385 __pyx_L1_error:;
9386 __Pyx_XDECREF(__pyx_t_3);
9387 __Pyx_XDECREF(__pyx_t_8);
9388 __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9389 __pyx_r = -1;
9390 if (__pyx_v_info->obj != NULL) {
9391 __Pyx_GOTREF(__pyx_v_info->obj);
9392 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9393 }
9394 goto __pyx_L2;
9395 __pyx_L0:;
9396 if (__pyx_v_info->obj == Py_None) {
9397 __Pyx_GOTREF(__pyx_v_info->obj);
9398 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9399 }
9400 __pyx_L2:;
9401 __Pyx_XDECREF((PyObject *)__pyx_v_descr);
9402 __Pyx_RefNannyFinishContext();
9403 return __pyx_r;
9404 }
9405
9406 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
9407 * f[0] = c'\0' # Terminate format string
9408 *
9409 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
9410 * if PyArray_HASFIELDS(self):
9411 * PyObject_Free(info.format)
9412 */
9413
9414 /* Python wrapper */
9415 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)9416 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
9417 __Pyx_RefNannyDeclarations
9418 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
9419 __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
9420
9421 /* function exit code */
9422 __Pyx_RefNannyFinishContext();
9423 }
9424
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)9425 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
9426 __Pyx_RefNannyDeclarations
9427 int __pyx_t_1;
9428 __Pyx_RefNannySetupContext("__releasebuffer__", 0);
9429
9430 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
9431 *
9432 * def __releasebuffer__(ndarray self, Py_buffer* info):
9433 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
9434 * PyObject_Free(info.format)
9435 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9436 */
9437 __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
9438 if (__pyx_t_1) {
9439
9440 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
9441 * def __releasebuffer__(ndarray self, Py_buffer* info):
9442 * if PyArray_HASFIELDS(self):
9443 * PyObject_Free(info.format) # <<<<<<<<<<<<<<
9444 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9445 * PyObject_Free(info.strides)
9446 */
9447 PyObject_Free(__pyx_v_info->format);
9448
9449 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
9450 *
9451 * def __releasebuffer__(ndarray self, Py_buffer* info):
9452 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
9453 * PyObject_Free(info.format)
9454 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9455 */
9456 }
9457
9458 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
9459 * if PyArray_HASFIELDS(self):
9460 * PyObject_Free(info.format)
9461 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
9462 * PyObject_Free(info.strides)
9463 * # info.shape was stored after info.strides in the same block
9464 */
9465 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
9466 if (__pyx_t_1) {
9467
9468 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
9469 * PyObject_Free(info.format)
9470 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9471 * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
9472 * # info.shape was stored after info.strides in the same block
9473 *
9474 */
9475 PyObject_Free(__pyx_v_info->strides);
9476
9477 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
9478 * if PyArray_HASFIELDS(self):
9479 * PyObject_Free(info.format)
9480 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
9481 * PyObject_Free(info.strides)
9482 * # info.shape was stored after info.strides in the same block
9483 */
9484 }
9485
9486 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
9487 * f[0] = c'\0' # Terminate format string
9488 *
9489 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
9490 * if PyArray_HASFIELDS(self):
9491 * PyObject_Free(info.format)
9492 */
9493
9494 /* function exit code */
9495 __Pyx_RefNannyFinishContext();
9496 }
9497
9498 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
9499 * ctypedef npy_cdouble complex_t
9500 *
9501 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
9502 * return PyArray_MultiIterNew(1, <void*>a)
9503 *
9504 */
9505
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)9506 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
9507 PyObject *__pyx_r = NULL;
9508 __Pyx_RefNannyDeclarations
9509 PyObject *__pyx_t_1 = NULL;
9510 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
9511
9512 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
9513 *
9514 * cdef inline object PyArray_MultiIterNew1(a):
9515 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
9516 *
9517 * cdef inline object PyArray_MultiIterNew2(a, b):
9518 */
9519 __Pyx_XDECREF(__pyx_r);
9520 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
9521 __Pyx_GOTREF(__pyx_t_1);
9522 __pyx_r = __pyx_t_1;
9523 __pyx_t_1 = 0;
9524 goto __pyx_L0;
9525
9526 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
9527 * ctypedef npy_cdouble complex_t
9528 *
9529 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
9530 * return PyArray_MultiIterNew(1, <void*>a)
9531 *
9532 */
9533
9534 /* function exit code */
9535 __pyx_L1_error:;
9536 __Pyx_XDECREF(__pyx_t_1);
9537 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
9538 __pyx_r = 0;
9539 __pyx_L0:;
9540 __Pyx_XGIVEREF(__pyx_r);
9541 __Pyx_RefNannyFinishContext();
9542 return __pyx_r;
9543 }
9544
9545 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
9546 * return PyArray_MultiIterNew(1, <void*>a)
9547 *
9548 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
9549 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9550 *
9551 */
9552
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)9553 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
9554 PyObject *__pyx_r = NULL;
9555 __Pyx_RefNannyDeclarations
9556 PyObject *__pyx_t_1 = NULL;
9557 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
9558
9559 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
9560 *
9561 * cdef inline object PyArray_MultiIterNew2(a, b):
9562 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
9563 *
9564 * cdef inline object PyArray_MultiIterNew3(a, b, c):
9565 */
9566 __Pyx_XDECREF(__pyx_r);
9567 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 825, __pyx_L1_error)
9568 __Pyx_GOTREF(__pyx_t_1);
9569 __pyx_r = __pyx_t_1;
9570 __pyx_t_1 = 0;
9571 goto __pyx_L0;
9572
9573 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
9574 * return PyArray_MultiIterNew(1, <void*>a)
9575 *
9576 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
9577 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9578 *
9579 */
9580
9581 /* function exit code */
9582 __pyx_L1_error:;
9583 __Pyx_XDECREF(__pyx_t_1);
9584 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
9585 __pyx_r = 0;
9586 __pyx_L0:;
9587 __Pyx_XGIVEREF(__pyx_r);
9588 __Pyx_RefNannyFinishContext();
9589 return __pyx_r;
9590 }
9591
9592 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
9593 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9594 *
9595 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
9596 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9597 *
9598 */
9599
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)9600 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
9601 PyObject *__pyx_r = NULL;
9602 __Pyx_RefNannyDeclarations
9603 PyObject *__pyx_t_1 = NULL;
9604 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
9605
9606 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
9607 *
9608 * cdef inline object PyArray_MultiIterNew3(a, b, c):
9609 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
9610 *
9611 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
9612 */
9613 __Pyx_XDECREF(__pyx_r);
9614 __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(2, 828, __pyx_L1_error)
9615 __Pyx_GOTREF(__pyx_t_1);
9616 __pyx_r = __pyx_t_1;
9617 __pyx_t_1 = 0;
9618 goto __pyx_L0;
9619
9620 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
9621 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9622 *
9623 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
9624 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9625 *
9626 */
9627
9628 /* function exit code */
9629 __pyx_L1_error:;
9630 __Pyx_XDECREF(__pyx_t_1);
9631 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
9632 __pyx_r = 0;
9633 __pyx_L0:;
9634 __Pyx_XGIVEREF(__pyx_r);
9635 __Pyx_RefNannyFinishContext();
9636 return __pyx_r;
9637 }
9638
9639 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
9640 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9641 *
9642 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
9643 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9644 *
9645 */
9646
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)9647 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) {
9648 PyObject *__pyx_r = NULL;
9649 __Pyx_RefNannyDeclarations
9650 PyObject *__pyx_t_1 = NULL;
9651 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
9652
9653 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
9654 *
9655 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
9656 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
9657 *
9658 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
9659 */
9660 __Pyx_XDECREF(__pyx_r);
9661 __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(2, 831, __pyx_L1_error)
9662 __Pyx_GOTREF(__pyx_t_1);
9663 __pyx_r = __pyx_t_1;
9664 __pyx_t_1 = 0;
9665 goto __pyx_L0;
9666
9667 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
9668 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9669 *
9670 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
9671 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9672 *
9673 */
9674
9675 /* function exit code */
9676 __pyx_L1_error:;
9677 __Pyx_XDECREF(__pyx_t_1);
9678 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
9679 __pyx_r = 0;
9680 __pyx_L0:;
9681 __Pyx_XGIVEREF(__pyx_r);
9682 __Pyx_RefNannyFinishContext();
9683 return __pyx_r;
9684 }
9685
9686 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
9687 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9688 *
9689 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
9690 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9691 *
9692 */
9693
__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)9694 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) {
9695 PyObject *__pyx_r = NULL;
9696 __Pyx_RefNannyDeclarations
9697 PyObject *__pyx_t_1 = NULL;
9698 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
9699
9700 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
9701 *
9702 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
9703 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
9704 *
9705 * cdef inline tuple PyDataType_SHAPE(dtype d):
9706 */
9707 __Pyx_XDECREF(__pyx_r);
9708 __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(2, 834, __pyx_L1_error)
9709 __Pyx_GOTREF(__pyx_t_1);
9710 __pyx_r = __pyx_t_1;
9711 __pyx_t_1 = 0;
9712 goto __pyx_L0;
9713
9714 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
9715 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9716 *
9717 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
9718 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9719 *
9720 */
9721
9722 /* function exit code */
9723 __pyx_L1_error:;
9724 __Pyx_XDECREF(__pyx_t_1);
9725 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
9726 __pyx_r = 0;
9727 __pyx_L0:;
9728 __Pyx_XGIVEREF(__pyx_r);
9729 __Pyx_RefNannyFinishContext();
9730 return __pyx_r;
9731 }
9732
9733 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
9734 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9735 *
9736 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
9737 * if PyDataType_HASSUBARRAY(d):
9738 * return <tuple>d.subarray.shape
9739 */
9740
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)9741 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
9742 PyObject *__pyx_r = NULL;
9743 __Pyx_RefNannyDeclarations
9744 int __pyx_t_1;
9745 __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
9746
9747 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
9748 *
9749 * cdef inline tuple PyDataType_SHAPE(dtype d):
9750 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
9751 * return <tuple>d.subarray.shape
9752 * else:
9753 */
9754 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
9755 if (__pyx_t_1) {
9756
9757 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
9758 * cdef inline tuple PyDataType_SHAPE(dtype d):
9759 * if PyDataType_HASSUBARRAY(d):
9760 * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
9761 * else:
9762 * return ()
9763 */
9764 __Pyx_XDECREF(__pyx_r);
9765 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
9766 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
9767 goto __pyx_L0;
9768
9769 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
9770 *
9771 * cdef inline tuple PyDataType_SHAPE(dtype d):
9772 * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
9773 * return <tuple>d.subarray.shape
9774 * else:
9775 */
9776 }
9777
9778 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
9779 * return <tuple>d.subarray.shape
9780 * else:
9781 * return () # <<<<<<<<<<<<<<
9782 *
9783 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
9784 */
9785 /*else*/ {
9786 __Pyx_XDECREF(__pyx_r);
9787 __Pyx_INCREF(__pyx_empty_tuple);
9788 __pyx_r = __pyx_empty_tuple;
9789 goto __pyx_L0;
9790 }
9791
9792 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
9793 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9794 *
9795 * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
9796 * if PyDataType_HASSUBARRAY(d):
9797 * return <tuple>d.subarray.shape
9798 */
9799
9800 /* function exit code */
9801 __pyx_L0:;
9802 __Pyx_XGIVEREF(__pyx_r);
9803 __Pyx_RefNannyFinishContext();
9804 return __pyx_r;
9805 }
9806
9807 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
9808 * return ()
9809 *
9810 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
9811 * # Recursive utility function used in __getbuffer__ to get format
9812 * # string. The new location in the format string is returned.
9813 */
9814
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)9815 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) {
9816 PyArray_Descr *__pyx_v_child = 0;
9817 int __pyx_v_endian_detector;
9818 int __pyx_v_little_endian;
9819 PyObject *__pyx_v_fields = 0;
9820 PyObject *__pyx_v_childname = NULL;
9821 PyObject *__pyx_v_new_offset = NULL;
9822 PyObject *__pyx_v_t = NULL;
9823 char *__pyx_r;
9824 __Pyx_RefNannyDeclarations
9825 PyObject *__pyx_t_1 = NULL;
9826 Py_ssize_t __pyx_t_2;
9827 PyObject *__pyx_t_3 = NULL;
9828 PyObject *__pyx_t_4 = NULL;
9829 int __pyx_t_5;
9830 int __pyx_t_6;
9831 int __pyx_t_7;
9832 long __pyx_t_8;
9833 char *__pyx_t_9;
9834 __Pyx_RefNannySetupContext("_util_dtypestring", 0);
9835
9836 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
9837 *
9838 * cdef dtype child
9839 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
9840 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
9841 * cdef tuple fields
9842 */
9843 __pyx_v_endian_detector = 1;
9844
9845 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
9846 * cdef dtype child
9847 * cdef int endian_detector = 1
9848 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
9849 * cdef tuple fields
9850 *
9851 */
9852 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
9853
9854 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
9855 * cdef tuple fields
9856 *
9857 * for childname in descr.names: # <<<<<<<<<<<<<<
9858 * fields = descr.fields[childname]
9859 * child, new_offset = fields
9860 */
9861 if (unlikely(__pyx_v_descr->names == Py_None)) {
9862 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
9863 __PYX_ERR(2, 851, __pyx_L1_error)
9864 }
9865 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
9866 for (;;) {
9867 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
9868 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9869 __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(2, 851, __pyx_L1_error)
9870 #else
9871 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 851, __pyx_L1_error)
9872 __Pyx_GOTREF(__pyx_t_3);
9873 #endif
9874 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
9875 __pyx_t_3 = 0;
9876
9877 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
9878 *
9879 * for childname in descr.names:
9880 * fields = descr.fields[childname] # <<<<<<<<<<<<<<
9881 * child, new_offset = fields
9882 *
9883 */
9884 if (unlikely(__pyx_v_descr->fields == Py_None)) {
9885 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9886 __PYX_ERR(2, 852, __pyx_L1_error)
9887 }
9888 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __pyx_L1_error)
9889 __Pyx_GOTREF(__pyx_t_3);
9890 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(2, 852, __pyx_L1_error)
9891 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
9892 __pyx_t_3 = 0;
9893
9894 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
9895 * for childname in descr.names:
9896 * fields = descr.fields[childname]
9897 * child, new_offset = fields # <<<<<<<<<<<<<<
9898 *
9899 * if (end - f) - <int>(new_offset - offset[0]) < 15:
9900 */
9901 if (likely(__pyx_v_fields != Py_None)) {
9902 PyObject* sequence = __pyx_v_fields;
9903 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9904 if (unlikely(size != 2)) {
9905 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9906 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9907 __PYX_ERR(2, 853, __pyx_L1_error)
9908 }
9909 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9910 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
9911 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
9912 __Pyx_INCREF(__pyx_t_3);
9913 __Pyx_INCREF(__pyx_t_4);
9914 #else
9915 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
9916 __Pyx_GOTREF(__pyx_t_3);
9917 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
9918 __Pyx_GOTREF(__pyx_t_4);
9919 #endif
9920 } else {
9921 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
9922 }
9923 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
9924 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
9925 __pyx_t_3 = 0;
9926 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
9927 __pyx_t_4 = 0;
9928
9929 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
9930 * child, new_offset = fields
9931 *
9932 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
9933 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9934 *
9935 */
9936 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
9937 __Pyx_GOTREF(__pyx_t_4);
9938 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
9939 __Pyx_GOTREF(__pyx_t_3);
9940 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9941 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 855, __pyx_L1_error)
9942 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9943 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
9944 if (unlikely(__pyx_t_6)) {
9945
9946 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
9947 *
9948 * if (end - f) - <int>(new_offset - offset[0]) < 15:
9949 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
9950 *
9951 * if ((child.byteorder == c'>' and little_endian) or
9952 */
9953 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
9954 __Pyx_GOTREF(__pyx_t_3);
9955 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9956 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9957 __PYX_ERR(2, 856, __pyx_L1_error)
9958
9959 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
9960 * child, new_offset = fields
9961 *
9962 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
9963 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9964 *
9965 */
9966 }
9967
9968 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
9969 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9970 *
9971 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9972 * (child.byteorder == c'<' and not little_endian)):
9973 * raise ValueError(u"Non-native byte order not supported")
9974 */
9975 __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
9976 if (!__pyx_t_7) {
9977 goto __pyx_L8_next_or;
9978 } else {
9979 }
9980 __pyx_t_7 = (__pyx_v_little_endian != 0);
9981 if (!__pyx_t_7) {
9982 } else {
9983 __pyx_t_6 = __pyx_t_7;
9984 goto __pyx_L7_bool_binop_done;
9985 }
9986 __pyx_L8_next_or:;
9987
9988 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
9989 *
9990 * if ((child.byteorder == c'>' and little_endian) or
9991 * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
9992 * raise ValueError(u"Non-native byte order not supported")
9993 * # One could encode it in the format string and have Cython
9994 */
9995 __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
9996 if (__pyx_t_7) {
9997 } else {
9998 __pyx_t_6 = __pyx_t_7;
9999 goto __pyx_L7_bool_binop_done;
10000 }
10001 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
10002 __pyx_t_6 = __pyx_t_7;
10003 __pyx_L7_bool_binop_done:;
10004
10005 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
10006 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
10007 *
10008 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
10009 * (child.byteorder == c'<' and not little_endian)):
10010 * raise ValueError(u"Non-native byte order not supported")
10011 */
10012 if (unlikely(__pyx_t_6)) {
10013
10014 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
10015 * if ((child.byteorder == c'>' and little_endian) or
10016 * (child.byteorder == c'<' and not little_endian)):
10017 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
10018 * # One could encode it in the format string and have Cython
10019 * # complain instead, BUT: < and > in format strings also imply
10020 */
10021 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
10022 __Pyx_GOTREF(__pyx_t_3);
10023 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10024 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10025 __PYX_ERR(2, 860, __pyx_L1_error)
10026
10027 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
10028 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
10029 *
10030 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
10031 * (child.byteorder == c'<' and not little_endian)):
10032 * raise ValueError(u"Non-native byte order not supported")
10033 */
10034 }
10035
10036 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
10037 *
10038 * # Output padding bytes
10039 * while offset[0] < new_offset: # <<<<<<<<<<<<<<
10040 * f[0] = 120 # "x"; pad byte
10041 * f += 1
10042 */
10043 while (1) {
10044 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
10045 __Pyx_GOTREF(__pyx_t_3);
10046 __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(2, 870, __pyx_L1_error)
10047 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10048 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
10049 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10050 if (!__pyx_t_6) break;
10051
10052 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
10053 * # Output padding bytes
10054 * while offset[0] < new_offset:
10055 * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
10056 * f += 1
10057 * offset[0] += 1
10058 */
10059 (__pyx_v_f[0]) = 0x78;
10060
10061 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
10062 * while offset[0] < new_offset:
10063 * f[0] = 120 # "x"; pad byte
10064 * f += 1 # <<<<<<<<<<<<<<
10065 * offset[0] += 1
10066 *
10067 */
10068 __pyx_v_f = (__pyx_v_f + 1);
10069
10070 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
10071 * f[0] = 120 # "x"; pad byte
10072 * f += 1
10073 * offset[0] += 1 # <<<<<<<<<<<<<<
10074 *
10075 * offset[0] += child.itemsize
10076 */
10077 __pyx_t_8 = 0;
10078 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
10079 }
10080
10081 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
10082 * offset[0] += 1
10083 *
10084 * offset[0] += child.itemsize # <<<<<<<<<<<<<<
10085 *
10086 * if not PyDataType_HASFIELDS(child):
10087 */
10088 __pyx_t_8 = 0;
10089 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
10090
10091 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
10092 * offset[0] += child.itemsize
10093 *
10094 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
10095 * t = child.type_num
10096 * if end - f < 5:
10097 */
10098 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
10099 if (__pyx_t_6) {
10100
10101 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
10102 *
10103 * if not PyDataType_HASFIELDS(child):
10104 * t = child.type_num # <<<<<<<<<<<<<<
10105 * if end - f < 5:
10106 * raise RuntimeError(u"Format string allocated too short.")
10107 */
10108 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
10109 __Pyx_GOTREF(__pyx_t_4);
10110 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
10111 __pyx_t_4 = 0;
10112
10113 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
10114 * if not PyDataType_HASFIELDS(child):
10115 * t = child.type_num
10116 * if end - f < 5: # <<<<<<<<<<<<<<
10117 * raise RuntimeError(u"Format string allocated too short.")
10118 *
10119 */
10120 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
10121 if (unlikely(__pyx_t_6)) {
10122
10123 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
10124 * t = child.type_num
10125 * if end - f < 5:
10126 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
10127 *
10128 * # Until ticket #99 is fixed, use integers to avoid warnings
10129 */
10130 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
10131 __Pyx_GOTREF(__pyx_t_4);
10132 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
10133 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10134 __PYX_ERR(2, 880, __pyx_L1_error)
10135
10136 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
10137 * if not PyDataType_HASFIELDS(child):
10138 * t = child.type_num
10139 * if end - f < 5: # <<<<<<<<<<<<<<
10140 * raise RuntimeError(u"Format string allocated too short.")
10141 *
10142 */
10143 }
10144
10145 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
10146 *
10147 * # Until ticket #99 is fixed, use integers to avoid warnings
10148 * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
10149 * elif t == NPY_UBYTE: f[0] = 66 #"B"
10150 * elif t == NPY_SHORT: f[0] = 104 #"h"
10151 */
10152 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
10153 __Pyx_GOTREF(__pyx_t_4);
10154 __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(2, 883, __pyx_L1_error)
10155 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10156 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
10157 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10158 if (__pyx_t_6) {
10159 (__pyx_v_f[0]) = 98;
10160 goto __pyx_L15;
10161 }
10162
10163 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
10164 * # Until ticket #99 is fixed, use integers to avoid warnings
10165 * if t == NPY_BYTE: f[0] = 98 #"b"
10166 * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
10167 * elif t == NPY_SHORT: f[0] = 104 #"h"
10168 * elif t == NPY_USHORT: f[0] = 72 #"H"
10169 */
10170 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
10171 __Pyx_GOTREF(__pyx_t_3);
10172 __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(2, 884, __pyx_L1_error)
10173 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10174 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
10175 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10176 if (__pyx_t_6) {
10177 (__pyx_v_f[0]) = 66;
10178 goto __pyx_L15;
10179 }
10180
10181 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
10182 * if t == NPY_BYTE: f[0] = 98 #"b"
10183 * elif t == NPY_UBYTE: f[0] = 66 #"B"
10184 * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
10185 * elif t == NPY_USHORT: f[0] = 72 #"H"
10186 * elif t == NPY_INT: f[0] = 105 #"i"
10187 */
10188 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
10189 __Pyx_GOTREF(__pyx_t_4);
10190 __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(2, 885, __pyx_L1_error)
10191 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10192 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
10193 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10194 if (__pyx_t_6) {
10195 (__pyx_v_f[0]) = 0x68;
10196 goto __pyx_L15;
10197 }
10198
10199 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
10200 * elif t == NPY_UBYTE: f[0] = 66 #"B"
10201 * elif t == NPY_SHORT: f[0] = 104 #"h"
10202 * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
10203 * elif t == NPY_INT: f[0] = 105 #"i"
10204 * elif t == NPY_UINT: f[0] = 73 #"I"
10205 */
10206 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
10207 __Pyx_GOTREF(__pyx_t_3);
10208 __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(2, 886, __pyx_L1_error)
10209 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10210 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
10211 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10212 if (__pyx_t_6) {
10213 (__pyx_v_f[0]) = 72;
10214 goto __pyx_L15;
10215 }
10216
10217 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
10218 * elif t == NPY_SHORT: f[0] = 104 #"h"
10219 * elif t == NPY_USHORT: f[0] = 72 #"H"
10220 * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
10221 * elif t == NPY_UINT: f[0] = 73 #"I"
10222 * elif t == NPY_LONG: f[0] = 108 #"l"
10223 */
10224 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
10225 __Pyx_GOTREF(__pyx_t_4);
10226 __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(2, 887, __pyx_L1_error)
10227 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10228 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
10229 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10230 if (__pyx_t_6) {
10231 (__pyx_v_f[0]) = 0x69;
10232 goto __pyx_L15;
10233 }
10234
10235 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
10236 * elif t == NPY_USHORT: f[0] = 72 #"H"
10237 * elif t == NPY_INT: f[0] = 105 #"i"
10238 * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
10239 * elif t == NPY_LONG: f[0] = 108 #"l"
10240 * elif t == NPY_ULONG: f[0] = 76 #"L"
10241 */
10242 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
10243 __Pyx_GOTREF(__pyx_t_3);
10244 __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(2, 888, __pyx_L1_error)
10245 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10246 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
10247 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10248 if (__pyx_t_6) {
10249 (__pyx_v_f[0]) = 73;
10250 goto __pyx_L15;
10251 }
10252
10253 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
10254 * elif t == NPY_INT: f[0] = 105 #"i"
10255 * elif t == NPY_UINT: f[0] = 73 #"I"
10256 * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
10257 * elif t == NPY_ULONG: f[0] = 76 #"L"
10258 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10259 */
10260 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
10261 __Pyx_GOTREF(__pyx_t_4);
10262 __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(2, 889, __pyx_L1_error)
10263 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10264 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
10265 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10266 if (__pyx_t_6) {
10267 (__pyx_v_f[0]) = 0x6C;
10268 goto __pyx_L15;
10269 }
10270
10271 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
10272 * elif t == NPY_UINT: f[0] = 73 #"I"
10273 * elif t == NPY_LONG: f[0] = 108 #"l"
10274 * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
10275 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10276 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10277 */
10278 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
10279 __Pyx_GOTREF(__pyx_t_3);
10280 __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(2, 890, __pyx_L1_error)
10281 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10282 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
10283 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10284 if (__pyx_t_6) {
10285 (__pyx_v_f[0]) = 76;
10286 goto __pyx_L15;
10287 }
10288
10289 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
10290 * elif t == NPY_LONG: f[0] = 108 #"l"
10291 * elif t == NPY_ULONG: f[0] = 76 #"L"
10292 * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
10293 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10294 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10295 */
10296 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
10297 __Pyx_GOTREF(__pyx_t_4);
10298 __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(2, 891, __pyx_L1_error)
10299 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10300 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
10301 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10302 if (__pyx_t_6) {
10303 (__pyx_v_f[0]) = 0x71;
10304 goto __pyx_L15;
10305 }
10306
10307 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
10308 * elif t == NPY_ULONG: f[0] = 76 #"L"
10309 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10310 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
10311 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10312 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10313 */
10314 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
10315 __Pyx_GOTREF(__pyx_t_3);
10316 __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(2, 892, __pyx_L1_error)
10317 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10318 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
10319 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10320 if (__pyx_t_6) {
10321 (__pyx_v_f[0]) = 81;
10322 goto __pyx_L15;
10323 }
10324
10325 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
10326 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10327 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10328 * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
10329 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10330 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10331 */
10332 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
10333 __Pyx_GOTREF(__pyx_t_4);
10334 __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(2, 893, __pyx_L1_error)
10335 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10336 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
10337 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10338 if (__pyx_t_6) {
10339 (__pyx_v_f[0]) = 0x66;
10340 goto __pyx_L15;
10341 }
10342
10343 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
10344 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10345 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10346 * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
10347 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10348 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10349 */
10350 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
10351 __Pyx_GOTREF(__pyx_t_3);
10352 __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(2, 894, __pyx_L1_error)
10353 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10354 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
10355 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10356 if (__pyx_t_6) {
10357 (__pyx_v_f[0]) = 0x64;
10358 goto __pyx_L15;
10359 }
10360
10361 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
10362 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10363 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10364 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
10365 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10366 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10367 */
10368 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
10369 __Pyx_GOTREF(__pyx_t_4);
10370 __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(2, 895, __pyx_L1_error)
10371 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10372 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
10373 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10374 if (__pyx_t_6) {
10375 (__pyx_v_f[0]) = 0x67;
10376 goto __pyx_L15;
10377 }
10378
10379 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
10380 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10381 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10382 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
10383 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10384 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
10385 */
10386 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
10387 __Pyx_GOTREF(__pyx_t_3);
10388 __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(2, 896, __pyx_L1_error)
10389 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10390 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
10391 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10392 if (__pyx_t_6) {
10393 (__pyx_v_f[0]) = 90;
10394 (__pyx_v_f[1]) = 0x66;
10395 __pyx_v_f = (__pyx_v_f + 1);
10396 goto __pyx_L15;
10397 }
10398
10399 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
10400 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10401 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10402 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
10403 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
10404 * elif t == NPY_OBJECT: f[0] = 79 #"O"
10405 */
10406 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
10407 __Pyx_GOTREF(__pyx_t_4);
10408 __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(2, 897, __pyx_L1_error)
10409 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10410 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
10411 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10412 if (__pyx_t_6) {
10413 (__pyx_v_f[0]) = 90;
10414 (__pyx_v_f[1]) = 0x64;
10415 __pyx_v_f = (__pyx_v_f + 1);
10416 goto __pyx_L15;
10417 }
10418
10419 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
10420 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10421 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10422 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
10423 * elif t == NPY_OBJECT: f[0] = 79 #"O"
10424 * else:
10425 */
10426 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
10427 __Pyx_GOTREF(__pyx_t_3);
10428 __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(2, 898, __pyx_L1_error)
10429 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10430 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
10431 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10432 if (__pyx_t_6) {
10433 (__pyx_v_f[0]) = 90;
10434 (__pyx_v_f[1]) = 0x67;
10435 __pyx_v_f = (__pyx_v_f + 1);
10436 goto __pyx_L15;
10437 }
10438
10439 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
10440 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10441 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
10442 * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
10443 * else:
10444 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
10445 */
10446 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
10447 __Pyx_GOTREF(__pyx_t_4);
10448 __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(2, 899, __pyx_L1_error)
10449 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10450 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
10451 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10452 if (likely(__pyx_t_6)) {
10453 (__pyx_v_f[0]) = 79;
10454 goto __pyx_L15;
10455 }
10456
10457 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
10458 * elif t == NPY_OBJECT: f[0] = 79 #"O"
10459 * else:
10460 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
10461 * f += 1
10462 * else:
10463 */
10464 /*else*/ {
10465 __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(2, 901, __pyx_L1_error)
10466 __Pyx_GOTREF(__pyx_t_3);
10467 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
10468 __Pyx_GOTREF(__pyx_t_4);
10469 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10470 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
10471 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10472 __PYX_ERR(2, 901, __pyx_L1_error)
10473 }
10474 __pyx_L15:;
10475
10476 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
10477 * else:
10478 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
10479 * f += 1 # <<<<<<<<<<<<<<
10480 * else:
10481 * # Cython ignores struct boundary information ("T{...}"),
10482 */
10483 __pyx_v_f = (__pyx_v_f + 1);
10484
10485 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
10486 * offset[0] += child.itemsize
10487 *
10488 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
10489 * t = child.type_num
10490 * if end - f < 5:
10491 */
10492 goto __pyx_L13;
10493 }
10494
10495 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
10496 * # Cython ignores struct boundary information ("T{...}"),
10497 * # so don't output it
10498 * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
10499 * return f
10500 *
10501 */
10502 /*else*/ {
10503 __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(2, 906, __pyx_L1_error)
10504 __pyx_v_f = __pyx_t_9;
10505 }
10506 __pyx_L13:;
10507
10508 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
10509 * cdef tuple fields
10510 *
10511 * for childname in descr.names: # <<<<<<<<<<<<<<
10512 * fields = descr.fields[childname]
10513 * child, new_offset = fields
10514 */
10515 }
10516 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10517
10518 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
10519 * # so don't output it
10520 * f = _util_dtypestring(child, f, end, offset)
10521 * return f # <<<<<<<<<<<<<<
10522 *
10523 *
10524 */
10525 __pyx_r = __pyx_v_f;
10526 goto __pyx_L0;
10527
10528 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
10529 * return ()
10530 *
10531 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
10532 * # Recursive utility function used in __getbuffer__ to get format
10533 * # string. The new location in the format string is returned.
10534 */
10535
10536 /* function exit code */
10537 __pyx_L1_error:;
10538 __Pyx_XDECREF(__pyx_t_1);
10539 __Pyx_XDECREF(__pyx_t_3);
10540 __Pyx_XDECREF(__pyx_t_4);
10541 __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
10542 __pyx_r = NULL;
10543 __pyx_L0:;
10544 __Pyx_XDECREF((PyObject *)__pyx_v_child);
10545 __Pyx_XDECREF(__pyx_v_fields);
10546 __Pyx_XDECREF(__pyx_v_childname);
10547 __Pyx_XDECREF(__pyx_v_new_offset);
10548 __Pyx_XDECREF(__pyx_v_t);
10549 __Pyx_RefNannyFinishContext();
10550 return __pyx_r;
10551 }
10552
10553 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
10554 * int _import_umath() except -1
10555 *
10556 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
10557 * Py_INCREF(base) # important to do this before stealing the reference below!
10558 * PyArray_SetBaseObject(arr, base)
10559 */
10560
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)10561 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
10562 __Pyx_RefNannyDeclarations
10563 __Pyx_RefNannySetupContext("set_array_base", 0);
10564
10565 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
10566 *
10567 * cdef inline void set_array_base(ndarray arr, object base):
10568 * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
10569 * PyArray_SetBaseObject(arr, base)
10570 *
10571 */
10572 Py_INCREF(__pyx_v_base);
10573
10574 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
10575 * cdef inline void set_array_base(ndarray arr, object base):
10576 * Py_INCREF(base) # important to do this before stealing the reference below!
10577 * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
10578 *
10579 * cdef inline object get_array_base(ndarray arr):
10580 */
10581 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
10582
10583 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
10584 * int _import_umath() except -1
10585 *
10586 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
10587 * Py_INCREF(base) # important to do this before stealing the reference below!
10588 * PyArray_SetBaseObject(arr, base)
10589 */
10590
10591 /* function exit code */
10592 __Pyx_RefNannyFinishContext();
10593 }
10594
10595 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
10596 * PyArray_SetBaseObject(arr, base)
10597 *
10598 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
10599 * base = PyArray_BASE(arr)
10600 * if base is NULL:
10601 */
10602
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)10603 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
10604 PyObject *__pyx_v_base;
10605 PyObject *__pyx_r = NULL;
10606 __Pyx_RefNannyDeclarations
10607 int __pyx_t_1;
10608 __Pyx_RefNannySetupContext("get_array_base", 0);
10609
10610 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
10611 *
10612 * cdef inline object get_array_base(ndarray arr):
10613 * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
10614 * if base is NULL:
10615 * return None
10616 */
10617 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
10618
10619 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
10620 * cdef inline object get_array_base(ndarray arr):
10621 * base = PyArray_BASE(arr)
10622 * if base is NULL: # <<<<<<<<<<<<<<
10623 * return None
10624 * return <object>base
10625 */
10626 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
10627 if (__pyx_t_1) {
10628
10629 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
10630 * base = PyArray_BASE(arr)
10631 * if base is NULL:
10632 * return None # <<<<<<<<<<<<<<
10633 * return <object>base
10634 *
10635 */
10636 __Pyx_XDECREF(__pyx_r);
10637 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10638 goto __pyx_L0;
10639
10640 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
10641 * cdef inline object get_array_base(ndarray arr):
10642 * base = PyArray_BASE(arr)
10643 * if base is NULL: # <<<<<<<<<<<<<<
10644 * return None
10645 * return <object>base
10646 */
10647 }
10648
10649 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
10650 * if base is NULL:
10651 * return None
10652 * return <object>base # <<<<<<<<<<<<<<
10653 *
10654 * # Versions of the import_* functions which are more suitable for
10655 */
10656 __Pyx_XDECREF(__pyx_r);
10657 __Pyx_INCREF(((PyObject *)__pyx_v_base));
10658 __pyx_r = ((PyObject *)__pyx_v_base);
10659 goto __pyx_L0;
10660
10661 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
10662 * PyArray_SetBaseObject(arr, base)
10663 *
10664 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
10665 * base = PyArray_BASE(arr)
10666 * if base is NULL:
10667 */
10668
10669 /* function exit code */
10670 __pyx_L0:;
10671 __Pyx_XGIVEREF(__pyx_r);
10672 __Pyx_RefNannyFinishContext();
10673 return __pyx_r;
10674 }
10675
10676 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
10677 * # Versions of the import_* functions which are more suitable for
10678 * # Cython code.
10679 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
10680 * try:
10681 * _import_array()
10682 */
10683
__pyx_f_5numpy_import_array(void)10684 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
10685 int __pyx_r;
10686 __Pyx_RefNannyDeclarations
10687 PyObject *__pyx_t_1 = NULL;
10688 PyObject *__pyx_t_2 = NULL;
10689 PyObject *__pyx_t_3 = NULL;
10690 int __pyx_t_4;
10691 PyObject *__pyx_t_5 = NULL;
10692 PyObject *__pyx_t_6 = NULL;
10693 PyObject *__pyx_t_7 = NULL;
10694 PyObject *__pyx_t_8 = NULL;
10695 __Pyx_RefNannySetupContext("import_array", 0);
10696
10697 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
10698 * # Cython code.
10699 * cdef inline int import_array() except -1:
10700 * try: # <<<<<<<<<<<<<<
10701 * _import_array()
10702 * except Exception:
10703 */
10704 {
10705 __Pyx_PyThreadState_declare
10706 __Pyx_PyThreadState_assign
10707 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10708 __Pyx_XGOTREF(__pyx_t_1);
10709 __Pyx_XGOTREF(__pyx_t_2);
10710 __Pyx_XGOTREF(__pyx_t_3);
10711 /*try:*/ {
10712
10713 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
10714 * cdef inline int import_array() except -1:
10715 * try:
10716 * _import_array() # <<<<<<<<<<<<<<
10717 * except Exception:
10718 * raise ImportError("numpy.core.multiarray failed to import")
10719 */
10720 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)
10721
10722 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
10723 * # Cython code.
10724 * cdef inline int import_array() except -1:
10725 * try: # <<<<<<<<<<<<<<
10726 * _import_array()
10727 * except Exception:
10728 */
10729 }
10730 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10731 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10732 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10733 goto __pyx_L8_try_end;
10734 __pyx_L3_error:;
10735
10736 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
10737 * try:
10738 * _import_array()
10739 * except Exception: # <<<<<<<<<<<<<<
10740 * raise ImportError("numpy.core.multiarray failed to import")
10741 *
10742 */
10743 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10744 if (__pyx_t_4) {
10745 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
10746 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
10747 __Pyx_GOTREF(__pyx_t_5);
10748 __Pyx_GOTREF(__pyx_t_6);
10749 __Pyx_GOTREF(__pyx_t_7);
10750
10751 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
10752 * _import_array()
10753 * except Exception:
10754 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
10755 *
10756 * cdef inline int import_umath() except -1:
10757 */
10758 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
10759 __Pyx_GOTREF(__pyx_t_8);
10760 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10761 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10762 __PYX_ERR(2, 1038, __pyx_L5_except_error)
10763 }
10764 goto __pyx_L5_except_error;
10765 __pyx_L5_except_error:;
10766
10767 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
10768 * # Cython code.
10769 * cdef inline int import_array() except -1:
10770 * try: # <<<<<<<<<<<<<<
10771 * _import_array()
10772 * except Exception:
10773 */
10774 __Pyx_XGIVEREF(__pyx_t_1);
10775 __Pyx_XGIVEREF(__pyx_t_2);
10776 __Pyx_XGIVEREF(__pyx_t_3);
10777 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10778 goto __pyx_L1_error;
10779 __pyx_L8_try_end:;
10780 }
10781
10782 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
10783 * # Versions of the import_* functions which are more suitable for
10784 * # Cython code.
10785 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
10786 * try:
10787 * _import_array()
10788 */
10789
10790 /* function exit code */
10791 __pyx_r = 0;
10792 goto __pyx_L0;
10793 __pyx_L1_error:;
10794 __Pyx_XDECREF(__pyx_t_5);
10795 __Pyx_XDECREF(__pyx_t_6);
10796 __Pyx_XDECREF(__pyx_t_7);
10797 __Pyx_XDECREF(__pyx_t_8);
10798 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
10799 __pyx_r = -1;
10800 __pyx_L0:;
10801 __Pyx_RefNannyFinishContext();
10802 return __pyx_r;
10803 }
10804
10805 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
10806 * raise ImportError("numpy.core.multiarray failed to import")
10807 *
10808 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
10809 * try:
10810 * _import_umath()
10811 */
10812
__pyx_f_5numpy_import_umath(void)10813 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
10814 int __pyx_r;
10815 __Pyx_RefNannyDeclarations
10816 PyObject *__pyx_t_1 = NULL;
10817 PyObject *__pyx_t_2 = NULL;
10818 PyObject *__pyx_t_3 = NULL;
10819 int __pyx_t_4;
10820 PyObject *__pyx_t_5 = NULL;
10821 PyObject *__pyx_t_6 = NULL;
10822 PyObject *__pyx_t_7 = NULL;
10823 PyObject *__pyx_t_8 = NULL;
10824 __Pyx_RefNannySetupContext("import_umath", 0);
10825
10826 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
10827 *
10828 * cdef inline int import_umath() except -1:
10829 * try: # <<<<<<<<<<<<<<
10830 * _import_umath()
10831 * except Exception:
10832 */
10833 {
10834 __Pyx_PyThreadState_declare
10835 __Pyx_PyThreadState_assign
10836 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10837 __Pyx_XGOTREF(__pyx_t_1);
10838 __Pyx_XGOTREF(__pyx_t_2);
10839 __Pyx_XGOTREF(__pyx_t_3);
10840 /*try:*/ {
10841
10842 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
10843 * cdef inline int import_umath() except -1:
10844 * try:
10845 * _import_umath() # <<<<<<<<<<<<<<
10846 * except Exception:
10847 * raise ImportError("numpy.core.umath failed to import")
10848 */
10849 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)
10850
10851 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
10852 *
10853 * cdef inline int import_umath() except -1:
10854 * try: # <<<<<<<<<<<<<<
10855 * _import_umath()
10856 * except Exception:
10857 */
10858 }
10859 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10860 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10861 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10862 goto __pyx_L8_try_end;
10863 __pyx_L3_error:;
10864
10865 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
10866 * try:
10867 * _import_umath()
10868 * except Exception: # <<<<<<<<<<<<<<
10869 * raise ImportError("numpy.core.umath failed to import")
10870 *
10871 */
10872 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10873 if (__pyx_t_4) {
10874 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
10875 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
10876 __Pyx_GOTREF(__pyx_t_5);
10877 __Pyx_GOTREF(__pyx_t_6);
10878 __Pyx_GOTREF(__pyx_t_7);
10879
10880 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
10881 * _import_umath()
10882 * except Exception:
10883 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
10884 *
10885 * cdef inline int import_ufunc() except -1:
10886 */
10887 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
10888 __Pyx_GOTREF(__pyx_t_8);
10889 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10890 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10891 __PYX_ERR(2, 1044, __pyx_L5_except_error)
10892 }
10893 goto __pyx_L5_except_error;
10894 __pyx_L5_except_error:;
10895
10896 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
10897 *
10898 * cdef inline int import_umath() except -1:
10899 * try: # <<<<<<<<<<<<<<
10900 * _import_umath()
10901 * except Exception:
10902 */
10903 __Pyx_XGIVEREF(__pyx_t_1);
10904 __Pyx_XGIVEREF(__pyx_t_2);
10905 __Pyx_XGIVEREF(__pyx_t_3);
10906 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10907 goto __pyx_L1_error;
10908 __pyx_L8_try_end:;
10909 }
10910
10911 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
10912 * raise ImportError("numpy.core.multiarray failed to import")
10913 *
10914 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
10915 * try:
10916 * _import_umath()
10917 */
10918
10919 /* function exit code */
10920 __pyx_r = 0;
10921 goto __pyx_L0;
10922 __pyx_L1_error:;
10923 __Pyx_XDECREF(__pyx_t_5);
10924 __Pyx_XDECREF(__pyx_t_6);
10925 __Pyx_XDECREF(__pyx_t_7);
10926 __Pyx_XDECREF(__pyx_t_8);
10927 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
10928 __pyx_r = -1;
10929 __pyx_L0:;
10930 __Pyx_RefNannyFinishContext();
10931 return __pyx_r;
10932 }
10933
10934 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
10935 * raise ImportError("numpy.core.umath failed to import")
10936 *
10937 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
10938 * try:
10939 * _import_umath()
10940 */
10941
__pyx_f_5numpy_import_ufunc(void)10942 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
10943 int __pyx_r;
10944 __Pyx_RefNannyDeclarations
10945 PyObject *__pyx_t_1 = NULL;
10946 PyObject *__pyx_t_2 = NULL;
10947 PyObject *__pyx_t_3 = NULL;
10948 int __pyx_t_4;
10949 PyObject *__pyx_t_5 = NULL;
10950 PyObject *__pyx_t_6 = NULL;
10951 PyObject *__pyx_t_7 = NULL;
10952 PyObject *__pyx_t_8 = NULL;
10953 __Pyx_RefNannySetupContext("import_ufunc", 0);
10954
10955 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
10956 *
10957 * cdef inline int import_ufunc() except -1:
10958 * try: # <<<<<<<<<<<<<<
10959 * _import_umath()
10960 * except Exception:
10961 */
10962 {
10963 __Pyx_PyThreadState_declare
10964 __Pyx_PyThreadState_assign
10965 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10966 __Pyx_XGOTREF(__pyx_t_1);
10967 __Pyx_XGOTREF(__pyx_t_2);
10968 __Pyx_XGOTREF(__pyx_t_3);
10969 /*try:*/ {
10970
10971 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
10972 * cdef inline int import_ufunc() except -1:
10973 * try:
10974 * _import_umath() # <<<<<<<<<<<<<<
10975 * except Exception:
10976 * raise ImportError("numpy.core.umath failed to import")
10977 */
10978 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)
10979
10980 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
10981 *
10982 * cdef inline int import_ufunc() except -1:
10983 * try: # <<<<<<<<<<<<<<
10984 * _import_umath()
10985 * except Exception:
10986 */
10987 }
10988 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10989 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10990 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10991 goto __pyx_L8_try_end;
10992 __pyx_L3_error:;
10993
10994 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
10995 * try:
10996 * _import_umath()
10997 * except Exception: # <<<<<<<<<<<<<<
10998 * raise ImportError("numpy.core.umath failed to import")
10999 */
11000 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
11001 if (__pyx_t_4) {
11002 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11003 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
11004 __Pyx_GOTREF(__pyx_t_5);
11005 __Pyx_GOTREF(__pyx_t_6);
11006 __Pyx_GOTREF(__pyx_t_7);
11007
11008 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
11009 * _import_umath()
11010 * except Exception:
11011 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
11012 */
11013 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
11014 __Pyx_GOTREF(__pyx_t_8);
11015 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
11016 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11017 __PYX_ERR(2, 1050, __pyx_L5_except_error)
11018 }
11019 goto __pyx_L5_except_error;
11020 __pyx_L5_except_error:;
11021
11022 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
11023 *
11024 * cdef inline int import_ufunc() except -1:
11025 * try: # <<<<<<<<<<<<<<
11026 * _import_umath()
11027 * except Exception:
11028 */
11029 __Pyx_XGIVEREF(__pyx_t_1);
11030 __Pyx_XGIVEREF(__pyx_t_2);
11031 __Pyx_XGIVEREF(__pyx_t_3);
11032 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
11033 goto __pyx_L1_error;
11034 __pyx_L8_try_end:;
11035 }
11036
11037 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
11038 * raise ImportError("numpy.core.umath failed to import")
11039 *
11040 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
11041 * try:
11042 * _import_umath()
11043 */
11044
11045 /* function exit code */
11046 __pyx_r = 0;
11047 goto __pyx_L0;
11048 __pyx_L1_error:;
11049 __Pyx_XDECREF(__pyx_t_5);
11050 __Pyx_XDECREF(__pyx_t_6);
11051 __Pyx_XDECREF(__pyx_t_7);
11052 __Pyx_XDECREF(__pyx_t_8);
11053 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11054 __pyx_r = -1;
11055 __pyx_L0:;
11056 __Pyx_RefNannyFinishContext();
11057 return __pyx_r;
11058 }
11059
11060 /* "yt/utilities/lib/fp_utils.pxd":13
11061 *
11062 *
11063 * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11064 * if i0 > i1: return i0
11065 * return i1
11066 */
11067
__pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)11068 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
11069 __pyx_t_5numpy_int64_t __pyx_r;
11070 int __pyx_t_1;
11071
11072 /* "yt/utilities/lib/fp_utils.pxd":14
11073 *
11074 * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:
11075 * if i0 > i1: return i0 # <<<<<<<<<<<<<<
11076 * return i1
11077 *
11078 */
11079 __pyx_t_1 = ((__pyx_v_i0 > __pyx_v_i1) != 0);
11080 if (__pyx_t_1) {
11081 __pyx_r = __pyx_v_i0;
11082 goto __pyx_L0;
11083 }
11084
11085 /* "yt/utilities/lib/fp_utils.pxd":15
11086 * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:
11087 * if i0 > i1: return i0
11088 * return i1 # <<<<<<<<<<<<<<
11089 *
11090 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
11091 */
11092 __pyx_r = __pyx_v_i1;
11093 goto __pyx_L0;
11094
11095 /* "yt/utilities/lib/fp_utils.pxd":13
11096 *
11097 *
11098 * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11099 * if i0 > i1: return i0
11100 * return i1
11101 */
11102
11103 /* function exit code */
11104 __pyx_L0:;
11105 return __pyx_r;
11106 }
11107
11108 /* "yt/utilities/lib/fp_utils.pxd":17
11109 * return i1
11110 *
11111 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil: # <<<<<<<<<<<<<<
11112 * if f0 > f1: return f0
11113 * return f1
11114 */
11115
__pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)11116 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
11117 __pyx_t_5numpy_float64_t __pyx_r;
11118 int __pyx_t_1;
11119
11120 /* "yt/utilities/lib/fp_utils.pxd":18
11121 *
11122 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
11123 * if f0 > f1: return f0 # <<<<<<<<<<<<<<
11124 * return f1
11125 *
11126 */
11127 __pyx_t_1 = ((__pyx_v_f0 > __pyx_v_f1) != 0);
11128 if (__pyx_t_1) {
11129 __pyx_r = __pyx_v_f0;
11130 goto __pyx_L0;
11131 }
11132
11133 /* "yt/utilities/lib/fp_utils.pxd":19
11134 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
11135 * if f0 > f1: return f0
11136 * return f1 # <<<<<<<<<<<<<<
11137 *
11138 * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
11139 */
11140 __pyx_r = __pyx_v_f1;
11141 goto __pyx_L0;
11142
11143 /* "yt/utilities/lib/fp_utils.pxd":17
11144 * return i1
11145 *
11146 * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil: # <<<<<<<<<<<<<<
11147 * if f0 > f1: return f0
11148 * return f1
11149 */
11150
11151 /* function exit code */
11152 __pyx_L0:;
11153 return __pyx_r;
11154 }
11155
11156 /* "yt/utilities/lib/fp_utils.pxd":21
11157 * return f1
11158 *
11159 * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11160 * if i0 < i1: return i0
11161 * return i1
11162 */
11163
__pyx_f_2yt_9utilities_3lib_8fp_utils_imin(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)11164 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
11165 __pyx_t_5numpy_int64_t __pyx_r;
11166 int __pyx_t_1;
11167
11168 /* "yt/utilities/lib/fp_utils.pxd":22
11169 *
11170 * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
11171 * if i0 < i1: return i0 # <<<<<<<<<<<<<<
11172 * return i1
11173 *
11174 */
11175 __pyx_t_1 = ((__pyx_v_i0 < __pyx_v_i1) != 0);
11176 if (__pyx_t_1) {
11177 __pyx_r = __pyx_v_i0;
11178 goto __pyx_L0;
11179 }
11180
11181 /* "yt/utilities/lib/fp_utils.pxd":23
11182 * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
11183 * if i0 < i1: return i0
11184 * return i1 # <<<<<<<<<<<<<<
11185 *
11186 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
11187 */
11188 __pyx_r = __pyx_v_i1;
11189 goto __pyx_L0;
11190
11191 /* "yt/utilities/lib/fp_utils.pxd":21
11192 * return f1
11193 *
11194 * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11195 * if i0 < i1: return i0
11196 * return i1
11197 */
11198
11199 /* function exit code */
11200 __pyx_L0:;
11201 return __pyx_r;
11202 }
11203
11204 /* "yt/utilities/lib/fp_utils.pxd":25
11205 * return i1
11206 *
11207 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil: # <<<<<<<<<<<<<<
11208 * if f0 < f1: return f0
11209 * return f1
11210 */
11211
__pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)11212 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
11213 __pyx_t_5numpy_float64_t __pyx_r;
11214 int __pyx_t_1;
11215
11216 /* "yt/utilities/lib/fp_utils.pxd":26
11217 *
11218 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
11219 * if f0 < f1: return f0 # <<<<<<<<<<<<<<
11220 * return f1
11221 *
11222 */
11223 __pyx_t_1 = ((__pyx_v_f0 < __pyx_v_f1) != 0);
11224 if (__pyx_t_1) {
11225 __pyx_r = __pyx_v_f0;
11226 goto __pyx_L0;
11227 }
11228
11229 /* "yt/utilities/lib/fp_utils.pxd":27
11230 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
11231 * if f0 < f1: return f0
11232 * return f1 # <<<<<<<<<<<<<<
11233 *
11234 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
11235 */
11236 __pyx_r = __pyx_v_f1;
11237 goto __pyx_L0;
11238
11239 /* "yt/utilities/lib/fp_utils.pxd":25
11240 * return i1
11241 *
11242 * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil: # <<<<<<<<<<<<<<
11243 * if f0 < f1: return f0
11244 * return f1
11245 */
11246
11247 /* function exit code */
11248 __pyx_L0:;
11249 return __pyx_r;
11250 }
11251
11252 /* "yt/utilities/lib/fp_utils.pxd":29
11253 * return f1
11254 *
11255 * cdef inline np.float64_t fabs(np.float64_t f0) nogil: # <<<<<<<<<<<<<<
11256 * if f0 < 0.0: return -f0
11257 * return f0
11258 */
11259
__pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0)11260 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0) {
11261 __pyx_t_5numpy_float64_t __pyx_r;
11262 int __pyx_t_1;
11263
11264 /* "yt/utilities/lib/fp_utils.pxd":30
11265 *
11266 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
11267 * if f0 < 0.0: return -f0 # <<<<<<<<<<<<<<
11268 * return f0
11269 *
11270 */
11271 __pyx_t_1 = ((__pyx_v_f0 < 0.0) != 0);
11272 if (__pyx_t_1) {
11273 __pyx_r = (-__pyx_v_f0);
11274 goto __pyx_L0;
11275 }
11276
11277 /* "yt/utilities/lib/fp_utils.pxd":31
11278 * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
11279 * if f0 < 0.0: return -f0
11280 * return f0 # <<<<<<<<<<<<<<
11281 *
11282 * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
11283 */
11284 __pyx_r = __pyx_v_f0;
11285 goto __pyx_L0;
11286
11287 /* "yt/utilities/lib/fp_utils.pxd":29
11288 * return f1
11289 *
11290 * cdef inline np.float64_t fabs(np.float64_t f0) nogil: # <<<<<<<<<<<<<<
11291 * if f0 < 0.0: return -f0
11292 * return f0
11293 */
11294
11295 /* function exit code */
11296 __pyx_L0:;
11297 return __pyx_r;
11298 }
11299
11300 /* "yt/utilities/lib/fp_utils.pxd":33
11301 * return f0
11302 *
11303 * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil: # <<<<<<<<<<<<<<
11304 * if i < a: return a
11305 * if i > b: return b
11306 */
11307
__pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)11308 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(__pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
11309 __pyx_t_5numpy_int64_t __pyx_r;
11310 int __pyx_t_1;
11311
11312 /* "yt/utilities/lib/fp_utils.pxd":34
11313 *
11314 * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
11315 * if i < a: return a # <<<<<<<<<<<<<<
11316 * if i > b: return b
11317 * return i
11318 */
11319 __pyx_t_1 = ((__pyx_v_i < __pyx_v_a) != 0);
11320 if (__pyx_t_1) {
11321 __pyx_r = __pyx_v_a;
11322 goto __pyx_L0;
11323 }
11324
11325 /* "yt/utilities/lib/fp_utils.pxd":35
11326 * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
11327 * if i < a: return a
11328 * if i > b: return b # <<<<<<<<<<<<<<
11329 * return i
11330 *
11331 */
11332 __pyx_t_1 = ((__pyx_v_i > __pyx_v_b) != 0);
11333 if (__pyx_t_1) {
11334 __pyx_r = __pyx_v_b;
11335 goto __pyx_L0;
11336 }
11337
11338 /* "yt/utilities/lib/fp_utils.pxd":36
11339 * if i < a: return a
11340 * if i > b: return b
11341 * return i # <<<<<<<<<<<<<<
11342 *
11343 * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
11344 */
11345 __pyx_r = __pyx_v_i;
11346 goto __pyx_L0;
11347
11348 /* "yt/utilities/lib/fp_utils.pxd":33
11349 * return f0
11350 *
11351 * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil: # <<<<<<<<<<<<<<
11352 * if i < a: return a
11353 * if i > b: return b
11354 */
11355
11356 /* function exit code */
11357 __pyx_L0:;
11358 return __pyx_r;
11359 }
11360
11361 /* "yt/utilities/lib/fp_utils.pxd":38
11362 * return i
11363 *
11364 * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil: # <<<<<<<<<<<<<<
11365 * if i < a: return a
11366 * if i > b: return b
11367 */
11368
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)11369 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
11370 __pyx_t_5numpy_int64_t __pyx_r;
11371 int __pyx_t_1;
11372
11373 /* "yt/utilities/lib/fp_utils.pxd":39
11374 *
11375 * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
11376 * if i < a: return a # <<<<<<<<<<<<<<
11377 * if i > b: return b
11378 * return i
11379 */
11380 __pyx_t_1 = ((__pyx_v_i < __pyx_v_a) != 0);
11381 if (__pyx_t_1) {
11382 __pyx_r = __pyx_v_a;
11383 goto __pyx_L0;
11384 }
11385
11386 /* "yt/utilities/lib/fp_utils.pxd":40
11387 * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
11388 * if i < a: return a
11389 * if i > b: return b # <<<<<<<<<<<<<<
11390 * return i
11391 *
11392 */
11393 __pyx_t_1 = ((__pyx_v_i > __pyx_v_b) != 0);
11394 if (__pyx_t_1) {
11395 __pyx_r = __pyx_v_b;
11396 goto __pyx_L0;
11397 }
11398
11399 /* "yt/utilities/lib/fp_utils.pxd":41
11400 * if i < a: return a
11401 * if i > b: return b
11402 * return i # <<<<<<<<<<<<<<
11403 *
11404 * cdef inline np.float64_t fclip(np.float64_t f,
11405 */
11406 __pyx_r = __pyx_v_i;
11407 goto __pyx_L0;
11408
11409 /* "yt/utilities/lib/fp_utils.pxd":38
11410 * return i
11411 *
11412 * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil: # <<<<<<<<<<<<<<
11413 * if i < a: return a
11414 * if i > b: return b
11415 */
11416
11417 /* function exit code */
11418 __pyx_L0:;
11419 return __pyx_r;
11420 }
11421
11422 /* "yt/utilities/lib/fp_utils.pxd":43
11423 * return i
11424 *
11425 * cdef inline np.float64_t fclip(np.float64_t f, # <<<<<<<<<<<<<<
11426 * np.float64_t a, np.float64_t b) nogil:
11427 * return fmin(fmax(f, a), b)
11428 */
11429
__pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f,__pyx_t_5numpy_float64_t __pyx_v_a,__pyx_t_5numpy_float64_t __pyx_v_b)11430 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
11431 __pyx_t_5numpy_float64_t __pyx_r;
11432
11433 /* "yt/utilities/lib/fp_utils.pxd":45
11434 * cdef inline np.float64_t fclip(np.float64_t f,
11435 * np.float64_t a, np.float64_t b) nogil:
11436 * return fmin(fmax(f, a), b) # <<<<<<<<<<<<<<
11437 *
11438 * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
11439 */
11440 __pyx_r = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_v_f, __pyx_v_a), __pyx_v_b);
11441 goto __pyx_L0;
11442
11443 /* "yt/utilities/lib/fp_utils.pxd":43
11444 * return i
11445 *
11446 * cdef inline np.float64_t fclip(np.float64_t f, # <<<<<<<<<<<<<<
11447 * np.float64_t a, np.float64_t b) nogil:
11448 * return fmin(fmax(f, a), b)
11449 */
11450
11451 /* function exit code */
11452 __pyx_L0:;
11453 return __pyx_r;
11454 }
11455
11456 /* "yt/utilities/lib/fp_utils.pxd":47
11457 * return fmin(fmax(f, a), b)
11458 *
11459 * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11460 * if i0 > i1: return i0
11461 * return i1
11462 */
11463
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)11464 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
11465 __pyx_t_5numpy_int64_t __pyx_r;
11466 int __pyx_t_1;
11467
11468 /* "yt/utilities/lib/fp_utils.pxd":48
11469 *
11470 * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
11471 * if i0 > i1: return i0 # <<<<<<<<<<<<<<
11472 * return i1
11473 *
11474 */
11475 __pyx_t_1 = ((__pyx_v_i0 > __pyx_v_i1) != 0);
11476 if (__pyx_t_1) {
11477 __pyx_r = __pyx_v_i0;
11478 goto __pyx_L0;
11479 }
11480
11481 /* "yt/utilities/lib/fp_utils.pxd":49
11482 * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
11483 * if i0 > i1: return i0
11484 * return i1 # <<<<<<<<<<<<<<
11485 *
11486 * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
11487 */
11488 __pyx_r = __pyx_v_i1;
11489 goto __pyx_L0;
11490
11491 /* "yt/utilities/lib/fp_utils.pxd":47
11492 * return fmin(fmax(f, a), b)
11493 *
11494 * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11495 * if i0 > i1: return i0
11496 * return i1
11497 */
11498
11499 /* function exit code */
11500 __pyx_L0:;
11501 return __pyx_r;
11502 }
11503
11504 /* "yt/utilities/lib/fp_utils.pxd":51
11505 * return i1
11506 *
11507 * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11508 * if i0 < i1: return i0
11509 * return i1
11510 */
11511
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)11512 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
11513 __pyx_t_5numpy_int64_t __pyx_r;
11514 int __pyx_t_1;
11515
11516 /* "yt/utilities/lib/fp_utils.pxd":52
11517 *
11518 * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
11519 * if i0 < i1: return i0 # <<<<<<<<<<<<<<
11520 * return i1
11521 *
11522 */
11523 __pyx_t_1 = ((__pyx_v_i0 < __pyx_v_i1) != 0);
11524 if (__pyx_t_1) {
11525 __pyx_r = __pyx_v_i0;
11526 goto __pyx_L0;
11527 }
11528
11529 /* "yt/utilities/lib/fp_utils.pxd":53
11530 * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
11531 * if i0 < i1: return i0
11532 * return i1 # <<<<<<<<<<<<<<
11533 *
11534 * cdef inline _ensure_code(arr):
11535 */
11536 __pyx_r = __pyx_v_i1;
11537 goto __pyx_L0;
11538
11539 /* "yt/utilities/lib/fp_utils.pxd":51
11540 * return i1
11541 *
11542 * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil: # <<<<<<<<<<<<<<
11543 * if i0 < i1: return i0
11544 * return i1
11545 */
11546
11547 /* function exit code */
11548 __pyx_L0:;
11549 return __pyx_r;
11550 }
11551
11552 /* "yt/utilities/lib/fp_utils.pxd":55
11553 * return i1
11554 *
11555 * cdef inline _ensure_code(arr): # <<<<<<<<<<<<<<
11556 * if hasattr(arr, "units"):
11557 * if "code_length" == str(arr.units):
11558 */
11559
__pyx_f_2yt_9utilities_3lib_8fp_utils__ensure_code(PyObject * __pyx_v_arr)11560 static CYTHON_INLINE PyObject *__pyx_f_2yt_9utilities_3lib_8fp_utils__ensure_code(PyObject *__pyx_v_arr) {
11561 PyObject *__pyx_r = NULL;
11562 __Pyx_RefNannyDeclarations
11563 int __pyx_t_1;
11564 int __pyx_t_2;
11565 PyObject *__pyx_t_3 = NULL;
11566 PyObject *__pyx_t_4 = NULL;
11567 PyObject *__pyx_t_5 = NULL;
11568 __Pyx_RefNannySetupContext("_ensure_code", 0);
11569
11570 /* "yt/utilities/lib/fp_utils.pxd":56
11571 *
11572 * cdef inline _ensure_code(arr):
11573 * if hasattr(arr, "units"): # <<<<<<<<<<<<<<
11574 * if "code_length" == str(arr.units):
11575 * return arr
11576 */
11577 __pyx_t_1 = __Pyx_HasAttr(__pyx_v_arr, __pyx_n_s_units); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 56, __pyx_L1_error)
11578 __pyx_t_2 = (__pyx_t_1 != 0);
11579 if (__pyx_t_2) {
11580
11581 /* "yt/utilities/lib/fp_utils.pxd":57
11582 * cdef inline _ensure_code(arr):
11583 * if hasattr(arr, "units"):
11584 * if "code_length" == str(arr.units): # <<<<<<<<<<<<<<
11585 * return arr
11586 * arr.convert_to_units("code_length")
11587 */
11588 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_units); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 57, __pyx_L1_error)
11589 __Pyx_GOTREF(__pyx_t_3);
11590 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 57, __pyx_L1_error)
11591 __Pyx_GOTREF(__pyx_t_4);
11592 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11593 __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_n_s_code_length, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 57, __pyx_L1_error)
11594 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11595 if (__pyx_t_2) {
11596
11597 /* "yt/utilities/lib/fp_utils.pxd":58
11598 * if hasattr(arr, "units"):
11599 * if "code_length" == str(arr.units):
11600 * return arr # <<<<<<<<<<<<<<
11601 * arr.convert_to_units("code_length")
11602 * return arr
11603 */
11604 __Pyx_XDECREF(__pyx_r);
11605 __Pyx_INCREF(__pyx_v_arr);
11606 __pyx_r = __pyx_v_arr;
11607 goto __pyx_L0;
11608
11609 /* "yt/utilities/lib/fp_utils.pxd":57
11610 * cdef inline _ensure_code(arr):
11611 * if hasattr(arr, "units"):
11612 * if "code_length" == str(arr.units): # <<<<<<<<<<<<<<
11613 * return arr
11614 * arr.convert_to_units("code_length")
11615 */
11616 }
11617
11618 /* "yt/utilities/lib/fp_utils.pxd":59
11619 * if "code_length" == str(arr.units):
11620 * return arr
11621 * arr.convert_to_units("code_length") # <<<<<<<<<<<<<<
11622 * return arr
11623 */
11624 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_convert_to_units); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 59, __pyx_L1_error)
11625 __Pyx_GOTREF(__pyx_t_3);
11626 __pyx_t_5 = NULL;
11627 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
11628 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
11629 if (likely(__pyx_t_5)) {
11630 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11631 __Pyx_INCREF(__pyx_t_5);
11632 __Pyx_INCREF(function);
11633 __Pyx_DECREF_SET(__pyx_t_3, function);
11634 }
11635 }
11636 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_n_s_code_length) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_code_length);
11637 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11638 if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 59, __pyx_L1_error)
11639 __Pyx_GOTREF(__pyx_t_4);
11640 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11641 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11642
11643 /* "yt/utilities/lib/fp_utils.pxd":56
11644 *
11645 * cdef inline _ensure_code(arr):
11646 * if hasattr(arr, "units"): # <<<<<<<<<<<<<<
11647 * if "code_length" == str(arr.units):
11648 * return arr
11649 */
11650 }
11651
11652 /* "yt/utilities/lib/fp_utils.pxd":60
11653 * return arr
11654 * arr.convert_to_units("code_length")
11655 * return arr # <<<<<<<<<<<<<<
11656 */
11657 __Pyx_XDECREF(__pyx_r);
11658 __Pyx_INCREF(__pyx_v_arr);
11659 __pyx_r = __pyx_v_arr;
11660 goto __pyx_L0;
11661
11662 /* "yt/utilities/lib/fp_utils.pxd":55
11663 * return i1
11664 *
11665 * cdef inline _ensure_code(arr): # <<<<<<<<<<<<<<
11666 * if hasattr(arr, "units"):
11667 * if "code_length" == str(arr.units):
11668 */
11669
11670 /* function exit code */
11671 __pyx_L1_error:;
11672 __Pyx_XDECREF(__pyx_t_3);
11673 __Pyx_XDECREF(__pyx_t_4);
11674 __Pyx_XDECREF(__pyx_t_5);
11675 __Pyx_AddTraceback("yt.utilities.lib.fp_utils._ensure_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
11676 __pyx_r = 0;
11677 __pyx_L0:;
11678 __Pyx_XGIVEREF(__pyx_r);
11679 __Pyx_RefNannyFinishContext();
11680 return __pyx_r;
11681 }
11682 static struct __pyx_vtabstruct_2yt_9utilities_3lib_9quad_tree_QuadTree __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree;
11683
__pyx_tp_new_2yt_9utilities_3lib_9quad_tree_QuadTree(PyTypeObject * t,PyObject * a,PyObject * k)11684 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_9quad_tree_QuadTree(PyTypeObject *t, PyObject *a, PyObject *k) {
11685 struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *p;
11686 PyObject *o;
11687 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
11688 o = (*t->tp_alloc)(t, 0);
11689 } else {
11690 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
11691 }
11692 if (unlikely(!o)) return 0;
11693 p = ((struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *)o);
11694 p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_9quad_tree_QuadTree;
11695 if (unlikely(__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_1__cinit__(o, a, k) < 0)) goto bad;
11696 return o;
11697 bad:
11698 Py_DECREF(o); o = 0;
11699 return NULL;
11700 }
11701
__pyx_tp_dealloc_2yt_9utilities_3lib_9quad_tree_QuadTree(PyObject * o)11702 static void __pyx_tp_dealloc_2yt_9utilities_3lib_9quad_tree_QuadTree(PyObject *o) {
11703 #if CYTHON_USE_TP_FINALIZE
11704 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
11705 if (PyObject_CallFinalizerFromDealloc(o)) return;
11706 }
11707 #endif
11708 {
11709 PyObject *etype, *eval, *etb;
11710 PyErr_Fetch(&etype, &eval, &etb);
11711 ++Py_REFCNT(o);
11712 __pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_19__dealloc__(o);
11713 --Py_REFCNT(o);
11714 PyErr_Restore(etype, eval, etb);
11715 }
11716 (*Py_TYPE(o)->tp_free)(o);
11717 }
11718
11719 static PyMethodDef __pyx_methods_2yt_9utilities_3lib_9quad_tree_QuadTree[] = {
11720 {"frombuffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_3frombuffer, METH_VARARGS|METH_KEYWORDS, 0},
11721 {"tobuffer", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_5tobuffer, METH_NOARGS, 0},
11722 {"get_args", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_7get_args, METH_NOARGS, 0},
11723 {"add_array_to_tree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_9add_array_to_tree, METH_VARARGS|METH_KEYWORDS, 0},
11724 {"add_chunk_to_tree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_11add_chunk_to_tree, METH_VARARGS|METH_KEYWORDS, 0},
11725 {"initialize_chunk", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_13initialize_chunk, METH_VARARGS|METH_KEYWORDS, 0},
11726 {"get_all", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_15get_all, METH_VARARGS|METH_KEYWORDS, 0},
11727 {"fill_image", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_17fill_image, METH_VARARGS|METH_KEYWORDS, 0},
11728 {"__reduce_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_21__reduce_cython__, METH_NOARGS, 0},
11729 {"__setstate_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_9quad_tree_8QuadTree_23__setstate_cython__, METH_O, 0},
11730 {0, 0, 0, 0}
11731 };
11732
11733 static PyTypeObject __pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree = {
11734 PyVarObject_HEAD_INIT(0, 0)
11735 "yt.utilities.lib.quad_tree.QuadTree", /*tp_name*/
11736 sizeof(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree), /*tp_basicsize*/
11737 0, /*tp_itemsize*/
11738 __pyx_tp_dealloc_2yt_9utilities_3lib_9quad_tree_QuadTree, /*tp_dealloc*/
11739 0, /*tp_print*/
11740 0, /*tp_getattr*/
11741 0, /*tp_setattr*/
11742 #if PY_MAJOR_VERSION < 3
11743 0, /*tp_compare*/
11744 #endif
11745 #if PY_MAJOR_VERSION >= 3
11746 0, /*tp_as_async*/
11747 #endif
11748 0, /*tp_repr*/
11749 0, /*tp_as_number*/
11750 0, /*tp_as_sequence*/
11751 0, /*tp_as_mapping*/
11752 0, /*tp_hash*/
11753 0, /*tp_call*/
11754 0, /*tp_str*/
11755 0, /*tp_getattro*/
11756 0, /*tp_setattro*/
11757 0, /*tp_as_buffer*/
11758 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
11759 0, /*tp_doc*/
11760 0, /*tp_traverse*/
11761 0, /*tp_clear*/
11762 0, /*tp_richcompare*/
11763 0, /*tp_weaklistoffset*/
11764 0, /*tp_iter*/
11765 0, /*tp_iternext*/
11766 __pyx_methods_2yt_9utilities_3lib_9quad_tree_QuadTree, /*tp_methods*/
11767 0, /*tp_members*/
11768 0, /*tp_getset*/
11769 0, /*tp_base*/
11770 0, /*tp_dict*/
11771 0, /*tp_descr_get*/
11772 0, /*tp_descr_set*/
11773 0, /*tp_dictoffset*/
11774 0, /*tp_init*/
11775 0, /*tp_alloc*/
11776 __pyx_tp_new_2yt_9utilities_3lib_9quad_tree_QuadTree, /*tp_new*/
11777 0, /*tp_free*/
11778 0, /*tp_is_gc*/
11779 0, /*tp_bases*/
11780 0, /*tp_mro*/
11781 0, /*tp_cache*/
11782 0, /*tp_subclasses*/
11783 0, /*tp_weaklist*/
11784 0, /*tp_del*/
11785 0, /*tp_version_tag*/
11786 #if PY_VERSION_HEX >= 0x030400a1
11787 0, /*tp_finalize*/
11788 #endif
11789 #if PY_VERSION_HEX >= 0x030800b1
11790 0, /*tp_vectorcall*/
11791 #endif
11792 };
11793
11794 static PyMethodDef __pyx_methods[] = {
11795 {0, 0, 0, 0}
11796 };
11797
11798 #if PY_MAJOR_VERSION >= 3
11799 #if CYTHON_PEP489_MULTI_PHASE_INIT
11800 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
11801 static int __pyx_pymod_exec_quad_tree(PyObject* module); /*proto*/
11802 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
11803 {Py_mod_create, (void*)__pyx_pymod_create},
11804 {Py_mod_exec, (void*)__pyx_pymod_exec_quad_tree},
11805 {0, NULL}
11806 };
11807 #endif
11808
11809 static struct PyModuleDef __pyx_moduledef = {
11810 PyModuleDef_HEAD_INIT,
11811 "quad_tree",
11812 __pyx_k_A_refine_by_two_AMR_specific_qu, /* m_doc */
11813 #if CYTHON_PEP489_MULTI_PHASE_INIT
11814 0, /* m_size */
11815 #else
11816 -1, /* m_size */
11817 #endif
11818 __pyx_methods /* m_methods */,
11819 #if CYTHON_PEP489_MULTI_PHASE_INIT
11820 __pyx_moduledef_slots, /* m_slots */
11821 #else
11822 NULL, /* m_reload */
11823 #endif
11824 NULL, /* m_traverse */
11825 NULL, /* m_clear */
11826 NULL /* m_free */
11827 };
11828 #endif
11829 #ifndef CYTHON_SMALL_CODE
11830 #if defined(__clang__)
11831 #define CYTHON_SMALL_CODE
11832 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
11833 #define CYTHON_SMALL_CODE __attribute__((cold))
11834 #else
11835 #define CYTHON_SMALL_CODE
11836 #endif
11837 #endif
11838
11839 static __Pyx_StringTabEntry __pyx_string_tab[] = {
11840 {&__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},
11841 {&__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},
11842 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
11843 {&__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},
11844 {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
11845 {&__pyx_n_s_QuadTree, __pyx_k_QuadTree, sizeof(__pyx_k_QuadTree), 0, 0, 1, 1},
11846 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
11847 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
11848 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
11849 {&__pyx_n_s_YTIntDomainOverflow, __pyx_k_YTIntDomainOverflow, sizeof(__pyx_k_YTIntDomainOverflow), 0, 0, 1, 1},
11850 {&__pyx_n_s_bounds, __pyx_k_bounds, sizeof(__pyx_k_bounds), 0, 0, 1, 1},
11851 {&__pyx_n_s_bounds_2, __pyx_k_bounds_2, sizeof(__pyx_k_bounds_2), 0, 0, 1, 1},
11852 {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1},
11853 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
11854 {&__pyx_n_s_code_length, __pyx_k_code_length, sizeof(__pyx_k_code_length), 0, 0, 1, 1},
11855 {&__pyx_n_s_convert_to_units, __pyx_k_convert_to_units, sizeof(__pyx_k_convert_to_units), 0, 0, 1, 1},
11856 {&__pyx_n_s_count_only, __pyx_k_count_only, sizeof(__pyx_k_count_only), 0, 0, 1, 1},
11857 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
11858 {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
11859 {&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1},
11860 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
11861 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
11862 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11863 {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
11864 {&__pyx_n_s_integrate, __pyx_k_integrate, sizeof(__pyx_k_integrate), 0, 0, 1, 1},
11865 {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
11866 {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
11867 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11868 {&__pyx_n_s_merge_quadtrees, __pyx_k_merge_quadtrees, sizeof(__pyx_k_merge_quadtrees), 0, 0, 1, 1},
11869 {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
11870 {&__pyx_n_s_mip, __pyx_k_mip, sizeof(__pyx_k_mip), 0, 0, 1, 1},
11871 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
11872 {&__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},
11873 {&__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},
11874 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
11875 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
11876 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
11877 {&__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},
11878 {&__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},
11879 {&__pyx_n_s_nvals, __pyx_k_nvals, sizeof(__pyx_k_nvals), 0, 0, 1, 1},
11880 {&__pyx_n_s_pvals, __pyx_k_pvals, sizeof(__pyx_k_pvals), 0, 0, 1, 1},
11881 {&__pyx_n_s_pweight_vals, __pyx_k_pweight_vals, sizeof(__pyx_k_pweight_vals), 0, 0, 1, 1},
11882 {&__pyx_n_s_pxs, __pyx_k_pxs, sizeof(__pyx_k_pxs), 0, 0, 1, 1},
11883 {&__pyx_n_s_pys, __pyx_k_pys, sizeof(__pyx_k_pys), 0, 0, 1, 1},
11884 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
11885 {&__pyx_n_s_qt1, __pyx_k_qt1, sizeof(__pyx_k_qt1), 0, 0, 1, 1},
11886 {&__pyx_n_s_qt2, __pyx_k_qt2, sizeof(__pyx_k_qt2), 0, 0, 1, 1},
11887 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
11888 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
11889 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
11890 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
11891 {&__pyx_n_s_refined, __pyx_k_refined, sizeof(__pyx_k_refined), 0, 0, 1, 1},
11892 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
11893 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
11894 {&__pyx_n_s_skip, __pyx_k_skip, sizeof(__pyx_k_skip), 0, 0, 1, 1},
11895 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11896 {&__pyx_n_s_top_grid_dims, __pyx_k_top_grid_dims, sizeof(__pyx_k_top_grid_dims), 0, 0, 1, 1},
11897 {&__pyx_n_s_units, __pyx_k_units, sizeof(__pyx_k_units), 0, 0, 1, 1},
11898 {&__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},
11899 {&__pyx_n_s_val_index, __pyx_k_val_index, sizeof(__pyx_k_val_index), 0, 0, 1, 1},
11900 {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
11901 {&__pyx_n_s_weighted, __pyx_k_weighted, sizeof(__pyx_k_weighted), 0, 0, 1, 1},
11902 {&__pyx_n_s_wval, __pyx_k_wval, sizeof(__pyx_k_wval), 0, 0, 1, 1},
11903 {&__pyx_n_s_yt_utilities_exceptions, __pyx_k_yt_utilities_exceptions, sizeof(__pyx_k_yt_utilities_exceptions), 0, 0, 1, 1},
11904 {&__pyx_n_s_yt_utilities_lib_quad_tree, __pyx_k_yt_utilities_lib_quad_tree, sizeof(__pyx_k_yt_utilities_lib_quad_tree), 0, 0, 1, 1},
11905 {&__pyx_kp_s_yt_utilities_lib_quad_tree_pyx, __pyx_k_yt_utilities_lib_quad_tree_pyx, sizeof(__pyx_k_yt_utilities_lib_quad_tree_pyx), 0, 0, 1, 0},
11906 {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
11907 {0, 0, 0, 0, 0, 0, 0}
11908 };
__Pyx_InitCachedBuiltins(void)11909 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
11910 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 42, __pyx_L1_error)
11911 __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 114, __pyx_L1_error)
11912 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
11913 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 558, __pyx_L1_error)
11914 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 272, __pyx_L1_error)
11915 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
11916 return 0;
11917 __pyx_L1_error:;
11918 return -1;
11919 }
11920
__Pyx_InitCachedConstants(void)11921 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
11922 __Pyx_RefNannyDeclarations
11923 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11924
11925 /* "(tree fragment)":2
11926 * def __reduce_cython__(self):
11927 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11928 * def __setstate_cython__(self, __pyx_state):
11929 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11930 */
11931 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
11932 __Pyx_GOTREF(__pyx_tuple_);
11933 __Pyx_GIVEREF(__pyx_tuple_);
11934
11935 /* "(tree fragment)":4
11936 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11937 * def __setstate_cython__(self, __pyx_state):
11938 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11939 */
11940 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
11941 __Pyx_GOTREF(__pyx_tuple__2);
11942 __Pyx_GIVEREF(__pyx_tuple__2);
11943
11944 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
11945 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
11946 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
11947 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
11948 *
11949 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11950 */
11951 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 272, __pyx_L1_error)
11952 __Pyx_GOTREF(__pyx_tuple__3);
11953 __Pyx_GIVEREF(__pyx_tuple__3);
11954
11955 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
11956 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11957 * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
11958 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
11959 *
11960 * info.buf = PyArray_DATA(self)
11961 */
11962 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 276, __pyx_L1_error)
11963 __Pyx_GOTREF(__pyx_tuple__4);
11964 __Pyx_GIVEREF(__pyx_tuple__4);
11965
11966 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
11967 * if ((descr.byteorder == c'>' and little_endian) or
11968 * (descr.byteorder == c'<' and not little_endian)):
11969 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
11970 * if t == NPY_BYTE: f = "b"
11971 * elif t == NPY_UBYTE: f = "B"
11972 */
11973 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 306, __pyx_L1_error)
11974 __Pyx_GOTREF(__pyx_tuple__5);
11975 __Pyx_GIVEREF(__pyx_tuple__5);
11976
11977 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
11978 *
11979 * if (end - f) - <int>(new_offset - offset[0]) < 15:
11980 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
11981 *
11982 * if ((child.byteorder == c'>' and little_endian) or
11983 */
11984 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 856, __pyx_L1_error)
11985 __Pyx_GOTREF(__pyx_tuple__6);
11986 __Pyx_GIVEREF(__pyx_tuple__6);
11987
11988 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
11989 * t = child.type_num
11990 * if end - f < 5:
11991 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
11992 *
11993 * # Until ticket #99 is fixed, use integers to avoid warnings
11994 */
11995 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 880, __pyx_L1_error)
11996 __Pyx_GOTREF(__pyx_tuple__7);
11997 __Pyx_GIVEREF(__pyx_tuple__7);
11998
11999 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
12000 * _import_array()
12001 * except Exception:
12002 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
12003 *
12004 * cdef inline int import_umath() except -1:
12005 */
12006 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 1038, __pyx_L1_error)
12007 __Pyx_GOTREF(__pyx_tuple__8);
12008 __Pyx_GIVEREF(__pyx_tuple__8);
12009
12010 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
12011 * _import_umath()
12012 * except Exception:
12013 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
12014 *
12015 * cdef inline int import_ufunc() except -1:
12016 */
12017 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 1044, __pyx_L1_error)
12018 __Pyx_GOTREF(__pyx_tuple__9);
12019 __Pyx_GIVEREF(__pyx_tuple__9);
12020
12021 /* "yt/utilities/lib/quad_tree.pyx":560
12022 * raise RuntimeError
12023 *
12024 * def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1): # <<<<<<<<<<<<<<
12025 * cdef int i, j
12026 * qt1.num_cells = 0
12027 */
12028 __pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_s_qt1, __pyx_n_s_qt2, __pyx_n_s_method, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_func); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 560, __pyx_L1_error)
12029 __Pyx_GOTREF(__pyx_tuple__10);
12030 __Pyx_GIVEREF(__pyx_tuple__10);
12031 __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_quad_tree_pyx, __pyx_n_s_merge_quadtrees, 560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 560, __pyx_L1_error)
12032 __Pyx_RefNannyFinishContext();
12033 return 0;
12034 __pyx_L1_error:;
12035 __Pyx_RefNannyFinishContext();
12036 return -1;
12037 }
12038
__Pyx_InitGlobals(void)12039 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
12040 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
12041 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 2, __pyx_L1_error)
12042 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 2, __pyx_L1_error)
12043 return 0;
12044 __pyx_L1_error:;
12045 return -1;
12046 }
12047
12048 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
12049 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
12050 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
12051 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
12052 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
12053 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
12054 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
12055
__Pyx_modinit_global_init_code(void)12056 static int __Pyx_modinit_global_init_code(void) {
12057 __Pyx_RefNannyDeclarations
12058 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
12059 /*--- Global init code ---*/
12060 __Pyx_RefNannyFinishContext();
12061 return 0;
12062 }
12063
__Pyx_modinit_variable_export_code(void)12064 static int __Pyx_modinit_variable_export_code(void) {
12065 __Pyx_RefNannyDeclarations
12066 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
12067 /*--- Variable export code ---*/
12068 __Pyx_RefNannyFinishContext();
12069 return 0;
12070 }
12071
__Pyx_modinit_function_export_code(void)12072 static int __Pyx_modinit_function_export_code(void) {
12073 __Pyx_RefNannyDeclarations
12074 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
12075 /*--- Function export code ---*/
12076 __Pyx_RefNannyFinishContext();
12077 return 0;
12078 }
12079
__Pyx_modinit_type_init_code(void)12080 static int __Pyx_modinit_type_init_code(void) {
12081 __Pyx_RefNannyDeclarations
12082 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
12083 /*--- Type init code ---*/
12084 __pyx_vtabptr_2yt_9utilities_3lib_9quad_tree_QuadTree = &__pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree;
12085 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.count_total_cells = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count_total_cells;
12086 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.fill_buffer = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, int, PyArrayObject *, PyArrayObject *, PyArrayObject *))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill_buffer;
12087 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.unfill_buffer = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, int, PyArrayObject *, PyArrayObject *, PyArrayObject *))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_unfill_buffer;
12088 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.add_to_position = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position *__pyx_optional_args))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_add_to_position;
12089 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.find_on_root_level = (struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *(*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, __pyx_t_5numpy_int64_t *, int))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_on_root_level;
12090 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.count = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_count;
12091 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.fill = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, struct __pyx_t_2yt_9utilities_3lib_9quad_tree_QuadTreeNode *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_int64_t))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_fill;
12092 __pyx_vtable_2yt_9utilities_3lib_9quad_tree_QuadTree.find_value_at_pos = (__pyx_t_5numpy_float64_t (*)(struct __pyx_obj_2yt_9utilities_3lib_9quad_tree_QuadTree *, __pyx_t_5numpy_float64_t *, int, __pyx_t_5numpy_float64_t *, struct __pyx_opt_args_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos *__pyx_optional_args))__pyx_f_2yt_9utilities_3lib_9quad_tree_8QuadTree_find_value_at_pos;
12093 if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
12094 #if PY_VERSION_HEX < 0x030800B1
12095 __pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree.tp_print = 0;
12096 #endif
12097 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree.tp_getattro == PyObject_GenericGetAttr)) {
12098 __pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree.tp_getattro = __Pyx_PyObject_GenericGetAttr;
12099 }
12100 if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_9quad_tree_QuadTree) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
12101 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_QuadTree, (PyObject *)&__pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
12102 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
12103 __pyx_ptype_2yt_9utilities_3lib_9quad_tree_QuadTree = &__pyx_type_2yt_9utilities_3lib_9quad_tree_QuadTree;
12104 __Pyx_RefNannyFinishContext();
12105 return 0;
12106 __pyx_L1_error:;
12107 __Pyx_RefNannyFinishContext();
12108 return -1;
12109 }
12110
__Pyx_modinit_type_import_code(void)12111 static int __Pyx_modinit_type_import_code(void) {
12112 __Pyx_RefNannyDeclarations
12113 PyObject *__pyx_t_1 = NULL;
12114 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
12115 /*--- Type import code ---*/
12116 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
12117 __Pyx_GOTREF(__pyx_t_1);
12118 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
12119 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
12120 sizeof(PyTypeObject),
12121 #else
12122 sizeof(PyHeapTypeObject),
12123 #endif
12124 __Pyx_ImportType_CheckSize_Warn);
12125 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error)
12126 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12127 __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
12128 __Pyx_GOTREF(__pyx_t_1);
12129 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
12130 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
12131 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
12132 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
12133 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
12134 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
12135 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
12136 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
12137 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
12138 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
12139 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12140 __Pyx_RefNannyFinishContext();
12141 return 0;
12142 __pyx_L1_error:;
12143 __Pyx_XDECREF(__pyx_t_1);
12144 __Pyx_RefNannyFinishContext();
12145 return -1;
12146 }
12147
__Pyx_modinit_variable_import_code(void)12148 static int __Pyx_modinit_variable_import_code(void) {
12149 __Pyx_RefNannyDeclarations
12150 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
12151 /*--- Variable import code ---*/
12152 __Pyx_RefNannyFinishContext();
12153 return 0;
12154 }
12155
__Pyx_modinit_function_import_code(void)12156 static int __Pyx_modinit_function_import_code(void) {
12157 __Pyx_RefNannyDeclarations
12158 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
12159 /*--- Function import code ---*/
12160 __Pyx_RefNannyFinishContext();
12161 return 0;
12162 }
12163
12164
12165 #if PY_MAJOR_VERSION < 3
12166 #ifdef CYTHON_NO_PYINIT_EXPORT
12167 #define __Pyx_PyMODINIT_FUNC void
12168 #else
12169 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
12170 #endif
12171 #else
12172 #ifdef CYTHON_NO_PYINIT_EXPORT
12173 #define __Pyx_PyMODINIT_FUNC PyObject *
12174 #else
12175 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
12176 #endif
12177 #endif
12178
12179
12180 #if PY_MAJOR_VERSION < 3
12181 __Pyx_PyMODINIT_FUNC initquad_tree(void) CYTHON_SMALL_CODE; /*proto*/
initquad_tree(void)12182 __Pyx_PyMODINIT_FUNC initquad_tree(void)
12183 #else
12184 __Pyx_PyMODINIT_FUNC PyInit_quad_tree(void) CYTHON_SMALL_CODE; /*proto*/
12185 __Pyx_PyMODINIT_FUNC PyInit_quad_tree(void)
12186 #if CYTHON_PEP489_MULTI_PHASE_INIT
12187 {
12188 return PyModuleDef_Init(&__pyx_moduledef);
12189 }
12190 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
12191 #if PY_VERSION_HEX >= 0x030700A1
12192 static PY_INT64_T main_interpreter_id = -1;
12193 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
12194 if (main_interpreter_id == -1) {
12195 main_interpreter_id = current_id;
12196 return (unlikely(current_id == -1)) ? -1 : 0;
12197 } else if (unlikely(main_interpreter_id != current_id))
12198 #else
12199 static PyInterpreterState *main_interpreter = NULL;
12200 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
12201 if (!main_interpreter) {
12202 main_interpreter = current_interpreter;
12203 } else if (unlikely(main_interpreter != current_interpreter))
12204 #endif
12205 {
12206 PyErr_SetString(
12207 PyExc_ImportError,
12208 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
12209 return -1;
12210 }
12211 return 0;
12212 }
12213 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) {
12214 PyObject *value = PyObject_GetAttrString(spec, from_name);
12215 int result = 0;
12216 if (likely(value)) {
12217 if (allow_none || value != Py_None) {
12218 result = PyDict_SetItemString(moddict, to_name, value);
12219 }
12220 Py_DECREF(value);
12221 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
12222 PyErr_Clear();
12223 } else {
12224 result = -1;
12225 }
12226 return result;
12227 }
12228 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
12229 PyObject *module = NULL, *moddict, *modname;
12230 if (__Pyx_check_single_interpreter())
12231 return NULL;
12232 if (__pyx_m)
12233 return __Pyx_NewRef(__pyx_m);
12234 modname = PyObject_GetAttrString(spec, "name");
12235 if (unlikely(!modname)) goto bad;
12236 module = PyModule_NewObject(modname);
12237 Py_DECREF(modname);
12238 if (unlikely(!module)) goto bad;
12239 moddict = PyModule_GetDict(module);
12240 if (unlikely(!moddict)) goto bad;
12241 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
12242 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
12243 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
12244 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
12245 return module;
12246 bad:
12247 Py_XDECREF(module);
12248 return NULL;
12249 }
12250
12251
12252 static CYTHON_SMALL_CODE int __pyx_pymod_exec_quad_tree(PyObject *__pyx_pyinit_module)
12253 #endif
12254 #endif
12255 {
12256 PyObject *__pyx_t_1 = NULL;
12257 PyObject *__pyx_t_2 = NULL;
12258 __Pyx_RefNannyDeclarations
12259 #if CYTHON_PEP489_MULTI_PHASE_INIT
12260 if (__pyx_m) {
12261 if (__pyx_m == __pyx_pyinit_module) return 0;
12262 PyErr_SetString(PyExc_RuntimeError, "Module 'quad_tree' has already been imported. Re-initialisation is not supported.");
12263 return -1;
12264 }
12265 #elif PY_MAJOR_VERSION >= 3
12266 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
12267 #endif
12268 #if CYTHON_REFNANNY
12269 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
12270 if (!__Pyx_RefNanny) {
12271 PyErr_Clear();
12272 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
12273 if (!__Pyx_RefNanny)
12274 Py_FatalError("failed to import 'refnanny' module");
12275 }
12276 #endif
12277 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_quad_tree(void)", 0);
12278 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12279 #ifdef __Pxy_PyFrame_Initialize_Offsets
12280 __Pxy_PyFrame_Initialize_Offsets();
12281 #endif
12282 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
12283 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
12284 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
12285 #ifdef __Pyx_CyFunction_USED
12286 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12287 #endif
12288 #ifdef __Pyx_FusedFunction_USED
12289 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12290 #endif
12291 #ifdef __Pyx_Coroutine_USED
12292 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12293 #endif
12294 #ifdef __Pyx_Generator_USED
12295 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12296 #endif
12297 #ifdef __Pyx_AsyncGen_USED
12298 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12299 #endif
12300 #ifdef __Pyx_StopAsyncIteration_USED
12301 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12302 #endif
12303 /*--- Library function declarations ---*/
12304 /*--- Threads initialization code ---*/
12305 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
12306 #ifdef WITH_THREAD /* Python build with threading support? */
12307 PyEval_InitThreads();
12308 #endif
12309 #endif
12310 /*--- Module creation code ---*/
12311 #if CYTHON_PEP489_MULTI_PHASE_INIT
12312 __pyx_m = __pyx_pyinit_module;
12313 Py_INCREF(__pyx_m);
12314 #else
12315 #if PY_MAJOR_VERSION < 3
12316 __pyx_m = Py_InitModule4("quad_tree", __pyx_methods, __pyx_k_A_refine_by_two_AMR_specific_qu, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
12317 #else
12318 __pyx_m = PyModule_Create(&__pyx_moduledef);
12319 #endif
12320 if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
12321 #endif
12322 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
12323 Py_INCREF(__pyx_d);
12324 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
12325 Py_INCREF(__pyx_b);
12326 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
12327 Py_INCREF(__pyx_cython_runtime);
12328 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
12329 /*--- Initialize various global constants etc. ---*/
12330 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12331 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
12332 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12333 #endif
12334 if (__pyx_module_is_main_yt__utilities__lib__quad_tree) {
12335 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12336 }
12337 #if PY_MAJOR_VERSION >= 3
12338 {
12339 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
12340 if (!PyDict_GetItemString(modules, "yt.utilities.lib.quad_tree")) {
12341 if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.quad_tree", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
12342 }
12343 }
12344 #endif
12345 /*--- Builtin init code ---*/
12346 if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
12347 /*--- Constants init code ---*/
12348 if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
12349 /*--- Global type/function init code ---*/
12350 (void)__Pyx_modinit_global_init_code();
12351 (void)__Pyx_modinit_variable_export_code();
12352 (void)__Pyx_modinit_function_export_code();
12353 if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
12354 if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
12355 (void)__Pyx_modinit_variable_import_code();
12356 (void)__Pyx_modinit_function_import_code();
12357 /*--- Execution code ---*/
12358 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
12359 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12360 #endif
12361
12362 /* "yt/utilities/lib/quad_tree.pyx":12
12363 *
12364 *
12365 * import numpy as np # <<<<<<<<<<<<<<
12366 *
12367 * cimport cython
12368 */
12369 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
12370 __Pyx_GOTREF(__pyx_t_1);
12371 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
12372 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12373
12374 /* "yt/utilities/lib/quad_tree.pyx":21
12375 * from yt.utilities.lib.fp_utils cimport fmax
12376 *
12377 * from yt.utilities.exceptions import YTIntDomainOverflow # <<<<<<<<<<<<<<
12378 *
12379 *
12380 */
12381 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
12382 __Pyx_GOTREF(__pyx_t_1);
12383 __Pyx_INCREF(__pyx_n_s_YTIntDomainOverflow);
12384 __Pyx_GIVEREF(__pyx_n_s_YTIntDomainOverflow);
12385 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_YTIntDomainOverflow);
12386 __pyx_t_2 = __Pyx_Import(__pyx_n_s_yt_utilities_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
12387 __Pyx_GOTREF(__pyx_t_2);
12388 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12389 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_YTIntDomainOverflow); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
12390 __Pyx_GOTREF(__pyx_t_1);
12391 if (PyDict_SetItem(__pyx_d, __pyx_n_s_YTIntDomainOverflow, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
12392 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12393 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12394
12395 /* "yt/utilities/lib/quad_tree.pyx":560
12396 * raise RuntimeError
12397 *
12398 * def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1): # <<<<<<<<<<<<<<
12399 * cdef int i, j
12400 * qt1.num_cells = 0
12401 */
12402 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_9quad_tree_1merge_quadtrees, NULL, __pyx_n_s_yt_utilities_lib_quad_tree); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error)
12403 __Pyx_GOTREF(__pyx_t_2);
12404 if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge_quadtrees, __pyx_t_2) < 0) __PYX_ERR(0, 560, __pyx_L1_error)
12405 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12406
12407 /* "yt/utilities/lib/quad_tree.pyx":2
12408 *
12409 * # distutils: libraries = STD_LIBS # <<<<<<<<<<<<<<
12410 * """
12411 * A refine-by-two AMR-specific quadtree
12412 */
12413 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
12414 __Pyx_GOTREF(__pyx_t_2);
12415 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
12416 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12417
12418 /* "yt/utilities/lib/fp_utils.pxd":55
12419 * return i1
12420 *
12421 * cdef inline _ensure_code(arr): # <<<<<<<<<<<<<<
12422 * if hasattr(arr, "units"):
12423 * if "code_length" == str(arr.units):
12424 */
12425
12426 /*--- Wrapped vars code ---*/
12427
12428 goto __pyx_L0;
12429 __pyx_L1_error:;
12430 __Pyx_XDECREF(__pyx_t_1);
12431 __Pyx_XDECREF(__pyx_t_2);
12432 if (__pyx_m) {
12433 if (__pyx_d) {
12434 __Pyx_AddTraceback("init yt.utilities.lib.quad_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
12435 }
12436 Py_CLEAR(__pyx_m);
12437 } else if (!PyErr_Occurred()) {
12438 PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.quad_tree");
12439 }
12440 __pyx_L0:;
12441 __Pyx_RefNannyFinishContext();
12442 #if CYTHON_PEP489_MULTI_PHASE_INIT
12443 return (__pyx_m != NULL) ? 0 : -1;
12444 #elif PY_MAJOR_VERSION >= 3
12445 return __pyx_m;
12446 #else
12447 return;
12448 #endif
12449 }
12450
12451 /* --- Runtime support code --- */
12452 /* Refnanny */
12453 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)12454 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
12455 PyObject *m = NULL, *p = NULL;
12456 void *r = NULL;
12457 m = PyImport_ImportModule(modname);
12458 if (!m) goto end;
12459 p = PyObject_GetAttrString(m, "RefNannyAPI");
12460 if (!p) goto end;
12461 r = PyLong_AsVoidPtr(p);
12462 end:
12463 Py_XDECREF(p);
12464 Py_XDECREF(m);
12465 return (__Pyx_RefNannyAPIStruct *)r;
12466 }
12467 #endif
12468
12469 /* PyObjectGetAttrStr */
12470 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)12471 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
12472 PyTypeObject* tp = Py_TYPE(obj);
12473 if (likely(tp->tp_getattro))
12474 return tp->tp_getattro(obj, attr_name);
12475 #if PY_MAJOR_VERSION < 3
12476 if (likely(tp->tp_getattr))
12477 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
12478 #endif
12479 return PyObject_GetAttr(obj, attr_name);
12480 }
12481 #endif
12482
12483 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)12484 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
12485 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
12486 if (unlikely(!result)) {
12487 PyErr_Format(PyExc_NameError,
12488 #if PY_MAJOR_VERSION >= 3
12489 "name '%U' is not defined", name);
12490 #else
12491 "name '%.200s' is not defined", PyString_AS_STRING(name));
12492 #endif
12493 }
12494 return result;
12495 }
12496
12497 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)12498 static void __Pyx_RaiseArgtupleInvalid(
12499 const char* func_name,
12500 int exact,
12501 Py_ssize_t num_min,
12502 Py_ssize_t num_max,
12503 Py_ssize_t num_found)
12504 {
12505 Py_ssize_t num_expected;
12506 const char *more_or_less;
12507 if (num_found < num_min) {
12508 num_expected = num_min;
12509 more_or_less = "at least";
12510 } else {
12511 num_expected = num_max;
12512 more_or_less = "at most";
12513 }
12514 if (exact) {
12515 more_or_less = "exactly";
12516 }
12517 PyErr_Format(PyExc_TypeError,
12518 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
12519 func_name, more_or_less, num_expected,
12520 (num_expected == 1) ? "" : "s", num_found);
12521 }
12522
12523 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)12524 static void __Pyx_RaiseDoubleKeywordsError(
12525 const char* func_name,
12526 PyObject* kw_name)
12527 {
12528 PyErr_Format(PyExc_TypeError,
12529 #if PY_MAJOR_VERSION >= 3
12530 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
12531 #else
12532 "%s() got multiple values for keyword argument '%s'", func_name,
12533 PyString_AsString(kw_name));
12534 #endif
12535 }
12536
12537 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)12538 static int __Pyx_ParseOptionalKeywords(
12539 PyObject *kwds,
12540 PyObject **argnames[],
12541 PyObject *kwds2,
12542 PyObject *values[],
12543 Py_ssize_t num_pos_args,
12544 const char* function_name)
12545 {
12546 PyObject *key = 0, *value = 0;
12547 Py_ssize_t pos = 0;
12548 PyObject*** name;
12549 PyObject*** first_kw_arg = argnames + num_pos_args;
12550 while (PyDict_Next(kwds, &pos, &key, &value)) {
12551 name = first_kw_arg;
12552 while (*name && (**name != key)) name++;
12553 if (*name) {
12554 values[name-argnames] = value;
12555 continue;
12556 }
12557 name = first_kw_arg;
12558 #if PY_MAJOR_VERSION < 3
12559 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
12560 while (*name) {
12561 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
12562 && _PyString_Eq(**name, key)) {
12563 values[name-argnames] = value;
12564 break;
12565 }
12566 name++;
12567 }
12568 if (*name) continue;
12569 else {
12570 PyObject*** argname = argnames;
12571 while (argname != first_kw_arg) {
12572 if ((**argname == key) || (
12573 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
12574 && _PyString_Eq(**argname, key))) {
12575 goto arg_passed_twice;
12576 }
12577 argname++;
12578 }
12579 }
12580 } else
12581 #endif
12582 if (likely(PyUnicode_Check(key))) {
12583 while (*name) {
12584 int cmp = (**name == key) ? 0 :
12585 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
12586 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
12587 #endif
12588 PyUnicode_Compare(**name, key);
12589 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12590 if (cmp == 0) {
12591 values[name-argnames] = value;
12592 break;
12593 }
12594 name++;
12595 }
12596 if (*name) continue;
12597 else {
12598 PyObject*** argname = argnames;
12599 while (argname != first_kw_arg) {
12600 int cmp = (**argname == key) ? 0 :
12601 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
12602 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
12603 #endif
12604 PyUnicode_Compare(**argname, key);
12605 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12606 if (cmp == 0) goto arg_passed_twice;
12607 argname++;
12608 }
12609 }
12610 } else
12611 goto invalid_keyword_type;
12612 if (kwds2) {
12613 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
12614 } else {
12615 goto invalid_keyword;
12616 }
12617 }
12618 return 0;
12619 arg_passed_twice:
12620 __Pyx_RaiseDoubleKeywordsError(function_name, key);
12621 goto bad;
12622 invalid_keyword_type:
12623 PyErr_Format(PyExc_TypeError,
12624 "%.200s() keywords must be strings", function_name);
12625 goto bad;
12626 invalid_keyword:
12627 PyErr_Format(PyExc_TypeError,
12628 #if PY_MAJOR_VERSION < 3
12629 "%.200s() got an unexpected keyword argument '%.200s'",
12630 function_name, PyString_AsString(key));
12631 #else
12632 "%s() got an unexpected keyword argument '%U'",
12633 function_name, key);
12634 #endif
12635 bad:
12636 return -1;
12637 }
12638
12639 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)12640 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
12641 {
12642 if (unlikely(!type)) {
12643 PyErr_SetString(PyExc_SystemError, "Missing type object");
12644 return 0;
12645 }
12646 else if (exact) {
12647 #if PY_MAJOR_VERSION == 2
12648 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
12649 #endif
12650 }
12651 else {
12652 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
12653 }
12654 PyErr_Format(PyExc_TypeError,
12655 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
12656 name, type->tp_name, Py_TYPE(obj)->tp_name);
12657 return 0;
12658 }
12659
12660 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)12661 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
12662 {
12663 union {
12664 uint32_t u32;
12665 uint8_t u8[4];
12666 } S;
12667 S.u32 = 0x01020304;
12668 return S.u8[0] == 4;
12669 }
12670
12671 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)12672 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
12673 __Pyx_BufFmt_StackElem* stack,
12674 __Pyx_TypeInfo* type) {
12675 stack[0].field = &ctx->root;
12676 stack[0].parent_offset = 0;
12677 ctx->root.type = type;
12678 ctx->root.name = "buffer dtype";
12679 ctx->root.offset = 0;
12680 ctx->head = stack;
12681 ctx->head->field = &ctx->root;
12682 ctx->fmt_offset = 0;
12683 ctx->head->parent_offset = 0;
12684 ctx->new_packmode = '@';
12685 ctx->enc_packmode = '@';
12686 ctx->new_count = 1;
12687 ctx->enc_count = 0;
12688 ctx->enc_type = 0;
12689 ctx->is_complex = 0;
12690 ctx->is_valid_array = 0;
12691 ctx->struct_alignment = 0;
12692 while (type->typegroup == 'S') {
12693 ++ctx->head;
12694 ctx->head->field = type->fields;
12695 ctx->head->parent_offset = 0;
12696 type = type->fields->type;
12697 }
12698 }
__Pyx_BufFmt_ParseNumber(const char ** ts)12699 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
12700 int count;
12701 const char* t = *ts;
12702 if (*t < '0' || *t > '9') {
12703 return -1;
12704 } else {
12705 count = *t++ - '0';
12706 while (*t >= '0' && *t <= '9') {
12707 count *= 10;
12708 count += *t++ - '0';
12709 }
12710 }
12711 *ts = t;
12712 return count;
12713 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)12714 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
12715 int number = __Pyx_BufFmt_ParseNumber(ts);
12716 if (number == -1)
12717 PyErr_Format(PyExc_ValueError,\
12718 "Does not understand character buffer dtype format string ('%c')", **ts);
12719 return number;
12720 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)12721 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
12722 PyErr_Format(PyExc_ValueError,
12723 "Unexpected format string character: '%c'", ch);
12724 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)12725 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
12726 switch (ch) {
12727 case 'c': return "'char'";
12728 case 'b': return "'signed char'";
12729 case 'B': return "'unsigned char'";
12730 case 'h': return "'short'";
12731 case 'H': return "'unsigned short'";
12732 case 'i': return "'int'";
12733 case 'I': return "'unsigned int'";
12734 case 'l': return "'long'";
12735 case 'L': return "'unsigned long'";
12736 case 'q': return "'long long'";
12737 case 'Q': return "'unsigned long long'";
12738 case 'f': return (is_complex ? "'complex float'" : "'float'");
12739 case 'd': return (is_complex ? "'complex double'" : "'double'");
12740 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
12741 case 'T': return "a struct";
12742 case 'O': return "Python object";
12743 case 'P': return "a pointer";
12744 case 's': case 'p': return "a string";
12745 case 0: return "end";
12746 default: return "unparseable format string";
12747 }
12748 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)12749 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
12750 switch (ch) {
12751 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
12752 case 'h': case 'H': return 2;
12753 case 'i': case 'I': case 'l': case 'L': return 4;
12754 case 'q': case 'Q': return 8;
12755 case 'f': return (is_complex ? 8 : 4);
12756 case 'd': return (is_complex ? 16 : 8);
12757 case 'g': {
12758 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
12759 return 0;
12760 }
12761 case 'O': case 'P': return sizeof(void*);
12762 default:
12763 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
12764 return 0;
12765 }
12766 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)12767 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
12768 switch (ch) {
12769 case 'c': case 'b': case 'B': case 's': case 'p': return 1;
12770 case 'h': case 'H': return sizeof(short);
12771 case 'i': case 'I': return sizeof(int);
12772 case 'l': case 'L': return sizeof(long);
12773 #ifdef HAVE_LONG_LONG
12774 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
12775 #endif
12776 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
12777 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
12778 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
12779 case 'O': case 'P': return sizeof(void*);
12780 default: {
12781 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
12782 return 0;
12783 }
12784 }
12785 }
12786 typedef struct { char c; short x; } __Pyx_st_short;
12787 typedef struct { char c; int x; } __Pyx_st_int;
12788 typedef struct { char c; long x; } __Pyx_st_long;
12789 typedef struct { char c; float x; } __Pyx_st_float;
12790 typedef struct { char c; double x; } __Pyx_st_double;
12791 typedef struct { char c; long double x; } __Pyx_st_longdouble;
12792 typedef struct { char c; void *x; } __Pyx_st_void_p;
12793 #ifdef HAVE_LONG_LONG
12794 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
12795 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)12796 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
12797 switch (ch) {
12798 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
12799 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
12800 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
12801 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
12802 #ifdef HAVE_LONG_LONG
12803 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
12804 #endif
12805 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
12806 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
12807 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
12808 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
12809 default:
12810 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
12811 return 0;
12812 }
12813 }
12814 /* These are for computing the padding at the end of the struct to align
12815 on the first member of the struct. This will probably the same as above,
12816 but we don't have any guarantees.
12817 */
12818 typedef struct { short x; char c; } __Pyx_pad_short;
12819 typedef struct { int x; char c; } __Pyx_pad_int;
12820 typedef struct { long x; char c; } __Pyx_pad_long;
12821 typedef struct { float x; char c; } __Pyx_pad_float;
12822 typedef struct { double x; char c; } __Pyx_pad_double;
12823 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
12824 typedef struct { void *x; char c; } __Pyx_pad_void_p;
12825 #ifdef HAVE_LONG_LONG
12826 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
12827 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)12828 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
12829 switch (ch) {
12830 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
12831 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
12832 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
12833 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
12834 #ifdef HAVE_LONG_LONG
12835 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
12836 #endif
12837 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
12838 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
12839 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
12840 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
12841 default:
12842 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
12843 return 0;
12844 }
12845 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)12846 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
12847 switch (ch) {
12848 case 'c':
12849 return 'H';
12850 case 'b': case 'h': case 'i':
12851 case 'l': case 'q': case 's': case 'p':
12852 return 'I';
12853 case 'B': case 'H': case 'I': case 'L': case 'Q':
12854 return 'U';
12855 case 'f': case 'd': case 'g':
12856 return (is_complex ? 'C' : 'R');
12857 case 'O':
12858 return 'O';
12859 case 'P':
12860 return 'P';
12861 default: {
12862 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
12863 return 0;
12864 }
12865 }
12866 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)12867 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
12868 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
12869 const char* expected;
12870 const char* quote;
12871 if (ctx->head == NULL) {
12872 expected = "end";
12873 quote = "";
12874 } else {
12875 expected = ctx->head->field->type->name;
12876 quote = "'";
12877 }
12878 PyErr_Format(PyExc_ValueError,
12879 "Buffer dtype mismatch, expected %s%s%s but got %s",
12880 quote, expected, quote,
12881 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
12882 } else {
12883 __Pyx_StructField* field = ctx->head->field;
12884 __Pyx_StructField* parent = (ctx->head - 1)->field;
12885 PyErr_Format(PyExc_ValueError,
12886 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
12887 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
12888 parent->type->name, field->name);
12889 }
12890 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)12891 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
12892 char group;
12893 size_t size, offset, arraysize = 1;
12894 if (ctx->enc_type == 0) return 0;
12895 if (ctx->head->field->type->arraysize[0]) {
12896 int i, ndim = 0;
12897 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
12898 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
12899 ndim = 1;
12900 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
12901 PyErr_Format(PyExc_ValueError,
12902 "Expected a dimension of size %zu, got %zu",
12903 ctx->head->field->type->arraysize[0], ctx->enc_count);
12904 return -1;
12905 }
12906 }
12907 if (!ctx->is_valid_array) {
12908 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
12909 ctx->head->field->type->ndim, ndim);
12910 return -1;
12911 }
12912 for (i = 0; i < ctx->head->field->type->ndim; i++) {
12913 arraysize *= ctx->head->field->type->arraysize[i];
12914 }
12915 ctx->is_valid_array = 0;
12916 ctx->enc_count = 1;
12917 }
12918 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
12919 do {
12920 __Pyx_StructField* field = ctx->head->field;
12921 __Pyx_TypeInfo* type = field->type;
12922 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
12923 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
12924 } else {
12925 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
12926 }
12927 if (ctx->enc_packmode == '@') {
12928 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
12929 size_t align_mod_offset;
12930 if (align_at == 0) return -1;
12931 align_mod_offset = ctx->fmt_offset % align_at;
12932 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
12933 if (ctx->struct_alignment == 0)
12934 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
12935 ctx->is_complex);
12936 }
12937 if (type->size != size || type->typegroup != group) {
12938 if (type->typegroup == 'C' && type->fields != NULL) {
12939 size_t parent_offset = ctx->head->parent_offset + field->offset;
12940 ++ctx->head;
12941 ctx->head->field = type->fields;
12942 ctx->head->parent_offset = parent_offset;
12943 continue;
12944 }
12945 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
12946 } else {
12947 __Pyx_BufFmt_RaiseExpected(ctx);
12948 return -1;
12949 }
12950 }
12951 offset = ctx->head->parent_offset + field->offset;
12952 if (ctx->fmt_offset != offset) {
12953 PyErr_Format(PyExc_ValueError,
12954 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
12955 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
12956 return -1;
12957 }
12958 ctx->fmt_offset += size;
12959 if (arraysize)
12960 ctx->fmt_offset += (arraysize - 1) * size;
12961 --ctx->enc_count;
12962 while (1) {
12963 if (field == &ctx->root) {
12964 ctx->head = NULL;
12965 if (ctx->enc_count != 0) {
12966 __Pyx_BufFmt_RaiseExpected(ctx);
12967 return -1;
12968 }
12969 break;
12970 }
12971 ctx->head->field = ++field;
12972 if (field->type == NULL) {
12973 --ctx->head;
12974 field = ctx->head->field;
12975 continue;
12976 } else if (field->type->typegroup == 'S') {
12977 size_t parent_offset = ctx->head->parent_offset + field->offset;
12978 if (field->type->fields->type == NULL) continue;
12979 field = field->type->fields;
12980 ++ctx->head;
12981 ctx->head->field = field;
12982 ctx->head->parent_offset = parent_offset;
12983 break;
12984 } else {
12985 break;
12986 }
12987 }
12988 } while (ctx->enc_count);
12989 ctx->enc_type = 0;
12990 ctx->is_complex = 0;
12991 return 0;
12992 }
12993 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)12994 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
12995 {
12996 const char *ts = *tsp;
12997 int i = 0, number;
12998 int ndim = ctx->head->field->type->ndim;
12999 ;
13000 ++ts;
13001 if (ctx->new_count != 1) {
13002 PyErr_SetString(PyExc_ValueError,
13003 "Cannot handle repeated arrays in format string");
13004 return NULL;
13005 }
13006 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13007 while (*ts && *ts != ')') {
13008 switch (*ts) {
13009 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
13010 default: break;
13011 }
13012 number = __Pyx_BufFmt_ExpectNumber(&ts);
13013 if (number == -1) return NULL;
13014 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
13015 return PyErr_Format(PyExc_ValueError,
13016 "Expected a dimension of size %zu, got %d",
13017 ctx->head->field->type->arraysize[i], number);
13018 if (*ts != ',' && *ts != ')')
13019 return PyErr_Format(PyExc_ValueError,
13020 "Expected a comma in format string, got '%c'", *ts);
13021 if (*ts == ',') ts++;
13022 i++;
13023 }
13024 if (i != ndim)
13025 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
13026 ctx->head->field->type->ndim, i);
13027 if (!*ts) {
13028 PyErr_SetString(PyExc_ValueError,
13029 "Unexpected end of format string, expected ')'");
13030 return NULL;
13031 }
13032 ctx->is_valid_array = 1;
13033 ctx->new_count = 1;
13034 *tsp = ++ts;
13035 return Py_None;
13036 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)13037 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
13038 int got_Z = 0;
13039 while (1) {
13040 switch(*ts) {
13041 case 0:
13042 if (ctx->enc_type != 0 && ctx->head == NULL) {
13043 __Pyx_BufFmt_RaiseExpected(ctx);
13044 return NULL;
13045 }
13046 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13047 if (ctx->head != NULL) {
13048 __Pyx_BufFmt_RaiseExpected(ctx);
13049 return NULL;
13050 }
13051 return ts;
13052 case ' ':
13053 case '\r':
13054 case '\n':
13055 ++ts;
13056 break;
13057 case '<':
13058 if (!__Pyx_Is_Little_Endian()) {
13059 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
13060 return NULL;
13061 }
13062 ctx->new_packmode = '=';
13063 ++ts;
13064 break;
13065 case '>':
13066 case '!':
13067 if (__Pyx_Is_Little_Endian()) {
13068 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
13069 return NULL;
13070 }
13071 ctx->new_packmode = '=';
13072 ++ts;
13073 break;
13074 case '=':
13075 case '@':
13076 case '^':
13077 ctx->new_packmode = *ts++;
13078 break;
13079 case 'T':
13080 {
13081 const char* ts_after_sub;
13082 size_t i, struct_count = ctx->new_count;
13083 size_t struct_alignment = ctx->struct_alignment;
13084 ctx->new_count = 1;
13085 ++ts;
13086 if (*ts != '{') {
13087 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
13088 return NULL;
13089 }
13090 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13091 ctx->enc_type = 0;
13092 ctx->enc_count = 0;
13093 ctx->struct_alignment = 0;
13094 ++ts;
13095 ts_after_sub = ts;
13096 for (i = 0; i != struct_count; ++i) {
13097 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
13098 if (!ts_after_sub) return NULL;
13099 }
13100 ts = ts_after_sub;
13101 if (struct_alignment) ctx->struct_alignment = struct_alignment;
13102 }
13103 break;
13104 case '}':
13105 {
13106 size_t alignment = ctx->struct_alignment;
13107 ++ts;
13108 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13109 ctx->enc_type = 0;
13110 if (alignment && ctx->fmt_offset % alignment) {
13111 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
13112 }
13113 }
13114 return ts;
13115 case 'x':
13116 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13117 ctx->fmt_offset += ctx->new_count;
13118 ctx->new_count = 1;
13119 ctx->enc_count = 0;
13120 ctx->enc_type = 0;
13121 ctx->enc_packmode = ctx->new_packmode;
13122 ++ts;
13123 break;
13124 case 'Z':
13125 got_Z = 1;
13126 ++ts;
13127 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
13128 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
13129 return NULL;
13130 }
13131 CYTHON_FALLTHROUGH;
13132 case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
13133 case 'l': case 'L': case 'q': case 'Q':
13134 case 'f': case 'd': case 'g':
13135 case 'O': case 'p':
13136 if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
13137 ctx->enc_packmode == ctx->new_packmode) {
13138 ctx->enc_count += ctx->new_count;
13139 ctx->new_count = 1;
13140 got_Z = 0;
13141 ++ts;
13142 break;
13143 }
13144 CYTHON_FALLTHROUGH;
13145 case 's':
13146 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13147 ctx->enc_count = ctx->new_count;
13148 ctx->enc_packmode = ctx->new_packmode;
13149 ctx->enc_type = *ts;
13150 ctx->is_complex = got_Z;
13151 ++ts;
13152 ctx->new_count = 1;
13153 got_Z = 0;
13154 break;
13155 case ':':
13156 ++ts;
13157 while(*ts != ':') ++ts;
13158 ++ts;
13159 break;
13160 case '(':
13161 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
13162 break;
13163 default:
13164 {
13165 int number = __Pyx_BufFmt_ExpectNumber(&ts);
13166 if (number == -1) return NULL;
13167 ctx->new_count = (size_t)number;
13168 }
13169 }
13170 }
13171 }
13172
13173 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)13174 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
13175 if (unlikely(info->buf == NULL)) return;
13176 if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
13177 __Pyx_ReleaseBuffer(info);
13178 }
__Pyx_ZeroBuffer(Py_buffer * buf)13179 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
13180 buf->buf = NULL;
13181 buf->obj = NULL;
13182 buf->strides = __Pyx_zeros;
13183 buf->shape = __Pyx_zeros;
13184 buf->suboffsets = __Pyx_minusones;
13185 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)13186 static int __Pyx__GetBufferAndValidate(
13187 Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
13188 int nd, int cast, __Pyx_BufFmt_StackElem* stack)
13189 {
13190 buf->buf = NULL;
13191 if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
13192 __Pyx_ZeroBuffer(buf);
13193 return -1;
13194 }
13195 if (unlikely(buf->ndim != nd)) {
13196 PyErr_Format(PyExc_ValueError,
13197 "Buffer has wrong number of dimensions (expected %d, got %d)",
13198 nd, buf->ndim);
13199 goto fail;
13200 }
13201 if (!cast) {
13202 __Pyx_BufFmt_Context ctx;
13203 __Pyx_BufFmt_Init(&ctx, stack, dtype);
13204 if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
13205 }
13206 if (unlikely((size_t)buf->itemsize != dtype->size)) {
13207 PyErr_Format(PyExc_ValueError,
13208 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
13209 buf->itemsize, (buf->itemsize > 1) ? "s" : "",
13210 dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
13211 goto fail;
13212 }
13213 if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
13214 return 0;
13215 fail:;
13216 __Pyx_SafeReleaseBuffer(buf);
13217 return -1;
13218 }
13219
13220 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)13221 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
13222 #if CYTHON_COMPILING_IN_PYPY
13223 return PyObject_RichCompareBool(s1, s2, equals);
13224 #else
13225 if (s1 == s2) {
13226 return (equals == Py_EQ);
13227 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
13228 const char *ps1, *ps2;
13229 Py_ssize_t length = PyBytes_GET_SIZE(s1);
13230 if (length != PyBytes_GET_SIZE(s2))
13231 return (equals == Py_NE);
13232 ps1 = PyBytes_AS_STRING(s1);
13233 ps2 = PyBytes_AS_STRING(s2);
13234 if (ps1[0] != ps2[0]) {
13235 return (equals == Py_NE);
13236 } else if (length == 1) {
13237 return (equals == Py_EQ);
13238 } else {
13239 int result;
13240 #if CYTHON_USE_UNICODE_INTERNALS
13241 Py_hash_t hash1, hash2;
13242 hash1 = ((PyBytesObject*)s1)->ob_shash;
13243 hash2 = ((PyBytesObject*)s2)->ob_shash;
13244 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
13245 return (equals == Py_NE);
13246 }
13247 #endif
13248 result = memcmp(ps1, ps2, (size_t)length);
13249 return (equals == Py_EQ) ? (result == 0) : (result != 0);
13250 }
13251 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
13252 return (equals == Py_NE);
13253 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
13254 return (equals == Py_NE);
13255 } else {
13256 int result;
13257 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
13258 if (!py_result)
13259 return -1;
13260 result = __Pyx_PyObject_IsTrue(py_result);
13261 Py_DECREF(py_result);
13262 return result;
13263 }
13264 #endif
13265 }
13266
13267 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)13268 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
13269 #if CYTHON_COMPILING_IN_PYPY
13270 return PyObject_RichCompareBool(s1, s2, equals);
13271 #else
13272 #if PY_MAJOR_VERSION < 3
13273 PyObject* owned_ref = NULL;
13274 #endif
13275 int s1_is_unicode, s2_is_unicode;
13276 if (s1 == s2) {
13277 goto return_eq;
13278 }
13279 s1_is_unicode = PyUnicode_CheckExact(s1);
13280 s2_is_unicode = PyUnicode_CheckExact(s2);
13281 #if PY_MAJOR_VERSION < 3
13282 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
13283 owned_ref = PyUnicode_FromObject(s2);
13284 if (unlikely(!owned_ref))
13285 return -1;
13286 s2 = owned_ref;
13287 s2_is_unicode = 1;
13288 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
13289 owned_ref = PyUnicode_FromObject(s1);
13290 if (unlikely(!owned_ref))
13291 return -1;
13292 s1 = owned_ref;
13293 s1_is_unicode = 1;
13294 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
13295 return __Pyx_PyBytes_Equals(s1, s2, equals);
13296 }
13297 #endif
13298 if (s1_is_unicode & s2_is_unicode) {
13299 Py_ssize_t length;
13300 int kind;
13301 void *data1, *data2;
13302 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
13303 return -1;
13304 length = __Pyx_PyUnicode_GET_LENGTH(s1);
13305 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
13306 goto return_ne;
13307 }
13308 #if CYTHON_USE_UNICODE_INTERNALS
13309 {
13310 Py_hash_t hash1, hash2;
13311 #if CYTHON_PEP393_ENABLED
13312 hash1 = ((PyASCIIObject*)s1)->hash;
13313 hash2 = ((PyASCIIObject*)s2)->hash;
13314 #else
13315 hash1 = ((PyUnicodeObject*)s1)->hash;
13316 hash2 = ((PyUnicodeObject*)s2)->hash;
13317 #endif
13318 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
13319 goto return_ne;
13320 }
13321 }
13322 #endif
13323 kind = __Pyx_PyUnicode_KIND(s1);
13324 if (kind != __Pyx_PyUnicode_KIND(s2)) {
13325 goto return_ne;
13326 }
13327 data1 = __Pyx_PyUnicode_DATA(s1);
13328 data2 = __Pyx_PyUnicode_DATA(s2);
13329 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
13330 goto return_ne;
13331 } else if (length == 1) {
13332 goto return_eq;
13333 } else {
13334 int result = memcmp(data1, data2, (size_t)(length * kind));
13335 #if PY_MAJOR_VERSION < 3
13336 Py_XDECREF(owned_ref);
13337 #endif
13338 return (equals == Py_EQ) ? (result == 0) : (result != 0);
13339 }
13340 } else if ((s1 == Py_None) & s2_is_unicode) {
13341 goto return_ne;
13342 } else if ((s2 == Py_None) & s1_is_unicode) {
13343 goto return_ne;
13344 } else {
13345 int result;
13346 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
13347 #if PY_MAJOR_VERSION < 3
13348 Py_XDECREF(owned_ref);
13349 #endif
13350 if (!py_result)
13351 return -1;
13352 result = __Pyx_PyObject_IsTrue(py_result);
13353 Py_DECREF(py_result);
13354 return result;
13355 }
13356 return_eq:
13357 #if PY_MAJOR_VERSION < 3
13358 Py_XDECREF(owned_ref);
13359 #endif
13360 return (equals == Py_EQ);
13361 return_ne:
13362 #if PY_MAJOR_VERSION < 3
13363 Py_XDECREF(owned_ref);
13364 #endif
13365 return (equals == Py_NE);
13366 #endif
13367 }
13368
13369 /* PyErrFetchRestore */
13370 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)13371 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
13372 PyObject *tmp_type, *tmp_value, *tmp_tb;
13373 tmp_type = tstate->curexc_type;
13374 tmp_value = tstate->curexc_value;
13375 tmp_tb = tstate->curexc_traceback;
13376 tstate->curexc_type = type;
13377 tstate->curexc_value = value;
13378 tstate->curexc_traceback = tb;
13379 Py_XDECREF(tmp_type);
13380 Py_XDECREF(tmp_value);
13381 Py_XDECREF(tmp_tb);
13382 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)13383 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
13384 *type = tstate->curexc_type;
13385 *value = tstate->curexc_value;
13386 *tb = tstate->curexc_traceback;
13387 tstate->curexc_type = 0;
13388 tstate->curexc_value = 0;
13389 tstate->curexc_traceback = 0;
13390 }
13391 #endif
13392
13393 /* RaiseException */
13394 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)13395 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
13396 CYTHON_UNUSED PyObject *cause) {
13397 __Pyx_PyThreadState_declare
13398 Py_XINCREF(type);
13399 if (!value || value == Py_None)
13400 value = NULL;
13401 else
13402 Py_INCREF(value);
13403 if (!tb || tb == Py_None)
13404 tb = NULL;
13405 else {
13406 Py_INCREF(tb);
13407 if (!PyTraceBack_Check(tb)) {
13408 PyErr_SetString(PyExc_TypeError,
13409 "raise: arg 3 must be a traceback or None");
13410 goto raise_error;
13411 }
13412 }
13413 if (PyType_Check(type)) {
13414 #if CYTHON_COMPILING_IN_PYPY
13415 if (!value) {
13416 Py_INCREF(Py_None);
13417 value = Py_None;
13418 }
13419 #endif
13420 PyErr_NormalizeException(&type, &value, &tb);
13421 } else {
13422 if (value) {
13423 PyErr_SetString(PyExc_TypeError,
13424 "instance exception may not have a separate value");
13425 goto raise_error;
13426 }
13427 value = type;
13428 type = (PyObject*) Py_TYPE(type);
13429 Py_INCREF(type);
13430 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
13431 PyErr_SetString(PyExc_TypeError,
13432 "raise: exception class must be a subclass of BaseException");
13433 goto raise_error;
13434 }
13435 }
13436 __Pyx_PyThreadState_assign
13437 __Pyx_ErrRestore(type, value, tb);
13438 return;
13439 raise_error:
13440 Py_XDECREF(value);
13441 Py_XDECREF(type);
13442 Py_XDECREF(tb);
13443 return;
13444 }
13445 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)13446 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
13447 PyObject* owned_instance = NULL;
13448 if (tb == Py_None) {
13449 tb = 0;
13450 } else if (tb && !PyTraceBack_Check(tb)) {
13451 PyErr_SetString(PyExc_TypeError,
13452 "raise: arg 3 must be a traceback or None");
13453 goto bad;
13454 }
13455 if (value == Py_None)
13456 value = 0;
13457 if (PyExceptionInstance_Check(type)) {
13458 if (value) {
13459 PyErr_SetString(PyExc_TypeError,
13460 "instance exception may not have a separate value");
13461 goto bad;
13462 }
13463 value = type;
13464 type = (PyObject*) Py_TYPE(value);
13465 } else if (PyExceptionClass_Check(type)) {
13466 PyObject *instance_class = NULL;
13467 if (value && PyExceptionInstance_Check(value)) {
13468 instance_class = (PyObject*) Py_TYPE(value);
13469 if (instance_class != type) {
13470 int is_subclass = PyObject_IsSubclass(instance_class, type);
13471 if (!is_subclass) {
13472 instance_class = NULL;
13473 } else if (unlikely(is_subclass == -1)) {
13474 goto bad;
13475 } else {
13476 type = instance_class;
13477 }
13478 }
13479 }
13480 if (!instance_class) {
13481 PyObject *args;
13482 if (!value)
13483 args = PyTuple_New(0);
13484 else if (PyTuple_Check(value)) {
13485 Py_INCREF(value);
13486 args = value;
13487 } else
13488 args = PyTuple_Pack(1, value);
13489 if (!args)
13490 goto bad;
13491 owned_instance = PyObject_Call(type, args, NULL);
13492 Py_DECREF(args);
13493 if (!owned_instance)
13494 goto bad;
13495 value = owned_instance;
13496 if (!PyExceptionInstance_Check(value)) {
13497 PyErr_Format(PyExc_TypeError,
13498 "calling %R should have returned an instance of "
13499 "BaseException, not %R",
13500 type, Py_TYPE(value));
13501 goto bad;
13502 }
13503 }
13504 } else {
13505 PyErr_SetString(PyExc_TypeError,
13506 "raise: exception class must be a subclass of BaseException");
13507 goto bad;
13508 }
13509 if (cause) {
13510 PyObject *fixed_cause;
13511 if (cause == Py_None) {
13512 fixed_cause = NULL;
13513 } else if (PyExceptionClass_Check(cause)) {
13514 fixed_cause = PyObject_CallObject(cause, NULL);
13515 if (fixed_cause == NULL)
13516 goto bad;
13517 } else if (PyExceptionInstance_Check(cause)) {
13518 fixed_cause = cause;
13519 Py_INCREF(fixed_cause);
13520 } else {
13521 PyErr_SetString(PyExc_TypeError,
13522 "exception causes must derive from "
13523 "BaseException");
13524 goto bad;
13525 }
13526 PyException_SetCause(value, fixed_cause);
13527 }
13528 PyErr_SetObject(type, value);
13529 if (tb) {
13530 #if CYTHON_COMPILING_IN_PYPY
13531 PyObject *tmp_type, *tmp_value, *tmp_tb;
13532 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
13533 Py_INCREF(tb);
13534 PyErr_Restore(tmp_type, tmp_value, tb);
13535 Py_XDECREF(tmp_tb);
13536 #else
13537 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13538 PyObject* tmp_tb = tstate->curexc_traceback;
13539 if (tb != tmp_tb) {
13540 Py_INCREF(tb);
13541 tstate->curexc_traceback = tb;
13542 Py_XDECREF(tmp_tb);
13543 }
13544 #endif
13545 }
13546 bad:
13547 Py_XDECREF(owned_instance);
13548 return;
13549 }
13550 #endif
13551
13552 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)13553 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
13554 PyObject *r;
13555 if (!j) return NULL;
13556 r = PyObject_GetItem(o, j);
13557 Py_DECREF(j);
13558 return r;
13559 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)13560 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
13561 CYTHON_NCP_UNUSED int wraparound,
13562 CYTHON_NCP_UNUSED int boundscheck) {
13563 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13564 Py_ssize_t wrapped_i = i;
13565 if (wraparound & unlikely(i < 0)) {
13566 wrapped_i += PyList_GET_SIZE(o);
13567 }
13568 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
13569 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
13570 Py_INCREF(r);
13571 return r;
13572 }
13573 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13574 #else
13575 return PySequence_GetItem(o, i);
13576 #endif
13577 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)13578 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
13579 CYTHON_NCP_UNUSED int wraparound,
13580 CYTHON_NCP_UNUSED int boundscheck) {
13581 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13582 Py_ssize_t wrapped_i = i;
13583 if (wraparound & unlikely(i < 0)) {
13584 wrapped_i += PyTuple_GET_SIZE(o);
13585 }
13586 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
13587 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
13588 Py_INCREF(r);
13589 return r;
13590 }
13591 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13592 #else
13593 return PySequence_GetItem(o, i);
13594 #endif
13595 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)13596 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
13597 CYTHON_NCP_UNUSED int wraparound,
13598 CYTHON_NCP_UNUSED int boundscheck) {
13599 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
13600 if (is_list || PyList_CheckExact(o)) {
13601 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
13602 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
13603 PyObject *r = PyList_GET_ITEM(o, n);
13604 Py_INCREF(r);
13605 return r;
13606 }
13607 }
13608 else if (PyTuple_CheckExact(o)) {
13609 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
13610 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
13611 PyObject *r = PyTuple_GET_ITEM(o, n);
13612 Py_INCREF(r);
13613 return r;
13614 }
13615 } else {
13616 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
13617 if (likely(m && m->sq_item)) {
13618 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
13619 Py_ssize_t l = m->sq_length(o);
13620 if (likely(l >= 0)) {
13621 i += l;
13622 } else {
13623 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
13624 return NULL;
13625 PyErr_Clear();
13626 }
13627 }
13628 return m->sq_item(o, i);
13629 }
13630 }
13631 #else
13632 if (is_list || PySequence_Check(o)) {
13633 return PySequence_GetItem(o, i);
13634 }
13635 #endif
13636 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13637 }
13638
13639 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)13640 static void __Pyx_RaiseBufferIndexError(int axis) {
13641 PyErr_Format(PyExc_IndexError,
13642 "Out of bounds on buffer access (axis %d)", axis);
13643 }
13644
13645 /* 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)13646 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
13647 CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
13648 int full_traceback, CYTHON_UNUSED int nogil) {
13649 PyObject *old_exc, *old_val, *old_tb;
13650 PyObject *ctx;
13651 __Pyx_PyThreadState_declare
13652 #ifdef WITH_THREAD
13653 PyGILState_STATE state;
13654 if (nogil)
13655 state = PyGILState_Ensure();
13656 #ifdef _MSC_VER
13657 else state = (PyGILState_STATE)-1;
13658 #endif
13659 #endif
13660 __Pyx_PyThreadState_assign
13661 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
13662 if (full_traceback) {
13663 Py_XINCREF(old_exc);
13664 Py_XINCREF(old_val);
13665 Py_XINCREF(old_tb);
13666 __Pyx_ErrRestore(old_exc, old_val, old_tb);
13667 PyErr_PrintEx(1);
13668 }
13669 #if PY_MAJOR_VERSION < 3
13670 ctx = PyString_FromString(name);
13671 #else
13672 ctx = PyUnicode_FromString(name);
13673 #endif
13674 __Pyx_ErrRestore(old_exc, old_val, old_tb);
13675 if (!ctx) {
13676 PyErr_WriteUnraisable(Py_None);
13677 } else {
13678 PyErr_WriteUnraisable(ctx);
13679 Py_DECREF(ctx);
13680 }
13681 #ifdef WITH_THREAD
13682 if (nogil)
13683 PyGILState_Release(state);
13684 #endif
13685 }
13686
13687 /* PyIntCompare */
__Pyx_PyInt_EqObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,CYTHON_UNUSED long inplace)13688 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
13689 if (op1 == op2) {
13690 Py_RETURN_TRUE;
13691 }
13692 #if PY_MAJOR_VERSION < 3
13693 if (likely(PyInt_CheckExact(op1))) {
13694 const long b = intval;
13695 long a = PyInt_AS_LONG(op1);
13696 if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13697 }
13698 #endif
13699 #if CYTHON_USE_PYLONG_INTERNALS
13700 if (likely(PyLong_CheckExact(op1))) {
13701 int unequal;
13702 unsigned long uintval;
13703 Py_ssize_t size = Py_SIZE(op1);
13704 const digit* digits = ((PyLongObject*)op1)->ob_digit;
13705 if (intval == 0) {
13706 if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13707 } else if (intval < 0) {
13708 if (size >= 0)
13709 Py_RETURN_FALSE;
13710 intval = -intval;
13711 size = -size;
13712 } else {
13713 if (size <= 0)
13714 Py_RETURN_FALSE;
13715 }
13716 uintval = (unsigned long) intval;
13717 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
13718 if (uintval >> (PyLong_SHIFT * 4)) {
13719 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13720 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13721 } else
13722 #endif
13723 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
13724 if (uintval >> (PyLong_SHIFT * 3)) {
13725 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13726 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13727 } else
13728 #endif
13729 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
13730 if (uintval >> (PyLong_SHIFT * 2)) {
13731 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13732 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13733 } else
13734 #endif
13735 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
13736 if (uintval >> (PyLong_SHIFT * 1)) {
13737 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
13738 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
13739 } else
13740 #endif
13741 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
13742 if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13743 }
13744 #endif
13745 if (PyFloat_CheckExact(op1)) {
13746 const long b = intval;
13747 double a = PyFloat_AS_DOUBLE(op1);
13748 if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
13749 }
13750 return (
13751 PyObject_RichCompare(op1, op2, Py_EQ));
13752 }
13753
13754 /* PyDictVersioning */
13755 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)13756 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
13757 PyObject *dict = Py_TYPE(obj)->tp_dict;
13758 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
13759 }
__Pyx_get_object_dict_version(PyObject * obj)13760 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
13761 PyObject **dictptr = NULL;
13762 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
13763 if (offset) {
13764 #if CYTHON_COMPILING_IN_CPYTHON
13765 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
13766 #else
13767 dictptr = _PyObject_GetDictPtr(obj);
13768 #endif
13769 }
13770 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
13771 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)13772 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
13773 PyObject *dict = Py_TYPE(obj)->tp_dict;
13774 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
13775 return 0;
13776 return obj_dict_version == __Pyx_get_object_dict_version(obj);
13777 }
13778 #endif
13779
13780 /* GetModuleGlobalName */
13781 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)13782 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
13783 #else
13784 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
13785 #endif
13786 {
13787 PyObject *result;
13788 #if !CYTHON_AVOID_BORROWED_REFS
13789 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
13790 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
13791 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13792 if (likely(result)) {
13793 return __Pyx_NewRef(result);
13794 } else if (unlikely(PyErr_Occurred())) {
13795 return NULL;
13796 }
13797 #else
13798 result = PyDict_GetItem(__pyx_d, name);
13799 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13800 if (likely(result)) {
13801 return __Pyx_NewRef(result);
13802 }
13803 #endif
13804 #else
13805 result = PyObject_GetItem(__pyx_d, name);
13806 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
13807 if (likely(result)) {
13808 return __Pyx_NewRef(result);
13809 }
13810 PyErr_Clear();
13811 #endif
13812 return __Pyx_GetBuiltinName(name);
13813 }
13814
13815 /* PyObjectCall */
13816 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)13817 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
13818 PyObject *result;
13819 ternaryfunc call = func->ob_type->tp_call;
13820 if (unlikely(!call))
13821 return PyObject_Call(func, arg, kw);
13822 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
13823 return NULL;
13824 result = (*call)(func, arg, kw);
13825 Py_LeaveRecursiveCall();
13826 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
13827 PyErr_SetString(
13828 PyExc_SystemError,
13829 "NULL result without error in PyObject_Call");
13830 }
13831 return result;
13832 }
13833 #endif
13834
13835 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)13836 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
13837 if (unlikely(!type)) {
13838 PyErr_SetString(PyExc_SystemError, "Missing type object");
13839 return 0;
13840 }
13841 if (likely(__Pyx_TypeCheck(obj, type)))
13842 return 1;
13843 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
13844 Py_TYPE(obj)->tp_name, type->tp_name);
13845 return 0;
13846 }
13847
13848 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)13849 static void __Pyx_RaiseBufferFallbackError(void) {
13850 PyErr_SetString(PyExc_ValueError,
13851 "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
13852 }
13853
13854 /* PyFunctionFastCall */
13855 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)13856 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
13857 PyObject *globals) {
13858 PyFrameObject *f;
13859 PyThreadState *tstate = __Pyx_PyThreadState_Current;
13860 PyObject **fastlocals;
13861 Py_ssize_t i;
13862 PyObject *result;
13863 assert(globals != NULL);
13864 /* XXX Perhaps we should create a specialized
13865 PyFrame_New() that doesn't take locals, but does
13866 take builtins without sanity checking them.
13867 */
13868 assert(tstate != NULL);
13869 f = PyFrame_New(tstate, co, globals, NULL);
13870 if (f == NULL) {
13871 return NULL;
13872 }
13873 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
13874 for (i = 0; i < na; i++) {
13875 Py_INCREF(*args);
13876 fastlocals[i] = *args++;
13877 }
13878 result = PyEval_EvalFrameEx(f,0);
13879 ++tstate->recursion_depth;
13880 Py_DECREF(f);
13881 --tstate->recursion_depth;
13882 return result;
13883 }
13884 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)13885 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
13886 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
13887 PyObject *globals = PyFunction_GET_GLOBALS(func);
13888 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
13889 PyObject *closure;
13890 #if PY_MAJOR_VERSION >= 3
13891 PyObject *kwdefs;
13892 #endif
13893 PyObject *kwtuple, **k;
13894 PyObject **d;
13895 Py_ssize_t nd;
13896 Py_ssize_t nk;
13897 PyObject *result;
13898 assert(kwargs == NULL || PyDict_Check(kwargs));
13899 nk = kwargs ? PyDict_Size(kwargs) : 0;
13900 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
13901 return NULL;
13902 }
13903 if (
13904 #if PY_MAJOR_VERSION >= 3
13905 co->co_kwonlyargcount == 0 &&
13906 #endif
13907 likely(kwargs == NULL || nk == 0) &&
13908 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
13909 if (argdefs == NULL && co->co_argcount == nargs) {
13910 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
13911 goto done;
13912 }
13913 else if (nargs == 0 && argdefs != NULL
13914 && co->co_argcount == Py_SIZE(argdefs)) {
13915 /* function called with no arguments, but all parameters have
13916 a default value: use default values as arguments .*/
13917 args = &PyTuple_GET_ITEM(argdefs, 0);
13918 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
13919 goto done;
13920 }
13921 }
13922 if (kwargs != NULL) {
13923 Py_ssize_t pos, i;
13924 kwtuple = PyTuple_New(2 * nk);
13925 if (kwtuple == NULL) {
13926 result = NULL;
13927 goto done;
13928 }
13929 k = &PyTuple_GET_ITEM(kwtuple, 0);
13930 pos = i = 0;
13931 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
13932 Py_INCREF(k[i]);
13933 Py_INCREF(k[i+1]);
13934 i += 2;
13935 }
13936 nk = i / 2;
13937 }
13938 else {
13939 kwtuple = NULL;
13940 k = NULL;
13941 }
13942 closure = PyFunction_GET_CLOSURE(func);
13943 #if PY_MAJOR_VERSION >= 3
13944 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
13945 #endif
13946 if (argdefs != NULL) {
13947 d = &PyTuple_GET_ITEM(argdefs, 0);
13948 nd = Py_SIZE(argdefs);
13949 }
13950 else {
13951 d = NULL;
13952 nd = 0;
13953 }
13954 #if PY_MAJOR_VERSION >= 3
13955 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
13956 args, (int)nargs,
13957 k, (int)nk,
13958 d, (int)nd, kwdefs, closure);
13959 #else
13960 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
13961 args, (int)nargs,
13962 k, (int)nk,
13963 d, (int)nd, closure);
13964 #endif
13965 Py_XDECREF(kwtuple);
13966 done:
13967 Py_LeaveRecursiveCall();
13968 return result;
13969 }
13970 #endif
13971 #endif
13972
13973 /* PyCFunctionFastCall */
13974 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)13975 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
13976 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
13977 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
13978 PyObject *self = PyCFunction_GET_SELF(func);
13979 int flags = PyCFunction_GET_FLAGS(func);
13980 assert(PyCFunction_Check(func));
13981 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
13982 assert(nargs >= 0);
13983 assert(nargs == 0 || args != NULL);
13984 /* _PyCFunction_FastCallDict() must not be called with an exception set,
13985 because it may clear it (directly or indirectly) and so the
13986 caller loses its exception */
13987 assert(!PyErr_Occurred());
13988 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
13989 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
13990 } else {
13991 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
13992 }
13993 }
13994 #endif
13995
13996 /* PyObjectCallMethO */
13997 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)13998 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
13999 PyObject *self, *result;
14000 PyCFunction cfunc;
14001 cfunc = PyCFunction_GET_FUNCTION(func);
14002 self = PyCFunction_GET_SELF(func);
14003 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
14004 return NULL;
14005 result = cfunc(self, arg);
14006 Py_LeaveRecursiveCall();
14007 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14008 PyErr_SetString(
14009 PyExc_SystemError,
14010 "NULL result without error in PyObject_Call");
14011 }
14012 return result;
14013 }
14014 #endif
14015
14016 /* PyObjectCallOneArg */
14017 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)14018 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14019 PyObject *result;
14020 PyObject *args = PyTuple_New(1);
14021 if (unlikely(!args)) return NULL;
14022 Py_INCREF(arg);
14023 PyTuple_SET_ITEM(args, 0, arg);
14024 result = __Pyx_PyObject_Call(func, args, NULL);
14025 Py_DECREF(args);
14026 return result;
14027 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)14028 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14029 #if CYTHON_FAST_PYCALL
14030 if (PyFunction_Check(func)) {
14031 return __Pyx_PyFunction_FastCall(func, &arg, 1);
14032 }
14033 #endif
14034 if (likely(PyCFunction_Check(func))) {
14035 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
14036 return __Pyx_PyObject_CallMethO(func, arg);
14037 #if CYTHON_FAST_PYCCALL
14038 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
14039 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
14040 #endif
14041 }
14042 }
14043 return __Pyx__PyObject_CallOneArg(func, arg);
14044 }
14045 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)14046 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14047 PyObject *result;
14048 PyObject *args = PyTuple_Pack(1, arg);
14049 if (unlikely(!args)) return NULL;
14050 result = __Pyx_PyObject_Call(func, args, NULL);
14051 Py_DECREF(args);
14052 return result;
14053 }
14054 #endif
14055
14056 /* DictGetItem */
14057 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)14058 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
14059 PyObject *value;
14060 value = PyDict_GetItemWithError(d, key);
14061 if (unlikely(!value)) {
14062 if (!PyErr_Occurred()) {
14063 if (unlikely(PyTuple_Check(key))) {
14064 PyObject* args = PyTuple_Pack(1, key);
14065 if (likely(args)) {
14066 PyErr_SetObject(PyExc_KeyError, args);
14067 Py_DECREF(args);
14068 }
14069 } else {
14070 PyErr_SetObject(PyExc_KeyError, key);
14071 }
14072 }
14073 return NULL;
14074 }
14075 Py_INCREF(value);
14076 return value;
14077 }
14078 #endif
14079
14080 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)14081 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
14082 PyErr_Format(PyExc_ValueError,
14083 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
14084 }
14085
14086 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)14087 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
14088 PyErr_Format(PyExc_ValueError,
14089 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
14090 index, (index == 1) ? "" : "s");
14091 }
14092
14093 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)14094 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
14095 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
14096 }
14097
14098 /* GetTopmostException */
14099 #if CYTHON_USE_EXC_INFO_STACK
14100 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)14101 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
14102 {
14103 _PyErr_StackItem *exc_info = tstate->exc_info;
14104 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
14105 exc_info->previous_item != NULL)
14106 {
14107 exc_info = exc_info->previous_item;
14108 }
14109 return exc_info;
14110 }
14111 #endif
14112
14113 /* SaveResetException */
14114 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14115 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14116 #if CYTHON_USE_EXC_INFO_STACK
14117 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
14118 *type = exc_info->exc_type;
14119 *value = exc_info->exc_value;
14120 *tb = exc_info->exc_traceback;
14121 #else
14122 *type = tstate->exc_type;
14123 *value = tstate->exc_value;
14124 *tb = tstate->exc_traceback;
14125 #endif
14126 Py_XINCREF(*type);
14127 Py_XINCREF(*value);
14128 Py_XINCREF(*tb);
14129 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)14130 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14131 PyObject *tmp_type, *tmp_value, *tmp_tb;
14132 #if CYTHON_USE_EXC_INFO_STACK
14133 _PyErr_StackItem *exc_info = tstate->exc_info;
14134 tmp_type = exc_info->exc_type;
14135 tmp_value = exc_info->exc_value;
14136 tmp_tb = exc_info->exc_traceback;
14137 exc_info->exc_type = type;
14138 exc_info->exc_value = value;
14139 exc_info->exc_traceback = tb;
14140 #else
14141 tmp_type = tstate->exc_type;
14142 tmp_value = tstate->exc_value;
14143 tmp_tb = tstate->exc_traceback;
14144 tstate->exc_type = type;
14145 tstate->exc_value = value;
14146 tstate->exc_traceback = tb;
14147 #endif
14148 Py_XDECREF(tmp_type);
14149 Py_XDECREF(tmp_value);
14150 Py_XDECREF(tmp_tb);
14151 }
14152 #endif
14153
14154 /* PyErrExceptionMatches */
14155 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)14156 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14157 Py_ssize_t i, n;
14158 n = PyTuple_GET_SIZE(tuple);
14159 #if PY_MAJOR_VERSION >= 3
14160 for (i=0; i<n; i++) {
14161 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14162 }
14163 #endif
14164 for (i=0; i<n; i++) {
14165 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
14166 }
14167 return 0;
14168 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)14169 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
14170 PyObject *exc_type = tstate->curexc_type;
14171 if (exc_type == err) return 1;
14172 if (unlikely(!exc_type)) return 0;
14173 if (unlikely(PyTuple_Check(err)))
14174 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
14175 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
14176 }
14177 #endif
14178
14179 /* GetException */
14180 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)14181 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
14182 #else
14183 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
14184 #endif
14185 {
14186 PyObject *local_type, *local_value, *local_tb;
14187 #if CYTHON_FAST_THREAD_STATE
14188 PyObject *tmp_type, *tmp_value, *tmp_tb;
14189 local_type = tstate->curexc_type;
14190 local_value = tstate->curexc_value;
14191 local_tb = tstate->curexc_traceback;
14192 tstate->curexc_type = 0;
14193 tstate->curexc_value = 0;
14194 tstate->curexc_traceback = 0;
14195 #else
14196 PyErr_Fetch(&local_type, &local_value, &local_tb);
14197 #endif
14198 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
14199 #if CYTHON_FAST_THREAD_STATE
14200 if (unlikely(tstate->curexc_type))
14201 #else
14202 if (unlikely(PyErr_Occurred()))
14203 #endif
14204 goto bad;
14205 #if PY_MAJOR_VERSION >= 3
14206 if (local_tb) {
14207 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
14208 goto bad;
14209 }
14210 #endif
14211 Py_XINCREF(local_tb);
14212 Py_XINCREF(local_type);
14213 Py_XINCREF(local_value);
14214 *type = local_type;
14215 *value = local_value;
14216 *tb = local_tb;
14217 #if CYTHON_FAST_THREAD_STATE
14218 #if CYTHON_USE_EXC_INFO_STACK
14219 {
14220 _PyErr_StackItem *exc_info = tstate->exc_info;
14221 tmp_type = exc_info->exc_type;
14222 tmp_value = exc_info->exc_value;
14223 tmp_tb = exc_info->exc_traceback;
14224 exc_info->exc_type = local_type;
14225 exc_info->exc_value = local_value;
14226 exc_info->exc_traceback = local_tb;
14227 }
14228 #else
14229 tmp_type = tstate->exc_type;
14230 tmp_value = tstate->exc_value;
14231 tmp_tb = tstate->exc_traceback;
14232 tstate->exc_type = local_type;
14233 tstate->exc_value = local_value;
14234 tstate->exc_traceback = local_tb;
14235 #endif
14236 Py_XDECREF(tmp_type);
14237 Py_XDECREF(tmp_value);
14238 Py_XDECREF(tmp_tb);
14239 #else
14240 PyErr_SetExcInfo(local_type, local_value, local_tb);
14241 #endif
14242 return 0;
14243 bad:
14244 *type = 0;
14245 *value = 0;
14246 *tb = 0;
14247 Py_XDECREF(local_type);
14248 Py_XDECREF(local_value);
14249 Py_XDECREF(local_tb);
14250 return -1;
14251 }
14252
14253 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)14254 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
14255 #if CYTHON_USE_TYPE_SLOTS
14256 #if PY_MAJOR_VERSION >= 3
14257 if (likely(PyUnicode_Check(n)))
14258 #else
14259 if (likely(PyString_Check(n)))
14260 #endif
14261 return __Pyx_PyObject_GetAttrStr(o, n);
14262 #endif
14263 return PyObject_GetAttr(o, n);
14264 }
14265
14266 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)14267 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
14268 PyObject *r;
14269 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
14270 PyErr_SetString(PyExc_TypeError,
14271 "hasattr(): attribute name must be string");
14272 return -1;
14273 }
14274 r = __Pyx_GetAttr(o, n);
14275 if (unlikely(!r)) {
14276 PyErr_Clear();
14277 return 0;
14278 } else {
14279 Py_DECREF(r);
14280 return 1;
14281 }
14282 }
14283
14284 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)14285 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
14286 PyObject *args, *result = NULL;
14287 #if CYTHON_FAST_PYCALL
14288 if (PyFunction_Check(function)) {
14289 PyObject *args[2] = {arg1, arg2};
14290 return __Pyx_PyFunction_FastCall(function, args, 2);
14291 }
14292 #endif
14293 #if CYTHON_FAST_PYCCALL
14294 if (__Pyx_PyFastCFunction_Check(function)) {
14295 PyObject *args[2] = {arg1, arg2};
14296 return __Pyx_PyCFunction_FastCall(function, args, 2);
14297 }
14298 #endif
14299 args = PyTuple_New(2);
14300 if (unlikely(!args)) goto done;
14301 Py_INCREF(arg1);
14302 PyTuple_SET_ITEM(args, 0, arg1);
14303 Py_INCREF(arg2);
14304 PyTuple_SET_ITEM(args, 1, arg2);
14305 Py_INCREF(function);
14306 result = __Pyx_PyObject_Call(function, args, NULL);
14307 Py_DECREF(args);
14308 Py_DECREF(function);
14309 done:
14310 return result;
14311 }
14312
14313 /* PyObject_GenericGetAttrNoDict */
14314 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)14315 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
14316 PyErr_Format(PyExc_AttributeError,
14317 #if PY_MAJOR_VERSION >= 3
14318 "'%.50s' object has no attribute '%U'",
14319 tp->tp_name, attr_name);
14320 #else
14321 "'%.50s' object has no attribute '%.400s'",
14322 tp->tp_name, PyString_AS_STRING(attr_name));
14323 #endif
14324 return NULL;
14325 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)14326 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
14327 PyObject *descr;
14328 PyTypeObject *tp = Py_TYPE(obj);
14329 if (unlikely(!PyString_Check(attr_name))) {
14330 return PyObject_GenericGetAttr(obj, attr_name);
14331 }
14332 assert(!tp->tp_dictoffset);
14333 descr = _PyType_Lookup(tp, attr_name);
14334 if (unlikely(!descr)) {
14335 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
14336 }
14337 Py_INCREF(descr);
14338 #if PY_MAJOR_VERSION < 3
14339 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
14340 #endif
14341 {
14342 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
14343 if (unlikely(f)) {
14344 PyObject *res = f(descr, obj, (PyObject *)tp);
14345 Py_DECREF(descr);
14346 return res;
14347 }
14348 }
14349 return descr;
14350 }
14351 #endif
14352
14353 /* PyObject_GenericGetAttr */
14354 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)14355 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
14356 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
14357 return PyObject_GenericGetAttr(obj, attr_name);
14358 }
14359 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
14360 }
14361 #endif
14362
14363 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)14364 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
14365 #if PY_VERSION_HEX >= 0x02070000
14366 PyObject *ob = PyCapsule_New(vtable, 0, 0);
14367 #else
14368 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
14369 #endif
14370 if (!ob)
14371 goto bad;
14372 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
14373 goto bad;
14374 Py_DECREF(ob);
14375 return 0;
14376 bad:
14377 Py_XDECREF(ob);
14378 return -1;
14379 }
14380
14381 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)14382 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
14383 int ret;
14384 PyObject *name_attr;
14385 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
14386 if (likely(name_attr)) {
14387 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
14388 } else {
14389 ret = -1;
14390 }
14391 if (unlikely(ret < 0)) {
14392 PyErr_Clear();
14393 ret = 0;
14394 }
14395 Py_XDECREF(name_attr);
14396 return ret;
14397 }
__Pyx_setup_reduce(PyObject * type_obj)14398 static int __Pyx_setup_reduce(PyObject* type_obj) {
14399 int ret = 0;
14400 PyObject *object_reduce = NULL;
14401 PyObject *object_reduce_ex = NULL;
14402 PyObject *reduce = NULL;
14403 PyObject *reduce_ex = NULL;
14404 PyObject *reduce_cython = NULL;
14405 PyObject *setstate = NULL;
14406 PyObject *setstate_cython = NULL;
14407 #if CYTHON_USE_PYTYPE_LOOKUP
14408 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
14409 #else
14410 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
14411 #endif
14412 #if CYTHON_USE_PYTYPE_LOOKUP
14413 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
14414 #else
14415 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
14416 #endif
14417 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
14418 if (reduce_ex == object_reduce_ex) {
14419 #if CYTHON_USE_PYTYPE_LOOKUP
14420 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
14421 #else
14422 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
14423 #endif
14424 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
14425 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
14426 reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
14427 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
14428 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
14429 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
14430 if (!setstate) PyErr_Clear();
14431 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
14432 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
14433 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
14434 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
14435 }
14436 PyType_Modified((PyTypeObject*)type_obj);
14437 }
14438 }
14439 goto GOOD;
14440 BAD:
14441 if (!PyErr_Occurred())
14442 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
14443 ret = -1;
14444 GOOD:
14445 #if !CYTHON_USE_PYTYPE_LOOKUP
14446 Py_XDECREF(object_reduce);
14447 Py_XDECREF(object_reduce_ex);
14448 #endif
14449 Py_XDECREF(reduce);
14450 Py_XDECREF(reduce_ex);
14451 Py_XDECREF(reduce_cython);
14452 Py_XDECREF(setstate);
14453 Py_XDECREF(setstate_cython);
14454 return ret;
14455 }
14456
14457 /* TypeImport */
14458 #ifndef __PYX_HAVE_RT_ImportType
14459 #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)14460 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
14461 size_t size, enum __Pyx_ImportType_CheckSize check_size)
14462 {
14463 PyObject *result = 0;
14464 char warning[200];
14465 Py_ssize_t basicsize;
14466 #ifdef Py_LIMITED_API
14467 PyObject *py_basicsize;
14468 #endif
14469 result = PyObject_GetAttrString(module, class_name);
14470 if (!result)
14471 goto bad;
14472 if (!PyType_Check(result)) {
14473 PyErr_Format(PyExc_TypeError,
14474 "%.200s.%.200s is not a type object",
14475 module_name, class_name);
14476 goto bad;
14477 }
14478 #ifndef Py_LIMITED_API
14479 basicsize = ((PyTypeObject *)result)->tp_basicsize;
14480 #else
14481 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
14482 if (!py_basicsize)
14483 goto bad;
14484 basicsize = PyLong_AsSsize_t(py_basicsize);
14485 Py_DECREF(py_basicsize);
14486 py_basicsize = 0;
14487 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
14488 goto bad;
14489 #endif
14490 if ((size_t)basicsize < size) {
14491 PyErr_Format(PyExc_ValueError,
14492 "%.200s.%.200s size changed, may indicate binary incompatibility. "
14493 "Expected %zd from C header, got %zd from PyObject",
14494 module_name, class_name, size, basicsize);
14495 goto bad;
14496 }
14497 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
14498 PyErr_Format(PyExc_ValueError,
14499 "%.200s.%.200s size changed, may indicate binary incompatibility. "
14500 "Expected %zd from C header, got %zd from PyObject",
14501 module_name, class_name, size, basicsize);
14502 goto bad;
14503 }
14504 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
14505 PyOS_snprintf(warning, sizeof(warning),
14506 "%s.%s size changed, may indicate binary incompatibility. "
14507 "Expected %zd from C header, got %zd from PyObject",
14508 module_name, class_name, size, basicsize);
14509 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
14510 }
14511 return (PyTypeObject *)result;
14512 bad:
14513 Py_XDECREF(result);
14514 return NULL;
14515 }
14516 #endif
14517
14518 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)14519 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
14520 PyObject *empty_list = 0;
14521 PyObject *module = 0;
14522 PyObject *global_dict = 0;
14523 PyObject *empty_dict = 0;
14524 PyObject *list;
14525 #if PY_MAJOR_VERSION < 3
14526 PyObject *py_import;
14527 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
14528 if (!py_import)
14529 goto bad;
14530 #endif
14531 if (from_list)
14532 list = from_list;
14533 else {
14534 empty_list = PyList_New(0);
14535 if (!empty_list)
14536 goto bad;
14537 list = empty_list;
14538 }
14539 global_dict = PyModule_GetDict(__pyx_m);
14540 if (!global_dict)
14541 goto bad;
14542 empty_dict = PyDict_New();
14543 if (!empty_dict)
14544 goto bad;
14545 {
14546 #if PY_MAJOR_VERSION >= 3
14547 if (level == -1) {
14548 if (strchr(__Pyx_MODULE_NAME, '.')) {
14549 module = PyImport_ImportModuleLevelObject(
14550 name, global_dict, empty_dict, list, 1);
14551 if (!module) {
14552 if (!PyErr_ExceptionMatches(PyExc_ImportError))
14553 goto bad;
14554 PyErr_Clear();
14555 }
14556 }
14557 level = 0;
14558 }
14559 #endif
14560 if (!module) {
14561 #if PY_MAJOR_VERSION < 3
14562 PyObject *py_level = PyInt_FromLong(level);
14563 if (!py_level)
14564 goto bad;
14565 module = PyObject_CallFunctionObjArgs(py_import,
14566 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
14567 Py_DECREF(py_level);
14568 #else
14569 module = PyImport_ImportModuleLevelObject(
14570 name, global_dict, empty_dict, list, level);
14571 #endif
14572 }
14573 }
14574 bad:
14575 #if PY_MAJOR_VERSION < 3
14576 Py_XDECREF(py_import);
14577 #endif
14578 Py_XDECREF(empty_list);
14579 Py_XDECREF(empty_dict);
14580 return module;
14581 }
14582
14583 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)14584 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
14585 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
14586 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
14587 PyErr_Format(PyExc_ImportError,
14588 #if PY_MAJOR_VERSION < 3
14589 "cannot import name %.230s", PyString_AS_STRING(name));
14590 #else
14591 "cannot import name %S", name);
14592 #endif
14593 }
14594 return value;
14595 }
14596
14597 /* CLineInTraceback */
14598 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)14599 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
14600 PyObject *use_cline;
14601 PyObject *ptype, *pvalue, *ptraceback;
14602 #if CYTHON_COMPILING_IN_CPYTHON
14603 PyObject **cython_runtime_dict;
14604 #endif
14605 if (unlikely(!__pyx_cython_runtime)) {
14606 return c_line;
14607 }
14608 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
14609 #if CYTHON_COMPILING_IN_CPYTHON
14610 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
14611 if (likely(cython_runtime_dict)) {
14612 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
14613 use_cline, *cython_runtime_dict,
14614 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
14615 } else
14616 #endif
14617 {
14618 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
14619 if (use_cline_obj) {
14620 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
14621 Py_DECREF(use_cline_obj);
14622 } else {
14623 PyErr_Clear();
14624 use_cline = NULL;
14625 }
14626 }
14627 if (!use_cline) {
14628 c_line = 0;
14629 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
14630 }
14631 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
14632 c_line = 0;
14633 }
14634 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
14635 return c_line;
14636 }
14637 #endif
14638
14639 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)14640 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
14641 int start = 0, mid = 0, end = count - 1;
14642 if (end >= 0 && code_line > entries[end].code_line) {
14643 return count;
14644 }
14645 while (start < end) {
14646 mid = start + (end - start) / 2;
14647 if (code_line < entries[mid].code_line) {
14648 end = mid;
14649 } else if (code_line > entries[mid].code_line) {
14650 start = mid + 1;
14651 } else {
14652 return mid;
14653 }
14654 }
14655 if (code_line <= entries[mid].code_line) {
14656 return mid;
14657 } else {
14658 return mid + 1;
14659 }
14660 }
__pyx_find_code_object(int code_line)14661 static PyCodeObject *__pyx_find_code_object(int code_line) {
14662 PyCodeObject* code_object;
14663 int pos;
14664 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
14665 return NULL;
14666 }
14667 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14668 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
14669 return NULL;
14670 }
14671 code_object = __pyx_code_cache.entries[pos].code_object;
14672 Py_INCREF(code_object);
14673 return code_object;
14674 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)14675 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
14676 int pos, i;
14677 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
14678 if (unlikely(!code_line)) {
14679 return;
14680 }
14681 if (unlikely(!entries)) {
14682 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
14683 if (likely(entries)) {
14684 __pyx_code_cache.entries = entries;
14685 __pyx_code_cache.max_count = 64;
14686 __pyx_code_cache.count = 1;
14687 entries[0].code_line = code_line;
14688 entries[0].code_object = code_object;
14689 Py_INCREF(code_object);
14690 }
14691 return;
14692 }
14693 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14694 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
14695 PyCodeObject* tmp = entries[pos].code_object;
14696 entries[pos].code_object = code_object;
14697 Py_DECREF(tmp);
14698 return;
14699 }
14700 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
14701 int new_max = __pyx_code_cache.max_count + 64;
14702 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
14703 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
14704 if (unlikely(!entries)) {
14705 return;
14706 }
14707 __pyx_code_cache.entries = entries;
14708 __pyx_code_cache.max_count = new_max;
14709 }
14710 for (i=__pyx_code_cache.count; i>pos; i--) {
14711 entries[i] = entries[i-1];
14712 }
14713 entries[pos].code_line = code_line;
14714 entries[pos].code_object = code_object;
14715 __pyx_code_cache.count++;
14716 Py_INCREF(code_object);
14717 }
14718
14719 /* AddTraceback */
14720 #include "compile.h"
14721 #include "frameobject.h"
14722 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)14723 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
14724 const char *funcname, int c_line,
14725 int py_line, const char *filename) {
14726 PyCodeObject *py_code = 0;
14727 PyObject *py_srcfile = 0;
14728 PyObject *py_funcname = 0;
14729 #if PY_MAJOR_VERSION < 3
14730 py_srcfile = PyString_FromString(filename);
14731 #else
14732 py_srcfile = PyUnicode_FromString(filename);
14733 #endif
14734 if (!py_srcfile) goto bad;
14735 if (c_line) {
14736 #if PY_MAJOR_VERSION < 3
14737 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14738 #else
14739 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14740 #endif
14741 }
14742 else {
14743 #if PY_MAJOR_VERSION < 3
14744 py_funcname = PyString_FromString(funcname);
14745 #else
14746 py_funcname = PyUnicode_FromString(funcname);
14747 #endif
14748 }
14749 if (!py_funcname) goto bad;
14750 py_code = __Pyx_PyCode_New(
14751 0,
14752 0,
14753 0,
14754 0,
14755 0,
14756 __pyx_empty_bytes, /*PyObject *code,*/
14757 __pyx_empty_tuple, /*PyObject *consts,*/
14758 __pyx_empty_tuple, /*PyObject *names,*/
14759 __pyx_empty_tuple, /*PyObject *varnames,*/
14760 __pyx_empty_tuple, /*PyObject *freevars,*/
14761 __pyx_empty_tuple, /*PyObject *cellvars,*/
14762 py_srcfile, /*PyObject *filename,*/
14763 py_funcname, /*PyObject *name,*/
14764 py_line,
14765 __pyx_empty_bytes /*PyObject *lnotab*/
14766 );
14767 Py_DECREF(py_srcfile);
14768 Py_DECREF(py_funcname);
14769 return py_code;
14770 bad:
14771 Py_XDECREF(py_srcfile);
14772 Py_XDECREF(py_funcname);
14773 return NULL;
14774 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)14775 static void __Pyx_AddTraceback(const char *funcname, int c_line,
14776 int py_line, const char *filename) {
14777 PyCodeObject *py_code = 0;
14778 PyFrameObject *py_frame = 0;
14779 PyThreadState *tstate = __Pyx_PyThreadState_Current;
14780 if (c_line) {
14781 c_line = __Pyx_CLineForTraceback(tstate, c_line);
14782 }
14783 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
14784 if (!py_code) {
14785 py_code = __Pyx_CreateCodeObjectForTraceback(
14786 funcname, c_line, py_line, filename);
14787 if (!py_code) goto bad;
14788 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
14789 }
14790 py_frame = PyFrame_New(
14791 tstate, /*PyThreadState *tstate,*/
14792 py_code, /*PyCodeObject *code,*/
14793 __pyx_d, /*PyObject *globals,*/
14794 0 /*PyObject *locals*/
14795 );
14796 if (!py_frame) goto bad;
14797 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
14798 PyTraceBack_Here(py_frame);
14799 bad:
14800 Py_XDECREF(py_code);
14801 Py_XDECREF(py_frame);
14802 }
14803
14804 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)14805 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
14806 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
14807 if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
14808 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
14809 return -1;
14810 }
__Pyx_ReleaseBuffer(Py_buffer * view)14811 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
14812 PyObject *obj = view->obj;
14813 if (!obj) return;
14814 if (PyObject_CheckBuffer(obj)) {
14815 PyBuffer_Release(view);
14816 return;
14817 }
14818 if ((0)) {}
14819 else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
14820 view->obj = NULL;
14821 Py_DECREF(obj);
14822 }
14823 #endif
14824
14825
14826 /* CIntFromPyVerify */
14827 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
14828 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
14829 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
14830 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
14831 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
14832 {\
14833 func_type value = func_value;\
14834 if (sizeof(target_type) < sizeof(func_type)) {\
14835 if (unlikely(value != (func_type) (target_type) value)) {\
14836 func_type zero = 0;\
14837 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
14838 return (target_type) -1;\
14839 if (is_unsigned && unlikely(value < zero))\
14840 goto raise_neg_overflow;\
14841 else\
14842 goto raise_overflow;\
14843 }\
14844 }\
14845 return (target_type) value;\
14846 }
14847
14848 /* CIntToPy */
__Pyx_PyInt_From_int(int value)14849 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
14850 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
14851 const int is_unsigned = neg_one > const_zero;
14852 if (is_unsigned) {
14853 if (sizeof(int) < sizeof(long)) {
14854 return PyInt_FromLong((long) value);
14855 } else if (sizeof(int) <= sizeof(unsigned long)) {
14856 return PyLong_FromUnsignedLong((unsigned long) value);
14857 #ifdef HAVE_LONG_LONG
14858 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
14859 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14860 #endif
14861 }
14862 } else {
14863 if (sizeof(int) <= sizeof(long)) {
14864 return PyInt_FromLong((long) value);
14865 #ifdef HAVE_LONG_LONG
14866 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
14867 return PyLong_FromLongLong((PY_LONG_LONG) value);
14868 #endif
14869 }
14870 }
14871 {
14872 int one = 1; int little = (int)*(unsigned char *)&one;
14873 unsigned char *bytes = (unsigned char *)&value;
14874 return _PyLong_FromByteArray(bytes, sizeof(int),
14875 little, !is_unsigned);
14876 }
14877 }
14878
14879 /* CIntToPy */
__Pyx_PyInt_From_npy_int64(npy_int64 value)14880 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
14881 const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
14882 const int is_unsigned = neg_one > const_zero;
14883 if (is_unsigned) {
14884 if (sizeof(npy_int64) < sizeof(long)) {
14885 return PyInt_FromLong((long) value);
14886 } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
14887 return PyLong_FromUnsignedLong((unsigned long) value);
14888 #ifdef HAVE_LONG_LONG
14889 } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
14890 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14891 #endif
14892 }
14893 } else {
14894 if (sizeof(npy_int64) <= sizeof(long)) {
14895 return PyInt_FromLong((long) value);
14896 #ifdef HAVE_LONG_LONG
14897 } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
14898 return PyLong_FromLongLong((PY_LONG_LONG) value);
14899 #endif
14900 }
14901 }
14902 {
14903 int one = 1; int little = (int)*(unsigned char *)&one;
14904 unsigned char *bytes = (unsigned char *)&value;
14905 return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
14906 little, !is_unsigned);
14907 }
14908 }
14909
14910 /* CIntToPy */
__Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value)14911 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
14912 const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
14913 const int is_unsigned = neg_one > const_zero;
14914 if (is_unsigned) {
14915 if (sizeof(Py_intptr_t) < sizeof(long)) {
14916 return PyInt_FromLong((long) value);
14917 } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
14918 return PyLong_FromUnsignedLong((unsigned long) value);
14919 #ifdef HAVE_LONG_LONG
14920 } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
14921 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14922 #endif
14923 }
14924 } else {
14925 if (sizeof(Py_intptr_t) <= sizeof(long)) {
14926 return PyInt_FromLong((long) value);
14927 #ifdef HAVE_LONG_LONG
14928 } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
14929 return PyLong_FromLongLong((PY_LONG_LONG) value);
14930 #endif
14931 }
14932 }
14933 {
14934 int one = 1; int little = (int)*(unsigned char *)&one;
14935 unsigned char *bytes = (unsigned char *)&value;
14936 return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
14937 little, !is_unsigned);
14938 }
14939 }
14940
14941 /* None */
__Pyx_pow___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t b,__pyx_t_5numpy_int64_t e)14942 static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_pow___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t b, __pyx_t_5numpy_int64_t e) {
14943 __pyx_t_5numpy_int64_t t = b;
14944 switch (e) {
14945 case 3:
14946 t *= b;
14947 CYTHON_FALLTHROUGH;
14948 case 2:
14949 t *= b;
14950 CYTHON_FALLTHROUGH;
14951 case 1:
14952 return t;
14953 case 0:
14954 return 1;
14955 }
14956 #if 1
14957 if (unlikely(e<0)) return 0;
14958 #endif
14959 t = 1;
14960 while (likely(e)) {
14961 t *= (b * (e&1)) | ((~e)&1);
14962 b *= b;
14963 e >>= 1;
14964 }
14965 return t;
14966 }
14967
14968 /* Declarations */
14969 #if CYTHON_CCOMPLEX
14970 #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)14971 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14972 return ::std::complex< float >(x, y);
14973 }
14974 #else
__pyx_t_float_complex_from_parts(float x,float y)14975 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14976 return x + y*(__pyx_t_float_complex)_Complex_I;
14977 }
14978 #endif
14979 #else
__pyx_t_float_complex_from_parts(float x,float y)14980 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14981 __pyx_t_float_complex z;
14982 z.real = x;
14983 z.imag = y;
14984 return z;
14985 }
14986 #endif
14987
14988 /* Arithmetic */
14989 #if CYTHON_CCOMPLEX
14990 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14991 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14992 return (a.real == b.real) && (a.imag == b.imag);
14993 }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14994 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14995 __pyx_t_float_complex z;
14996 z.real = a.real + b.real;
14997 z.imag = a.imag + b.imag;
14998 return z;
14999 }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)15000 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
15001 __pyx_t_float_complex z;
15002 z.real = a.real - b.real;
15003 z.imag = a.imag - b.imag;
15004 return z;
15005 }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)15006 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
15007 __pyx_t_float_complex z;
15008 z.real = a.real * b.real - a.imag * b.imag;
15009 z.imag = a.real * b.imag + a.imag * b.real;
15010 return z;
15011 }
15012 #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)15013 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
15014 if (b.imag == 0) {
15015 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
15016 } else if (fabsf(b.real) >= fabsf(b.imag)) {
15017 if (b.real == 0 && b.imag == 0) {
15018 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
15019 } else {
15020 float r = b.imag / b.real;
15021 float s = (float)(1.0) / (b.real + b.imag * r);
15022 return __pyx_t_float_complex_from_parts(
15023 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
15024 }
15025 } else {
15026 float r = b.real / b.imag;
15027 float s = (float)(1.0) / (b.imag + b.real * r);
15028 return __pyx_t_float_complex_from_parts(
15029 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
15030 }
15031 }
15032 #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)15033 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
15034 if (b.imag == 0) {
15035 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
15036 } else {
15037 float denom = b.real * b.real + b.imag * b.imag;
15038 return __pyx_t_float_complex_from_parts(
15039 (a.real * b.real + a.imag * b.imag) / denom,
15040 (a.imag * b.real - a.real * b.imag) / denom);
15041 }
15042 }
15043 #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)15044 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
15045 __pyx_t_float_complex z;
15046 z.real = -a.real;
15047 z.imag = -a.imag;
15048 return z;
15049 }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)15050 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
15051 return (a.real == 0) && (a.imag == 0);
15052 }
__Pyx_c_conj_float(__pyx_t_float_complex a)15053 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
15054 __pyx_t_float_complex z;
15055 z.real = a.real;
15056 z.imag = -a.imag;
15057 return z;
15058 }
15059 #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)15060 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
15061 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
15062 return sqrtf(z.real*z.real + z.imag*z.imag);
15063 #else
15064 return hypotf(z.real, z.imag);
15065 #endif
15066 }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)15067 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
15068 __pyx_t_float_complex z;
15069 float r, lnr, theta, z_r, z_theta;
15070 if (b.imag == 0 && b.real == (int)b.real) {
15071 if (b.real < 0) {
15072 float denom = a.real * a.real + a.imag * a.imag;
15073 a.real = a.real / denom;
15074 a.imag = -a.imag / denom;
15075 b.real = -b.real;
15076 }
15077 switch ((int)b.real) {
15078 case 0:
15079 z.real = 1;
15080 z.imag = 0;
15081 return z;
15082 case 1:
15083 return a;
15084 case 2:
15085 z = __Pyx_c_prod_float(a, a);
15086 return __Pyx_c_prod_float(a, a);
15087 case 3:
15088 z = __Pyx_c_prod_float(a, a);
15089 return __Pyx_c_prod_float(z, a);
15090 case 4:
15091 z = __Pyx_c_prod_float(a, a);
15092 return __Pyx_c_prod_float(z, z);
15093 }
15094 }
15095 if (a.imag == 0) {
15096 if (a.real == 0) {
15097 return a;
15098 } else if (b.imag == 0) {
15099 z.real = powf(a.real, b.real);
15100 z.imag = 0;
15101 return z;
15102 } else if (a.real > 0) {
15103 r = a.real;
15104 theta = 0;
15105 } else {
15106 r = -a.real;
15107 theta = atan2f(0.0, -1.0);
15108 }
15109 } else {
15110 r = __Pyx_c_abs_float(a);
15111 theta = atan2f(a.imag, a.real);
15112 }
15113 lnr = logf(r);
15114 z_r = expf(lnr * b.real - theta * b.imag);
15115 z_theta = theta * b.real + lnr * b.imag;
15116 z.real = z_r * cosf(z_theta);
15117 z.imag = z_r * sinf(z_theta);
15118 return z;
15119 }
15120 #endif
15121 #endif
15122
15123 /* Declarations */
15124 #if CYTHON_CCOMPLEX
15125 #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)15126 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
15127 return ::std::complex< double >(x, y);
15128 }
15129 #else
__pyx_t_double_complex_from_parts(double x,double y)15130 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
15131 return x + y*(__pyx_t_double_complex)_Complex_I;
15132 }
15133 #endif
15134 #else
__pyx_t_double_complex_from_parts(double x,double y)15135 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
15136 __pyx_t_double_complex z;
15137 z.real = x;
15138 z.imag = y;
15139 return z;
15140 }
15141 #endif
15142
15143 /* Arithmetic */
15144 #if CYTHON_CCOMPLEX
15145 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15146 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15147 return (a.real == b.real) && (a.imag == b.imag);
15148 }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15149 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15150 __pyx_t_double_complex z;
15151 z.real = a.real + b.real;
15152 z.imag = a.imag + b.imag;
15153 return z;
15154 }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15155 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15156 __pyx_t_double_complex z;
15157 z.real = a.real - b.real;
15158 z.imag = a.imag - b.imag;
15159 return z;
15160 }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15161 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15162 __pyx_t_double_complex z;
15163 z.real = a.real * b.real - a.imag * b.imag;
15164 z.imag = a.real * b.imag + a.imag * b.real;
15165 return z;
15166 }
15167 #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15168 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15169 if (b.imag == 0) {
15170 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
15171 } else if (fabs(b.real) >= fabs(b.imag)) {
15172 if (b.real == 0 && b.imag == 0) {
15173 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
15174 } else {
15175 double r = b.imag / b.real;
15176 double s = (double)(1.0) / (b.real + b.imag * r);
15177 return __pyx_t_double_complex_from_parts(
15178 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
15179 }
15180 } else {
15181 double r = b.real / b.imag;
15182 double s = (double)(1.0) / (b.imag + b.real * r);
15183 return __pyx_t_double_complex_from_parts(
15184 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
15185 }
15186 }
15187 #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15188 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15189 if (b.imag == 0) {
15190 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
15191 } else {
15192 double denom = b.real * b.real + b.imag * b.imag;
15193 return __pyx_t_double_complex_from_parts(
15194 (a.real * b.real + a.imag * b.imag) / denom,
15195 (a.imag * b.real - a.real * b.imag) / denom);
15196 }
15197 }
15198 #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)15199 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
15200 __pyx_t_double_complex z;
15201 z.real = -a.real;
15202 z.imag = -a.imag;
15203 return z;
15204 }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)15205 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
15206 return (a.real == 0) && (a.imag == 0);
15207 }
__Pyx_c_conj_double(__pyx_t_double_complex a)15208 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
15209 __pyx_t_double_complex z;
15210 z.real = a.real;
15211 z.imag = -a.imag;
15212 return z;
15213 }
15214 #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)15215 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
15216 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
15217 return sqrt(z.real*z.real + z.imag*z.imag);
15218 #else
15219 return hypot(z.real, z.imag);
15220 #endif
15221 }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)15222 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
15223 __pyx_t_double_complex z;
15224 double r, lnr, theta, z_r, z_theta;
15225 if (b.imag == 0 && b.real == (int)b.real) {
15226 if (b.real < 0) {
15227 double denom = a.real * a.real + a.imag * a.imag;
15228 a.real = a.real / denom;
15229 a.imag = -a.imag / denom;
15230 b.real = -b.real;
15231 }
15232 switch ((int)b.real) {
15233 case 0:
15234 z.real = 1;
15235 z.imag = 0;
15236 return z;
15237 case 1:
15238 return a;
15239 case 2:
15240 z = __Pyx_c_prod_double(a, a);
15241 return __Pyx_c_prod_double(a, a);
15242 case 3:
15243 z = __Pyx_c_prod_double(a, a);
15244 return __Pyx_c_prod_double(z, a);
15245 case 4:
15246 z = __Pyx_c_prod_double(a, a);
15247 return __Pyx_c_prod_double(z, z);
15248 }
15249 }
15250 if (a.imag == 0) {
15251 if (a.real == 0) {
15252 return a;
15253 } else if (b.imag == 0) {
15254 z.real = pow(a.real, b.real);
15255 z.imag = 0;
15256 return z;
15257 } else if (a.real > 0) {
15258 r = a.real;
15259 theta = 0;
15260 } else {
15261 r = -a.real;
15262 theta = atan2(0.0, -1.0);
15263 }
15264 } else {
15265 r = __Pyx_c_abs_double(a);
15266 theta = atan2(a.imag, a.real);
15267 }
15268 lnr = log(r);
15269 z_r = exp(lnr * b.real - theta * b.imag);
15270 z_theta = theta * b.real + lnr * b.imag;
15271 z.real = z_r * cos(z_theta);
15272 z.imag = z_r * sin(z_theta);
15273 return z;
15274 }
15275 #endif
15276 #endif
15277
15278 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)15279 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
15280 const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
15281 const int is_unsigned = neg_one > const_zero;
15282 if (is_unsigned) {
15283 if (sizeof(enum NPY_TYPES) < sizeof(long)) {
15284 return PyInt_FromLong((long) value);
15285 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
15286 return PyLong_FromUnsignedLong((unsigned long) value);
15287 #ifdef HAVE_LONG_LONG
15288 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
15289 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15290 #endif
15291 }
15292 } else {
15293 if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
15294 return PyInt_FromLong((long) value);
15295 #ifdef HAVE_LONG_LONG
15296 } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
15297 return PyLong_FromLongLong((PY_LONG_LONG) value);
15298 #endif
15299 }
15300 }
15301 {
15302 int one = 1; int little = (int)*(unsigned char *)&one;
15303 unsigned char *bytes = (unsigned char *)&value;
15304 return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
15305 little, !is_unsigned);
15306 }
15307 }
15308
15309 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)15310 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
15311 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
15312 const int is_unsigned = neg_one > const_zero;
15313 #if PY_MAJOR_VERSION < 3
15314 if (likely(PyInt_Check(x))) {
15315 if (sizeof(int) < sizeof(long)) {
15316 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
15317 } else {
15318 long val = PyInt_AS_LONG(x);
15319 if (is_unsigned && unlikely(val < 0)) {
15320 goto raise_neg_overflow;
15321 }
15322 return (int) val;
15323 }
15324 } else
15325 #endif
15326 if (likely(PyLong_Check(x))) {
15327 if (is_unsigned) {
15328 #if CYTHON_USE_PYLONG_INTERNALS
15329 const digit* digits = ((PyLongObject*)x)->ob_digit;
15330 switch (Py_SIZE(x)) {
15331 case 0: return (int) 0;
15332 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
15333 case 2:
15334 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
15335 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15336 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15337 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
15338 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15339 }
15340 }
15341 break;
15342 case 3:
15343 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
15344 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15345 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15346 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
15347 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15348 }
15349 }
15350 break;
15351 case 4:
15352 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
15353 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15354 __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])))
15355 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
15356 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15357 }
15358 }
15359 break;
15360 }
15361 #endif
15362 #if CYTHON_COMPILING_IN_CPYTHON
15363 if (unlikely(Py_SIZE(x) < 0)) {
15364 goto raise_neg_overflow;
15365 }
15366 #else
15367 {
15368 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15369 if (unlikely(result < 0))
15370 return (int) -1;
15371 if (unlikely(result == 1))
15372 goto raise_neg_overflow;
15373 }
15374 #endif
15375 if (sizeof(int) <= sizeof(unsigned long)) {
15376 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
15377 #ifdef HAVE_LONG_LONG
15378 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
15379 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15380 #endif
15381 }
15382 } else {
15383 #if CYTHON_USE_PYLONG_INTERNALS
15384 const digit* digits = ((PyLongObject*)x)->ob_digit;
15385 switch (Py_SIZE(x)) {
15386 case 0: return (int) 0;
15387 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
15388 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
15389 case -2:
15390 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
15391 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15392 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15393 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15394 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15395 }
15396 }
15397 break;
15398 case 2:
15399 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
15400 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15401 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15402 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15403 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15404 }
15405 }
15406 break;
15407 case -3:
15408 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15409 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15410 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15411 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15412 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15413 }
15414 }
15415 break;
15416 case 3:
15417 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
15418 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15419 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15420 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15421 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15422 }
15423 }
15424 break;
15425 case -4:
15426 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15427 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15428 __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])))
15429 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
15430 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15431 }
15432 }
15433 break;
15434 case 4:
15435 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
15436 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15437 __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])))
15438 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
15439 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15440 }
15441 }
15442 break;
15443 }
15444 #endif
15445 if (sizeof(int) <= sizeof(long)) {
15446 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
15447 #ifdef HAVE_LONG_LONG
15448 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
15449 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
15450 #endif
15451 }
15452 }
15453 {
15454 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15455 PyErr_SetString(PyExc_RuntimeError,
15456 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15457 #else
15458 int val;
15459 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15460 #if PY_MAJOR_VERSION < 3
15461 if (likely(v) && !PyLong_Check(v)) {
15462 PyObject *tmp = v;
15463 v = PyNumber_Long(tmp);
15464 Py_DECREF(tmp);
15465 }
15466 #endif
15467 if (likely(v)) {
15468 int one = 1; int is_little = (int)*(unsigned char *)&one;
15469 unsigned char *bytes = (unsigned char *)&val;
15470 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15471 bytes, sizeof(val),
15472 is_little, !is_unsigned);
15473 Py_DECREF(v);
15474 if (likely(!ret))
15475 return val;
15476 }
15477 #endif
15478 return (int) -1;
15479 }
15480 } else {
15481 int val;
15482 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15483 if (!tmp) return (int) -1;
15484 val = __Pyx_PyInt_As_int(tmp);
15485 Py_DECREF(tmp);
15486 return val;
15487 }
15488 raise_overflow:
15489 PyErr_SetString(PyExc_OverflowError,
15490 "value too large to convert to int");
15491 return (int) -1;
15492 raise_neg_overflow:
15493 PyErr_SetString(PyExc_OverflowError,
15494 "can't convert negative value to int");
15495 return (int) -1;
15496 }
15497
15498 /* CIntFromPy */
__Pyx_PyInt_As_npy_int64(PyObject * x)15499 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) {
15500 const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
15501 const int is_unsigned = neg_one > const_zero;
15502 #if PY_MAJOR_VERSION < 3
15503 if (likely(PyInt_Check(x))) {
15504 if (sizeof(npy_int64) < sizeof(long)) {
15505 __PYX_VERIFY_RETURN_INT(npy_int64, long, PyInt_AS_LONG(x))
15506 } else {
15507 long val = PyInt_AS_LONG(x);
15508 if (is_unsigned && unlikely(val < 0)) {
15509 goto raise_neg_overflow;
15510 }
15511 return (npy_int64) val;
15512 }
15513 } else
15514 #endif
15515 if (likely(PyLong_Check(x))) {
15516 if (is_unsigned) {
15517 #if CYTHON_USE_PYLONG_INTERNALS
15518 const digit* digits = ((PyLongObject*)x)->ob_digit;
15519 switch (Py_SIZE(x)) {
15520 case 0: return (npy_int64) 0;
15521 case 1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, digits[0])
15522 case 2:
15523 if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
15524 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15525 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15526 } else if (8 * sizeof(npy_int64) >= 2 * PyLong_SHIFT) {
15527 return (npy_int64) (((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
15528 }
15529 }
15530 break;
15531 case 3:
15532 if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
15533 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15534 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15535 } else if (8 * sizeof(npy_int64) >= 3 * PyLong_SHIFT) {
15536 return (npy_int64) (((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
15537 }
15538 }
15539 break;
15540 case 4:
15541 if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
15542 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15543 __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])))
15544 } else if (8 * sizeof(npy_int64) >= 4 * PyLong_SHIFT) {
15545 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]));
15546 }
15547 }
15548 break;
15549 }
15550 #endif
15551 #if CYTHON_COMPILING_IN_CPYTHON
15552 if (unlikely(Py_SIZE(x) < 0)) {
15553 goto raise_neg_overflow;
15554 }
15555 #else
15556 {
15557 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15558 if (unlikely(result < 0))
15559 return (npy_int64) -1;
15560 if (unlikely(result == 1))
15561 goto raise_neg_overflow;
15562 }
15563 #endif
15564 if (sizeof(npy_int64) <= sizeof(unsigned long)) {
15565 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned long, PyLong_AsUnsignedLong(x))
15566 #ifdef HAVE_LONG_LONG
15567 } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
15568 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15569 #endif
15570 }
15571 } else {
15572 #if CYTHON_USE_PYLONG_INTERNALS
15573 const digit* digits = ((PyLongObject*)x)->ob_digit;
15574 switch (Py_SIZE(x)) {
15575 case 0: return (npy_int64) 0;
15576 case -1: __PYX_VERIFY_RETURN_INT(npy_int64, sdigit, (sdigit) (-(sdigit)digits[0]))
15577 case 1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, +digits[0])
15578 case -2:
15579 if (8 * sizeof(npy_int64) - 1 > 1 * PyLong_SHIFT) {
15580 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15581 __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15582 } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
15583 return (npy_int64) (((npy_int64)-1)*(((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
15584 }
15585 }
15586 break;
15587 case 2:
15588 if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
15589 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15590 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15591 } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
15592 return (npy_int64) ((((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
15593 }
15594 }
15595 break;
15596 case -3:
15597 if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
15598 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15599 __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15600 } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
15601 return (npy_int64) (((npy_int64)-1)*(((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
15602 }
15603 }
15604 break;
15605 case 3:
15606 if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
15607 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15608 __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15609 } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
15610 return (npy_int64) ((((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
15611 }
15612 }
15613 break;
15614 case -4:
15615 if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
15616 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15617 __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])))
15618 } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
15619 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])));
15620 }
15621 }
15622 break;
15623 case 4:
15624 if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
15625 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15626 __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])))
15627 } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
15628 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])));
15629 }
15630 }
15631 break;
15632 }
15633 #endif
15634 if (sizeof(npy_int64) <= sizeof(long)) {
15635 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, long, PyLong_AsLong(x))
15636 #ifdef HAVE_LONG_LONG
15637 } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
15638 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, PY_LONG_LONG, PyLong_AsLongLong(x))
15639 #endif
15640 }
15641 }
15642 {
15643 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15644 PyErr_SetString(PyExc_RuntimeError,
15645 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15646 #else
15647 npy_int64 val;
15648 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15649 #if PY_MAJOR_VERSION < 3
15650 if (likely(v) && !PyLong_Check(v)) {
15651 PyObject *tmp = v;
15652 v = PyNumber_Long(tmp);
15653 Py_DECREF(tmp);
15654 }
15655 #endif
15656 if (likely(v)) {
15657 int one = 1; int is_little = (int)*(unsigned char *)&one;
15658 unsigned char *bytes = (unsigned char *)&val;
15659 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15660 bytes, sizeof(val),
15661 is_little, !is_unsigned);
15662 Py_DECREF(v);
15663 if (likely(!ret))
15664 return val;
15665 }
15666 #endif
15667 return (npy_int64) -1;
15668 }
15669 } else {
15670 npy_int64 val;
15671 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15672 if (!tmp) return (npy_int64) -1;
15673 val = __Pyx_PyInt_As_npy_int64(tmp);
15674 Py_DECREF(tmp);
15675 return val;
15676 }
15677 raise_overflow:
15678 PyErr_SetString(PyExc_OverflowError,
15679 "value too large to convert to npy_int64");
15680 return (npy_int64) -1;
15681 raise_neg_overflow:
15682 PyErr_SetString(PyExc_OverflowError,
15683 "can't convert negative value to npy_int64");
15684 return (npy_int64) -1;
15685 }
15686
15687 /* CIntToPy */
__Pyx_PyInt_From_long(long value)15688 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
15689 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
15690 const int is_unsigned = neg_one > const_zero;
15691 if (is_unsigned) {
15692 if (sizeof(long) < sizeof(long)) {
15693 return PyInt_FromLong((long) value);
15694 } else if (sizeof(long) <= sizeof(unsigned long)) {
15695 return PyLong_FromUnsignedLong((unsigned long) value);
15696 #ifdef HAVE_LONG_LONG
15697 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
15698 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15699 #endif
15700 }
15701 } else {
15702 if (sizeof(long) <= sizeof(long)) {
15703 return PyInt_FromLong((long) value);
15704 #ifdef HAVE_LONG_LONG
15705 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
15706 return PyLong_FromLongLong((PY_LONG_LONG) value);
15707 #endif
15708 }
15709 }
15710 {
15711 int one = 1; int little = (int)*(unsigned char *)&one;
15712 unsigned char *bytes = (unsigned char *)&value;
15713 return _PyLong_FromByteArray(bytes, sizeof(long),
15714 little, !is_unsigned);
15715 }
15716 }
15717
15718 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)15719 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
15720 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
15721 const int is_unsigned = neg_one > const_zero;
15722 #if PY_MAJOR_VERSION < 3
15723 if (likely(PyInt_Check(x))) {
15724 if (sizeof(long) < sizeof(long)) {
15725 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
15726 } else {
15727 long val = PyInt_AS_LONG(x);
15728 if (is_unsigned && unlikely(val < 0)) {
15729 goto raise_neg_overflow;
15730 }
15731 return (long) val;
15732 }
15733 } else
15734 #endif
15735 if (likely(PyLong_Check(x))) {
15736 if (is_unsigned) {
15737 #if CYTHON_USE_PYLONG_INTERNALS
15738 const digit* digits = ((PyLongObject*)x)->ob_digit;
15739 switch (Py_SIZE(x)) {
15740 case 0: return (long) 0;
15741 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
15742 case 2:
15743 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
15744 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15745 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15746 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
15747 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15748 }
15749 }
15750 break;
15751 case 3:
15752 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
15753 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15754 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15755 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
15756 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15757 }
15758 }
15759 break;
15760 case 4:
15761 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
15762 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15763 __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])))
15764 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
15765 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15766 }
15767 }
15768 break;
15769 }
15770 #endif
15771 #if CYTHON_COMPILING_IN_CPYTHON
15772 if (unlikely(Py_SIZE(x) < 0)) {
15773 goto raise_neg_overflow;
15774 }
15775 #else
15776 {
15777 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15778 if (unlikely(result < 0))
15779 return (long) -1;
15780 if (unlikely(result == 1))
15781 goto raise_neg_overflow;
15782 }
15783 #endif
15784 if (sizeof(long) <= sizeof(unsigned long)) {
15785 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
15786 #ifdef HAVE_LONG_LONG
15787 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
15788 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15789 #endif
15790 }
15791 } else {
15792 #if CYTHON_USE_PYLONG_INTERNALS
15793 const digit* digits = ((PyLongObject*)x)->ob_digit;
15794 switch (Py_SIZE(x)) {
15795 case 0: return (long) 0;
15796 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
15797 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
15798 case -2:
15799 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
15800 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15801 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15802 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15803 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15804 }
15805 }
15806 break;
15807 case 2:
15808 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
15809 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15810 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15811 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15812 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15813 }
15814 }
15815 break;
15816 case -3:
15817 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15818 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15819 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15820 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15821 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15822 }
15823 }
15824 break;
15825 case 3:
15826 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
15827 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15828 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15829 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15830 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15831 }
15832 }
15833 break;
15834 case -4:
15835 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15836 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15837 __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])))
15838 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15839 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15840 }
15841 }
15842 break;
15843 case 4:
15844 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
15845 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15846 __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])))
15847 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15848 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15849 }
15850 }
15851 break;
15852 }
15853 #endif
15854 if (sizeof(long) <= sizeof(long)) {
15855 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
15856 #ifdef HAVE_LONG_LONG
15857 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
15858 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
15859 #endif
15860 }
15861 }
15862 {
15863 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15864 PyErr_SetString(PyExc_RuntimeError,
15865 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15866 #else
15867 long val;
15868 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15869 #if PY_MAJOR_VERSION < 3
15870 if (likely(v) && !PyLong_Check(v)) {
15871 PyObject *tmp = v;
15872 v = PyNumber_Long(tmp);
15873 Py_DECREF(tmp);
15874 }
15875 #endif
15876 if (likely(v)) {
15877 int one = 1; int is_little = (int)*(unsigned char *)&one;
15878 unsigned char *bytes = (unsigned char *)&val;
15879 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15880 bytes, sizeof(val),
15881 is_little, !is_unsigned);
15882 Py_DECREF(v);
15883 if (likely(!ret))
15884 return val;
15885 }
15886 #endif
15887 return (long) -1;
15888 }
15889 } else {
15890 long val;
15891 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15892 if (!tmp) return (long) -1;
15893 val = __Pyx_PyInt_As_long(tmp);
15894 Py_DECREF(tmp);
15895 return val;
15896 }
15897 raise_overflow:
15898 PyErr_SetString(PyExc_OverflowError,
15899 "value too large to convert to long");
15900 return (long) -1;
15901 raise_neg_overflow:
15902 PyErr_SetString(PyExc_OverflowError,
15903 "can't convert negative value to long");
15904 return (long) -1;
15905 }
15906
15907 /* FastTypeChecks */
15908 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)15909 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
15910 while (a) {
15911 a = a->tp_base;
15912 if (a == b)
15913 return 1;
15914 }
15915 return b == &PyBaseObject_Type;
15916 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)15917 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
15918 PyObject *mro;
15919 if (a == b) return 1;
15920 mro = a->tp_mro;
15921 if (likely(mro)) {
15922 Py_ssize_t i, n;
15923 n = PyTuple_GET_SIZE(mro);
15924 for (i = 0; i < n; i++) {
15925 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
15926 return 1;
15927 }
15928 return 0;
15929 }
15930 return __Pyx_InBases(a, b);
15931 }
15932 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)15933 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
15934 PyObject *exception, *value, *tb;
15935 int res;
15936 __Pyx_PyThreadState_declare
15937 __Pyx_PyThreadState_assign
15938 __Pyx_ErrFetch(&exception, &value, &tb);
15939 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
15940 if (unlikely(res == -1)) {
15941 PyErr_WriteUnraisable(err);
15942 res = 0;
15943 }
15944 if (!res) {
15945 res = PyObject_IsSubclass(err, exc_type2);
15946 if (unlikely(res == -1)) {
15947 PyErr_WriteUnraisable(err);
15948 res = 0;
15949 }
15950 }
15951 __Pyx_ErrRestore(exception, value, tb);
15952 return res;
15953 }
15954 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)15955 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
15956 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
15957 if (!res) {
15958 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
15959 }
15960 return res;
15961 }
15962 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)15963 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
15964 Py_ssize_t i, n;
15965 assert(PyExceptionClass_Check(exc_type));
15966 n = PyTuple_GET_SIZE(tuple);
15967 #if PY_MAJOR_VERSION >= 3
15968 for (i=0; i<n; i++) {
15969 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
15970 }
15971 #endif
15972 for (i=0; i<n; i++) {
15973 PyObject *t = PyTuple_GET_ITEM(tuple, i);
15974 #if PY_MAJOR_VERSION < 3
15975 if (likely(exc_type == t)) return 1;
15976 #endif
15977 if (likely(PyExceptionClass_Check(t))) {
15978 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
15979 } else {
15980 }
15981 }
15982 return 0;
15983 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)15984 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
15985 if (likely(err == exc_type)) return 1;
15986 if (likely(PyExceptionClass_Check(err))) {
15987 if (likely(PyExceptionClass_Check(exc_type))) {
15988 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
15989 } else if (likely(PyTuple_Check(exc_type))) {
15990 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
15991 } else {
15992 }
15993 }
15994 return PyErr_GivenExceptionMatches(err, exc_type);
15995 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)15996 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
15997 assert(PyExceptionClass_Check(exc_type1));
15998 assert(PyExceptionClass_Check(exc_type2));
15999 if (likely(err == exc_type1 || err == exc_type2)) return 1;
16000 if (likely(PyExceptionClass_Check(err))) {
16001 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
16002 }
16003 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
16004 }
16005 #endif
16006
16007 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)16008 static int __Pyx_check_binary_version(void) {
16009 char ctversion[4], rtversion[4];
16010 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
16011 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
16012 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
16013 char message[200];
16014 PyOS_snprintf(message, sizeof(message),
16015 "compiletime version %s of module '%.100s' "
16016 "does not match runtime version %s",
16017 ctversion, __Pyx_MODULE_NAME, rtversion);
16018 return PyErr_WarnEx(NULL, message, 1);
16019 }
16020 return 0;
16021 }
16022
16023 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)16024 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
16025 while (t->p) {
16026 #if PY_MAJOR_VERSION < 3
16027 if (t->is_unicode) {
16028 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
16029 } else if (t->intern) {
16030 *t->p = PyString_InternFromString(t->s);
16031 } else {
16032 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
16033 }
16034 #else
16035 if (t->is_unicode | t->is_str) {
16036 if (t->intern) {
16037 *t->p = PyUnicode_InternFromString(t->s);
16038 } else if (t->encoding) {
16039 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
16040 } else {
16041 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
16042 }
16043 } else {
16044 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
16045 }
16046 #endif
16047 if (!*t->p)
16048 return -1;
16049 if (PyObject_Hash(*t->p) == -1)
16050 return -1;
16051 ++t;
16052 }
16053 return 0;
16054 }
16055
__Pyx_PyUnicode_FromString(const char * c_str)16056 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
16057 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
16058 }
__Pyx_PyObject_AsString(PyObject * o)16059 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
16060 Py_ssize_t ignore;
16061 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
16062 }
16063 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
16064 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)16065 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
16066 char* defenc_c;
16067 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
16068 if (!defenc) return NULL;
16069 defenc_c = PyBytes_AS_STRING(defenc);
16070 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
16071 {
16072 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
16073 char* c;
16074 for (c = defenc_c; c < end; c++) {
16075 if ((unsigned char) (*c) >= 128) {
16076 PyUnicode_AsASCIIString(o);
16077 return NULL;
16078 }
16079 }
16080 }
16081 #endif
16082 *length = PyBytes_GET_SIZE(defenc);
16083 return defenc_c;
16084 }
16085 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)16086 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
16087 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
16088 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
16089 if (likely(PyUnicode_IS_ASCII(o))) {
16090 *length = PyUnicode_GET_LENGTH(o);
16091 return PyUnicode_AsUTF8(o);
16092 } else {
16093 PyUnicode_AsASCIIString(o);
16094 return NULL;
16095 }
16096 #else
16097 return PyUnicode_AsUTF8AndSize(o, length);
16098 #endif
16099 }
16100 #endif
16101 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)16102 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
16103 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
16104 if (
16105 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
16106 __Pyx_sys_getdefaultencoding_not_ascii &&
16107 #endif
16108 PyUnicode_Check(o)) {
16109 return __Pyx_PyUnicode_AsStringAndSize(o, length);
16110 } else
16111 #endif
16112 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
16113 if (PyByteArray_Check(o)) {
16114 *length = PyByteArray_GET_SIZE(o);
16115 return PyByteArray_AS_STRING(o);
16116 } else
16117 #endif
16118 {
16119 char* result;
16120 int r = PyBytes_AsStringAndSize(o, &result, length);
16121 if (unlikely(r < 0)) {
16122 return NULL;
16123 } else {
16124 return result;
16125 }
16126 }
16127 }
__Pyx_PyObject_IsTrue(PyObject * x)16128 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
16129 int is_true = x == Py_True;
16130 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
16131 else return PyObject_IsTrue(x);
16132 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)16133 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
16134 int retval;
16135 if (unlikely(!x)) return -1;
16136 retval = __Pyx_PyObject_IsTrue(x);
16137 Py_DECREF(x);
16138 return retval;
16139 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)16140 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
16141 #if PY_MAJOR_VERSION >= 3
16142 if (PyLong_Check(result)) {
16143 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
16144 "__int__ returned non-int (type %.200s). "
16145 "The ability to return an instance of a strict subclass of int "
16146 "is deprecated, and may be removed in a future version of Python.",
16147 Py_TYPE(result)->tp_name)) {
16148 Py_DECREF(result);
16149 return NULL;
16150 }
16151 return result;
16152 }
16153 #endif
16154 PyErr_Format(PyExc_TypeError,
16155 "__%.4s__ returned non-%.4s (type %.200s)",
16156 type_name, type_name, Py_TYPE(result)->tp_name);
16157 Py_DECREF(result);
16158 return NULL;
16159 }
__Pyx_PyNumber_IntOrLong(PyObject * x)16160 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
16161 #if CYTHON_USE_TYPE_SLOTS
16162 PyNumberMethods *m;
16163 #endif
16164 const char *name = NULL;
16165 PyObject *res = NULL;
16166 #if PY_MAJOR_VERSION < 3
16167 if (likely(PyInt_Check(x) || PyLong_Check(x)))
16168 #else
16169 if (likely(PyLong_Check(x)))
16170 #endif
16171 return __Pyx_NewRef(x);
16172 #if CYTHON_USE_TYPE_SLOTS
16173 m = Py_TYPE(x)->tp_as_number;
16174 #if PY_MAJOR_VERSION < 3
16175 if (m && m->nb_int) {
16176 name = "int";
16177 res = m->nb_int(x);
16178 }
16179 else if (m && m->nb_long) {
16180 name = "long";
16181 res = m->nb_long(x);
16182 }
16183 #else
16184 if (likely(m && m->nb_int)) {
16185 name = "int";
16186 res = m->nb_int(x);
16187 }
16188 #endif
16189 #else
16190 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
16191 res = PyNumber_Int(x);
16192 }
16193 #endif
16194 if (likely(res)) {
16195 #if PY_MAJOR_VERSION < 3
16196 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
16197 #else
16198 if (unlikely(!PyLong_CheckExact(res))) {
16199 #endif
16200 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
16201 }
16202 }
16203 else if (!PyErr_Occurred()) {
16204 PyErr_SetString(PyExc_TypeError,
16205 "an integer is required");
16206 }
16207 return res;
16208 }
16209 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
16210 Py_ssize_t ival;
16211 PyObject *x;
16212 #if PY_MAJOR_VERSION < 3
16213 if (likely(PyInt_CheckExact(b))) {
16214 if (sizeof(Py_ssize_t) >= sizeof(long))
16215 return PyInt_AS_LONG(b);
16216 else
16217 return PyInt_AsSsize_t(b);
16218 }
16219 #endif
16220 if (likely(PyLong_CheckExact(b))) {
16221 #if CYTHON_USE_PYLONG_INTERNALS
16222 const digit* digits = ((PyLongObject*)b)->ob_digit;
16223 const Py_ssize_t size = Py_SIZE(b);
16224 if (likely(__Pyx_sst_abs(size) <= 1)) {
16225 ival = likely(size) ? digits[0] : 0;
16226 if (size == -1) ival = -ival;
16227 return ival;
16228 } else {
16229 switch (size) {
16230 case 2:
16231 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16232 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16233 }
16234 break;
16235 case -2:
16236 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16237 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16238 }
16239 break;
16240 case 3:
16241 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16242 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16243 }
16244 break;
16245 case -3:
16246 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16247 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16248 }
16249 break;
16250 case 4:
16251 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16252 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]));
16253 }
16254 break;
16255 case -4:
16256 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16257 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]));
16258 }
16259 break;
16260 }
16261 }
16262 #endif
16263 return PyLong_AsSsize_t(b);
16264 }
16265 x = PyNumber_Index(b);
16266 if (!x) return -1;
16267 ival = PyInt_AsSsize_t(x);
16268 Py_DECREF(x);
16269 return ival;
16270 }
16271 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
16272 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
16273 }
16274 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
16275 return PyInt_FromSize_t(ival);
16276 }
16277
16278
16279 #endif /* Py_PYTHON_H */
16280