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.basic_octree",
16         "sources": [
17             "yt/utilities/lib/basic_octree.pyx"
18         ]
19     },
20     "module_name": "yt.utilities.lib.basic_octree"
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__basic_octree
615 #define __PYX_HAVE_API__yt__utilities__lib__basic_octree
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 #include "math.h"
624 #ifdef _OPENMP
625 #include <omp.h>
626 #endif /* _OPENMP */
627 
628 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
629 #define CYTHON_WITHOUT_ASSERTIONS
630 #endif
631 
632 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
633                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
634 
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
637 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
638 #define __PYX_DEFAULT_STRING_ENCODING ""
639 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
640 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
641 #define __Pyx_uchar_cast(c) ((unsigned char)c)
642 #define __Pyx_long_cast(x) ((long)x)
643 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
644     (sizeof(type) < sizeof(Py_ssize_t))  ||\
645     (sizeof(type) > sizeof(Py_ssize_t) &&\
646           likely(v < (type)PY_SSIZE_T_MAX ||\
647                  v == (type)PY_SSIZE_T_MAX)  &&\
648           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
649                                 v == (type)PY_SSIZE_T_MIN)))  ||\
650     (sizeof(type) == sizeof(Py_ssize_t) &&\
651           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
652                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)653 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
654     return (size_t) i < (size_t) limit;
655 }
656 #if defined (__cplusplus) && __cplusplus >= 201103L
657     #include <cstdlib>
658     #define __Pyx_sst_abs(value) std::abs(value)
659 #elif SIZEOF_INT >= SIZEOF_SIZE_T
660     #define __Pyx_sst_abs(value) abs(value)
661 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
662     #define __Pyx_sst_abs(value) labs(value)
663 #elif defined (_MSC_VER)
664     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
665 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
666     #define __Pyx_sst_abs(value) llabs(value)
667 #elif defined (__GNUC__)
668     #define __Pyx_sst_abs(value) __builtin_llabs(value)
669 #else
670     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
671 #endif
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
673 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
674 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
675 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
676 #define __Pyx_PyBytes_FromString        PyBytes_FromString
677 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
678 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
679 #if PY_MAJOR_VERSION < 3
680     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
681     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
682 #else
683     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
684     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
685 #endif
686 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
692 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
697 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
698 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
699 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
700 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
701 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)702 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
703     const Py_UNICODE *u_end = u;
704     while (*u_end++) ;
705     return (size_t)(u_end - u - 1);
706 }
707 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
708 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
709 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
710 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
711 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
712 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
714 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
715 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
716 #define __Pyx_PySequence_Tuple(obj)\
717     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
718 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
719 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
720 #if CYTHON_ASSUME_SAFE_MACROS
721 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
722 #else
723 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
724 #endif
725 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
726 #if PY_MAJOR_VERSION >= 3
727 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
728 #else
729 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
730 #endif
731 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
732 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
733 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)734 static int __Pyx_init_sys_getdefaultencoding_params(void) {
735     PyObject* sys;
736     PyObject* default_encoding = NULL;
737     PyObject* ascii_chars_u = NULL;
738     PyObject* ascii_chars_b = NULL;
739     const char* default_encoding_c;
740     sys = PyImport_ImportModule("sys");
741     if (!sys) goto bad;
742     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
743     Py_DECREF(sys);
744     if (!default_encoding) goto bad;
745     default_encoding_c = PyBytes_AsString(default_encoding);
746     if (!default_encoding_c) goto bad;
747     if (strcmp(default_encoding_c, "ascii") == 0) {
748         __Pyx_sys_getdefaultencoding_not_ascii = 0;
749     } else {
750         char ascii_chars[128];
751         int c;
752         for (c = 0; c < 128; c++) {
753             ascii_chars[c] = c;
754         }
755         __Pyx_sys_getdefaultencoding_not_ascii = 1;
756         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
757         if (!ascii_chars_u) goto bad;
758         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
759         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
760             PyErr_Format(
761                 PyExc_ValueError,
762                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
763                 default_encoding_c);
764             goto bad;
765         }
766         Py_DECREF(ascii_chars_u);
767         Py_DECREF(ascii_chars_b);
768     }
769     Py_DECREF(default_encoding);
770     return 0;
771 bad:
772     Py_XDECREF(default_encoding);
773     Py_XDECREF(ascii_chars_u);
774     Py_XDECREF(ascii_chars_b);
775     return -1;
776 }
777 #endif
778 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
779 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
780 #else
781 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
782 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
783 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)784 static int __Pyx_init_sys_getdefaultencoding_params(void) {
785     PyObject* sys;
786     PyObject* default_encoding = NULL;
787     char* default_encoding_c;
788     sys = PyImport_ImportModule("sys");
789     if (!sys) goto bad;
790     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
791     Py_DECREF(sys);
792     if (!default_encoding) goto bad;
793     default_encoding_c = PyBytes_AsString(default_encoding);
794     if (!default_encoding_c) goto bad;
795     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
796     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
797     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
798     Py_DECREF(default_encoding);
799     return 0;
800 bad:
801     Py_XDECREF(default_encoding);
802     return -1;
803 }
804 #endif
805 #endif
806 
807 
808 /* Test for GCC > 2.95 */
809 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
810   #define likely(x)   __builtin_expect(!!(x), 1)
811   #define unlikely(x) __builtin_expect(!!(x), 0)
812 #else /* !__GNUC__ or GCC < 2.95 */
813   #define likely(x)   (x)
814   #define unlikely(x) (x)
815 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)816 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
817 
818 static PyObject *__pyx_m = NULL;
819 static PyObject *__pyx_d;
820 static PyObject *__pyx_b;
821 static PyObject *__pyx_cython_runtime = NULL;
822 static PyObject *__pyx_empty_tuple;
823 static PyObject *__pyx_empty_bytes;
824 static PyObject *__pyx_empty_unicode;
825 static int __pyx_lineno;
826 static int __pyx_clineno = 0;
827 static const char * __pyx_cfilenm= __FILE__;
828 static const char *__pyx_filename;
829 
830 /* Header.proto */
831 #if !defined(CYTHON_CCOMPLEX)
832   #if defined(__cplusplus)
833     #define CYTHON_CCOMPLEX 1
834   #elif defined(_Complex_I)
835     #define CYTHON_CCOMPLEX 1
836   #else
837     #define CYTHON_CCOMPLEX 0
838   #endif
839 #endif
840 #if CYTHON_CCOMPLEX
841   #ifdef __cplusplus
842     #include <complex>
843   #else
844     #include <complex.h>
845   #endif
846 #endif
847 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
848   #undef _Complex_I
849   #define _Complex_I 1.0fj
850 #endif
851 
852 
853 static const char *__pyx_f[] = {
854   "yt/utilities/lib/basic_octree.pyx",
855   "stringsource",
856   "__init__.pxd",
857   "yt/utilities/lib/fp_utils.pxd",
858   "type.pxd",
859 };
860 /* BufferFormatStructs.proto */
861 #define IS_UNSIGNED(type) (((type) -1) > 0)
862 struct __Pyx_StructField_;
863 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
864 typedef struct {
865   const char* name;
866   struct __Pyx_StructField_* fields;
867   size_t size;
868   size_t arraysize[8];
869   int ndim;
870   char typegroup;
871   char is_unsigned;
872   int flags;
873 } __Pyx_TypeInfo;
874 typedef struct __Pyx_StructField_ {
875   __Pyx_TypeInfo* type;
876   const char* name;
877   size_t offset;
878 } __Pyx_StructField;
879 typedef struct {
880   __Pyx_StructField* field;
881   size_t parent_offset;
882 } __Pyx_BufFmt_StackElem;
883 typedef struct {
884   __Pyx_StructField root;
885   __Pyx_BufFmt_StackElem* head;
886   size_t fmt_offset;
887   size_t new_count, enc_count;
888   size_t struct_alignment;
889   int is_complex;
890   char enc_type;
891   char new_packmode;
892   char enc_packmode;
893   char is_valid_array;
894 } __Pyx_BufFmt_Context;
895 
896 
897 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
898  * # in Cython to enable them only on the right systems.
899  *
900  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
901  * ctypedef npy_int16      int16_t
902  * ctypedef npy_int32      int32_t
903  */
904 typedef npy_int8 __pyx_t_5numpy_int8_t;
905 
906 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
907  *
908  * ctypedef npy_int8       int8_t
909  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
910  * ctypedef npy_int32      int32_t
911  * ctypedef npy_int64      int64_t
912  */
913 typedef npy_int16 __pyx_t_5numpy_int16_t;
914 
915 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
916  * ctypedef npy_int8       int8_t
917  * ctypedef npy_int16      int16_t
918  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
919  * ctypedef npy_int64      int64_t
920  * #ctypedef npy_int96      int96_t
921  */
922 typedef npy_int32 __pyx_t_5numpy_int32_t;
923 
924 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
925  * ctypedef npy_int16      int16_t
926  * ctypedef npy_int32      int32_t
927  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
928  * #ctypedef npy_int96      int96_t
929  * #ctypedef npy_int128     int128_t
930  */
931 typedef npy_int64 __pyx_t_5numpy_int64_t;
932 
933 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
934  * #ctypedef npy_int128     int128_t
935  *
936  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
937  * ctypedef npy_uint16     uint16_t
938  * ctypedef npy_uint32     uint32_t
939  */
940 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
941 
942 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
943  *
944  * ctypedef npy_uint8      uint8_t
945  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
946  * ctypedef npy_uint32     uint32_t
947  * ctypedef npy_uint64     uint64_t
948  */
949 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
950 
951 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
952  * ctypedef npy_uint8      uint8_t
953  * ctypedef npy_uint16     uint16_t
954  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
955  * ctypedef npy_uint64     uint64_t
956  * #ctypedef npy_uint96     uint96_t
957  */
958 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
959 
960 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
961  * ctypedef npy_uint16     uint16_t
962  * ctypedef npy_uint32     uint32_t
963  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
964  * #ctypedef npy_uint96     uint96_t
965  * #ctypedef npy_uint128    uint128_t
966  */
967 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
968 
969 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
970  * #ctypedef npy_uint128    uint128_t
971  *
972  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
973  * ctypedef npy_float64    float64_t
974  * #ctypedef npy_float80    float80_t
975  */
976 typedef npy_float32 __pyx_t_5numpy_float32_t;
977 
978 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
979  *
980  * ctypedef npy_float32    float32_t
981  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
982  * #ctypedef npy_float80    float80_t
983  * #ctypedef npy_float128   float128_t
984  */
985 typedef npy_float64 __pyx_t_5numpy_float64_t;
986 
987 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
988  * # The int types are mapped a bit surprising --
989  * # numpy.int corresponds to 'l' and numpy.long to 'q'
990  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
991  * ctypedef npy_longlong   long_t
992  * ctypedef npy_longlong   longlong_t
993  */
994 typedef npy_long __pyx_t_5numpy_int_t;
995 
996 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
997  * # numpy.int corresponds to 'l' and numpy.long to 'q'
998  * ctypedef npy_long       int_t
999  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1000  * ctypedef npy_longlong   longlong_t
1001  *
1002  */
1003 typedef npy_longlong __pyx_t_5numpy_long_t;
1004 
1005 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1006  * ctypedef npy_long       int_t
1007  * ctypedef npy_longlong   long_t
1008  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1009  *
1010  * ctypedef npy_ulong      uint_t
1011  */
1012 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1013 
1014 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1015  * ctypedef npy_longlong   longlong_t
1016  *
1017  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1018  * ctypedef npy_ulonglong  ulong_t
1019  * ctypedef npy_ulonglong  ulonglong_t
1020  */
1021 typedef npy_ulong __pyx_t_5numpy_uint_t;
1022 
1023 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1024  *
1025  * ctypedef npy_ulong      uint_t
1026  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1027  * ctypedef npy_ulonglong  ulonglong_t
1028  *
1029  */
1030 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1031 
1032 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1033  * ctypedef npy_ulong      uint_t
1034  * ctypedef npy_ulonglong  ulong_t
1035  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1036  *
1037  * ctypedef npy_intp       intp_t
1038  */
1039 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1040 
1041 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1042  * ctypedef npy_ulonglong  ulonglong_t
1043  *
1044  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1045  * ctypedef npy_uintp      uintp_t
1046  *
1047  */
1048 typedef npy_intp __pyx_t_5numpy_intp_t;
1049 
1050 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1051  *
1052  * ctypedef npy_intp       intp_t
1053  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1054  *
1055  * ctypedef npy_double     float_t
1056  */
1057 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1058 
1059 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1060  * ctypedef npy_uintp      uintp_t
1061  *
1062  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1063  * ctypedef npy_double     double_t
1064  * ctypedef npy_longdouble longdouble_t
1065  */
1066 typedef npy_double __pyx_t_5numpy_float_t;
1067 
1068 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1069  *
1070  * ctypedef npy_double     float_t
1071  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1072  * ctypedef npy_longdouble longdouble_t
1073  *
1074  */
1075 typedef npy_double __pyx_t_5numpy_double_t;
1076 
1077 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1078  * ctypedef npy_double     float_t
1079  * ctypedef npy_double     double_t
1080  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1081  *
1082  * ctypedef npy_cfloat      cfloat_t
1083  */
1084 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1085 /* Declarations.proto */
1086 #if CYTHON_CCOMPLEX
1087   #ifdef __cplusplus
1088     typedef ::std::complex< float > __pyx_t_float_complex;
1089   #else
1090     typedef float _Complex __pyx_t_float_complex;
1091   #endif
1092 #else
1093     typedef struct { float real, imag; } __pyx_t_float_complex;
1094 #endif
1095 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1096 
1097 /* Declarations.proto */
1098 #if CYTHON_CCOMPLEX
1099   #ifdef __cplusplus
1100     typedef ::std::complex< double > __pyx_t_double_complex;
1101   #else
1102     typedef double _Complex __pyx_t_double_complex;
1103   #endif
1104 #else
1105     typedef struct { double real, imag; } __pyx_t_double_complex;
1106 #endif
1107 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1108 
1109 
1110 /*--- Type declarations ---*/
1111 struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree;
1112 
1113 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1114  * ctypedef npy_longdouble longdouble_t
1115  *
1116  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1117  * ctypedef npy_cdouble     cdouble_t
1118  * ctypedef npy_clongdouble clongdouble_t
1119  */
1120 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1121 
1122 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1123  *
1124  * ctypedef npy_cfloat      cfloat_t
1125  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1126  * ctypedef npy_clongdouble clongdouble_t
1127  *
1128  */
1129 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1130 
1131 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1132  * ctypedef npy_cfloat      cfloat_t
1133  * ctypedef npy_cdouble     cdouble_t
1134  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1135  *
1136  * ctypedef npy_cdouble     complex_t
1137  */
1138 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1139 
1140 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1141  * ctypedef npy_clongdouble clongdouble_t
1142  *
1143  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1144  *
1145  * cdef inline object PyArray_MultiIterNew1(a):
1146  */
1147 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1148 struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode;
1149 struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_refine;
1150 struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_initialize;
1151 
1152 /* "yt/utilities/lib/basic_octree.pyx":38
1153  *     return f1
1154  *
1155  * cdef struct OctreeNode:             # <<<<<<<<<<<<<<
1156  *     np.float64_t *val
1157  *     np.float64_t weight_val
1158  */
1159 struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode {
1160   __pyx_t_5numpy_float64_t *val;
1161   __pyx_t_5numpy_float64_t weight_val;
1162   __pyx_t_5numpy_int64_t pos[3];
1163   int level;
1164   int nvals;
1165   int max_level;
1166   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *children[2][2][2];
1167   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *parent;
1168   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *next;
1169   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *up_next;
1170 };
1171 
1172 /* "yt/utilities/lib/basic_octree.pyx":59
1173  *         self.max_level = imax(self.max_level, level)
1174  *
1175  * cdef void OTN_refine(OctreeNode *self, int incremental = 0):             # <<<<<<<<<<<<<<
1176  *     cdef int i, j, k
1177  *     cdef np.int64_t npos[3]
1178  */
1179 struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_refine {
1180   int __pyx_n;
1181   int incremental;
1182 };
1183 
1184 /* "yt/utilities/lib/basic_octree.pyx":77
1185  *     self.weight_val = 0.0
1186  *
1187  * cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals,             # <<<<<<<<<<<<<<
1188  *                         np.float64_t *val, np.float64_t weight_val,
1189  *                         int level, OctreeNode *parent, int incremental = 0):
1190  */
1191 struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_initialize {
1192   int __pyx_n;
1193   int incremental;
1194 };
1195 
1196 /* "yt/utilities/lib/basic_octree.pyx":118
1197  *     free(node)
1198  *
1199  * cdef class Octree:             # <<<<<<<<<<<<<<
1200  *     cdef int nvals
1201  *     cdef np.int64_t po2[80]
1202  */
1203 struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree {
1204   PyObject_HEAD
1205   struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_vtab;
1206   int nvals;
1207   __pyx_t_5numpy_int64_t po2[80];
1208   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode ****root_nodes;
1209   __pyx_t_5numpy_int64_t top_grid_dims[3];
1210   int incremental;
1211   __pyx_t_5numpy_float64_t opening_angle;
1212   __pyx_t_5numpy_float64_t dist;
1213   __pyx_t_5numpy_float64_t root_dx[3];
1214   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *last_node;
1215 };
1216 
1217 
1218 
1219 struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree {
1220   void (*add_to_position)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, PyObject *);
1221   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *(*find_on_root_level)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, __pyx_t_5numpy_int64_t *, int);
1222   int (*count_at_level)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, int);
1223   int (*fill_from_level)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *);
1224   __pyx_t_5numpy_float64_t (*fbe_node_separation)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1225   __pyx_t_5numpy_float64_t (*fbe_opening_angle)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1226   void (*set_next)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, int);
1227   void (*set_up_next)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1228   __pyx_t_5numpy_float64_t (*fbe_main)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, __pyx_t_5numpy_float64_t, int, __pyx_t_5numpy_float64_t);
1229   int (*node_ID)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1230   int (*node_ID_on_level)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1231   void (*print_node_info)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1232   void (*iterate_print_nodes)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *);
1233 };
1234 static struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_vtabptr_2yt_9utilities_3lib_12basic_octree_Octree;
1235 
1236 /* --- Runtime support code (head) --- */
1237 /* Refnanny.proto */
1238 #ifndef CYTHON_REFNANNY
1239   #define CYTHON_REFNANNY 0
1240 #endif
1241 #if CYTHON_REFNANNY
1242   typedef struct {
1243     void (*INCREF)(void*, PyObject*, int);
1244     void (*DECREF)(void*, PyObject*, int);
1245     void (*GOTREF)(void*, PyObject*, int);
1246     void (*GIVEREF)(void*, PyObject*, int);
1247     void* (*SetupContext)(const char*, int, const char*);
1248     void (*FinishContext)(void**);
1249   } __Pyx_RefNannyAPIStruct;
1250   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1251   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1252   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1253 #ifdef WITH_THREAD
1254   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1255           if (acquire_gil) {\
1256               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1257               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1258               PyGILState_Release(__pyx_gilstate_save);\
1259           } else {\
1260               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1261           }
1262 #else
1263   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1264           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1265 #endif
1266   #define __Pyx_RefNannyFinishContext()\
1267           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1268   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1269   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1270   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1271   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1272   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1273   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1274   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1275   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1276 #else
1277   #define __Pyx_RefNannyDeclarations
1278   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1279   #define __Pyx_RefNannyFinishContext()
1280   #define __Pyx_INCREF(r) Py_INCREF(r)
1281   #define __Pyx_DECREF(r) Py_DECREF(r)
1282   #define __Pyx_GOTREF(r)
1283   #define __Pyx_GIVEREF(r)
1284   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1285   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1286   #define __Pyx_XGOTREF(r)
1287   #define __Pyx_XGIVEREF(r)
1288 #endif
1289 #define __Pyx_XDECREF_SET(r, v) do {\
1290         PyObject *tmp = (PyObject *) r;\
1291         r = v; __Pyx_XDECREF(tmp);\
1292     } while (0)
1293 #define __Pyx_DECREF_SET(r, v) do {\
1294         PyObject *tmp = (PyObject *) r;\
1295         r = v; __Pyx_DECREF(tmp);\
1296     } while (0)
1297 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1298 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1299 
1300 /* PyObjectGetAttrStr.proto */
1301 #if CYTHON_USE_TYPE_SLOTS
1302 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1303 #else
1304 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1305 #endif
1306 
1307 /* GetBuiltinName.proto */
1308 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1309 
1310 /* RaiseArgTupleInvalid.proto */
1311 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1312     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1313 
1314 /* RaiseDoubleKeywords.proto */
1315 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1316 
1317 /* ParseKeywords.proto */
1318 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1319     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1320     const char* function_name);
1321 
1322 /* ArgTypeTest.proto */
1323 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1324     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1325         __Pyx__ArgTypeTest(obj, type, name, exact))
1326 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1327 
1328 /* IsLittleEndian.proto */
1329 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1330 
1331 /* BufferFormatCheck.proto */
1332 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1333 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1334                               __Pyx_BufFmt_StackElem* stack,
1335                               __Pyx_TypeInfo* type);
1336 
1337 /* BufferGetAndValidate.proto */
1338 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1339     ((obj == Py_None || obj == NULL) ?\
1340     (__Pyx_ZeroBuffer(buf), 0) :\
1341     __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1342 static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1343     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1344 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1345 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1346 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1347 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1348 
1349 /* BufferIndexError.proto */
1350 static void __Pyx_RaiseBufferIndexError(int axis);
1351 
1352 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1353 /* PyThreadStateGet.proto */
1354 #if CYTHON_FAST_THREAD_STATE
1355 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1356 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1357 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1358 #else
1359 #define __Pyx_PyThreadState_declare
1360 #define __Pyx_PyThreadState_assign
1361 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1362 #endif
1363 
1364 /* PyErrFetchRestore.proto */
1365 #if CYTHON_FAST_THREAD_STATE
1366 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1367 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1368 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1369 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1370 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1371 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1372 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1373 #if CYTHON_COMPILING_IN_CPYTHON
1374 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1375 #else
1376 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1377 #endif
1378 #else
1379 #define __Pyx_PyErr_Clear() PyErr_Clear()
1380 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1381 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1382 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1383 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1384 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1385 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1386 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1387 #endif
1388 
1389 /* WriteUnraisableException.proto */
1390 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1391                                   int lineno, const char *filename,
1392                                   int full_traceback, int nogil);
1393 
1394 /* None.proto */
1395 static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t);
1396 
1397 /* UnaryNegOverflows.proto */
1398 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1399         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1400 
1401 /* PyDictVersioning.proto */
1402 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1403 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1404 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1405 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1406     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1407     (cache_var) = (value);
1408 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1409     static PY_UINT64_T __pyx_dict_version = 0;\
1410     static PyObject *__pyx_dict_cached_value = NULL;\
1411     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1412         (VAR) = __pyx_dict_cached_value;\
1413     } else {\
1414         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1415         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1416     }\
1417 }
1418 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1419 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1420 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1421 #else
1422 #define __PYX_GET_DICT_VERSION(dict)  (0)
1423 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1424 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1425 #endif
1426 
1427 /* GetModuleGlobalName.proto */
1428 #if CYTHON_USE_DICT_VERSIONS
1429 #define __Pyx_GetModuleGlobalName(var, name)  {\
1430     static PY_UINT64_T __pyx_dict_version = 0;\
1431     static PyObject *__pyx_dict_cached_value = NULL;\
1432     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1433         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1434         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1435 }
1436 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1437     PY_UINT64_T __pyx_dict_version;\
1438     PyObject *__pyx_dict_cached_value;\
1439     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1440 }
1441 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1442 #else
1443 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1444 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1445 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1446 #endif
1447 
1448 /* PyObjectCall.proto */
1449 #if CYTHON_COMPILING_IN_CPYTHON
1450 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1451 #else
1452 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1453 #endif
1454 
1455 /* ExtTypeTest.proto */
1456 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1457 
1458 /* BufferFallbackError.proto */
1459 static void __Pyx_RaiseBufferFallbackError(void);
1460 
1461 /* None.proto */
1462 static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_mod___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t);
1463 
1464 /* PyFunctionFastCall.proto */
1465 #if CYTHON_FAST_PYCALL
1466 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1467     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1468 #if 1 || PY_VERSION_HEX < 0x030600B1
1469 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1470 #else
1471 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1472 #endif
1473 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1474     (sizeof(char [1 - 2*!(cond)]) - 1)
1475 #ifndef Py_MEMBER_SIZE
1476 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1477 #endif
1478   static size_t __pyx_pyframe_localsplus_offset = 0;
1479   #include "frameobject.h"
1480   #define __Pxy_PyFrame_Initialize_Offsets()\
1481     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1482      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1483   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1484     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1485 #endif
1486 
1487 /* PyObjectCallMethO.proto */
1488 #if CYTHON_COMPILING_IN_CPYTHON
1489 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1490 #endif
1491 
1492 /* PyObjectCallNoArg.proto */
1493 #if CYTHON_COMPILING_IN_CPYTHON
1494 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1495 #else
1496 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1497 #endif
1498 
1499 /* PyCFunctionFastCall.proto */
1500 #if CYTHON_FAST_PYCCALL
1501 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1502 #else
1503 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1504 #endif
1505 
1506 /* PyObjectCallOneArg.proto */
1507 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1508 
1509 /* RaiseException.proto */
1510 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1511 
1512 /* DictGetItem.proto */
1513 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1514 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1515 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1516     (likely(PyDict_CheckExact(obj)) ?\
1517      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1518 #else
1519 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1520 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1521 #endif
1522 
1523 /* RaiseTooManyValuesToUnpack.proto */
1524 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1525 
1526 /* RaiseNeedMoreValuesToUnpack.proto */
1527 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1528 
1529 /* RaiseNoneIterError.proto */
1530 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1531 
1532 /* GetTopmostException.proto */
1533 #if CYTHON_USE_EXC_INFO_STACK
1534 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1535 #endif
1536 
1537 /* SaveResetException.proto */
1538 #if CYTHON_FAST_THREAD_STATE
1539 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1540 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1541 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1542 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1543 #else
1544 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1545 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1546 #endif
1547 
1548 /* PyErrExceptionMatches.proto */
1549 #if CYTHON_FAST_THREAD_STATE
1550 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1551 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1552 #else
1553 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1554 #endif
1555 
1556 /* GetException.proto */
1557 #if CYTHON_FAST_THREAD_STATE
1558 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1559 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1560 #else
1561 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1562 #endif
1563 
1564 /* GetAttr.proto */
1565 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1566 
1567 /* HasAttr.proto */
1568 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1569 
1570 /* IncludeStringH.proto */
1571 #include <string.h>
1572 
1573 /* BytesEquals.proto */
1574 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1575 
1576 /* UnicodeEquals.proto */
1577 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1578 
1579 /* StrEquals.proto */
1580 #if PY_MAJOR_VERSION >= 3
1581 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1582 #else
1583 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1584 #endif
1585 
1586 /* PyObjectCall2Args.proto */
1587 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1588 
1589 /* PyObject_GenericGetAttrNoDict.proto */
1590 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1591 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1592 #else
1593 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1594 #endif
1595 
1596 /* PyObject_GenericGetAttr.proto */
1597 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1598 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1599 #else
1600 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1601 #endif
1602 
1603 /* SetVTable.proto */
1604 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1605 
1606 /* SetupReduce.proto */
1607 static int __Pyx_setup_reduce(PyObject* type_obj);
1608 
1609 /* TypeImport.proto */
1610 #ifndef __PYX_HAVE_RT_ImportType_proto
1611 #define __PYX_HAVE_RT_ImportType_proto
1612 enum __Pyx_ImportType_CheckSize {
1613    __Pyx_ImportType_CheckSize_Error = 0,
1614    __Pyx_ImportType_CheckSize_Warn = 1,
1615    __Pyx_ImportType_CheckSize_Ignore = 2
1616 };
1617 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1618 #endif
1619 
1620 /* Import.proto */
1621 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1622 
1623 /* CLineInTraceback.proto */
1624 #ifdef CYTHON_CLINE_IN_TRACEBACK
1625 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1626 #else
1627 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1628 #endif
1629 
1630 /* CodeObjectCache.proto */
1631 typedef struct {
1632     PyCodeObject* code_object;
1633     int code_line;
1634 } __Pyx_CodeObjectCacheEntry;
1635 struct __Pyx_CodeObjectCache {
1636     int count;
1637     int max_count;
1638     __Pyx_CodeObjectCacheEntry* entries;
1639 };
1640 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1641 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1642 static PyCodeObject *__pyx_find_code_object(int code_line);
1643 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1644 
1645 /* AddTraceback.proto */
1646 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1647                                int py_line, const char *filename);
1648 
1649 /* BufferStructDeclare.proto */
1650 typedef struct {
1651   Py_ssize_t shape, strides, suboffsets;
1652 } __Pyx_Buf_DimInfo;
1653 typedef struct {
1654   size_t refcount;
1655   Py_buffer pybuffer;
1656 } __Pyx_Buffer;
1657 typedef struct {
1658   __Pyx_Buffer *rcbuffer;
1659   char *data;
1660   __Pyx_Buf_DimInfo diminfo[8];
1661 } __Pyx_LocalBuf_ND;
1662 
1663 #if PY_MAJOR_VERSION < 3
1664     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1665     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1666 #else
1667     #define __Pyx_GetBuffer PyObject_GetBuffer
1668     #define __Pyx_ReleaseBuffer PyBuffer_Release
1669 #endif
1670 
1671 
1672 /* CIntToPy.proto */
1673 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1674 
1675 /* None.proto */
1676 static CYTHON_INLINE long __Pyx_pow_long(long, long);
1677 
1678 /* CIntToPy.proto */
1679 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
1680 
1681 /* Print.proto */
1682 static int __Pyx_Print(PyObject*, PyObject *, int);
1683 #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
1684 static PyObject* __pyx_print = 0;
1685 static PyObject* __pyx_print_kwargs = 0;
1686 #endif
1687 
1688 /* RealImag.proto */
1689 #if CYTHON_CCOMPLEX
1690   #ifdef __cplusplus
1691     #define __Pyx_CREAL(z) ((z).real())
1692     #define __Pyx_CIMAG(z) ((z).imag())
1693   #else
1694     #define __Pyx_CREAL(z) (__real__(z))
1695     #define __Pyx_CIMAG(z) (__imag__(z))
1696   #endif
1697 #else
1698     #define __Pyx_CREAL(z) ((z).real)
1699     #define __Pyx_CIMAG(z) ((z).imag)
1700 #endif
1701 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1702         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1703     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1704     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1705 #else
1706     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1707     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1708 #endif
1709 
1710 /* Arithmetic.proto */
1711 #if CYTHON_CCOMPLEX
1712     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
1713     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
1714     #define __Pyx_c_diff_float(a, b) ((a)-(b))
1715     #define __Pyx_c_prod_float(a, b) ((a)*(b))
1716     #define __Pyx_c_quot_float(a, b) ((a)/(b))
1717     #define __Pyx_c_neg_float(a)     (-(a))
1718   #ifdef __cplusplus
1719     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1720     #define __Pyx_c_conj_float(z)    (::std::conj(z))
1721     #if 1
1722         #define __Pyx_c_abs_float(z)     (::std::abs(z))
1723         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
1724     #endif
1725   #else
1726     #define __Pyx_c_is_zero_float(z) ((z)==0)
1727     #define __Pyx_c_conj_float(z)    (conjf(z))
1728     #if 1
1729         #define __Pyx_c_abs_float(z)     (cabsf(z))
1730         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
1731     #endif
1732  #endif
1733 #else
1734     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1735     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1736     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1737     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1738     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1739     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1740     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1741     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1742     #if 1
1743         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1744         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1745     #endif
1746 #endif
1747 
1748 /* Arithmetic.proto */
1749 #if CYTHON_CCOMPLEX
1750     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
1751     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
1752     #define __Pyx_c_diff_double(a, b) ((a)-(b))
1753     #define __Pyx_c_prod_double(a, b) ((a)*(b))
1754     #define __Pyx_c_quot_double(a, b) ((a)/(b))
1755     #define __Pyx_c_neg_double(a)     (-(a))
1756   #ifdef __cplusplus
1757     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1758     #define __Pyx_c_conj_double(z)    (::std::conj(z))
1759     #if 1
1760         #define __Pyx_c_abs_double(z)     (::std::abs(z))
1761         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
1762     #endif
1763   #else
1764     #define __Pyx_c_is_zero_double(z) ((z)==0)
1765     #define __Pyx_c_conj_double(z)    (conj(z))
1766     #if 1
1767         #define __Pyx_c_abs_double(z)     (cabs(z))
1768         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
1769     #endif
1770  #endif
1771 #else
1772     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1773     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1774     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1775     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1776     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1777     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1778     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1779     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1780     #if 1
1781         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1782         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1783     #endif
1784 #endif
1785 
1786 /* CIntToPy.proto */
1787 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1788 
1789 /* CIntFromPy.proto */
1790 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1791 
1792 /* PrintOne.proto */
1793 static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
1794 
1795 /* CIntToPy.proto */
1796 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1797 
1798 /* CIntFromPy.proto */
1799 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1800 
1801 /* FastTypeChecks.proto */
1802 #if CYTHON_COMPILING_IN_CPYTHON
1803 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1804 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1805 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1806 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1807 #else
1808 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1809 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1810 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1811 #endif
1812 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1813 
1814 /* CheckBinaryVersion.proto */
1815 static int __Pyx_check_binary_version(void);
1816 
1817 /* InitStrings.proto */
1818 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1819 
1820 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_add_to_position(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__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, PyObject *__pyx_v_treecode); /* proto*/
1821 static struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_find_on_root_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, __pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_level); /* proto*/
1822 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_count_at_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node, int __pyx_v_level); /* proto*/
1823 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fill_from_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node, int __pyx_v_level, __pyx_t_5numpy_int64_t __pyx_v_curpos, __pyx_t_5numpy_int64_t *__pyx_v_pdata, __pyx_t_5numpy_float64_t *__pyx_v_vdata, __pyx_t_5numpy_float64_t *__pyx_v_wdata); /* proto*/
1824 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_node_separation(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node1, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node2); /* proto*/
1825 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_opening_angle(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node1, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node2); /* proto*/
1826 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_next(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node, int __pyx_v_treecode); /* proto*/
1827 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_up_next(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node); /* proto*/
1828 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_main(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, __pyx_t_5numpy_float64_t __pyx_v_potential, int __pyx_v_truncate, __pyx_t_5numpy_float64_t __pyx_v_kinetic); /* proto*/
1829 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node); /* proto*/
1830 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID_on_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node); /* proto*/
1831 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_print_node_info(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node); /* proto*/
1832 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_iterate_print_nodes(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node); /* proto*/
1833 
1834 /* Module declarations from 'cython' */
1835 
1836 /* Module declarations from 'cpython.buffer' */
1837 
1838 /* Module declarations from 'libc.string' */
1839 
1840 /* Module declarations from 'libc.stdio' */
1841 
1842 /* Module declarations from '__builtin__' */
1843 
1844 /* Module declarations from 'cpython.type' */
1845 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1846 
1847 /* Module declarations from 'cpython' */
1848 
1849 /* Module declarations from 'cpython.object' */
1850 
1851 /* Module declarations from 'cpython.ref' */
1852 
1853 /* Module declarations from 'cpython.mem' */
1854 
1855 /* Module declarations from 'numpy' */
1856 
1857 /* Module declarations from 'numpy' */
1858 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1859 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1860 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1861 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1862 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1863 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1864 
1865 /* Module declarations from 'libc.stdlib' */
1866 
1867 /* Module declarations from 'yt.utilities.lib.fp_utils' */
1868 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
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_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
1871 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*/
1872 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
1873 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
1874 
1875 /* Module declarations from 'yt.utilities.lib.basic_octree' */
1876 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_12basic_octree_Octree = 0;
1877 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_f64max(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
1878 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_add_value(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int, int); /*proto*/
1879 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_refine(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_refine *__pyx_optional_args); /*proto*/
1880 static struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_initialize(__pyx_t_5numpy_int64_t *, int, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, int, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_initialize *__pyx_optional_args); /*proto*/
1881 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_free(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *); /*proto*/
1882 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 };
1883 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 };
1884 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 };
1885 #define __Pyx_MODULE_NAME "yt.utilities.lib.basic_octree"
1886 extern int __pyx_module_is_main_yt__utilities__lib__basic_octree;
1887 int __pyx_module_is_main_yt__utilities__lib__basic_octree = 0;
1888 
1889 /* Implementation of 'yt.utilities.lib.basic_octree' */
1890 static PyObject *__pyx_builtin_range;
1891 static PyObject *__pyx_builtin_TypeError;
1892 static PyObject *__pyx_builtin_ValueError;
1893 static PyObject *__pyx_builtin_RuntimeError;
1894 static PyObject *__pyx_builtin_ImportError;
1895 static const char __pyx_k_[] = "";
1896 static const char __pyx_k_1[] = "-1\t";
1897 static const char __pyx_k_d[] = "%d\t";
1898 static const char __pyx_k_f[] = "%f\t";
1899 static const char __pyx_k_cm[] = "cm";
1900 static const char __pyx_k_np[] = "np";
1901 static const char __pyx_k_d_2[] = "%d,";
1902 static const char __pyx_k_end[] = "end";
1903 static const char __pyx_k_pxs[] = "pxs";
1904 static const char __pyx_k_pys[] = "pys";
1905 static const char __pyx_k_pzs[] = "pzs";
1906 static const char __pyx_k_s_s[] = "%s\t%s\t";
1907 static const char __pyx_k_sys[] = "sys";
1908 static const char __pyx_k_1_5e[] = "%1.5e\t";
1909 static const char __pyx_k_file[] = "file";
1910 static const char __pyx_k_main[] = "__main__";
1911 static const char __pyx_k_name[] = "__name__";
1912 static const char __pyx_k_test[] = "__test__";
1913 static const char __pyx_k_time[] = "time";
1914 static const char __pyx_k_dtype[] = "dtype";
1915 static const char __pyx_k_flush[] = "flush";
1916 static const char __pyx_k_int64[] = "int64";
1917 static const char __pyx_k_level[] = "level";
1918 static const char __pyx_k_numpy[] = "numpy";
1919 static const char __pyx_k_nvals[] = "nvals";
1920 static const char __pyx_k_print[] = "print";
1921 static const char __pyx_k_pvals[] = "pvals";
1922 static const char __pyx_k_range[] = "range";
1923 static const char __pyx_k_units[] = "units";
1924 static const char __pyx_k_val_d[] = "val%d\t\t";
1925 static const char __pyx_k_wvals[] = "wvals";
1926 static const char __pyx_k_zeros[] = "zeros";
1927 static const char __pyx_k_Octree[] = "Octree";
1928 static const char __pyx_k_import[] = "__import__";
1929 static const char __pyx_k_reduce[] = "__reduce__";
1930 static const char __pyx_k_stderr[] = "stderr";
1931 static const char __pyx_k_stdout[] = "stdout";
1932 static const char __pyx_k_d_d_d_d[] = "%d\t%d\t%d\t%d\t";
1933 static const char __pyx_k_float64[] = "float64";
1934 static const char __pyx_k_kinetic[] = "kinetic";
1935 static const char __pyx_k_root_dx[] = "root_dx";
1936 static const char __pyx_k_getstate[] = "__getstate__";
1937 static const char __pyx_k_setstate[] = "__setstate__";
1938 static const char __pyx_k_treecode[] = "treecode";
1939 static const char __pyx_k_truncate[] = "truncate";
1940 static const char __pyx_k_TypeError[] = "TypeError";
1941 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1942 static const char __pyx_k_Truncating[] = "Truncating...";
1943 static const char __pyx_k_ValueError[] = "ValueError";
1944 static const char __pyx_k_count_only[] = "count_only";
1945 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1946 static const char __pyx_k_ImportError[] = "ImportError";
1947 static const char __pyx_k_code_length[] = "code_length";
1948 static const char __pyx_k_incremental[] = "incremental";
1949 static const char __pyx_k_start_index[] = "start_index";
1950 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1951 static const char __pyx_k_pweight_vals[] = "pweight_vals";
1952 static const char __pyx_k_opening_angle[] = "opening_angle";
1953 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1954 static const char __pyx_k_top_grid_dims[] = "top_grid_dims";
1955 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1956 static const char __pyx_k_convert_to_units[] = "convert_to_units";
1957 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1958 static const char __pyx_k_ID_next_up_n_level_x_y_z[] = "ID\tnext\tup_n\tlevel\tx\ty\tz\t";
1959 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1960 static const char __pyx_k_weight_child_parent_children[] = "weight\t\tchild?\tparent?\tchildren";
1961 static const char __pyx_k_A_refine_by_two_AMR_specific_oc[] = "\nA refine-by-two AMR-specific octree\n\n\n\n";
1962 static const char __pyx_k_Octree_print_all_nodes_line_561[] = "Octree.print_all_nodes (line 561)";
1963 static const char __pyx_k_Prints_out_information_about_al[] = "\n        Prints out information about all the nodes in the octree.\n\n        Parameters\n        ----------\n        None.\n\n        Examples\n        --------\n        >>> octree.print_all_nodes()\n        (many lines of data)\n        ";
1964 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1965 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1966 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1967 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1968 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1969 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
1970 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1971 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1972 static PyObject *__pyx_kp_s_;
1973 static PyObject *__pyx_kp_s_1;
1974 static PyObject *__pyx_kp_s_1_5e;
1975 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1976 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1977 static PyObject *__pyx_kp_s_ID_next_up_n_level_x_y_z;
1978 static PyObject *__pyx_n_s_ImportError;
1979 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1980 static PyObject *__pyx_n_s_Octree;
1981 static PyObject *__pyx_kp_u_Octree_print_all_nodes_line_561;
1982 static PyObject *__pyx_kp_u_Prints_out_information_about_al;
1983 static PyObject *__pyx_n_s_RuntimeError;
1984 static PyObject *__pyx_kp_s_Truncating;
1985 static PyObject *__pyx_n_s_TypeError;
1986 static PyObject *__pyx_n_s_ValueError;
1987 static PyObject *__pyx_n_s_cline_in_traceback;
1988 static PyObject *__pyx_n_s_cm;
1989 static PyObject *__pyx_n_s_code_length;
1990 static PyObject *__pyx_n_s_convert_to_units;
1991 static PyObject *__pyx_n_s_count_only;
1992 static PyObject *__pyx_kp_s_d;
1993 static PyObject *__pyx_kp_s_d_2;
1994 static PyObject *__pyx_kp_s_d_d_d_d;
1995 static PyObject *__pyx_n_s_dtype;
1996 static PyObject *__pyx_n_s_end;
1997 static PyObject *__pyx_kp_s_f;
1998 static PyObject *__pyx_n_s_file;
1999 static PyObject *__pyx_n_s_float64;
2000 static PyObject *__pyx_n_s_flush;
2001 static PyObject *__pyx_n_s_getstate;
2002 static PyObject *__pyx_n_s_import;
2003 static PyObject *__pyx_n_s_incremental;
2004 static PyObject *__pyx_n_s_int64;
2005 static PyObject *__pyx_n_s_kinetic;
2006 static PyObject *__pyx_n_s_level;
2007 static PyObject *__pyx_n_s_main;
2008 static PyObject *__pyx_n_s_name;
2009 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2010 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2011 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2012 static PyObject *__pyx_n_s_np;
2013 static PyObject *__pyx_n_s_numpy;
2014 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2015 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2016 static PyObject *__pyx_n_s_nvals;
2017 static PyObject *__pyx_n_s_opening_angle;
2018 static PyObject *__pyx_n_s_print;
2019 static PyObject *__pyx_n_s_pvals;
2020 static PyObject *__pyx_n_s_pweight_vals;
2021 static PyObject *__pyx_n_s_pxs;
2022 static PyObject *__pyx_n_s_pys;
2023 static PyObject *__pyx_n_s_pyx_vtable;
2024 static PyObject *__pyx_n_s_pzs;
2025 static PyObject *__pyx_n_s_range;
2026 static PyObject *__pyx_n_s_reduce;
2027 static PyObject *__pyx_n_s_reduce_cython;
2028 static PyObject *__pyx_n_s_reduce_ex;
2029 static PyObject *__pyx_n_s_root_dx;
2030 static PyObject *__pyx_kp_s_s_s;
2031 static PyObject *__pyx_n_s_setstate;
2032 static PyObject *__pyx_n_s_setstate_cython;
2033 static PyObject *__pyx_n_s_start_index;
2034 static PyObject *__pyx_n_s_stderr;
2035 static PyObject *__pyx_n_s_stdout;
2036 static PyObject *__pyx_n_s_sys;
2037 static PyObject *__pyx_n_s_test;
2038 static PyObject *__pyx_n_s_time;
2039 static PyObject *__pyx_n_s_top_grid_dims;
2040 static PyObject *__pyx_n_s_treecode;
2041 static PyObject *__pyx_n_s_truncate;
2042 static PyObject *__pyx_n_s_units;
2043 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2044 static PyObject *__pyx_kp_s_val_d;
2045 static PyObject *__pyx_kp_s_weight_child_parent_children;
2046 static PyObject *__pyx_n_s_wvals;
2047 static PyObject *__pyx_n_s_zeros;
2048 static int __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree___cinit__(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, PyArrayObject *__pyx_v_top_grid_dims, int __pyx_v_nvals, int __pyx_v_incremental); /* proto */
2049 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_2add_array_to_tree(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_level, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_pzs, PyArrayObject *__pyx_v_pvals, PyArrayObject *__pyx_v_pweight_vals, int __pyx_v_treecode); /* proto */
2050 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_4add_grid_to_tree(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, CYTHON_UNUSED int __pyx_v_level, CYTHON_UNUSED PyArrayObject *__pyx_v_start_index, CYTHON_UNUSED PyArrayObject *__pyx_v_pvals, CYTHON_UNUSED PyArrayObject *__pyx_v_wvals, CYTHON_UNUSED PyArrayObject *__pyx_v_cm); /* proto */
2051 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_6get_all_from_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_level, int __pyx_v_count_only); /* proto */
2052 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_8finalize(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_treecode); /* proto */
2053 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_10find_binding_energy(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_truncate, __pyx_t_5numpy_float64_t __pyx_v_kinetic, PyArrayObject *__pyx_v_root_dx, float __pyx_v_opening_angle); /* proto */
2054 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_12print_all_nodes(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self); /* proto */
2055 static void __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_14__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self); /* proto */
2056 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self); /* proto */
2057 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2058 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2059 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2060 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_12basic_octree_Octree(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2061 static PyObject *__pyx_int_3;
2062 static PyObject *__pyx_tuple__2;
2063 static PyObject *__pyx_tuple__3;
2064 static PyObject *__pyx_tuple__4;
2065 static PyObject *__pyx_tuple__5;
2066 static PyObject *__pyx_tuple__6;
2067 static PyObject *__pyx_tuple__7;
2068 static PyObject *__pyx_tuple__8;
2069 static PyObject *__pyx_tuple__9;
2070 static PyObject *__pyx_tuple__10;
2071 /* Late includes */
2072 
2073 /* "yt/utilities/lib/basic_octree.pyx":34
2074  *     double sqrt(double x)
2075  *
2076  * cdef inline np.float64_t f64max(np.float64_t f0, np.float64_t f1):             # <<<<<<<<<<<<<<
2077  *     if f0 > f1: return f0
2078  *     return f1
2079  */
2080 
__pyx_f_2yt_9utilities_3lib_12basic_octree_f64max(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)2081 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_f64max(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
2082   __pyx_t_5numpy_float64_t __pyx_r;
2083   __Pyx_RefNannyDeclarations
2084   int __pyx_t_1;
2085   __Pyx_RefNannySetupContext("f64max", 0);
2086 
2087   /* "yt/utilities/lib/basic_octree.pyx":35
2088  *
2089  * cdef inline np.float64_t f64max(np.float64_t f0, np.float64_t f1):
2090  *     if f0 > f1: return f0             # <<<<<<<<<<<<<<
2091  *     return f1
2092  *
2093  */
2094   __pyx_t_1 = ((__pyx_v_f0 > __pyx_v_f1) != 0);
2095   if (__pyx_t_1) {
2096     __pyx_r = __pyx_v_f0;
2097     goto __pyx_L0;
2098   }
2099 
2100   /* "yt/utilities/lib/basic_octree.pyx":36
2101  * cdef inline np.float64_t f64max(np.float64_t f0, np.float64_t f1):
2102  *     if f0 > f1: return f0
2103  *     return f1             # <<<<<<<<<<<<<<
2104  *
2105  * cdef struct OctreeNode:
2106  */
2107   __pyx_r = __pyx_v_f1;
2108   goto __pyx_L0;
2109 
2110   /* "yt/utilities/lib/basic_octree.pyx":34
2111  *     double sqrt(double x)
2112  *
2113  * cdef inline np.float64_t f64max(np.float64_t f0, np.float64_t f1):             # <<<<<<<<<<<<<<
2114  *     if f0 > f1: return f0
2115  *     return f1
2116  */
2117 
2118   /* function exit code */
2119   __pyx_L0:;
2120   __Pyx_RefNannyFinishContext();
2121   return __pyx_r;
2122 }
2123 
2124 /* "yt/utilities/lib/basic_octree.pyx":50
2125  *     OctreeNode *up_next
2126  *
2127  * cdef void OTN_add_value(OctreeNode *self,             # <<<<<<<<<<<<<<
2128  *         np.float64_t *val, np.float64_t weight_val, int level, int treecode):
2129  *     cdef int i
2130  */
2131 
__pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_add_value(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_self,__pyx_t_5numpy_float64_t * __pyx_v_val,__pyx_t_5numpy_float64_t __pyx_v_weight_val,int __pyx_v_level,int __pyx_v_treecode)2132 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_add_value(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_self, __pyx_t_5numpy_float64_t *__pyx_v_val, __pyx_t_5numpy_float64_t __pyx_v_weight_val, int __pyx_v_level, int __pyx_v_treecode) {
2133   int __pyx_v_i;
2134   __Pyx_RefNannyDeclarations
2135   int __pyx_t_1;
2136   int __pyx_t_2;
2137   int __pyx_t_3;
2138   int __pyx_t_4;
2139   int __pyx_t_5;
2140   int __pyx_t_6;
2141   __Pyx_RefNannySetupContext("OTN_add_value", 0);
2142 
2143   /* "yt/utilities/lib/basic_octree.pyx":53
2144  *         np.float64_t *val, np.float64_t weight_val, int level, int treecode):
2145  *     cdef int i
2146  *     for i in range(self.nvals):             # <<<<<<<<<<<<<<
2147  *         self.val[i] += val[i]
2148  *     self.weight_val += weight_val
2149  */
2150   __pyx_t_1 = __pyx_v_self->nvals;
2151   __pyx_t_2 = __pyx_t_1;
2152   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2153     __pyx_v_i = __pyx_t_3;
2154 
2155     /* "yt/utilities/lib/basic_octree.pyx":54
2156  *     cdef int i
2157  *     for i in range(self.nvals):
2158  *         self.val[i] += val[i]             # <<<<<<<<<<<<<<
2159  *     self.weight_val += weight_val
2160  *     if treecode and val[0] > 0.:
2161  */
2162     __pyx_t_4 = __pyx_v_i;
2163     (__pyx_v_self->val[__pyx_t_4]) = ((__pyx_v_self->val[__pyx_t_4]) + (__pyx_v_val[__pyx_v_i]));
2164   }
2165 
2166   /* "yt/utilities/lib/basic_octree.pyx":55
2167  *     for i in range(self.nvals):
2168  *         self.val[i] += val[i]
2169  *     self.weight_val += weight_val             # <<<<<<<<<<<<<<
2170  *     if treecode and val[0] > 0.:
2171  *         self.max_level = imax(self.max_level, level)
2172  */
2173   __pyx_v_self->weight_val = (__pyx_v_self->weight_val + __pyx_v_weight_val);
2174 
2175   /* "yt/utilities/lib/basic_octree.pyx":56
2176  *         self.val[i] += val[i]
2177  *     self.weight_val += weight_val
2178  *     if treecode and val[0] > 0.:             # <<<<<<<<<<<<<<
2179  *         self.max_level = imax(self.max_level, level)
2180  *
2181  */
2182   __pyx_t_6 = (__pyx_v_treecode != 0);
2183   if (__pyx_t_6) {
2184   } else {
2185     __pyx_t_5 = __pyx_t_6;
2186     goto __pyx_L6_bool_binop_done;
2187   }
2188   __pyx_t_6 = (((__pyx_v_val[0]) > 0.) != 0);
2189   __pyx_t_5 = __pyx_t_6;
2190   __pyx_L6_bool_binop_done:;
2191   if (__pyx_t_5) {
2192 
2193     /* "yt/utilities/lib/basic_octree.pyx":57
2194  *     self.weight_val += weight_val
2195  *     if treecode and val[0] > 0.:
2196  *         self.max_level = imax(self.max_level, level)             # <<<<<<<<<<<<<<
2197  *
2198  * cdef void OTN_refine(OctreeNode *self, int incremental = 0):
2199  */
2200     __pyx_v_self->max_level = __pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_v_self->max_level, __pyx_v_level);
2201 
2202     /* "yt/utilities/lib/basic_octree.pyx":56
2203  *         self.val[i] += val[i]
2204  *     self.weight_val += weight_val
2205  *     if treecode and val[0] > 0.:             # <<<<<<<<<<<<<<
2206  *         self.max_level = imax(self.max_level, level)
2207  *
2208  */
2209   }
2210 
2211   /* "yt/utilities/lib/basic_octree.pyx":50
2212  *     OctreeNode *up_next
2213  *
2214  * cdef void OTN_add_value(OctreeNode *self,             # <<<<<<<<<<<<<<
2215  *         np.float64_t *val, np.float64_t weight_val, int level, int treecode):
2216  *     cdef int i
2217  */
2218 
2219   /* function exit code */
2220   __Pyx_RefNannyFinishContext();
2221 }
2222 
2223 /* "yt/utilities/lib/basic_octree.pyx":59
2224  *         self.max_level = imax(self.max_level, level)
2225  *
2226  * cdef void OTN_refine(OctreeNode *self, int incremental = 0):             # <<<<<<<<<<<<<<
2227  *     cdef int i, j, k
2228  *     cdef np.int64_t npos[3]
2229  */
2230 
__pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_refine(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_self,struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_refine * __pyx_optional_args)2231 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_refine(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_self, struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_refine *__pyx_optional_args) {
2232   int __pyx_v_incremental = ((int)0);
2233   int __pyx_v_i;
2234   int __pyx_v_j;
2235   int __pyx_v_k;
2236   __pyx_t_5numpy_int64_t __pyx_v_npos[3];
2237   __Pyx_RefNannyDeclarations
2238   int __pyx_t_1;
2239   int __pyx_t_2;
2240   int __pyx_t_3;
2241   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_t_4;
2242   struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_initialize __pyx_t_5;
2243   int __pyx_t_6;
2244   __Pyx_RefNannySetupContext("OTN_refine", 0);
2245   if (__pyx_optional_args) {
2246     if (__pyx_optional_args->__pyx_n > 0) {
2247       __pyx_v_incremental = __pyx_optional_args->incremental;
2248     }
2249   }
2250 
2251   /* "yt/utilities/lib/basic_octree.pyx":62
2252  *     cdef int i, j, k
2253  *     cdef np.int64_t npos[3]
2254  *     for i in range(2):             # <<<<<<<<<<<<<<
2255  *         npos[0] = self.pos[0] * 2 + i
2256  *         for j in range(2):
2257  */
2258   for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
2259     __pyx_v_i = __pyx_t_1;
2260 
2261     /* "yt/utilities/lib/basic_octree.pyx":63
2262  *     cdef np.int64_t npos[3]
2263  *     for i in range(2):
2264  *         npos[0] = self.pos[0] * 2 + i             # <<<<<<<<<<<<<<
2265  *         for j in range(2):
2266  *             npos[1] = self.pos[1] * 2 + j
2267  */
2268     (__pyx_v_npos[0]) = (((__pyx_v_self->pos[0]) * 2) + __pyx_v_i);
2269 
2270     /* "yt/utilities/lib/basic_octree.pyx":64
2271  *     for i in range(2):
2272  *         npos[0] = self.pos[0] * 2 + i
2273  *         for j in range(2):             # <<<<<<<<<<<<<<
2274  *             npos[1] = self.pos[1] * 2 + j
2275  *             # We have to be careful with allocation...
2276  */
2277     for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
2278       __pyx_v_j = __pyx_t_2;
2279 
2280       /* "yt/utilities/lib/basic_octree.pyx":65
2281  *         npos[0] = self.pos[0] * 2 + i
2282  *         for j in range(2):
2283  *             npos[1] = self.pos[1] * 2 + j             # <<<<<<<<<<<<<<
2284  *             # We have to be careful with allocation...
2285  *             for k in range(2):
2286  */
2287       (__pyx_v_npos[1]) = (((__pyx_v_self->pos[1]) * 2) + __pyx_v_j);
2288 
2289       /* "yt/utilities/lib/basic_octree.pyx":67
2290  *             npos[1] = self.pos[1] * 2 + j
2291  *             # We have to be careful with allocation...
2292  *             for k in range(2):             # <<<<<<<<<<<<<<
2293  *                 npos[2] = self.pos[2] * 2 + k
2294  *                 self.children[i][j][k] = OTN_initialize(
2295  */
2296       for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
2297         __pyx_v_k = __pyx_t_3;
2298 
2299         /* "yt/utilities/lib/basic_octree.pyx":68
2300  *             # We have to be careful with allocation...
2301  *             for k in range(2):
2302  *                 npos[2] = self.pos[2] * 2 + k             # <<<<<<<<<<<<<<
2303  *                 self.children[i][j][k] = OTN_initialize(
2304  *                             npos,
2305  */
2306         (__pyx_v_npos[2]) = (((__pyx_v_self->pos[2]) * 2) + __pyx_v_k);
2307 
2308         /* "yt/utilities/lib/basic_octree.pyx":69
2309  *             for k in range(2):
2310  *                 npos[2] = self.pos[2] * 2 + k
2311  *                 self.children[i][j][k] = OTN_initialize(             # <<<<<<<<<<<<<<
2312  *                             npos,
2313  *                             self.nvals, self.val, self.weight_val,
2314  */
2315         __pyx_t_5.__pyx_n = 1;
2316         __pyx_t_5.incremental = __pyx_v_incremental;
2317         __pyx_t_4 = __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_initialize(__pyx_v_npos, __pyx_v_self->nvals, __pyx_v_self->val, __pyx_v_self->weight_val, (__pyx_v_self->level + 1), __pyx_v_self, &__pyx_t_5);
2318         (((__pyx_v_self->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]) = __pyx_t_4;
2319       }
2320     }
2321   }
2322 
2323   /* "yt/utilities/lib/basic_octree.pyx":73
2324  *                             self.nvals, self.val, self.weight_val,
2325  *                             self.level + 1, self, incremental)
2326  *     if incremental: return             # <<<<<<<<<<<<<<
2327  *     for i in range(self.nvals): self.val[i] = 0.0
2328  *     self.weight_val = 0.0
2329  */
2330   __pyx_t_6 = (__pyx_v_incremental != 0);
2331   if (__pyx_t_6) {
2332     goto __pyx_L0;
2333   }
2334 
2335   /* "yt/utilities/lib/basic_octree.pyx":74
2336  *                             self.level + 1, self, incremental)
2337  *     if incremental: return
2338  *     for i in range(self.nvals): self.val[i] = 0.0             # <<<<<<<<<<<<<<
2339  *     self.weight_val = 0.0
2340  *
2341  */
2342   __pyx_t_1 = __pyx_v_self->nvals;
2343   __pyx_t_2 = __pyx_t_1;
2344   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2345     __pyx_v_i = __pyx_t_3;
2346     (__pyx_v_self->val[__pyx_v_i]) = 0.0;
2347   }
2348 
2349   /* "yt/utilities/lib/basic_octree.pyx":75
2350  *     if incremental: return
2351  *     for i in range(self.nvals): self.val[i] = 0.0
2352  *     self.weight_val = 0.0             # <<<<<<<<<<<<<<
2353  *
2354  * cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals,
2355  */
2356   __pyx_v_self->weight_val = 0.0;
2357 
2358   /* "yt/utilities/lib/basic_octree.pyx":59
2359  *         self.max_level = imax(self.max_level, level)
2360  *
2361  * cdef void OTN_refine(OctreeNode *self, int incremental = 0):             # <<<<<<<<<<<<<<
2362  *     cdef int i, j, k
2363  *     cdef np.int64_t npos[3]
2364  */
2365 
2366   /* function exit code */
2367   __pyx_L0:;
2368   __Pyx_RefNannyFinishContext();
2369 }
2370 
2371 /* "yt/utilities/lib/basic_octree.pyx":77
2372  *     self.weight_val = 0.0
2373  *
2374  * cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals,             # <<<<<<<<<<<<<<
2375  *                         np.float64_t *val, np.float64_t weight_val,
2376  *                         int level, OctreeNode *parent, int incremental = 0):
2377  */
2378 
__pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_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,int __pyx_v_level,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_parent,struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_initialize * __pyx_optional_args)2379 static struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_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, int __pyx_v_level, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_parent, struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_initialize *__pyx_optional_args) {
2380   int __pyx_v_incremental = ((int)0);
2381   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node;
2382   int __pyx_v_i;
2383   int __pyx_v_j;
2384   int __pyx_v_k;
2385   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_r;
2386   __Pyx_RefNannyDeclarations
2387   int __pyx_t_1;
2388   int __pyx_t_2;
2389   int __pyx_t_3;
2390   int __pyx_t_4;
2391   __Pyx_RefNannySetupContext("OTN_initialize", 0);
2392   if (__pyx_optional_args) {
2393     if (__pyx_optional_args->__pyx_n > 0) {
2394       __pyx_v_incremental = __pyx_optional_args->incremental;
2395     }
2396   }
2397 
2398   /* "yt/utilities/lib/basic_octree.pyx":82
2399  *     cdef OctreeNode *node
2400  *     cdef int i, j, k
2401  *     node = <OctreeNode *> malloc(sizeof(OctreeNode))             # <<<<<<<<<<<<<<
2402  *     node.pos[0] = pos[0]
2403  *     node.pos[1] = pos[1]
2404  */
2405   __pyx_v_node = ((struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode))));
2406 
2407   /* "yt/utilities/lib/basic_octree.pyx":83
2408  *     cdef int i, j, k
2409  *     node = <OctreeNode *> malloc(sizeof(OctreeNode))
2410  *     node.pos[0] = pos[0]             # <<<<<<<<<<<<<<
2411  *     node.pos[1] = pos[1]
2412  *     node.pos[2] = pos[2]
2413  */
2414   (__pyx_v_node->pos[0]) = (__pyx_v_pos[0]);
2415 
2416   /* "yt/utilities/lib/basic_octree.pyx":84
2417  *     node = <OctreeNode *> malloc(sizeof(OctreeNode))
2418  *     node.pos[0] = pos[0]
2419  *     node.pos[1] = pos[1]             # <<<<<<<<<<<<<<
2420  *     node.pos[2] = pos[2]
2421  *     node.nvals = nvals
2422  */
2423   (__pyx_v_node->pos[1]) = (__pyx_v_pos[1]);
2424 
2425   /* "yt/utilities/lib/basic_octree.pyx":85
2426  *     node.pos[0] = pos[0]
2427  *     node.pos[1] = pos[1]
2428  *     node.pos[2] = pos[2]             # <<<<<<<<<<<<<<
2429  *     node.nvals = nvals
2430  *     node.parent = parent
2431  */
2432   (__pyx_v_node->pos[2]) = (__pyx_v_pos[2]);
2433 
2434   /* "yt/utilities/lib/basic_octree.pyx":86
2435  *     node.pos[1] = pos[1]
2436  *     node.pos[2] = pos[2]
2437  *     node.nvals = nvals             # <<<<<<<<<<<<<<
2438  *     node.parent = parent
2439  *     node.next = NULL
2440  */
2441   __pyx_v_node->nvals = __pyx_v_nvals;
2442 
2443   /* "yt/utilities/lib/basic_octree.pyx":87
2444  *     node.pos[2] = pos[2]
2445  *     node.nvals = nvals
2446  *     node.parent = parent             # <<<<<<<<<<<<<<
2447  *     node.next = NULL
2448  *     node.up_next = NULL
2449  */
2450   __pyx_v_node->parent = __pyx_v_parent;
2451 
2452   /* "yt/utilities/lib/basic_octree.pyx":88
2453  *     node.nvals = nvals
2454  *     node.parent = parent
2455  *     node.next = NULL             # <<<<<<<<<<<<<<
2456  *     node.up_next = NULL
2457  *     node.max_level = 0
2458  */
2459   __pyx_v_node->next = NULL;
2460 
2461   /* "yt/utilities/lib/basic_octree.pyx":89
2462  *     node.parent = parent
2463  *     node.next = NULL
2464  *     node.up_next = NULL             # <<<<<<<<<<<<<<
2465  *     node.max_level = 0
2466  *     node.val = <np.float64_t *> malloc(
2467  */
2468   __pyx_v_node->up_next = NULL;
2469 
2470   /* "yt/utilities/lib/basic_octree.pyx":90
2471  *     node.next = NULL
2472  *     node.up_next = NULL
2473  *     node.max_level = 0             # <<<<<<<<<<<<<<
2474  *     node.val = <np.float64_t *> malloc(
2475  *                 nvals * sizeof(np.float64_t))
2476  */
2477   __pyx_v_node->max_level = 0;
2478 
2479   /* "yt/utilities/lib/basic_octree.pyx":91
2480  *     node.up_next = NULL
2481  *     node.max_level = 0
2482  *     node.val = <np.float64_t *> malloc(             # <<<<<<<<<<<<<<
2483  *                 nvals * sizeof(np.float64_t))
2484  *     if incremental:
2485  */
2486   __pyx_v_node->val = ((__pyx_t_5numpy_float64_t *)malloc((__pyx_v_nvals * (sizeof(__pyx_t_5numpy_float64_t)))));
2487 
2488   /* "yt/utilities/lib/basic_octree.pyx":93
2489  *     node.val = <np.float64_t *> malloc(
2490  *                 nvals * sizeof(np.float64_t))
2491  *     if incremental:             # <<<<<<<<<<<<<<
2492  *         for i in range(nvals):
2493  *             node.val[i] = 0.
2494  */
2495   __pyx_t_1 = (__pyx_v_incremental != 0);
2496   if (__pyx_t_1) {
2497 
2498     /* "yt/utilities/lib/basic_octree.pyx":94
2499  *                 nvals * sizeof(np.float64_t))
2500  *     if incremental:
2501  *         for i in range(nvals):             # <<<<<<<<<<<<<<
2502  *             node.val[i] = 0.
2503  *         node.weight_val = 0.
2504  */
2505     __pyx_t_2 = __pyx_v_nvals;
2506     __pyx_t_3 = __pyx_t_2;
2507     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
2508       __pyx_v_i = __pyx_t_4;
2509 
2510       /* "yt/utilities/lib/basic_octree.pyx":95
2511  *     if incremental:
2512  *         for i in range(nvals):
2513  *             node.val[i] = 0.             # <<<<<<<<<<<<<<
2514  *         node.weight_val = 0.
2515  *     else:
2516  */
2517       (__pyx_v_node->val[__pyx_v_i]) = 0.;
2518     }
2519 
2520     /* "yt/utilities/lib/basic_octree.pyx":96
2521  *         for i in range(nvals):
2522  *             node.val[i] = 0.
2523  *         node.weight_val = 0.             # <<<<<<<<<<<<<<
2524  *     else:
2525  *         for i in range(nvals):
2526  */
2527     __pyx_v_node->weight_val = 0.;
2528 
2529     /* "yt/utilities/lib/basic_octree.pyx":93
2530  *     node.val = <np.float64_t *> malloc(
2531  *                 nvals * sizeof(np.float64_t))
2532  *     if incremental:             # <<<<<<<<<<<<<<
2533  *         for i in range(nvals):
2534  *             node.val[i] = 0.
2535  */
2536     goto __pyx_L3;
2537   }
2538 
2539   /* "yt/utilities/lib/basic_octree.pyx":98
2540  *         node.weight_val = 0.
2541  *     else:
2542  *         for i in range(nvals):             # <<<<<<<<<<<<<<
2543  *             node.val[i] = val[i]
2544  *         node.weight_val = weight_val
2545  */
2546   /*else*/ {
2547     __pyx_t_2 = __pyx_v_nvals;
2548     __pyx_t_3 = __pyx_t_2;
2549     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
2550       __pyx_v_i = __pyx_t_4;
2551 
2552       /* "yt/utilities/lib/basic_octree.pyx":99
2553  *     else:
2554  *         for i in range(nvals):
2555  *             node.val[i] = val[i]             # <<<<<<<<<<<<<<
2556  *         node.weight_val = weight_val
2557  *     for i in range(2):
2558  */
2559       (__pyx_v_node->val[__pyx_v_i]) = (__pyx_v_val[__pyx_v_i]);
2560     }
2561 
2562     /* "yt/utilities/lib/basic_octree.pyx":100
2563  *         for i in range(nvals):
2564  *             node.val[i] = val[i]
2565  *         node.weight_val = weight_val             # <<<<<<<<<<<<<<
2566  *     for i in range(2):
2567  *         for j in range(2):
2568  */
2569     __pyx_v_node->weight_val = __pyx_v_weight_val;
2570   }
2571   __pyx_L3:;
2572 
2573   /* "yt/utilities/lib/basic_octree.pyx":101
2574  *             node.val[i] = val[i]
2575  *         node.weight_val = weight_val
2576  *     for i in range(2):             # <<<<<<<<<<<<<<
2577  *         for j in range(2):
2578  *             for k in range(2):
2579  */
2580   for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
2581     __pyx_v_i = __pyx_t_2;
2582 
2583     /* "yt/utilities/lib/basic_octree.pyx":102
2584  *         node.weight_val = weight_val
2585  *     for i in range(2):
2586  *         for j in range(2):             # <<<<<<<<<<<<<<
2587  *             for k in range(2):
2588  *                 node.children[i][j][k] = NULL
2589  */
2590     for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
2591       __pyx_v_j = __pyx_t_3;
2592 
2593       /* "yt/utilities/lib/basic_octree.pyx":103
2594  *     for i in range(2):
2595  *         for j in range(2):
2596  *             for k in range(2):             # <<<<<<<<<<<<<<
2597  *                 node.children[i][j][k] = NULL
2598  *     node.level = level
2599  */
2600       for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
2601         __pyx_v_k = __pyx_t_4;
2602 
2603         /* "yt/utilities/lib/basic_octree.pyx":104
2604  *         for j in range(2):
2605  *             for k in range(2):
2606  *                 node.children[i][j][k] = NULL             # <<<<<<<<<<<<<<
2607  *     node.level = level
2608  *     return node
2609  */
2610         (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]) = NULL;
2611       }
2612     }
2613   }
2614 
2615   /* "yt/utilities/lib/basic_octree.pyx":105
2616  *             for k in range(2):
2617  *                 node.children[i][j][k] = NULL
2618  *     node.level = level             # <<<<<<<<<<<<<<
2619  *     return node
2620  *
2621  */
2622   __pyx_v_node->level = __pyx_v_level;
2623 
2624   /* "yt/utilities/lib/basic_octree.pyx":106
2625  *                 node.children[i][j][k] = NULL
2626  *     node.level = level
2627  *     return node             # <<<<<<<<<<<<<<
2628  *
2629  * cdef void OTN_free(OctreeNode *node):
2630  */
2631   __pyx_r = __pyx_v_node;
2632   goto __pyx_L0;
2633 
2634   /* "yt/utilities/lib/basic_octree.pyx":77
2635  *     self.weight_val = 0.0
2636  *
2637  * cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals,             # <<<<<<<<<<<<<<
2638  *                         np.float64_t *val, np.float64_t weight_val,
2639  *                         int level, OctreeNode *parent, int incremental = 0):
2640  */
2641 
2642   /* function exit code */
2643   __pyx_L0:;
2644   __Pyx_RefNannyFinishContext();
2645   return __pyx_r;
2646 }
2647 
2648 /* "yt/utilities/lib/basic_octree.pyx":108
2649  *     return node
2650  *
2651  * cdef void OTN_free(OctreeNode *node):             # <<<<<<<<<<<<<<
2652  *     cdef int i, j, k
2653  *     for i in range(2):
2654  */
2655 
__pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_free(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node)2656 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_free(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node) {
2657   int __pyx_v_i;
2658   int __pyx_v_j;
2659   int __pyx_v_k;
2660   __Pyx_RefNannyDeclarations
2661   int __pyx_t_1;
2662   int __pyx_t_2;
2663   int __pyx_t_3;
2664   int __pyx_t_4;
2665   __Pyx_RefNannySetupContext("OTN_free", 0);
2666 
2667   /* "yt/utilities/lib/basic_octree.pyx":110
2668  * cdef void OTN_free(OctreeNode *node):
2669  *     cdef int i, j, k
2670  *     for i in range(2):             # <<<<<<<<<<<<<<
2671  *         for j in range(2):
2672  *             for k in range(2):
2673  */
2674   for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
2675     __pyx_v_i = __pyx_t_1;
2676 
2677     /* "yt/utilities/lib/basic_octree.pyx":111
2678  *     cdef int i, j, k
2679  *     for i in range(2):
2680  *         for j in range(2):             # <<<<<<<<<<<<<<
2681  *             for k in range(2):
2682  *                 if node.children[i][j][k] == NULL: continue
2683  */
2684     for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
2685       __pyx_v_j = __pyx_t_2;
2686 
2687       /* "yt/utilities/lib/basic_octree.pyx":112
2688  *     for i in range(2):
2689  *         for j in range(2):
2690  *             for k in range(2):             # <<<<<<<<<<<<<<
2691  *                 if node.children[i][j][k] == NULL: continue
2692  *                 OTN_free(node.children[i][j][k])
2693  */
2694       for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
2695         __pyx_v_k = __pyx_t_3;
2696 
2697         /* "yt/utilities/lib/basic_octree.pyx":113
2698  *         for j in range(2):
2699  *             for k in range(2):
2700  *                 if node.children[i][j][k] == NULL: continue             # <<<<<<<<<<<<<<
2701  *                 OTN_free(node.children[i][j][k])
2702  *     free(node.val)
2703  */
2704         __pyx_t_4 = (((((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]) == NULL) != 0);
2705         if (__pyx_t_4) {
2706           goto __pyx_L7_continue;
2707         }
2708 
2709         /* "yt/utilities/lib/basic_octree.pyx":114
2710  *             for k in range(2):
2711  *                 if node.children[i][j][k] == NULL: continue
2712  *                 OTN_free(node.children[i][j][k])             # <<<<<<<<<<<<<<
2713  *     free(node.val)
2714  *     free(node)
2715  */
2716         __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_free((((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]));
2717         __pyx_L7_continue:;
2718       }
2719     }
2720   }
2721 
2722   /* "yt/utilities/lib/basic_octree.pyx":115
2723  *                 if node.children[i][j][k] == NULL: continue
2724  *                 OTN_free(node.children[i][j][k])
2725  *     free(node.val)             # <<<<<<<<<<<<<<
2726  *     free(node)
2727  *
2728  */
2729   free(__pyx_v_node->val);
2730 
2731   /* "yt/utilities/lib/basic_octree.pyx":116
2732  *                 OTN_free(node.children[i][j][k])
2733  *     free(node.val)
2734  *     free(node)             # <<<<<<<<<<<<<<
2735  *
2736  * cdef class Octree:
2737  */
2738   free(__pyx_v_node);
2739 
2740   /* "yt/utilities/lib/basic_octree.pyx":108
2741  *     return node
2742  *
2743  * cdef void OTN_free(OctreeNode *node):             # <<<<<<<<<<<<<<
2744  *     cdef int i, j, k
2745  *     for i in range(2):
2746  */
2747 
2748   /* function exit code */
2749   __Pyx_RefNannyFinishContext();
2750 }
2751 
2752 /* "yt/utilities/lib/basic_octree.pyx":131
2753  *     cdef OctreeNode *last_node
2754  *
2755  *     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,             # <<<<<<<<<<<<<<
2756  *                   int nvals, int incremental = False):
2757  *         cdef int i, j, k
2758  */
2759 
2760 /* Python wrapper */
2761 static int __pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2762 static int __pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2763   PyArrayObject *__pyx_v_top_grid_dims = 0;
2764   int __pyx_v_nvals;
2765   int __pyx_v_incremental;
2766   int __pyx_r;
2767   __Pyx_RefNannyDeclarations
2768   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2769   {
2770     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_top_grid_dims,&__pyx_n_s_nvals,&__pyx_n_s_incremental,0};
2771     PyObject* values[3] = {0,0,0};
2772     if (unlikely(__pyx_kwds)) {
2773       Py_ssize_t kw_args;
2774       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2775       switch (pos_args) {
2776         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2777         CYTHON_FALLTHROUGH;
2778         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2779         CYTHON_FALLTHROUGH;
2780         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2781         CYTHON_FALLTHROUGH;
2782         case  0: break;
2783         default: goto __pyx_L5_argtuple_error;
2784       }
2785       kw_args = PyDict_Size(__pyx_kwds);
2786       switch (pos_args) {
2787         case  0:
2788         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_top_grid_dims)) != 0)) kw_args--;
2789         else goto __pyx_L5_argtuple_error;
2790         CYTHON_FALLTHROUGH;
2791         case  1:
2792         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nvals)) != 0)) kw_args--;
2793         else {
2794           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(0, 131, __pyx_L3_error)
2795         }
2796         CYTHON_FALLTHROUGH;
2797         case  2:
2798         if (kw_args > 0) {
2799           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_incremental);
2800           if (value) { values[2] = value; kw_args--; }
2801         }
2802       }
2803       if (unlikely(kw_args > 0)) {
2804         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 131, __pyx_L3_error)
2805       }
2806     } else {
2807       switch (PyTuple_GET_SIZE(__pyx_args)) {
2808         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2809         CYTHON_FALLTHROUGH;
2810         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2811         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2812         break;
2813         default: goto __pyx_L5_argtuple_error;
2814       }
2815     }
2816     __pyx_v_top_grid_dims = ((PyArrayObject *)values[0]);
2817     __pyx_v_nvals = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nvals == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error)
2818     if (values[2]) {
2819       __pyx_v_incremental = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_incremental == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error)
2820     } else {
2821 
2822       /* "yt/utilities/lib/basic_octree.pyx":132
2823  *
2824  *     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
2825  *                   int nvals, int incremental = False):             # <<<<<<<<<<<<<<
2826  *         cdef int i, j, k
2827  *         self.incremental = incremental
2828  */
2829       __pyx_v_incremental = ((int)0);
2830     }
2831   }
2832   goto __pyx_L4_argument_unpacking_done;
2833   __pyx_L5_argtuple_error:;
2834   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 131, __pyx_L3_error)
2835   __pyx_L3_error:;
2836   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2837   __Pyx_RefNannyFinishContext();
2838   return -1;
2839   __pyx_L4_argument_unpacking_done:;
2840   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_top_grid_dims), __pyx_ptype_5numpy_ndarray, 1, "top_grid_dims", 0))) __PYX_ERR(0, 131, __pyx_L1_error)
2841   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), __pyx_v_top_grid_dims, __pyx_v_nvals, __pyx_v_incremental);
2842 
2843   /* "yt/utilities/lib/basic_octree.pyx":131
2844  *     cdef OctreeNode *last_node
2845  *
2846  *     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,             # <<<<<<<<<<<<<<
2847  *                   int nvals, int incremental = False):
2848  *         cdef int i, j, k
2849  */
2850 
2851   /* function exit code */
2852   goto __pyx_L0;
2853   __pyx_L1_error:;
2854   __pyx_r = -1;
2855   __pyx_L0:;
2856   __Pyx_RefNannyFinishContext();
2857   return __pyx_r;
2858 }
2859 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree___cinit__(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,PyArrayObject * __pyx_v_top_grid_dims,int __pyx_v_nvals,int __pyx_v_incremental)2860 static int __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree___cinit__(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, PyArrayObject *__pyx_v_top_grid_dims, int __pyx_v_nvals, int __pyx_v_incremental) {
2861   int __pyx_v_i;
2862   int __pyx_v_j;
2863   int __pyx_v_k;
2864   __pyx_t_5numpy_int64_t __pyx_v_pos[3];
2865   __pyx_t_5numpy_float64_t *__pyx_v_vals;
2866   __pyx_t_5numpy_float64_t __pyx_v_weight_val;
2867   __Pyx_LocalBuf_ND __pyx_pybuffernd_top_grid_dims;
2868   __Pyx_Buffer __pyx_pybuffer_top_grid_dims;
2869   int __pyx_r;
2870   __Pyx_RefNannyDeclarations
2871   int __pyx_t_1;
2872   int __pyx_t_2;
2873   int __pyx_t_3;
2874   Py_ssize_t __pyx_t_4;
2875   Py_ssize_t __pyx_t_5;
2876   Py_ssize_t __pyx_t_6;
2877   Py_ssize_t __pyx_t_7;
2878   Py_ssize_t __pyx_t_8;
2879   __pyx_t_5numpy_int64_t __pyx_t_9;
2880   __pyx_t_5numpy_int64_t __pyx_t_10;
2881   Py_ssize_t __pyx_t_11;
2882   Py_ssize_t __pyx_t_12;
2883   __pyx_t_5numpy_int64_t __pyx_t_13;
2884   __pyx_t_5numpy_int64_t __pyx_t_14;
2885   Py_ssize_t __pyx_t_15;
2886   Py_ssize_t __pyx_t_16;
2887   __pyx_t_5numpy_int64_t __pyx_t_17;
2888   __pyx_t_5numpy_int64_t __pyx_t_18;
2889   __Pyx_RefNannySetupContext("__cinit__", 0);
2890   __pyx_pybuffer_top_grid_dims.pybuffer.buf = NULL;
2891   __pyx_pybuffer_top_grid_dims.refcount = 0;
2892   __pyx_pybuffernd_top_grid_dims.data = NULL;
2893   __pyx_pybuffernd_top_grid_dims.rcbuffer = &__pyx_pybuffer_top_grid_dims;
2894   {
2895     __Pyx_BufFmt_StackElem __pyx_stack[1];
2896     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, 131, __pyx_L1_error)
2897   }
2898   __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];
2899 
2900   /* "yt/utilities/lib/basic_octree.pyx":134
2901  *                   int nvals, int incremental = False):
2902  *         cdef int i, j, k
2903  *         self.incremental = incremental             # <<<<<<<<<<<<<<
2904  *         cdef np.int64_t pos[3]
2905  *         cdef np.float64_t *vals = <np.float64_t *> alloca(
2906  */
2907   __pyx_v_self->incremental = __pyx_v_incremental;
2908 
2909   /* "yt/utilities/lib/basic_octree.pyx":136
2910  *         self.incremental = incremental
2911  *         cdef np.int64_t pos[3]
2912  *         cdef np.float64_t *vals = <np.float64_t *> alloca(             # <<<<<<<<<<<<<<
2913  *                 sizeof(np.float64_t)*nvals)
2914  *         cdef np.float64_t weight_val = 0.0
2915  */
2916   __pyx_v_vals = ((__pyx_t_5numpy_float64_t *)alloca(((sizeof(__pyx_t_5numpy_float64_t)) * __pyx_v_nvals)));
2917 
2918   /* "yt/utilities/lib/basic_octree.pyx":138
2919  *         cdef np.float64_t *vals = <np.float64_t *> alloca(
2920  *                 sizeof(np.float64_t)*nvals)
2921  *         cdef np.float64_t weight_val = 0.0             # <<<<<<<<<<<<<<
2922  *         self.nvals = nvals
2923  *         for i in range(nvals): vals[i] = 0.0
2924  */
2925   __pyx_v_weight_val = 0.0;
2926 
2927   /* "yt/utilities/lib/basic_octree.pyx":139
2928  *                 sizeof(np.float64_t)*nvals)
2929  *         cdef np.float64_t weight_val = 0.0
2930  *         self.nvals = nvals             # <<<<<<<<<<<<<<
2931  *         for i in range(nvals): vals[i] = 0.0
2932  *
2933  */
2934   __pyx_v_self->nvals = __pyx_v_nvals;
2935 
2936   /* "yt/utilities/lib/basic_octree.pyx":140
2937  *         cdef np.float64_t weight_val = 0.0
2938  *         self.nvals = nvals
2939  *         for i in range(nvals): vals[i] = 0.0             # <<<<<<<<<<<<<<
2940  *
2941  *         self.top_grid_dims[0] = top_grid_dims[0]
2942  */
2943   __pyx_t_1 = __pyx_v_nvals;
2944   __pyx_t_2 = __pyx_t_1;
2945   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2946     __pyx_v_i = __pyx_t_3;
2947     (__pyx_v_vals[__pyx_v_i]) = 0.0;
2948   }
2949 
2950   /* "yt/utilities/lib/basic_octree.pyx":142
2951  *         for i in range(nvals): vals[i] = 0.0
2952  *
2953  *         self.top_grid_dims[0] = top_grid_dims[0]             # <<<<<<<<<<<<<<
2954  *         self.top_grid_dims[1] = top_grid_dims[1]
2955  *         self.top_grid_dims[2] = top_grid_dims[2]
2956  */
2957   __pyx_t_4 = 0;
2958   __pyx_t_1 = -1;
2959   if (__pyx_t_4 < 0) {
2960     __pyx_t_4 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2961     if (unlikely(__pyx_t_4 < 0)) __pyx_t_1 = 0;
2962   } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_1 = 0;
2963   if (unlikely(__pyx_t_1 != -1)) {
2964     __Pyx_RaiseBufferIndexError(__pyx_t_1);
2965     __PYX_ERR(0, 142, __pyx_L1_error)
2966   }
2967   (__pyx_v_self->top_grid_dims[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
2968 
2969   /* "yt/utilities/lib/basic_octree.pyx":143
2970  *
2971  *         self.top_grid_dims[0] = top_grid_dims[0]
2972  *         self.top_grid_dims[1] = top_grid_dims[1]             # <<<<<<<<<<<<<<
2973  *         self.top_grid_dims[2] = top_grid_dims[2]
2974  *
2975  */
2976   __pyx_t_5 = 1;
2977   __pyx_t_1 = -1;
2978   if (__pyx_t_5 < 0) {
2979     __pyx_t_5 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2980     if (unlikely(__pyx_t_5 < 0)) __pyx_t_1 = 0;
2981   } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_1 = 0;
2982   if (unlikely(__pyx_t_1 != -1)) {
2983     __Pyx_RaiseBufferIndexError(__pyx_t_1);
2984     __PYX_ERR(0, 143, __pyx_L1_error)
2985   }
2986   (__pyx_v_self->top_grid_dims[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
2987 
2988   /* "yt/utilities/lib/basic_octree.pyx":144
2989  *         self.top_grid_dims[0] = top_grid_dims[0]
2990  *         self.top_grid_dims[1] = top_grid_dims[1]
2991  *         self.top_grid_dims[2] = top_grid_dims[2]             # <<<<<<<<<<<<<<
2992  *
2993  *         # This wouldn't be necessary if we did bitshifting...
2994  */
2995   __pyx_t_6 = 2;
2996   __pyx_t_1 = -1;
2997   if (__pyx_t_6 < 0) {
2998     __pyx_t_6 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
2999     if (unlikely(__pyx_t_6 < 0)) __pyx_t_1 = 0;
3000   } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_1 = 0;
3001   if (unlikely(__pyx_t_1 != -1)) {
3002     __Pyx_RaiseBufferIndexError(__pyx_t_1);
3003     __PYX_ERR(0, 144, __pyx_L1_error)
3004   }
3005   (__pyx_v_self->top_grid_dims[2]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
3006 
3007   /* "yt/utilities/lib/basic_octree.pyx":147
3008  *
3009  *         # This wouldn't be necessary if we did bitshifting...
3010  *         for i in range(80):             # <<<<<<<<<<<<<<
3011  *             self.po2[i] = 2**i
3012  *         # Cython doesn't seem to like sizeof(OctreeNode ***)
3013  */
3014   for (__pyx_t_1 = 0; __pyx_t_1 < 80; __pyx_t_1+=1) {
3015     __pyx_v_i = __pyx_t_1;
3016 
3017     /* "yt/utilities/lib/basic_octree.pyx":148
3018  *         # This wouldn't be necessary if we did bitshifting...
3019  *         for i in range(80):
3020  *             self.po2[i] = 2**i             # <<<<<<<<<<<<<<
3021  *         # Cython doesn't seem to like sizeof(OctreeNode ***)
3022  *         self.root_nodes = <OctreeNode ****> \
3023  */
3024     (__pyx_v_self->po2[__pyx_v_i]) = __Pyx_pow_long(2, ((long)__pyx_v_i));
3025   }
3026 
3027   /* "yt/utilities/lib/basic_octree.pyx":151
3028  *         # Cython doesn't seem to like sizeof(OctreeNode ***)
3029  *         self.root_nodes = <OctreeNode ****> \
3030  *             malloc(sizeof(void*) * top_grid_dims[0])             # <<<<<<<<<<<<<<
3031  *
3032  *         # We initialize our root values to 0.0.
3033  */
3034   __pyx_t_7 = 0;
3035   __pyx_t_1 = -1;
3036   if (__pyx_t_7 < 0) {
3037     __pyx_t_7 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
3038     if (unlikely(__pyx_t_7 < 0)) __pyx_t_1 = 0;
3039   } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_1 = 0;
3040   if (unlikely(__pyx_t_1 != -1)) {
3041     __Pyx_RaiseBufferIndexError(__pyx_t_1);
3042     __PYX_ERR(0, 151, __pyx_L1_error)
3043   }
3044 
3045   /* "yt/utilities/lib/basic_octree.pyx":150
3046  *             self.po2[i] = 2**i
3047  *         # Cython doesn't seem to like sizeof(OctreeNode ***)
3048  *         self.root_nodes = <OctreeNode ****> \             # <<<<<<<<<<<<<<
3049  *             malloc(sizeof(void*) * top_grid_dims[0])
3050  *
3051  */
3052   __pyx_v_self->root_nodes = ((struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode ****)malloc(((sizeof(void *)) * (*__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)))));
3053 
3054   /* "yt/utilities/lib/basic_octree.pyx":154
3055  *
3056  *         # We initialize our root values to 0.0.
3057  *         for i in range(top_grid_dims[0]):             # <<<<<<<<<<<<<<
3058  *             pos[0] = i
3059  *             self.root_nodes[i] = <OctreeNode ***> \
3060  */
3061   __pyx_t_8 = 0;
3062   __pyx_t_1 = -1;
3063   if (__pyx_t_8 < 0) {
3064     __pyx_t_8 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
3065     if (unlikely(__pyx_t_8 < 0)) __pyx_t_1 = 0;
3066   } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_1 = 0;
3067   if (unlikely(__pyx_t_1 != -1)) {
3068     __Pyx_RaiseBufferIndexError(__pyx_t_1);
3069     __PYX_ERR(0, 154, __pyx_L1_error)
3070   }
3071   __pyx_t_9 = (*__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));
3072   __pyx_t_10 = __pyx_t_9;
3073   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_10; __pyx_t_1+=1) {
3074     __pyx_v_i = __pyx_t_1;
3075 
3076     /* "yt/utilities/lib/basic_octree.pyx":155
3077  *         # We initialize our root values to 0.0.
3078  *         for i in range(top_grid_dims[0]):
3079  *             pos[0] = i             # <<<<<<<<<<<<<<
3080  *             self.root_nodes[i] = <OctreeNode ***> \
3081  *                 malloc(sizeof(OctreeNode **) * top_grid_dims[1])
3082  */
3083     (__pyx_v_pos[0]) = __pyx_v_i;
3084 
3085     /* "yt/utilities/lib/basic_octree.pyx":157
3086  *             pos[0] = i
3087  *             self.root_nodes[i] = <OctreeNode ***> \
3088  *                 malloc(sizeof(OctreeNode **) * top_grid_dims[1])             # <<<<<<<<<<<<<<
3089  *             for j in range(top_grid_dims[1]):
3090  *                 pos[1] = j
3091  */
3092     __pyx_t_11 = 1;
3093     __pyx_t_2 = -1;
3094     if (__pyx_t_11 < 0) {
3095       __pyx_t_11 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
3096       if (unlikely(__pyx_t_11 < 0)) __pyx_t_2 = 0;
3097     } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_2 = 0;
3098     if (unlikely(__pyx_t_2 != -1)) {
3099       __Pyx_RaiseBufferIndexError(__pyx_t_2);
3100       __PYX_ERR(0, 157, __pyx_L1_error)
3101     }
3102 
3103     /* "yt/utilities/lib/basic_octree.pyx":156
3104  *         for i in range(top_grid_dims[0]):
3105  *             pos[0] = i
3106  *             self.root_nodes[i] = <OctreeNode ***> \             # <<<<<<<<<<<<<<
3107  *                 malloc(sizeof(OctreeNode **) * top_grid_dims[1])
3108  *             for j in range(top_grid_dims[1]):
3109  */
3110     (__pyx_v_self->root_nodes[__pyx_v_i]) = ((struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode ***)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode **)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides)))));
3111 
3112     /* "yt/utilities/lib/basic_octree.pyx":158
3113  *             self.root_nodes[i] = <OctreeNode ***> \
3114  *                 malloc(sizeof(OctreeNode **) * top_grid_dims[1])
3115  *             for j in range(top_grid_dims[1]):             # <<<<<<<<<<<<<<
3116  *                 pos[1] = j
3117  *                 self.root_nodes[i][j] = <OctreeNode **> \
3118  */
3119     __pyx_t_12 = 1;
3120     __pyx_t_2 = -1;
3121     if (__pyx_t_12 < 0) {
3122       __pyx_t_12 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
3123       if (unlikely(__pyx_t_12 < 0)) __pyx_t_2 = 0;
3124     } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_2 = 0;
3125     if (unlikely(__pyx_t_2 != -1)) {
3126       __Pyx_RaiseBufferIndexError(__pyx_t_2);
3127       __PYX_ERR(0, 158, __pyx_L1_error)
3128     }
3129     __pyx_t_13 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
3130     __pyx_t_14 = __pyx_t_13;
3131     for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_14; __pyx_t_2+=1) {
3132       __pyx_v_j = __pyx_t_2;
3133 
3134       /* "yt/utilities/lib/basic_octree.pyx":159
3135  *                 malloc(sizeof(OctreeNode **) * top_grid_dims[1])
3136  *             for j in range(top_grid_dims[1]):
3137  *                 pos[1] = j             # <<<<<<<<<<<<<<
3138  *                 self.root_nodes[i][j] = <OctreeNode **> \
3139  *                     malloc(sizeof(OctreeNode *) * top_grid_dims[1])
3140  */
3141       (__pyx_v_pos[1]) = __pyx_v_j;
3142 
3143       /* "yt/utilities/lib/basic_octree.pyx":161
3144  *                 pos[1] = j
3145  *                 self.root_nodes[i][j] = <OctreeNode **> \
3146  *                     malloc(sizeof(OctreeNode *) * top_grid_dims[1])             # <<<<<<<<<<<<<<
3147  *                 for k in range(top_grid_dims[2]):
3148  *                     pos[2] = k
3149  */
3150       __pyx_t_15 = 1;
3151       __pyx_t_3 = -1;
3152       if (__pyx_t_15 < 0) {
3153         __pyx_t_15 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
3154         if (unlikely(__pyx_t_15 < 0)) __pyx_t_3 = 0;
3155       } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_3 = 0;
3156       if (unlikely(__pyx_t_3 != -1)) {
3157         __Pyx_RaiseBufferIndexError(__pyx_t_3);
3158         __PYX_ERR(0, 161, __pyx_L1_error)
3159       }
3160 
3161       /* "yt/utilities/lib/basic_octree.pyx":160
3162  *             for j in range(top_grid_dims[1]):
3163  *                 pos[1] = j
3164  *                 self.root_nodes[i][j] = <OctreeNode **> \             # <<<<<<<<<<<<<<
3165  *                     malloc(sizeof(OctreeNode *) * top_grid_dims[1])
3166  *                 for k in range(top_grid_dims[2]):
3167  */
3168       ((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]) = ((struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode **)malloc(((sizeof(struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides)))));
3169 
3170       /* "yt/utilities/lib/basic_octree.pyx":162
3171  *                 self.root_nodes[i][j] = <OctreeNode **> \
3172  *                     malloc(sizeof(OctreeNode *) * top_grid_dims[1])
3173  *                 for k in range(top_grid_dims[2]):             # <<<<<<<<<<<<<<
3174  *                     pos[2] = k
3175  *                     self.root_nodes[i][j][k] = OTN_initialize(
3176  */
3177       __pyx_t_16 = 2;
3178       __pyx_t_3 = -1;
3179       if (__pyx_t_16 < 0) {
3180         __pyx_t_16 += __pyx_pybuffernd_top_grid_dims.diminfo[0].shape;
3181         if (unlikely(__pyx_t_16 < 0)) __pyx_t_3 = 0;
3182       } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_top_grid_dims.diminfo[0].shape)) __pyx_t_3 = 0;
3183       if (unlikely(__pyx_t_3 != -1)) {
3184         __Pyx_RaiseBufferIndexError(__pyx_t_3);
3185         __PYX_ERR(0, 162, __pyx_L1_error)
3186       }
3187       __pyx_t_17 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_top_grid_dims.diminfo[0].strides));
3188       __pyx_t_18 = __pyx_t_17;
3189       for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_18; __pyx_t_3+=1) {
3190         __pyx_v_k = __pyx_t_3;
3191 
3192         /* "yt/utilities/lib/basic_octree.pyx":163
3193  *                     malloc(sizeof(OctreeNode *) * top_grid_dims[1])
3194  *                 for k in range(top_grid_dims[2]):
3195  *                     pos[2] = k             # <<<<<<<<<<<<<<
3196  *                     self.root_nodes[i][j][k] = OTN_initialize(
3197  *                         pos, nvals, vals, weight_val, 0, NULL)
3198  */
3199         (__pyx_v_pos[2]) = __pyx_v_k;
3200 
3201         /* "yt/utilities/lib/basic_octree.pyx":164
3202  *                 for k in range(top_grid_dims[2]):
3203  *                     pos[2] = k
3204  *                     self.root_nodes[i][j][k] = OTN_initialize(             # <<<<<<<<<<<<<<
3205  *                         pos, nvals, vals, weight_val, 0, NULL)
3206  *
3207  */
3208         (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]) = __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_initialize(__pyx_v_pos, __pyx_v_nvals, __pyx_v_vals, __pyx_v_weight_val, 0, NULL, NULL);
3209       }
3210     }
3211   }
3212 
3213   /* "yt/utilities/lib/basic_octree.pyx":131
3214  *     cdef OctreeNode *last_node
3215  *
3216  *     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,             # <<<<<<<<<<<<<<
3217  *                   int nvals, int incremental = False):
3218  *         cdef int i, j, k
3219  */
3220 
3221   /* function exit code */
3222   __pyx_r = 0;
3223   goto __pyx_L0;
3224   __pyx_L1_error:;
3225   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3226     __Pyx_PyThreadState_declare
3227     __Pyx_PyThreadState_assign
3228     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3229     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer);
3230   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3231   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3232   __pyx_r = -1;
3233   goto __pyx_L2;
3234   __pyx_L0:;
3235   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_top_grid_dims.rcbuffer->pybuffer);
3236   __pyx_L2:;
3237   __Pyx_RefNannyFinishContext();
3238   return __pyx_r;
3239 }
3240 
3241 /* "yt/utilities/lib/basic_octree.pyx":167
3242  *                         pos, nvals, vals, weight_val, 0, NULL)
3243  *
3244  *     cdef void add_to_position(self,             # <<<<<<<<<<<<<<
3245  *                  int level, np.int64_t pos[3],
3246  *                  np.float64_t *val,
3247  */
3248 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_add_to_position(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __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,PyObject * __pyx_v_treecode)3249 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_add_to_position(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__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, PyObject *__pyx_v_treecode) {
3250   int __pyx_v_i;
3251   int __pyx_v_j;
3252   int __pyx_v_k;
3253   int __pyx_v_L;
3254   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node;
3255   __pyx_t_5numpy_int64_t __pyx_v_fac;
3256   __Pyx_RefNannyDeclarations
3257   int __pyx_t_1;
3258   int __pyx_t_2;
3259   int __pyx_t_3;
3260   int __pyx_t_4;
3261   int __pyx_t_5;
3262   struct __pyx_opt_args_2yt_9utilities_3lib_12basic_octree_OTN_refine __pyx_t_6;
3263   __Pyx_RefNannySetupContext("add_to_position", 0);
3264 
3265   /* "yt/utilities/lib/basic_octree.pyx":173
3266  *         cdef int i, j, k, L
3267  *         cdef OctreeNode *node
3268  *         node = self.find_on_root_level(pos, level)             # <<<<<<<<<<<<<<
3269  *         cdef np.int64_t fac
3270  *         for L in range(level):
3271  */
3272   __pyx_v_node = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->find_on_root_level(__pyx_v_self, __pyx_v_pos, __pyx_v_level);
3273 
3274   /* "yt/utilities/lib/basic_octree.pyx":175
3275  *         node = self.find_on_root_level(pos, level)
3276  *         cdef np.int64_t fac
3277  *         for L in range(level):             # <<<<<<<<<<<<<<
3278  *             if self.incremental:
3279  *                 OTN_add_value(node, val, weight_val, level, treecode)
3280  */
3281   __pyx_t_1 = __pyx_v_level;
3282   __pyx_t_2 = __pyx_t_1;
3283   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3284     __pyx_v_L = __pyx_t_3;
3285 
3286     /* "yt/utilities/lib/basic_octree.pyx":176
3287  *         cdef np.int64_t fac
3288  *         for L in range(level):
3289  *             if self.incremental:             # <<<<<<<<<<<<<<
3290  *                 OTN_add_value(node, val, weight_val, level, treecode)
3291  *             if node.children[0][0][0] == NULL:
3292  */
3293     __pyx_t_4 = (__pyx_v_self->incremental != 0);
3294     if (__pyx_t_4) {
3295 
3296       /* "yt/utilities/lib/basic_octree.pyx":177
3297  *         for L in range(level):
3298  *             if self.incremental:
3299  *                 OTN_add_value(node, val, weight_val, level, treecode)             # <<<<<<<<<<<<<<
3300  *             if node.children[0][0][0] == NULL:
3301  *                 OTN_refine(node, self.incremental)
3302  */
3303       __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_treecode); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error)
3304       __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_add_value(__pyx_v_node, __pyx_v_val, __pyx_v_weight_val, __pyx_v_level, __pyx_t_5);
3305 
3306       /* "yt/utilities/lib/basic_octree.pyx":176
3307  *         cdef np.int64_t fac
3308  *         for L in range(level):
3309  *             if self.incremental:             # <<<<<<<<<<<<<<
3310  *                 OTN_add_value(node, val, weight_val, level, treecode)
3311  *             if node.children[0][0][0] == NULL:
3312  */
3313     }
3314 
3315     /* "yt/utilities/lib/basic_octree.pyx":178
3316  *             if self.incremental:
3317  *                 OTN_add_value(node, val, weight_val, level, treecode)
3318  *             if node.children[0][0][0] == NULL:             # <<<<<<<<<<<<<<
3319  *                 OTN_refine(node, self.incremental)
3320  *             # Maybe we should use bitwise operators?
3321  */
3322     __pyx_t_4 = (((((__pyx_v_node->children[0])[0])[0]) == NULL) != 0);
3323     if (__pyx_t_4) {
3324 
3325       /* "yt/utilities/lib/basic_octree.pyx":179
3326  *                 OTN_add_value(node, val, weight_val, level, treecode)
3327  *             if node.children[0][0][0] == NULL:
3328  *                 OTN_refine(node, self.incremental)             # <<<<<<<<<<<<<<
3329  *             # Maybe we should use bitwise operators?
3330  *             fac = self.po2[level - L - 1]
3331  */
3332       __pyx_t_6.__pyx_n = 1;
3333       __pyx_t_6.incremental = __pyx_v_self->incremental;
3334       __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_refine(__pyx_v_node, &__pyx_t_6);
3335 
3336       /* "yt/utilities/lib/basic_octree.pyx":178
3337  *             if self.incremental:
3338  *                 OTN_add_value(node, val, weight_val, level, treecode)
3339  *             if node.children[0][0][0] == NULL:             # <<<<<<<<<<<<<<
3340  *                 OTN_refine(node, self.incremental)
3341  *             # Maybe we should use bitwise operators?
3342  */
3343     }
3344 
3345     /* "yt/utilities/lib/basic_octree.pyx":181
3346  *                 OTN_refine(node, self.incremental)
3347  *             # Maybe we should use bitwise operators?
3348  *             fac = self.po2[level - L - 1]             # <<<<<<<<<<<<<<
3349  *             i = (pos[0] >= fac*(2*node.pos[0]+1))
3350  *             j = (pos[1] >= fac*(2*node.pos[1]+1))
3351  */
3352     __pyx_v_fac = (__pyx_v_self->po2[((__pyx_v_level - __pyx_v_L) - 1)]);
3353 
3354     /* "yt/utilities/lib/basic_octree.pyx":182
3355  *             # Maybe we should use bitwise operators?
3356  *             fac = self.po2[level - L - 1]
3357  *             i = (pos[0] >= fac*(2*node.pos[0]+1))             # <<<<<<<<<<<<<<
3358  *             j = (pos[1] >= fac*(2*node.pos[1]+1))
3359  *             k = (pos[2] >= fac*(2*node.pos[2]+1))
3360  */
3361     __pyx_v_i = ((__pyx_v_pos[0]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[0])) + 1)));
3362 
3363     /* "yt/utilities/lib/basic_octree.pyx":183
3364  *             fac = self.po2[level - L - 1]
3365  *             i = (pos[0] >= fac*(2*node.pos[0]+1))
3366  *             j = (pos[1] >= fac*(2*node.pos[1]+1))             # <<<<<<<<<<<<<<
3367  *             k = (pos[2] >= fac*(2*node.pos[2]+1))
3368  *             node = node.children[i][j][k]
3369  */
3370     __pyx_v_j = ((__pyx_v_pos[1]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[1])) + 1)));
3371 
3372     /* "yt/utilities/lib/basic_octree.pyx":184
3373  *             i = (pos[0] >= fac*(2*node.pos[0]+1))
3374  *             j = (pos[1] >= fac*(2*node.pos[1]+1))
3375  *             k = (pos[2] >= fac*(2*node.pos[2]+1))             # <<<<<<<<<<<<<<
3376  *             node = node.children[i][j][k]
3377  *         OTN_add_value(node, val, weight_val, level, treecode)
3378  */
3379     __pyx_v_k = ((__pyx_v_pos[2]) >= (__pyx_v_fac * ((2 * (__pyx_v_node->pos[2])) + 1)));
3380 
3381     /* "yt/utilities/lib/basic_octree.pyx":185
3382  *             j = (pos[1] >= fac*(2*node.pos[1]+1))
3383  *             k = (pos[2] >= fac*(2*node.pos[2]+1))
3384  *             node = node.children[i][j][k]             # <<<<<<<<<<<<<<
3385  *         OTN_add_value(node, val, weight_val, level, treecode)
3386  *
3387  */
3388     __pyx_v_node = (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]);
3389   }
3390 
3391   /* "yt/utilities/lib/basic_octree.pyx":186
3392  *             k = (pos[2] >= fac*(2*node.pos[2]+1))
3393  *             node = node.children[i][j][k]
3394  *         OTN_add_value(node, val, weight_val, level, treecode)             # <<<<<<<<<<<<<<
3395  *
3396  *     cdef OctreeNode *find_on_root_level(self, np.int64_t pos[3], int level):
3397  */
3398   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_treecode); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
3399   __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_add_value(__pyx_v_node, __pyx_v_val, __pyx_v_weight_val, __pyx_v_level, __pyx_t_1);
3400 
3401   /* "yt/utilities/lib/basic_octree.pyx":167
3402  *                         pos, nvals, vals, weight_val, 0, NULL)
3403  *
3404  *     cdef void add_to_position(self,             # <<<<<<<<<<<<<<
3405  *                  int level, np.int64_t pos[3],
3406  *                  np.float64_t *val,
3407  */
3408 
3409   /* function exit code */
3410   goto __pyx_L0;
3411   __pyx_L1_error:;
3412   __Pyx_WriteUnraisable("yt.utilities.lib.basic_octree.Octree.add_to_position", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3413   __pyx_L0:;
3414   __Pyx_RefNannyFinishContext();
3415 }
3416 
3417 /* "yt/utilities/lib/basic_octree.pyx":188
3418  *         OTN_add_value(node, val, weight_val, level, treecode)
3419  *
3420  *     cdef OctreeNode *find_on_root_level(self, np.int64_t pos[3], int level):             # <<<<<<<<<<<<<<
3421  *         # We need this because the root level won't just have four children
3422  *         # So we find on the root level, then we traverse the tree.
3423  */
3424 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_find_on_root_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,__pyx_t_5numpy_int64_t * __pyx_v_pos,int __pyx_v_level)3425 static struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_find_on_root_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, __pyx_t_5numpy_int64_t *__pyx_v_pos, int __pyx_v_level) {
3426   __pyx_t_5numpy_int64_t __pyx_v_i;
3427   __pyx_t_5numpy_int64_t __pyx_v_j;
3428   __pyx_t_5numpy_int64_t __pyx_v_k;
3429   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_r;
3430   __Pyx_RefNannyDeclarations
3431   __Pyx_RefNannySetupContext("find_on_root_level", 0);
3432 
3433   /* "yt/utilities/lib/basic_octree.pyx":192
3434  *         # So we find on the root level, then we traverse the tree.
3435  *         cdef np.int64_t i, j, k
3436  *         i = <np.int64_t> (pos[0] / self.po2[level])             # <<<<<<<<<<<<<<
3437  *         j = <np.int64_t> (pos[1] / self.po2[level])
3438  *         k = <np.int64_t> (pos[2] / self.po2[level])
3439  */
3440   if (unlikely((__pyx_v_self->po2[__pyx_v_level]) == 0)) {
3441     PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
3442     __PYX_ERR(0, 192, __pyx_L1_error)
3443   }
3444   else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && (!(((__pyx_t_5numpy_int64_t)-1) > 0)) && unlikely((__pyx_v_self->po2[__pyx_v_level]) == (__pyx_t_5numpy_int64_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_pos[0])))) {
3445     PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
3446     __PYX_ERR(0, 192, __pyx_L1_error)
3447   }
3448   __pyx_v_i = ((__pyx_t_5numpy_int64_t)__Pyx_div___pyx_t_5numpy_int64_t((__pyx_v_pos[0]), (__pyx_v_self->po2[__pyx_v_level])));
3449 
3450   /* "yt/utilities/lib/basic_octree.pyx":193
3451  *         cdef np.int64_t i, j, k
3452  *         i = <np.int64_t> (pos[0] / self.po2[level])
3453  *         j = <np.int64_t> (pos[1] / self.po2[level])             # <<<<<<<<<<<<<<
3454  *         k = <np.int64_t> (pos[2] / self.po2[level])
3455  *         return self.root_nodes[i][j][k]
3456  */
3457   if (unlikely((__pyx_v_self->po2[__pyx_v_level]) == 0)) {
3458     PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
3459     __PYX_ERR(0, 193, __pyx_L1_error)
3460   }
3461   else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && (!(((__pyx_t_5numpy_int64_t)-1) > 0)) && unlikely((__pyx_v_self->po2[__pyx_v_level]) == (__pyx_t_5numpy_int64_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_pos[1])))) {
3462     PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
3463     __PYX_ERR(0, 193, __pyx_L1_error)
3464   }
3465   __pyx_v_j = ((__pyx_t_5numpy_int64_t)__Pyx_div___pyx_t_5numpy_int64_t((__pyx_v_pos[1]), (__pyx_v_self->po2[__pyx_v_level])));
3466 
3467   /* "yt/utilities/lib/basic_octree.pyx":194
3468  *         i = <np.int64_t> (pos[0] / self.po2[level])
3469  *         j = <np.int64_t> (pos[1] / self.po2[level])
3470  *         k = <np.int64_t> (pos[2] / self.po2[level])             # <<<<<<<<<<<<<<
3471  *         return self.root_nodes[i][j][k]
3472  *
3473  */
3474   if (unlikely((__pyx_v_self->po2[__pyx_v_level]) == 0)) {
3475     PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
3476     __PYX_ERR(0, 194, __pyx_L1_error)
3477   }
3478   else if (sizeof(__pyx_t_5numpy_int64_t) == sizeof(long) && (!(((__pyx_t_5numpy_int64_t)-1) > 0)) && unlikely((__pyx_v_self->po2[__pyx_v_level]) == (__pyx_t_5numpy_int64_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW((__pyx_v_pos[2])))) {
3479     PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
3480     __PYX_ERR(0, 194, __pyx_L1_error)
3481   }
3482   __pyx_v_k = ((__pyx_t_5numpy_int64_t)__Pyx_div___pyx_t_5numpy_int64_t((__pyx_v_pos[2]), (__pyx_v_self->po2[__pyx_v_level])));
3483 
3484   /* "yt/utilities/lib/basic_octree.pyx":195
3485  *         j = <np.int64_t> (pos[1] / self.po2[level])
3486  *         k = <np.int64_t> (pos[2] / self.po2[level])
3487  *         return self.root_nodes[i][j][k]             # <<<<<<<<<<<<<<
3488  *
3489  *
3490  */
3491   __pyx_r = (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]);
3492   goto __pyx_L0;
3493 
3494   /* "yt/utilities/lib/basic_octree.pyx":188
3495  *         OTN_add_value(node, val, weight_val, level, treecode)
3496  *
3497  *     cdef OctreeNode *find_on_root_level(self, np.int64_t pos[3], int level):             # <<<<<<<<<<<<<<
3498  *         # We need this because the root level won't just have four children
3499  *         # So we find on the root level, then we traverse the tree.
3500  */
3501 
3502   /* function exit code */
3503   __pyx_L1_error:;
3504   __Pyx_WriteUnraisable("yt.utilities.lib.basic_octree.Octree.find_on_root_level", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3505   __pyx_r = 0;
3506   __pyx_L0:;
3507   __Pyx_RefNannyFinishContext();
3508   return __pyx_r;
3509 }
3510 
3511 /* "yt/utilities/lib/basic_octree.pyx":200
3512  *     @cython.boundscheck(False)
3513  *     @cython.wraparound(False)
3514  *     def add_array_to_tree(self, int level,             # <<<<<<<<<<<<<<
3515  *             np.ndarray[np.int64_t, ndim=1] pxs,
3516  *             np.ndarray[np.int64_t, ndim=1] pys,
3517  */
3518 
3519 /* Python wrapper */
3520 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_3add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_3add_array_to_tree(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3521 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_3add_array_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3522   int __pyx_v_level;
3523   PyArrayObject *__pyx_v_pxs = 0;
3524   PyArrayObject *__pyx_v_pys = 0;
3525   PyArrayObject *__pyx_v_pzs = 0;
3526   PyArrayObject *__pyx_v_pvals = 0;
3527   PyArrayObject *__pyx_v_pweight_vals = 0;
3528   int __pyx_v_treecode;
3529   PyObject *__pyx_r = 0;
3530   __Pyx_RefNannyDeclarations
3531   __Pyx_RefNannySetupContext("add_array_to_tree (wrapper)", 0);
3532   {
3533     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_pxs,&__pyx_n_s_pys,&__pyx_n_s_pzs,&__pyx_n_s_pvals,&__pyx_n_s_pweight_vals,&__pyx_n_s_treecode,0};
3534     PyObject* values[7] = {0,0,0,0,0,0,0};
3535     if (unlikely(__pyx_kwds)) {
3536       Py_ssize_t kw_args;
3537       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3538       switch (pos_args) {
3539         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3540         CYTHON_FALLTHROUGH;
3541         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3542         CYTHON_FALLTHROUGH;
3543         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3544         CYTHON_FALLTHROUGH;
3545         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3546         CYTHON_FALLTHROUGH;
3547         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3548         CYTHON_FALLTHROUGH;
3549         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3550         CYTHON_FALLTHROUGH;
3551         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3552         CYTHON_FALLTHROUGH;
3553         case  0: break;
3554         default: goto __pyx_L5_argtuple_error;
3555       }
3556       kw_args = PyDict_Size(__pyx_kwds);
3557       switch (pos_args) {
3558         case  0:
3559         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
3560         else goto __pyx_L5_argtuple_error;
3561         CYTHON_FALLTHROUGH;
3562         case  1:
3563         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pxs)) != 0)) kw_args--;
3564         else {
3565           __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 6, 7, 1); __PYX_ERR(0, 200, __pyx_L3_error)
3566         }
3567         CYTHON_FALLTHROUGH;
3568         case  2:
3569         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pys)) != 0)) kw_args--;
3570         else {
3571           __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 6, 7, 2); __PYX_ERR(0, 200, __pyx_L3_error)
3572         }
3573         CYTHON_FALLTHROUGH;
3574         case  3:
3575         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pzs)) != 0)) kw_args--;
3576         else {
3577           __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 6, 7, 3); __PYX_ERR(0, 200, __pyx_L3_error)
3578         }
3579         CYTHON_FALLTHROUGH;
3580         case  4:
3581         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pvals)) != 0)) kw_args--;
3582         else {
3583           __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 6, 7, 4); __PYX_ERR(0, 200, __pyx_L3_error)
3584         }
3585         CYTHON_FALLTHROUGH;
3586         case  5:
3587         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pweight_vals)) != 0)) kw_args--;
3588         else {
3589           __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 6, 7, 5); __PYX_ERR(0, 200, __pyx_L3_error)
3590         }
3591         CYTHON_FALLTHROUGH;
3592         case  6:
3593         if (kw_args > 0) {
3594           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treecode);
3595           if (value) { values[6] = value; kw_args--; }
3596         }
3597       }
3598       if (unlikely(kw_args > 0)) {
3599         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_array_to_tree") < 0)) __PYX_ERR(0, 200, __pyx_L3_error)
3600       }
3601     } else {
3602       switch (PyTuple_GET_SIZE(__pyx_args)) {
3603         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3604         CYTHON_FALLTHROUGH;
3605         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3606         values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3607         values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3608         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3609         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3610         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3611         break;
3612         default: goto __pyx_L5_argtuple_error;
3613       }
3614     }
3615     __pyx_v_level = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error)
3616     __pyx_v_pxs = ((PyArrayObject *)values[1]);
3617     __pyx_v_pys = ((PyArrayObject *)values[2]);
3618     __pyx_v_pzs = ((PyArrayObject *)values[3]);
3619     __pyx_v_pvals = ((PyArrayObject *)values[4]);
3620     __pyx_v_pweight_vals = ((PyArrayObject *)values[5]);
3621     if (values[6]) {
3622       __pyx_v_treecode = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_treecode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L3_error)
3623     } else {
3624       __pyx_v_treecode = ((int)0);
3625     }
3626   }
3627   goto __pyx_L4_argument_unpacking_done;
3628   __pyx_L5_argtuple_error:;
3629   __Pyx_RaiseArgtupleInvalid("add_array_to_tree", 0, 6, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 200, __pyx_L3_error)
3630   __pyx_L3_error:;
3631   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.add_array_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
3632   __Pyx_RefNannyFinishContext();
3633   return NULL;
3634   __pyx_L4_argument_unpacking_done:;
3635   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pxs), __pyx_ptype_5numpy_ndarray, 1, "pxs", 0))) __PYX_ERR(0, 201, __pyx_L1_error)
3636   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pys), __pyx_ptype_5numpy_ndarray, 1, "pys", 0))) __PYX_ERR(0, 202, __pyx_L1_error)
3637   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pzs), __pyx_ptype_5numpy_ndarray, 1, "pzs", 0))) __PYX_ERR(0, 203, __pyx_L1_error)
3638   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) __PYX_ERR(0, 204, __pyx_L1_error)
3639   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pweight_vals), __pyx_ptype_5numpy_ndarray, 1, "pweight_vals", 0))) __PYX_ERR(0, 205, __pyx_L1_error)
3640   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_2add_array_to_tree(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), __pyx_v_level, __pyx_v_pxs, __pyx_v_pys, __pyx_v_pzs, __pyx_v_pvals, __pyx_v_pweight_vals, __pyx_v_treecode);
3641 
3642   /* function exit code */
3643   goto __pyx_L0;
3644   __pyx_L1_error:;
3645   __pyx_r = NULL;
3646   __pyx_L0:;
3647   __Pyx_RefNannyFinishContext();
3648   return __pyx_r;
3649 }
3650 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_2add_array_to_tree(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,int __pyx_v_level,PyArrayObject * __pyx_v_pxs,PyArrayObject * __pyx_v_pys,PyArrayObject * __pyx_v_pzs,PyArrayObject * __pyx_v_pvals,PyArrayObject * __pyx_v_pweight_vals,int __pyx_v_treecode)3651 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_2add_array_to_tree(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_level, PyArrayObject *__pyx_v_pxs, PyArrayObject *__pyx_v_pys, PyArrayObject *__pyx_v_pzs, PyArrayObject *__pyx_v_pvals, PyArrayObject *__pyx_v_pweight_vals, int __pyx_v_treecode) {
3652   int __pyx_v_np;
3653   int __pyx_v_p;
3654   __pyx_t_5numpy_float64_t *__pyx_v_vals;
3655   __pyx_t_5numpy_float64_t *__pyx_v_data;
3656   __pyx_t_5numpy_int64_t __pyx_v_pos[3];
3657   __Pyx_LocalBuf_ND __pyx_pybuffernd_pvals;
3658   __Pyx_Buffer __pyx_pybuffer_pvals;
3659   __Pyx_LocalBuf_ND __pyx_pybuffernd_pweight_vals;
3660   __Pyx_Buffer __pyx_pybuffer_pweight_vals;
3661   __Pyx_LocalBuf_ND __pyx_pybuffernd_pxs;
3662   __Pyx_Buffer __pyx_pybuffer_pxs;
3663   __Pyx_LocalBuf_ND __pyx_pybuffernd_pys;
3664   __Pyx_Buffer __pyx_pybuffer_pys;
3665   __Pyx_LocalBuf_ND __pyx_pybuffernd_pzs;
3666   __Pyx_Buffer __pyx_pybuffer_pzs;
3667   PyObject *__pyx_r = NULL;
3668   __Pyx_RefNannyDeclarations
3669   int __pyx_t_1;
3670   int __pyx_t_2;
3671   int __pyx_t_3;
3672   Py_ssize_t __pyx_t_4;
3673   Py_ssize_t __pyx_t_5;
3674   Py_ssize_t __pyx_t_6;
3675   Py_ssize_t __pyx_t_7;
3676   PyObject *__pyx_t_8 = NULL;
3677   __Pyx_RefNannySetupContext("add_array_to_tree", 0);
3678   __pyx_pybuffer_pxs.pybuffer.buf = NULL;
3679   __pyx_pybuffer_pxs.refcount = 0;
3680   __pyx_pybuffernd_pxs.data = NULL;
3681   __pyx_pybuffernd_pxs.rcbuffer = &__pyx_pybuffer_pxs;
3682   __pyx_pybuffer_pys.pybuffer.buf = NULL;
3683   __pyx_pybuffer_pys.refcount = 0;
3684   __pyx_pybuffernd_pys.data = NULL;
3685   __pyx_pybuffernd_pys.rcbuffer = &__pyx_pybuffer_pys;
3686   __pyx_pybuffer_pzs.pybuffer.buf = NULL;
3687   __pyx_pybuffer_pzs.refcount = 0;
3688   __pyx_pybuffernd_pzs.data = NULL;
3689   __pyx_pybuffernd_pzs.rcbuffer = &__pyx_pybuffer_pzs;
3690   __pyx_pybuffer_pvals.pybuffer.buf = NULL;
3691   __pyx_pybuffer_pvals.refcount = 0;
3692   __pyx_pybuffernd_pvals.data = NULL;
3693   __pyx_pybuffernd_pvals.rcbuffer = &__pyx_pybuffer_pvals;
3694   __pyx_pybuffer_pweight_vals.pybuffer.buf = NULL;
3695   __pyx_pybuffer_pweight_vals.refcount = 0;
3696   __pyx_pybuffernd_pweight_vals.data = NULL;
3697   __pyx_pybuffernd_pweight_vals.rcbuffer = &__pyx_pybuffer_pweight_vals;
3698   {
3699     __Pyx_BufFmt_StackElem __pyx_stack[1];
3700     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, 200, __pyx_L1_error)
3701   }
3702   __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];
3703   {
3704     __Pyx_BufFmt_StackElem __pyx_stack[1];
3705     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, 200, __pyx_L1_error)
3706   }
3707   __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];
3708   {
3709     __Pyx_BufFmt_StackElem __pyx_stack[1];
3710     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pzs.rcbuffer->pybuffer, (PyObject*)__pyx_v_pzs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 200, __pyx_L1_error)
3711   }
3712   __pyx_pybuffernd_pzs.diminfo[0].strides = __pyx_pybuffernd_pzs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pzs.diminfo[0].shape = __pyx_pybuffernd_pzs.rcbuffer->pybuffer.shape[0];
3713   {
3714     __Pyx_BufFmt_StackElem __pyx_stack[1];
3715     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, 200, __pyx_L1_error)
3716   }
3717   __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];
3718   {
3719     __Pyx_BufFmt_StackElem __pyx_stack[1];
3720     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, 200, __pyx_L1_error)
3721   }
3722   __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];
3723 
3724   /* "yt/utilities/lib/basic_octree.pyx":207
3725  *             np.ndarray[np.float64_t, ndim=1] pweight_vals,
3726  *             int treecode = 0):
3727  *         cdef int np = pxs.shape[0]             # <<<<<<<<<<<<<<
3728  *         cdef int p
3729  *         cdef cnp.float64_t *vals
3730  */
3731   __pyx_v_np = (__pyx_v_pxs->dimensions[0]);
3732 
3733   /* "yt/utilities/lib/basic_octree.pyx":210
3734  *         cdef int p
3735  *         cdef cnp.float64_t *vals
3736  *         cdef cnp.float64_t *data = <cnp.float64_t *> pvals.data             # <<<<<<<<<<<<<<
3737  *         cdef cnp.int64_t pos[3]
3738  *         for p in range(np):
3739  */
3740   __pyx_v_data = ((__pyx_t_5numpy_float64_t *)__pyx_v_pvals->data);
3741 
3742   /* "yt/utilities/lib/basic_octree.pyx":212
3743  *         cdef cnp.float64_t *data = <cnp.float64_t *> pvals.data
3744  *         cdef cnp.int64_t pos[3]
3745  *         for p in range(np):             # <<<<<<<<<<<<<<
3746  *             vals = data + self.nvals*p
3747  *             pos[0] = pxs[p]
3748  */
3749   __pyx_t_1 = __pyx_v_np;
3750   __pyx_t_2 = __pyx_t_1;
3751   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3752     __pyx_v_p = __pyx_t_3;
3753 
3754     /* "yt/utilities/lib/basic_octree.pyx":213
3755  *         cdef cnp.int64_t pos[3]
3756  *         for p in range(np):
3757  *             vals = data + self.nvals*p             # <<<<<<<<<<<<<<
3758  *             pos[0] = pxs[p]
3759  *             pos[1] = pys[p]
3760  */
3761     __pyx_v_vals = (__pyx_v_data + (__pyx_v_self->nvals * __pyx_v_p));
3762 
3763     /* "yt/utilities/lib/basic_octree.pyx":214
3764  *         for p in range(np):
3765  *             vals = data + self.nvals*p
3766  *             pos[0] = pxs[p]             # <<<<<<<<<<<<<<
3767  *             pos[1] = pys[p]
3768  *             pos[2] = pzs[p]
3769  */
3770     __pyx_t_4 = __pyx_v_p;
3771     (__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));
3772 
3773     /* "yt/utilities/lib/basic_octree.pyx":215
3774  *             vals = data + self.nvals*p
3775  *             pos[0] = pxs[p]
3776  *             pos[1] = pys[p]             # <<<<<<<<<<<<<<
3777  *             pos[2] = pzs[p]
3778  *             self.add_to_position(level, pos, vals, pweight_vals[p], treecode)
3779  */
3780     __pyx_t_5 = __pyx_v_p;
3781     (__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));
3782 
3783     /* "yt/utilities/lib/basic_octree.pyx":216
3784  *             pos[0] = pxs[p]
3785  *             pos[1] = pys[p]
3786  *             pos[2] = pzs[p]             # <<<<<<<<<<<<<<
3787  *             self.add_to_position(level, pos, vals, pweight_vals[p], treecode)
3788  *
3789  */
3790     __pyx_t_6 = __pyx_v_p;
3791     (__pyx_v_pos[2]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_pzs.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_pzs.diminfo[0].strides));
3792 
3793     /* "yt/utilities/lib/basic_octree.pyx":217
3794  *             pos[1] = pys[p]
3795  *             pos[2] = pzs[p]
3796  *             self.add_to_position(level, pos, vals, pweight_vals[p], treecode)             # <<<<<<<<<<<<<<
3797  *
3798  *     def add_grid_to_tree(self, int level,
3799  */
3800     __pyx_t_7 = __pyx_v_p;
3801     __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_treecode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error)
3802     __Pyx_GOTREF(__pyx_t_8);
3803     ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__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_7, __pyx_pybuffernd_pweight_vals.diminfo[0].strides)), __pyx_t_8);
3804     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3805   }
3806 
3807   /* "yt/utilities/lib/basic_octree.pyx":200
3808  *     @cython.boundscheck(False)
3809  *     @cython.wraparound(False)
3810  *     def add_array_to_tree(self, int level,             # <<<<<<<<<<<<<<
3811  *             np.ndarray[np.int64_t, ndim=1] pxs,
3812  *             np.ndarray[np.int64_t, ndim=1] pys,
3813  */
3814 
3815   /* function exit code */
3816   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3817   goto __pyx_L0;
3818   __pyx_L1_error:;
3819   __Pyx_XDECREF(__pyx_t_8);
3820   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3821     __Pyx_PyThreadState_declare
3822     __Pyx_PyThreadState_assign
3823     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3824     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
3825     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer);
3826     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
3827     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
3828     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pzs.rcbuffer->pybuffer);
3829   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3830   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.add_array_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
3831   __pyx_r = NULL;
3832   goto __pyx_L2;
3833   __pyx_L0:;
3834   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
3835   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pweight_vals.rcbuffer->pybuffer);
3836   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pxs.rcbuffer->pybuffer);
3837   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pys.rcbuffer->pybuffer);
3838   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pzs.rcbuffer->pybuffer);
3839   __pyx_L2:;
3840   __Pyx_XGIVEREF(__pyx_r);
3841   __Pyx_RefNannyFinishContext();
3842   return __pyx_r;
3843 }
3844 
3845 /* "yt/utilities/lib/basic_octree.pyx":219
3846  *             self.add_to_position(level, pos, vals, pweight_vals[p], treecode)
3847  *
3848  *     def add_grid_to_tree(self, int level,             # <<<<<<<<<<<<<<
3849  *                          np.ndarray[np.int64_t, ndim=1] start_index,
3850  *                          np.ndarray[np.float64_t, ndim=2] pvals,
3851  */
3852 
3853 /* Python wrapper */
3854 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_5add_grid_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_5add_grid_to_tree(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3855 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_5add_grid_to_tree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3856   CYTHON_UNUSED int __pyx_v_level;
3857   CYTHON_UNUSED PyArrayObject *__pyx_v_start_index = 0;
3858   CYTHON_UNUSED PyArrayObject *__pyx_v_pvals = 0;
3859   CYTHON_UNUSED PyArrayObject *__pyx_v_wvals = 0;
3860   CYTHON_UNUSED PyArrayObject *__pyx_v_cm = 0;
3861   PyObject *__pyx_r = 0;
3862   __Pyx_RefNannyDeclarations
3863   __Pyx_RefNannySetupContext("add_grid_to_tree (wrapper)", 0);
3864   {
3865     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_start_index,&__pyx_n_s_pvals,&__pyx_n_s_wvals,&__pyx_n_s_cm,0};
3866     PyObject* values[5] = {0,0,0,0,0};
3867     if (unlikely(__pyx_kwds)) {
3868       Py_ssize_t kw_args;
3869       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3870       switch (pos_args) {
3871         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3872         CYTHON_FALLTHROUGH;
3873         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3874         CYTHON_FALLTHROUGH;
3875         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3876         CYTHON_FALLTHROUGH;
3877         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3878         CYTHON_FALLTHROUGH;
3879         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3880         CYTHON_FALLTHROUGH;
3881         case  0: break;
3882         default: goto __pyx_L5_argtuple_error;
3883       }
3884       kw_args = PyDict_Size(__pyx_kwds);
3885       switch (pos_args) {
3886         case  0:
3887         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
3888         else goto __pyx_L5_argtuple_error;
3889         CYTHON_FALLTHROUGH;
3890         case  1:
3891         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_index)) != 0)) kw_args--;
3892         else {
3893           __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 1); __PYX_ERR(0, 219, __pyx_L3_error)
3894         }
3895         CYTHON_FALLTHROUGH;
3896         case  2:
3897         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pvals)) != 0)) kw_args--;
3898         else {
3899           __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 2); __PYX_ERR(0, 219, __pyx_L3_error)
3900         }
3901         CYTHON_FALLTHROUGH;
3902         case  3:
3903         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wvals)) != 0)) kw_args--;
3904         else {
3905           __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 3); __PYX_ERR(0, 219, __pyx_L3_error)
3906         }
3907         CYTHON_FALLTHROUGH;
3908         case  4:
3909         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cm)) != 0)) kw_args--;
3910         else {
3911           __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, 4); __PYX_ERR(0, 219, __pyx_L3_error)
3912         }
3913       }
3914       if (unlikely(kw_args > 0)) {
3915         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_grid_to_tree") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
3916       }
3917     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3918       goto __pyx_L5_argtuple_error;
3919     } else {
3920       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3921       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3922       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3923       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3924       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3925     }
3926     __pyx_v_level = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
3927     __pyx_v_start_index = ((PyArrayObject *)values[1]);
3928     __pyx_v_pvals = ((PyArrayObject *)values[2]);
3929     __pyx_v_wvals = ((PyArrayObject *)values[3]);
3930     __pyx_v_cm = ((PyArrayObject *)values[4]);
3931   }
3932   goto __pyx_L4_argument_unpacking_done;
3933   __pyx_L5_argtuple_error:;
3934   __Pyx_RaiseArgtupleInvalid("add_grid_to_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
3935   __pyx_L3_error:;
3936   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.add_grid_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
3937   __Pyx_RefNannyFinishContext();
3938   return NULL;
3939   __pyx_L4_argument_unpacking_done:;
3940   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start_index), __pyx_ptype_5numpy_ndarray, 1, "start_index", 0))) __PYX_ERR(0, 220, __pyx_L1_error)
3941   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pvals), __pyx_ptype_5numpy_ndarray, 1, "pvals", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
3942   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wvals), __pyx_ptype_5numpy_ndarray, 1, "wvals", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
3943   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cm), __pyx_ptype_5numpy_ndarray, 1, "cm", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
3944   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_4add_grid_to_tree(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), __pyx_v_level, __pyx_v_start_index, __pyx_v_pvals, __pyx_v_wvals, __pyx_v_cm);
3945 
3946   /* function exit code */
3947   goto __pyx_L0;
3948   __pyx_L1_error:;
3949   __pyx_r = NULL;
3950   __pyx_L0:;
3951   __Pyx_RefNannyFinishContext();
3952   return __pyx_r;
3953 }
3954 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_4add_grid_to_tree(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,CYTHON_UNUSED int __pyx_v_level,CYTHON_UNUSED PyArrayObject * __pyx_v_start_index,CYTHON_UNUSED PyArrayObject * __pyx_v_pvals,CYTHON_UNUSED PyArrayObject * __pyx_v_wvals,CYTHON_UNUSED PyArrayObject * __pyx_v_cm)3955 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_4add_grid_to_tree(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, CYTHON_UNUSED int __pyx_v_level, CYTHON_UNUSED PyArrayObject *__pyx_v_start_index, CYTHON_UNUSED PyArrayObject *__pyx_v_pvals, CYTHON_UNUSED PyArrayObject *__pyx_v_wvals, CYTHON_UNUSED PyArrayObject *__pyx_v_cm) {
3956   __Pyx_LocalBuf_ND __pyx_pybuffernd_cm;
3957   __Pyx_Buffer __pyx_pybuffer_cm;
3958   __Pyx_LocalBuf_ND __pyx_pybuffernd_pvals;
3959   __Pyx_Buffer __pyx_pybuffer_pvals;
3960   __Pyx_LocalBuf_ND __pyx_pybuffernd_start_index;
3961   __Pyx_Buffer __pyx_pybuffer_start_index;
3962   __Pyx_LocalBuf_ND __pyx_pybuffernd_wvals;
3963   __Pyx_Buffer __pyx_pybuffer_wvals;
3964   PyObject *__pyx_r = NULL;
3965   __Pyx_RefNannyDeclarations
3966   __Pyx_RefNannySetupContext("add_grid_to_tree", 0);
3967   __pyx_pybuffer_start_index.pybuffer.buf = NULL;
3968   __pyx_pybuffer_start_index.refcount = 0;
3969   __pyx_pybuffernd_start_index.data = NULL;
3970   __pyx_pybuffernd_start_index.rcbuffer = &__pyx_pybuffer_start_index;
3971   __pyx_pybuffer_pvals.pybuffer.buf = NULL;
3972   __pyx_pybuffer_pvals.refcount = 0;
3973   __pyx_pybuffernd_pvals.data = NULL;
3974   __pyx_pybuffernd_pvals.rcbuffer = &__pyx_pybuffer_pvals;
3975   __pyx_pybuffer_wvals.pybuffer.buf = NULL;
3976   __pyx_pybuffer_wvals.refcount = 0;
3977   __pyx_pybuffernd_wvals.data = NULL;
3978   __pyx_pybuffernd_wvals.rcbuffer = &__pyx_pybuffer_wvals;
3979   __pyx_pybuffer_cm.pybuffer.buf = NULL;
3980   __pyx_pybuffer_cm.refcount = 0;
3981   __pyx_pybuffernd_cm.data = NULL;
3982   __pyx_pybuffernd_cm.rcbuffer = &__pyx_pybuffer_cm;
3983   {
3984     __Pyx_BufFmt_StackElem __pyx_stack[1];
3985     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_start_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_start_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
3986   }
3987   __pyx_pybuffernd_start_index.diminfo[0].strides = __pyx_pybuffernd_start_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_start_index.diminfo[0].shape = __pyx_pybuffernd_start_index.rcbuffer->pybuffer.shape[0];
3988   {
3989     __Pyx_BufFmt_StackElem __pyx_stack[1];
3990     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, 219, __pyx_L1_error)
3991   }
3992   __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];
3993   {
3994     __Pyx_BufFmt_StackElem __pyx_stack[1];
3995     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_wvals.rcbuffer->pybuffer, (PyObject*)__pyx_v_wvals, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
3996   }
3997   __pyx_pybuffernd_wvals.diminfo[0].strides = __pyx_pybuffernd_wvals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_wvals.diminfo[0].shape = __pyx_pybuffernd_wvals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_wvals.diminfo[1].strides = __pyx_pybuffernd_wvals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_wvals.diminfo[1].shape = __pyx_pybuffernd_wvals.rcbuffer->pybuffer.shape[1];
3998   {
3999     __Pyx_BufFmt_StackElem __pyx_stack[1];
4000     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cm.rcbuffer->pybuffer, (PyObject*)__pyx_v_cm, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
4001   }
4002   __pyx_pybuffernd_cm.diminfo[0].strides = __pyx_pybuffernd_cm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cm.diminfo[0].shape = __pyx_pybuffernd_cm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_cm.diminfo[1].strides = __pyx_pybuffernd_cm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_cm.diminfo[1].shape = __pyx_pybuffernd_cm.rcbuffer->pybuffer.shape[1];
4003 
4004   /* function exit code */
4005   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4006   goto __pyx_L0;
4007   __pyx_L1_error:;
4008   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4009     __Pyx_PyThreadState_declare
4010     __Pyx_PyThreadState_assign
4011     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4012     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cm.rcbuffer->pybuffer);
4013     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
4014     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_start_index.rcbuffer->pybuffer);
4015     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wvals.rcbuffer->pybuffer);
4016   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4017   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.add_grid_to_tree", __pyx_clineno, __pyx_lineno, __pyx_filename);
4018   __pyx_r = NULL;
4019   goto __pyx_L2;
4020   __pyx_L0:;
4021   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cm.rcbuffer->pybuffer);
4022   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pvals.rcbuffer->pybuffer);
4023   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_start_index.rcbuffer->pybuffer);
4024   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_wvals.rcbuffer->pybuffer);
4025   __pyx_L2:;
4026   __Pyx_XGIVEREF(__pyx_r);
4027   __Pyx_RefNannyFinishContext();
4028   return __pyx_r;
4029 }
4030 
4031 /* "yt/utilities/lib/basic_octree.pyx":228
4032  *     @cython.boundscheck(False)
4033  *     @cython.wraparound(False)
4034  *     def get_all_from_level(self, int level, int count_only = 0):             # <<<<<<<<<<<<<<
4035  *         cdef int i, j, k
4036  *         cdef int total = 0
4037  */
4038 
4039 /* Python wrapper */
4040 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_7get_all_from_level(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_7get_all_from_level(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4041 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_7get_all_from_level(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4042   int __pyx_v_level;
4043   int __pyx_v_count_only;
4044   PyObject *__pyx_r = 0;
4045   __Pyx_RefNannyDeclarations
4046   __Pyx_RefNannySetupContext("get_all_from_level (wrapper)", 0);
4047   {
4048     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_level,&__pyx_n_s_count_only,0};
4049     PyObject* values[2] = {0,0};
4050     if (unlikely(__pyx_kwds)) {
4051       Py_ssize_t kw_args;
4052       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4053       switch (pos_args) {
4054         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4055         CYTHON_FALLTHROUGH;
4056         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4057         CYTHON_FALLTHROUGH;
4058         case  0: break;
4059         default: goto __pyx_L5_argtuple_error;
4060       }
4061       kw_args = PyDict_Size(__pyx_kwds);
4062       switch (pos_args) {
4063         case  0:
4064         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--;
4065         else goto __pyx_L5_argtuple_error;
4066         CYTHON_FALLTHROUGH;
4067         case  1:
4068         if (kw_args > 0) {
4069           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count_only);
4070           if (value) { values[1] = value; kw_args--; }
4071         }
4072       }
4073       if (unlikely(kw_args > 0)) {
4074         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_all_from_level") < 0)) __PYX_ERR(0, 228, __pyx_L3_error)
4075       }
4076     } else {
4077       switch (PyTuple_GET_SIZE(__pyx_args)) {
4078         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4079         CYTHON_FALLTHROUGH;
4080         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4081         break;
4082         default: goto __pyx_L5_argtuple_error;
4083       }
4084     }
4085     __pyx_v_level = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L3_error)
4086     if (values[1]) {
4087       __pyx_v_count_only = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_count_only == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L3_error)
4088     } else {
4089       __pyx_v_count_only = ((int)0);
4090     }
4091   }
4092   goto __pyx_L4_argument_unpacking_done;
4093   __pyx_L5_argtuple_error:;
4094   __Pyx_RaiseArgtupleInvalid("get_all_from_level", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 228, __pyx_L3_error)
4095   __pyx_L3_error:;
4096   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.get_all_from_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
4097   __Pyx_RefNannyFinishContext();
4098   return NULL;
4099   __pyx_L4_argument_unpacking_done:;
4100   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_6get_all_from_level(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), __pyx_v_level, __pyx_v_count_only);
4101 
4102   /* function exit code */
4103   __Pyx_RefNannyFinishContext();
4104   return __pyx_r;
4105 }
4106 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_6get_all_from_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,int __pyx_v_level,int __pyx_v_count_only)4107 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_6get_all_from_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_level, int __pyx_v_count_only) {
4108   int __pyx_v_i;
4109   int __pyx_v_j;
4110   int __pyx_v_k;
4111   int __pyx_v_total;
4112   PyArrayObject *__pyx_v_npos = 0;
4113   PyArrayObject *__pyx_v_nvals = 0;
4114   PyArrayObject *__pyx_v_nwvals = 0;
4115   __pyx_t_5numpy_int64_t __pyx_v_curpos;
4116   __pyx_t_5numpy_int64_t *__pyx_v_pdata;
4117   __pyx_t_5numpy_float64_t *__pyx_v_vdata;
4118   __pyx_t_5numpy_float64_t *__pyx_v_wdata;
4119   __Pyx_LocalBuf_ND __pyx_pybuffernd_npos;
4120   __Pyx_Buffer __pyx_pybuffer_npos;
4121   __Pyx_LocalBuf_ND __pyx_pybuffernd_nvals;
4122   __Pyx_Buffer __pyx_pybuffer_nvals;
4123   __Pyx_LocalBuf_ND __pyx_pybuffernd_nwvals;
4124   __Pyx_Buffer __pyx_pybuffer_nwvals;
4125   PyObject *__pyx_r = NULL;
4126   __Pyx_RefNannyDeclarations
4127   __pyx_t_5numpy_int64_t __pyx_t_1;
4128   __pyx_t_5numpy_int64_t __pyx_t_2;
4129   int __pyx_t_3;
4130   __pyx_t_5numpy_int64_t __pyx_t_4;
4131   __pyx_t_5numpy_int64_t __pyx_t_5;
4132   int __pyx_t_6;
4133   __pyx_t_5numpy_int64_t __pyx_t_7;
4134   __pyx_t_5numpy_int64_t __pyx_t_8;
4135   int __pyx_t_9;
4136   int __pyx_t_10;
4137   PyObject *__pyx_t_11 = NULL;
4138   PyObject *__pyx_t_12 = NULL;
4139   PyObject *__pyx_t_13 = NULL;
4140   PyObject *__pyx_t_14 = NULL;
4141   PyArrayObject *__pyx_t_15 = NULL;
4142   PyObject *__pyx_t_16 = NULL;
4143   PyObject *__pyx_t_17 = NULL;
4144   PyObject *__pyx_t_18 = NULL;
4145   PyArrayObject *__pyx_t_19 = NULL;
4146   PyArrayObject *__pyx_t_20 = NULL;
4147   __Pyx_RefNannySetupContext("get_all_from_level", 0);
4148   __pyx_pybuffer_npos.pybuffer.buf = NULL;
4149   __pyx_pybuffer_npos.refcount = 0;
4150   __pyx_pybuffernd_npos.data = NULL;
4151   __pyx_pybuffernd_npos.rcbuffer = &__pyx_pybuffer_npos;
4152   __pyx_pybuffer_nvals.pybuffer.buf = NULL;
4153   __pyx_pybuffer_nvals.refcount = 0;
4154   __pyx_pybuffernd_nvals.data = NULL;
4155   __pyx_pybuffernd_nvals.rcbuffer = &__pyx_pybuffer_nvals;
4156   __pyx_pybuffer_nwvals.pybuffer.buf = NULL;
4157   __pyx_pybuffer_nwvals.refcount = 0;
4158   __pyx_pybuffernd_nwvals.data = NULL;
4159   __pyx_pybuffernd_nwvals.rcbuffer = &__pyx_pybuffer_nwvals;
4160 
4161   /* "yt/utilities/lib/basic_octree.pyx":230
4162  *     def get_all_from_level(self, int level, int count_only = 0):
4163  *         cdef int i, j, k
4164  *         cdef int total = 0             # <<<<<<<<<<<<<<
4165  *         for i in range(self.top_grid_dims[0]):
4166  *             for j in range(self.top_grid_dims[1]):
4167  */
4168   __pyx_v_total = 0;
4169 
4170   /* "yt/utilities/lib/basic_octree.pyx":231
4171  *         cdef int i, j, k
4172  *         cdef int total = 0
4173  *         for i in range(self.top_grid_dims[0]):             # <<<<<<<<<<<<<<
4174  *             for j in range(self.top_grid_dims[1]):
4175  *                 for k in range(self.top_grid_dims[2]):
4176  */
4177   __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
4178   __pyx_t_2 = __pyx_t_1;
4179   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4180     __pyx_v_i = __pyx_t_3;
4181 
4182     /* "yt/utilities/lib/basic_octree.pyx":232
4183  *         cdef int total = 0
4184  *         for i in range(self.top_grid_dims[0]):
4185  *             for j in range(self.top_grid_dims[1]):             # <<<<<<<<<<<<<<
4186  *                 for k in range(self.top_grid_dims[2]):
4187  *                     total += self.count_at_level(self.root_nodes[i][j][k], level)
4188  */
4189     __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
4190     __pyx_t_5 = __pyx_t_4;
4191     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4192       __pyx_v_j = __pyx_t_6;
4193 
4194       /* "yt/utilities/lib/basic_octree.pyx":233
4195  *         for i in range(self.top_grid_dims[0]):
4196  *             for j in range(self.top_grid_dims[1]):
4197  *                 for k in range(self.top_grid_dims[2]):             # <<<<<<<<<<<<<<
4198  *                     total += self.count_at_level(self.root_nodes[i][j][k], level)
4199  *         if count_only: return total
4200  */
4201       __pyx_t_7 = (__pyx_v_self->top_grid_dims[2]);
4202       __pyx_t_8 = __pyx_t_7;
4203       for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4204         __pyx_v_k = __pyx_t_9;
4205 
4206         /* "yt/utilities/lib/basic_octree.pyx":234
4207  *             for j in range(self.top_grid_dims[1]):
4208  *                 for k in range(self.top_grid_dims[2]):
4209  *                     total += self.count_at_level(self.root_nodes[i][j][k], level)             # <<<<<<<<<<<<<<
4210  *         if count_only: return total
4211  *         # Allocate our array
4212  */
4213         __pyx_v_total = (__pyx_v_total + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->count_at_level(__pyx_v_self, (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]), __pyx_v_level));
4214       }
4215     }
4216   }
4217 
4218   /* "yt/utilities/lib/basic_octree.pyx":235
4219  *                 for k in range(self.top_grid_dims[2]):
4220  *                     total += self.count_at_level(self.root_nodes[i][j][k], level)
4221  *         if count_only: return total             # <<<<<<<<<<<<<<
4222  *         # Allocate our array
4223  *         cdef np.ndarray[np.int64_t, ndim=2] npos
4224  */
4225   __pyx_t_10 = (__pyx_v_count_only != 0);
4226   if (__pyx_t_10) {
4227     __Pyx_XDECREF(__pyx_r);
4228     __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 235, __pyx_L1_error)
4229     __Pyx_GOTREF(__pyx_t_11);
4230     __pyx_r = __pyx_t_11;
4231     __pyx_t_11 = 0;
4232     goto __pyx_L0;
4233   }
4234 
4235   /* "yt/utilities/lib/basic_octree.pyx":240
4236  *         cdef np.ndarray[np.float64_t, ndim=2] nvals
4237  *         cdef np.ndarray[np.float64_t, ndim=1] nwvals
4238  *         npos = np.zeros( (total, 3), dtype='int64')             # <<<<<<<<<<<<<<
4239  *         nvals = np.zeros( (total, self.nvals), dtype='float64')
4240  *         nwvals = np.zeros( total, dtype='float64')
4241  */
4242   __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 240, __pyx_L1_error)
4243   __Pyx_GOTREF(__pyx_t_11);
4244   __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 240, __pyx_L1_error)
4245   __Pyx_GOTREF(__pyx_t_12);
4246   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4247   __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 240, __pyx_L1_error)
4248   __Pyx_GOTREF(__pyx_t_11);
4249   __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 240, __pyx_L1_error)
4250   __Pyx_GOTREF(__pyx_t_13);
4251   __Pyx_GIVEREF(__pyx_t_11);
4252   PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
4253   __Pyx_INCREF(__pyx_int_3);
4254   __Pyx_GIVEREF(__pyx_int_3);
4255   PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_int_3);
4256   __pyx_t_11 = 0;
4257   __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 240, __pyx_L1_error)
4258   __Pyx_GOTREF(__pyx_t_11);
4259   __Pyx_GIVEREF(__pyx_t_13);
4260   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
4261   __pyx_t_13 = 0;
4262   __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 240, __pyx_L1_error)
4263   __Pyx_GOTREF(__pyx_t_13);
4264   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, __pyx_n_s_int64) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
4265   __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 240, __pyx_L1_error)
4266   __Pyx_GOTREF(__pyx_t_14);
4267   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4268   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4269   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4270   if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 240, __pyx_L1_error)
4271   __pyx_t_15 = ((PyArrayObject *)__pyx_t_14);
4272   {
4273     __Pyx_BufFmt_StackElem __pyx_stack[1];
4274     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_npos.rcbuffer->pybuffer);
4275     __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_npos.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
4276     if (unlikely(__pyx_t_3 < 0)) {
4277       PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
4278       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_npos.rcbuffer->pybuffer, (PyObject*)__pyx_v_npos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
4279         Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
4280         __Pyx_RaiseBufferFallbackError();
4281       } else {
4282         PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
4283       }
4284       __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
4285     }
4286     __pyx_pybuffernd_npos.diminfo[0].strides = __pyx_pybuffernd_npos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_npos.diminfo[0].shape = __pyx_pybuffernd_npos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_npos.diminfo[1].strides = __pyx_pybuffernd_npos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_npos.diminfo[1].shape = __pyx_pybuffernd_npos.rcbuffer->pybuffer.shape[1];
4287     if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 240, __pyx_L1_error)
4288   }
4289   __pyx_t_15 = 0;
4290   __pyx_v_npos = ((PyArrayObject *)__pyx_t_14);
4291   __pyx_t_14 = 0;
4292 
4293   /* "yt/utilities/lib/basic_octree.pyx":241
4294  *         cdef np.ndarray[np.float64_t, ndim=1] nwvals
4295  *         npos = np.zeros( (total, 3), dtype='int64')
4296  *         nvals = np.zeros( (total, self.nvals), dtype='float64')             # <<<<<<<<<<<<<<
4297  *         nwvals = np.zeros( total, dtype='float64')
4298  *         cdef np.int64_t curpos = 0
4299  */
4300   __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 241, __pyx_L1_error)
4301   __Pyx_GOTREF(__pyx_t_14);
4302   __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_zeros); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 241, __pyx_L1_error)
4303   __Pyx_GOTREF(__pyx_t_13);
4304   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4305   __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 241, __pyx_L1_error)
4306   __Pyx_GOTREF(__pyx_t_14);
4307   __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_self->nvals); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 241, __pyx_L1_error)
4308   __Pyx_GOTREF(__pyx_t_11);
4309   __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 241, __pyx_L1_error)
4310   __Pyx_GOTREF(__pyx_t_12);
4311   __Pyx_GIVEREF(__pyx_t_14);
4312   PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
4313   __Pyx_GIVEREF(__pyx_t_11);
4314   PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
4315   __pyx_t_14 = 0;
4316   __pyx_t_11 = 0;
4317   __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 241, __pyx_L1_error)
4318   __Pyx_GOTREF(__pyx_t_11);
4319   __Pyx_GIVEREF(__pyx_t_12);
4320   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
4321   __pyx_t_12 = 0;
4322   __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 241, __pyx_L1_error)
4323   __Pyx_GOTREF(__pyx_t_12);
4324   if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
4325   __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 241, __pyx_L1_error)
4326   __Pyx_GOTREF(__pyx_t_14);
4327   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
4328   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4329   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4330   if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 241, __pyx_L1_error)
4331   __pyx_t_19 = ((PyArrayObject *)__pyx_t_14);
4332   {
4333     __Pyx_BufFmt_StackElem __pyx_stack[1];
4334     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer);
4335     __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);
4336     if (unlikely(__pyx_t_3 < 0)) {
4337       PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
4338       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)) {
4339         Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
4340         __Pyx_RaiseBufferFallbackError();
4341       } else {
4342         PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
4343       }
4344       __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
4345     }
4346     __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];
4347     if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
4348   }
4349   __pyx_t_19 = 0;
4350   __pyx_v_nvals = ((PyArrayObject *)__pyx_t_14);
4351   __pyx_t_14 = 0;
4352 
4353   /* "yt/utilities/lib/basic_octree.pyx":242
4354  *         npos = np.zeros( (total, 3), dtype='int64')
4355  *         nvals = np.zeros( (total, self.nvals), dtype='float64')
4356  *         nwvals = np.zeros( total, dtype='float64')             # <<<<<<<<<<<<<<
4357  *         cdef np.int64_t curpos = 0
4358  *         cdef np.int64_t *pdata = <np.int64_t *> npos.data
4359  */
4360   __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 242, __pyx_L1_error)
4361   __Pyx_GOTREF(__pyx_t_14);
4362   __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 242, __pyx_L1_error)
4363   __Pyx_GOTREF(__pyx_t_12);
4364   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4365   __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_total); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 242, __pyx_L1_error)
4366   __Pyx_GOTREF(__pyx_t_14);
4367   __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 242, __pyx_L1_error)
4368   __Pyx_GOTREF(__pyx_t_11);
4369   __Pyx_GIVEREF(__pyx_t_14);
4370   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_14);
4371   __pyx_t_14 = 0;
4372   __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 242, __pyx_L1_error)
4373   __Pyx_GOTREF(__pyx_t_14);
4374   if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 242, __pyx_L1_error)
4375   __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 242, __pyx_L1_error)
4376   __Pyx_GOTREF(__pyx_t_13);
4377   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4378   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4379   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4380   if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 242, __pyx_L1_error)
4381   __pyx_t_20 = ((PyArrayObject *)__pyx_t_13);
4382   {
4383     __Pyx_BufFmt_StackElem __pyx_stack[1];
4384     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer);
4385     __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);
4386     if (unlikely(__pyx_t_3 < 0)) {
4387       PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
4388       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)) {
4389         Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
4390         __Pyx_RaiseBufferFallbackError();
4391       } else {
4392         PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
4393       }
4394       __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
4395     }
4396     __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];
4397     if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 242, __pyx_L1_error)
4398   }
4399   __pyx_t_20 = 0;
4400   __pyx_v_nwvals = ((PyArrayObject *)__pyx_t_13);
4401   __pyx_t_13 = 0;
4402 
4403   /* "yt/utilities/lib/basic_octree.pyx":243
4404  *         nvals = np.zeros( (total, self.nvals), dtype='float64')
4405  *         nwvals = np.zeros( total, dtype='float64')
4406  *         cdef np.int64_t curpos = 0             # <<<<<<<<<<<<<<
4407  *         cdef np.int64_t *pdata = <np.int64_t *> npos.data
4408  *         cdef np.float64_t *vdata = <np.float64_t *> nvals.data
4409  */
4410   __pyx_v_curpos = 0;
4411 
4412   /* "yt/utilities/lib/basic_octree.pyx":244
4413  *         nwvals = np.zeros( total, dtype='float64')
4414  *         cdef np.int64_t curpos = 0
4415  *         cdef np.int64_t *pdata = <np.int64_t *> npos.data             # <<<<<<<<<<<<<<
4416  *         cdef np.float64_t *vdata = <np.float64_t *> nvals.data
4417  *         cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
4418  */
4419   __pyx_v_pdata = ((__pyx_t_5numpy_int64_t *)__pyx_v_npos->data);
4420 
4421   /* "yt/utilities/lib/basic_octree.pyx":245
4422  *         cdef np.int64_t curpos = 0
4423  *         cdef np.int64_t *pdata = <np.int64_t *> npos.data
4424  *         cdef np.float64_t *vdata = <np.float64_t *> nvals.data             # <<<<<<<<<<<<<<
4425  *         cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
4426  *         for i in range(self.top_grid_dims[0]):
4427  */
4428   __pyx_v_vdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nvals->data);
4429 
4430   /* "yt/utilities/lib/basic_octree.pyx":246
4431  *         cdef np.int64_t *pdata = <np.int64_t *> npos.data
4432  *         cdef np.float64_t *vdata = <np.float64_t *> nvals.data
4433  *         cdef np.float64_t *wdata = <np.float64_t *> nwvals.data             # <<<<<<<<<<<<<<
4434  *         for i in range(self.top_grid_dims[0]):
4435  *             for j in range(self.top_grid_dims[1]):
4436  */
4437   __pyx_v_wdata = ((__pyx_t_5numpy_float64_t *)__pyx_v_nwvals->data);
4438 
4439   /* "yt/utilities/lib/basic_octree.pyx":247
4440  *         cdef np.float64_t *vdata = <np.float64_t *> nvals.data
4441  *         cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
4442  *         for i in range(self.top_grid_dims[0]):             # <<<<<<<<<<<<<<
4443  *             for j in range(self.top_grid_dims[1]):
4444  *                 for k in range(self.top_grid_dims[2]):
4445  */
4446   __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
4447   __pyx_t_2 = __pyx_t_1;
4448   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4449     __pyx_v_i = __pyx_t_3;
4450 
4451     /* "yt/utilities/lib/basic_octree.pyx":248
4452  *         cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
4453  *         for i in range(self.top_grid_dims[0]):
4454  *             for j in range(self.top_grid_dims[1]):             # <<<<<<<<<<<<<<
4455  *                 for k in range(self.top_grid_dims[2]):
4456  *                     curpos += self.fill_from_level(self.root_nodes[i][j][k],
4457  */
4458     __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
4459     __pyx_t_5 = __pyx_t_4;
4460     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4461       __pyx_v_j = __pyx_t_6;
4462 
4463       /* "yt/utilities/lib/basic_octree.pyx":249
4464  *         for i in range(self.top_grid_dims[0]):
4465  *             for j in range(self.top_grid_dims[1]):
4466  *                 for k in range(self.top_grid_dims[2]):             # <<<<<<<<<<<<<<
4467  *                     curpos += self.fill_from_level(self.root_nodes[i][j][k],
4468  *                         level, curpos, pdata, vdata, wdata)
4469  */
4470       __pyx_t_7 = (__pyx_v_self->top_grid_dims[2]);
4471       __pyx_t_8 = __pyx_t_7;
4472       for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4473         __pyx_v_k = __pyx_t_9;
4474 
4475         /* "yt/utilities/lib/basic_octree.pyx":250
4476  *             for j in range(self.top_grid_dims[1]):
4477  *                 for k in range(self.top_grid_dims[2]):
4478  *                     curpos += self.fill_from_level(self.root_nodes[i][j][k],             # <<<<<<<<<<<<<<
4479  *                         level, curpos, pdata, vdata, wdata)
4480  *         return npos, nvals, nwvals
4481  */
4482         __pyx_v_curpos = (__pyx_v_curpos + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->fill_from_level(__pyx_v_self, (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]), __pyx_v_level, __pyx_v_curpos, __pyx_v_pdata, __pyx_v_vdata, __pyx_v_wdata));
4483       }
4484     }
4485   }
4486 
4487   /* "yt/utilities/lib/basic_octree.pyx":252
4488  *                     curpos += self.fill_from_level(self.root_nodes[i][j][k],
4489  *                         level, curpos, pdata, vdata, wdata)
4490  *         return npos, nvals, nwvals             # <<<<<<<<<<<<<<
4491  *
4492  *     cdef int count_at_level(self, OctreeNode *node, int level):
4493  */
4494   __Pyx_XDECREF(__pyx_r);
4495   __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 252, __pyx_L1_error)
4496   __Pyx_GOTREF(__pyx_t_13);
4497   __Pyx_INCREF(((PyObject *)__pyx_v_npos));
4498   __Pyx_GIVEREF(((PyObject *)__pyx_v_npos));
4499   PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_npos));
4500   __Pyx_INCREF(((PyObject *)__pyx_v_nvals));
4501   __Pyx_GIVEREF(((PyObject *)__pyx_v_nvals));
4502   PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_nvals));
4503   __Pyx_INCREF(((PyObject *)__pyx_v_nwvals));
4504   __Pyx_GIVEREF(((PyObject *)__pyx_v_nwvals));
4505   PyTuple_SET_ITEM(__pyx_t_13, 2, ((PyObject *)__pyx_v_nwvals));
4506   __pyx_r = __pyx_t_13;
4507   __pyx_t_13 = 0;
4508   goto __pyx_L0;
4509 
4510   /* "yt/utilities/lib/basic_octree.pyx":228
4511  *     @cython.boundscheck(False)
4512  *     @cython.wraparound(False)
4513  *     def get_all_from_level(self, int level, int count_only = 0):             # <<<<<<<<<<<<<<
4514  *         cdef int i, j, k
4515  *         cdef int total = 0
4516  */
4517 
4518   /* function exit code */
4519   __pyx_L1_error:;
4520   __Pyx_XDECREF(__pyx_t_11);
4521   __Pyx_XDECREF(__pyx_t_12);
4522   __Pyx_XDECREF(__pyx_t_13);
4523   __Pyx_XDECREF(__pyx_t_14);
4524   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4525     __Pyx_PyThreadState_declare
4526     __Pyx_PyThreadState_assign
4527     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4528     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_npos.rcbuffer->pybuffer);
4529     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer);
4530     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer);
4531   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4532   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.get_all_from_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
4533   __pyx_r = NULL;
4534   goto __pyx_L2;
4535   __pyx_L0:;
4536   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_npos.rcbuffer->pybuffer);
4537   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nvals.rcbuffer->pybuffer);
4538   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nwvals.rcbuffer->pybuffer);
4539   __pyx_L2:;
4540   __Pyx_XDECREF((PyObject *)__pyx_v_npos);
4541   __Pyx_XDECREF((PyObject *)__pyx_v_nvals);
4542   __Pyx_XDECREF((PyObject *)__pyx_v_nwvals);
4543   __Pyx_XGIVEREF(__pyx_r);
4544   __Pyx_RefNannyFinishContext();
4545   return __pyx_r;
4546 }
4547 
4548 /* "yt/utilities/lib/basic_octree.pyx":254
4549  *         return npos, nvals, nwvals
4550  *
4551  *     cdef int count_at_level(self, OctreeNode *node, int level):             # <<<<<<<<<<<<<<
4552  *         cdef int i, j, k
4553  *         # We only really return a non-zero, calculated value if we are at the
4554  */
4555 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_count_at_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node,int __pyx_v_level)4556 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_count_at_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node, int __pyx_v_level) {
4557   int __pyx_v_i;
4558   int __pyx_v_j;
4559   int __pyx_v_k;
4560   int __pyx_v_count;
4561   int __pyx_r;
4562   __Pyx_RefNannyDeclarations
4563   int __pyx_t_1;
4564   int __pyx_t_2;
4565   int __pyx_t_3;
4566   int __pyx_t_4;
4567   __Pyx_RefNannySetupContext("count_at_level", 0);
4568 
4569   /* "yt/utilities/lib/basic_octree.pyx":258
4570  *         # We only really return a non-zero, calculated value if we are at the
4571  *         # level in question.
4572  *         if node.level == level:             # <<<<<<<<<<<<<<
4573  *             if self.incremental: return 1
4574  *             # We return 1 if there are no finer points at this level and zero
4575  */
4576   __pyx_t_1 = ((__pyx_v_node->level == __pyx_v_level) != 0);
4577   if (__pyx_t_1) {
4578 
4579     /* "yt/utilities/lib/basic_octree.pyx":259
4580  *         # level in question.
4581  *         if node.level == level:
4582  *             if self.incremental: return 1             # <<<<<<<<<<<<<<
4583  *             # We return 1 if there are no finer points at this level and zero
4584  *             # if there are
4585  */
4586     __pyx_t_1 = (__pyx_v_self->incremental != 0);
4587     if (__pyx_t_1) {
4588       __pyx_r = 1;
4589       goto __pyx_L0;
4590     }
4591 
4592     /* "yt/utilities/lib/basic_octree.pyx":262
4593  *             # We return 1 if there are no finer points at this level and zero
4594  *             # if there are
4595  *             return (node.children[0][0][0] == NULL)             # <<<<<<<<<<<<<<
4596  *         if node.children[0][0][0] == NULL: return 0
4597  *         cdef int count = 0
4598  */
4599     __pyx_r = ((((__pyx_v_node->children[0])[0])[0]) == NULL);
4600     goto __pyx_L0;
4601 
4602     /* "yt/utilities/lib/basic_octree.pyx":258
4603  *         # We only really return a non-zero, calculated value if we are at the
4604  *         # level in question.
4605  *         if node.level == level:             # <<<<<<<<<<<<<<
4606  *             if self.incremental: return 1
4607  *             # We return 1 if there are no finer points at this level and zero
4608  */
4609   }
4610 
4611   /* "yt/utilities/lib/basic_octree.pyx":263
4612  *             # if there are
4613  *             return (node.children[0][0][0] == NULL)
4614  *         if node.children[0][0][0] == NULL: return 0             # <<<<<<<<<<<<<<
4615  *         cdef int count = 0
4616  *         for i in range(2):
4617  */
4618   __pyx_t_1 = (((((__pyx_v_node->children[0])[0])[0]) == NULL) != 0);
4619   if (__pyx_t_1) {
4620     __pyx_r = 0;
4621     goto __pyx_L0;
4622   }
4623 
4624   /* "yt/utilities/lib/basic_octree.pyx":264
4625  *             return (node.children[0][0][0] == NULL)
4626  *         if node.children[0][0][0] == NULL: return 0
4627  *         cdef int count = 0             # <<<<<<<<<<<<<<
4628  *         for i in range(2):
4629  *             for j in range(2):
4630  */
4631   __pyx_v_count = 0;
4632 
4633   /* "yt/utilities/lib/basic_octree.pyx":265
4634  *         if node.children[0][0][0] == NULL: return 0
4635  *         cdef int count = 0
4636  *         for i in range(2):             # <<<<<<<<<<<<<<
4637  *             for j in range(2):
4638  *                 for k in range(2):
4639  */
4640   for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
4641     __pyx_v_i = __pyx_t_2;
4642 
4643     /* "yt/utilities/lib/basic_octree.pyx":266
4644  *         cdef int count = 0
4645  *         for i in range(2):
4646  *             for j in range(2):             # <<<<<<<<<<<<<<
4647  *                 for k in range(2):
4648  *                     count += self.count_at_level(node.children[i][j][k], level)
4649  */
4650     for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
4651       __pyx_v_j = __pyx_t_3;
4652 
4653       /* "yt/utilities/lib/basic_octree.pyx":267
4654  *         for i in range(2):
4655  *             for j in range(2):
4656  *                 for k in range(2):             # <<<<<<<<<<<<<<
4657  *                     count += self.count_at_level(node.children[i][j][k], level)
4658  *         return count
4659  */
4660       for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
4661         __pyx_v_k = __pyx_t_4;
4662 
4663         /* "yt/utilities/lib/basic_octree.pyx":268
4664  *             for j in range(2):
4665  *                 for k in range(2):
4666  *                     count += self.count_at_level(node.children[i][j][k], level)             # <<<<<<<<<<<<<<
4667  *         return count
4668  *
4669  */
4670         __pyx_v_count = (__pyx_v_count + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->count_at_level(__pyx_v_self, (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]), __pyx_v_level));
4671       }
4672     }
4673   }
4674 
4675   /* "yt/utilities/lib/basic_octree.pyx":269
4676  *                 for k in range(2):
4677  *                     count += self.count_at_level(node.children[i][j][k], level)
4678  *         return count             # <<<<<<<<<<<<<<
4679  *
4680  *     cdef int fill_from_level(self, OctreeNode *node, int level,
4681  */
4682   __pyx_r = __pyx_v_count;
4683   goto __pyx_L0;
4684 
4685   /* "yt/utilities/lib/basic_octree.pyx":254
4686  *         return npos, nvals, nwvals
4687  *
4688  *     cdef int count_at_level(self, OctreeNode *node, int level):             # <<<<<<<<<<<<<<
4689  *         cdef int i, j, k
4690  *         # We only really return a non-zero, calculated value if we are at the
4691  */
4692 
4693   /* function exit code */
4694   __pyx_L0:;
4695   __Pyx_RefNannyFinishContext();
4696   return __pyx_r;
4697 }
4698 
4699 /* "yt/utilities/lib/basic_octree.pyx":271
4700  *         return count
4701  *
4702  *     cdef int fill_from_level(self, OctreeNode *node, int level,             # <<<<<<<<<<<<<<
4703  *                               np.int64_t curpos,
4704  *                               np.int64_t *pdata,
4705  */
4706 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fill_from_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node,int __pyx_v_level,__pyx_t_5numpy_int64_t __pyx_v_curpos,__pyx_t_5numpy_int64_t * __pyx_v_pdata,__pyx_t_5numpy_float64_t * __pyx_v_vdata,__pyx_t_5numpy_float64_t * __pyx_v_wdata)4707 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fill_from_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node, int __pyx_v_level, __pyx_t_5numpy_int64_t __pyx_v_curpos, __pyx_t_5numpy_int64_t *__pyx_v_pdata, __pyx_t_5numpy_float64_t *__pyx_v_vdata, __pyx_t_5numpy_float64_t *__pyx_v_wdata) {
4708   int __pyx_v_i;
4709   int __pyx_v_j;
4710   int __pyx_v_k;
4711   __pyx_t_5numpy_int64_t __pyx_v_added;
4712   int __pyx_r;
4713   __Pyx_RefNannyDeclarations
4714   int __pyx_t_1;
4715   int __pyx_t_2;
4716   int __pyx_t_3;
4717   int __pyx_t_4;
4718   int __pyx_t_5;
4719   __pyx_t_5numpy_float64_t __pyx_t_6;
4720   __Pyx_RefNannySetupContext("fill_from_level", 0);
4721 
4722   /* "yt/utilities/lib/basic_octree.pyx":277
4723  *                               np.float64_t *wdata):
4724  *         cdef int i, j, k
4725  *         if node.level == level:             # <<<<<<<<<<<<<<
4726  *             if node.children[0][0][0] != NULL and not self.incremental:
4727  *                 return 0
4728  */
4729   __pyx_t_1 = ((__pyx_v_node->level == __pyx_v_level) != 0);
4730   if (__pyx_t_1) {
4731 
4732     /* "yt/utilities/lib/basic_octree.pyx":278
4733  *         cdef int i, j, k
4734  *         if node.level == level:
4735  *             if node.children[0][0][0] != NULL and not self.incremental:             # <<<<<<<<<<<<<<
4736  *                 return 0
4737  *             for i in range(self.nvals):
4738  */
4739     __pyx_t_2 = (((((__pyx_v_node->children[0])[0])[0]) != NULL) != 0);
4740     if (__pyx_t_2) {
4741     } else {
4742       __pyx_t_1 = __pyx_t_2;
4743       goto __pyx_L5_bool_binop_done;
4744     }
4745     __pyx_t_2 = ((!(__pyx_v_self->incremental != 0)) != 0);
4746     __pyx_t_1 = __pyx_t_2;
4747     __pyx_L5_bool_binop_done:;
4748     if (__pyx_t_1) {
4749 
4750       /* "yt/utilities/lib/basic_octree.pyx":279
4751  *         if node.level == level:
4752  *             if node.children[0][0][0] != NULL and not self.incremental:
4753  *                 return 0             # <<<<<<<<<<<<<<
4754  *             for i in range(self.nvals):
4755  *                 vdata[self.nvals * curpos + i] = node.val[i]
4756  */
4757       __pyx_r = 0;
4758       goto __pyx_L0;
4759 
4760       /* "yt/utilities/lib/basic_octree.pyx":278
4761  *         cdef int i, j, k
4762  *         if node.level == level:
4763  *             if node.children[0][0][0] != NULL and not self.incremental:             # <<<<<<<<<<<<<<
4764  *                 return 0
4765  *             for i in range(self.nvals):
4766  */
4767     }
4768 
4769     /* "yt/utilities/lib/basic_octree.pyx":280
4770  *             if node.children[0][0][0] != NULL and not self.incremental:
4771  *                 return 0
4772  *             for i in range(self.nvals):             # <<<<<<<<<<<<<<
4773  *                 vdata[self.nvals * curpos + i] = node.val[i]
4774  *             wdata[curpos] = node.weight_val
4775  */
4776     __pyx_t_3 = __pyx_v_self->nvals;
4777     __pyx_t_4 = __pyx_t_3;
4778     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
4779       __pyx_v_i = __pyx_t_5;
4780 
4781       /* "yt/utilities/lib/basic_octree.pyx":281
4782  *                 return 0
4783  *             for i in range(self.nvals):
4784  *                 vdata[self.nvals * curpos + i] = node.val[i]             # <<<<<<<<<<<<<<
4785  *             wdata[curpos] = node.weight_val
4786  *             pdata[curpos * 3] = node.pos[0]
4787  */
4788       (__pyx_v_vdata[((__pyx_v_self->nvals * __pyx_v_curpos) + __pyx_v_i)]) = (__pyx_v_node->val[__pyx_v_i]);
4789     }
4790 
4791     /* "yt/utilities/lib/basic_octree.pyx":282
4792  *             for i in range(self.nvals):
4793  *                 vdata[self.nvals * curpos + i] = node.val[i]
4794  *             wdata[curpos] = node.weight_val             # <<<<<<<<<<<<<<
4795  *             pdata[curpos * 3] = node.pos[0]
4796  *             pdata[curpos * 3 + 1] = node.pos[1]
4797  */
4798     __pyx_t_6 = __pyx_v_node->weight_val;
4799     (__pyx_v_wdata[__pyx_v_curpos]) = __pyx_t_6;
4800 
4801     /* "yt/utilities/lib/basic_octree.pyx":283
4802  *                 vdata[self.nvals * curpos + i] = node.val[i]
4803  *             wdata[curpos] = node.weight_val
4804  *             pdata[curpos * 3] = node.pos[0]             # <<<<<<<<<<<<<<
4805  *             pdata[curpos * 3 + 1] = node.pos[1]
4806  *             pdata[curpos * 3 + 2] = node.pos[2]
4807  */
4808     (__pyx_v_pdata[(__pyx_v_curpos * 3)]) = (__pyx_v_node->pos[0]);
4809 
4810     /* "yt/utilities/lib/basic_octree.pyx":284
4811  *             wdata[curpos] = node.weight_val
4812  *             pdata[curpos * 3] = node.pos[0]
4813  *             pdata[curpos * 3 + 1] = node.pos[1]             # <<<<<<<<<<<<<<
4814  *             pdata[curpos * 3 + 2] = node.pos[2]
4815  *             return 1
4816  */
4817     (__pyx_v_pdata[((__pyx_v_curpos * 3) + 1)]) = (__pyx_v_node->pos[1]);
4818 
4819     /* "yt/utilities/lib/basic_octree.pyx":285
4820  *             pdata[curpos * 3] = node.pos[0]
4821  *             pdata[curpos * 3 + 1] = node.pos[1]
4822  *             pdata[curpos * 3 + 2] = node.pos[2]             # <<<<<<<<<<<<<<
4823  *             return 1
4824  *         if node.children[0][0][0] == NULL: return 0
4825  */
4826     (__pyx_v_pdata[((__pyx_v_curpos * 3) + 2)]) = (__pyx_v_node->pos[2]);
4827 
4828     /* "yt/utilities/lib/basic_octree.pyx":286
4829  *             pdata[curpos * 3 + 1] = node.pos[1]
4830  *             pdata[curpos * 3 + 2] = node.pos[2]
4831  *             return 1             # <<<<<<<<<<<<<<
4832  *         if node.children[0][0][0] == NULL: return 0
4833  *         cdef np.int64_t added = 0
4834  */
4835     __pyx_r = 1;
4836     goto __pyx_L0;
4837 
4838     /* "yt/utilities/lib/basic_octree.pyx":277
4839  *                               np.float64_t *wdata):
4840  *         cdef int i, j, k
4841  *         if node.level == level:             # <<<<<<<<<<<<<<
4842  *             if node.children[0][0][0] != NULL and not self.incremental:
4843  *                 return 0
4844  */
4845   }
4846 
4847   /* "yt/utilities/lib/basic_octree.pyx":287
4848  *             pdata[curpos * 3 + 2] = node.pos[2]
4849  *             return 1
4850  *         if node.children[0][0][0] == NULL: return 0             # <<<<<<<<<<<<<<
4851  *         cdef np.int64_t added = 0
4852  *         for i in range(2):
4853  */
4854   __pyx_t_1 = (((((__pyx_v_node->children[0])[0])[0]) == NULL) != 0);
4855   if (__pyx_t_1) {
4856     __pyx_r = 0;
4857     goto __pyx_L0;
4858   }
4859 
4860   /* "yt/utilities/lib/basic_octree.pyx":288
4861  *             return 1
4862  *         if node.children[0][0][0] == NULL: return 0
4863  *         cdef np.int64_t added = 0             # <<<<<<<<<<<<<<
4864  *         for i in range(2):
4865  *             for j in range(2):
4866  */
4867   __pyx_v_added = 0;
4868 
4869   /* "yt/utilities/lib/basic_octree.pyx":289
4870  *         if node.children[0][0][0] == NULL: return 0
4871  *         cdef np.int64_t added = 0
4872  *         for i in range(2):             # <<<<<<<<<<<<<<
4873  *             for j in range(2):
4874  *                 for k in range(2):
4875  */
4876   for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
4877     __pyx_v_i = __pyx_t_3;
4878 
4879     /* "yt/utilities/lib/basic_octree.pyx":290
4880  *         cdef np.int64_t added = 0
4881  *         for i in range(2):
4882  *             for j in range(2):             # <<<<<<<<<<<<<<
4883  *                 for k in range(2):
4884  *                     added += self.fill_from_level(node.children[i][j][k],
4885  */
4886     for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
4887       __pyx_v_j = __pyx_t_4;
4888 
4889       /* "yt/utilities/lib/basic_octree.pyx":291
4890  *         for i in range(2):
4891  *             for j in range(2):
4892  *                 for k in range(2):             # <<<<<<<<<<<<<<
4893  *                     added += self.fill_from_level(node.children[i][j][k],
4894  *                             level, curpos + added, pdata, vdata, wdata)
4895  */
4896       for (__pyx_t_5 = 0; __pyx_t_5 < 2; __pyx_t_5+=1) {
4897         __pyx_v_k = __pyx_t_5;
4898 
4899         /* "yt/utilities/lib/basic_octree.pyx":292
4900  *             for j in range(2):
4901  *                 for k in range(2):
4902  *                     added += self.fill_from_level(node.children[i][j][k],             # <<<<<<<<<<<<<<
4903  *                             level, curpos + added, pdata, vdata, wdata)
4904  *         return added
4905  */
4906         __pyx_v_added = (__pyx_v_added + ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->fill_from_level(__pyx_v_self, (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]), __pyx_v_level, (__pyx_v_curpos + __pyx_v_added), __pyx_v_pdata, __pyx_v_vdata, __pyx_v_wdata));
4907       }
4908     }
4909   }
4910 
4911   /* "yt/utilities/lib/basic_octree.pyx":294
4912  *                     added += self.fill_from_level(node.children[i][j][k],
4913  *                             level, curpos + added, pdata, vdata, wdata)
4914  *         return added             # <<<<<<<<<<<<<<
4915  *
4916  *     @cython.cdivision(True)
4917  */
4918   __pyx_r = __pyx_v_added;
4919   goto __pyx_L0;
4920 
4921   /* "yt/utilities/lib/basic_octree.pyx":271
4922  *         return count
4923  *
4924  *     cdef int fill_from_level(self, OctreeNode *node, int level,             # <<<<<<<<<<<<<<
4925  *                               np.int64_t curpos,
4926  *                               np.int64_t *pdata,
4927  */
4928 
4929   /* function exit code */
4930   __pyx_L0:;
4931   __Pyx_RefNannyFinishContext();
4932   return __pyx_r;
4933 }
4934 
4935 /* "yt/utilities/lib/basic_octree.pyx":297
4936  *
4937  *     @cython.cdivision(True)
4938  *     cdef np.float64_t fbe_node_separation(self, OctreeNode *node1, OctreeNode *node2):             # <<<<<<<<<<<<<<
4939  *         # Find the distance between the two nodes.
4940  *         cdef np.float64_t dx1, dx2, p1, p2, dist
4941  */
4942 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_node_separation(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node1,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node2)4943 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_node_separation(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node1, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node2) {
4944   __pyx_t_5numpy_float64_t __pyx_v_dx1;
4945   __pyx_t_5numpy_float64_t __pyx_v_dx2;
4946   __pyx_t_5numpy_float64_t __pyx_v_p1;
4947   __pyx_t_5numpy_float64_t __pyx_v_p2;
4948   __pyx_t_5numpy_float64_t __pyx_v_dist;
4949   int __pyx_v_i;
4950   __pyx_t_5numpy_float64_t __pyx_r;
4951   __Pyx_RefNannyDeclarations
4952   int __pyx_t_1;
4953   __Pyx_RefNannySetupContext("fbe_node_separation", 0);
4954 
4955   /* "yt/utilities/lib/basic_octree.pyx":301
4956  *         cdef np.float64_t dx1, dx2, p1, p2, dist
4957  *         cdef int i
4958  *         dist = 0.0             # <<<<<<<<<<<<<<
4959  *         for i in range(3):
4960  *             # Discover the appropriate dx for each node/dim.
4961  */
4962   __pyx_v_dist = 0.0;
4963 
4964   /* "yt/utilities/lib/basic_octree.pyx":302
4965  *         cdef int i
4966  *         dist = 0.0
4967  *         for i in range(3):             # <<<<<<<<<<<<<<
4968  *             # Discover the appropriate dx for each node/dim.
4969  *             dx1 = self.root_dx[i] / (<np.float64_t> self.po2[node1.level])
4970  */
4971   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4972     __pyx_v_i = __pyx_t_1;
4973 
4974     /* "yt/utilities/lib/basic_octree.pyx":304
4975  *         for i in range(3):
4976  *             # Discover the appropriate dx for each node/dim.
4977  *             dx1 = self.root_dx[i] / (<np.float64_t> self.po2[node1.level])             # <<<<<<<<<<<<<<
4978  *             dx2 = self.root_dx[i] / (<np.float64_t> self.po2[node2.level])
4979  *             # The added term is to re-cell center the data.
4980  */
4981     __pyx_v_dx1 = ((__pyx_v_self->root_dx[__pyx_v_i]) / ((__pyx_t_5numpy_float64_t)(__pyx_v_self->po2[__pyx_v_node1->level])));
4982 
4983     /* "yt/utilities/lib/basic_octree.pyx":305
4984  *             # Discover the appropriate dx for each node/dim.
4985  *             dx1 = self.root_dx[i] / (<np.float64_t> self.po2[node1.level])
4986  *             dx2 = self.root_dx[i] / (<np.float64_t> self.po2[node2.level])             # <<<<<<<<<<<<<<
4987  *             # The added term is to re-cell center the data.
4988  *             p1 = (<np.float64_t> node1.pos[i]) * dx1 + dx1/2.
4989  */
4990     __pyx_v_dx2 = ((__pyx_v_self->root_dx[__pyx_v_i]) / ((__pyx_t_5numpy_float64_t)(__pyx_v_self->po2[__pyx_v_node2->level])));
4991 
4992     /* "yt/utilities/lib/basic_octree.pyx":307
4993  *             dx2 = self.root_dx[i] / (<np.float64_t> self.po2[node2.level])
4994  *             # The added term is to re-cell center the data.
4995  *             p1 = (<np.float64_t> node1.pos[i]) * dx1 + dx1/2.             # <<<<<<<<<<<<<<
4996  *             p2 = (<np.float64_t> node2.pos[i]) * dx2 + dx2/2.
4997  *             dist += (p1 - p2) * (p1 - p2)
4998  */
4999     __pyx_v_p1 = ((((__pyx_t_5numpy_float64_t)(__pyx_v_node1->pos[__pyx_v_i])) * __pyx_v_dx1) + (__pyx_v_dx1 / 2.));
5000 
5001     /* "yt/utilities/lib/basic_octree.pyx":308
5002  *             # The added term is to re-cell center the data.
5003  *             p1 = (<np.float64_t> node1.pos[i]) * dx1 + dx1/2.
5004  *             p2 = (<np.float64_t> node2.pos[i]) * dx2 + dx2/2.             # <<<<<<<<<<<<<<
5005  *             dist += (p1 - p2) * (p1 - p2)
5006  *         dist = sqrt(dist)
5007  */
5008     __pyx_v_p2 = ((((__pyx_t_5numpy_float64_t)(__pyx_v_node2->pos[__pyx_v_i])) * __pyx_v_dx2) + (__pyx_v_dx2 / 2.));
5009 
5010     /* "yt/utilities/lib/basic_octree.pyx":309
5011  *             p1 = (<np.float64_t> node1.pos[i]) * dx1 + dx1/2.
5012  *             p2 = (<np.float64_t> node2.pos[i]) * dx2 + dx2/2.
5013  *             dist += (p1 - p2) * (p1 - p2)             # <<<<<<<<<<<<<<
5014  *         dist = sqrt(dist)
5015  *         return dist
5016  */
5017     __pyx_v_dist = (__pyx_v_dist + ((__pyx_v_p1 - __pyx_v_p2) * (__pyx_v_p1 - __pyx_v_p2)));
5018   }
5019 
5020   /* "yt/utilities/lib/basic_octree.pyx":310
5021  *             p2 = (<np.float64_t> node2.pos[i]) * dx2 + dx2/2.
5022  *             dist += (p1 - p2) * (p1 - p2)
5023  *         dist = sqrt(dist)             # <<<<<<<<<<<<<<
5024  *         return dist
5025  *
5026  */
5027   __pyx_v_dist = sqrt(__pyx_v_dist);
5028 
5029   /* "yt/utilities/lib/basic_octree.pyx":311
5030  *             dist += (p1 - p2) * (p1 - p2)
5031  *         dist = sqrt(dist)
5032  *         return dist             # <<<<<<<<<<<<<<
5033  *
5034  *     @cython.cdivision(True)
5035  */
5036   __pyx_r = __pyx_v_dist;
5037   goto __pyx_L0;
5038 
5039   /* "yt/utilities/lib/basic_octree.pyx":297
5040  *
5041  *     @cython.cdivision(True)
5042  *     cdef np.float64_t fbe_node_separation(self, OctreeNode *node1, OctreeNode *node2):             # <<<<<<<<<<<<<<
5043  *         # Find the distance between the two nodes.
5044  *         cdef np.float64_t dx1, dx2, p1, p2, dist
5045  */
5046 
5047   /* function exit code */
5048   __pyx_L0:;
5049   __Pyx_RefNannyFinishContext();
5050   return __pyx_r;
5051 }
5052 
5053 /* "yt/utilities/lib/basic_octree.pyx":314
5054  *
5055  *     @cython.cdivision(True)
5056  *     cdef np.float64_t fbe_opening_angle(self, OctreeNode *node1,             # <<<<<<<<<<<<<<
5057  *             OctreeNode *node2):
5058  *         # Calculate the opening angle of node2 upon the center of node1.
5059  */
5060 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_opening_angle(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node1,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node2)5061 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_opening_angle(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node1, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node2) {
5062   __pyx_t_5numpy_float64_t __pyx_v_d2;
5063   __pyx_t_5numpy_float64_t __pyx_v_dx2;
5064   __pyx_t_5numpy_float64_t __pyx_v_dist;
5065   __pyx_t_5numpy_int64_t __pyx_v_n2;
5066   int __pyx_v_i;
5067   __pyx_t_5numpy_float64_t __pyx_r;
5068   __Pyx_RefNannyDeclarations
5069   int __pyx_t_1;
5070   int __pyx_t_2;
5071   int __pyx_t_3;
5072   __Pyx_RefNannySetupContext("fbe_opening_angle", 0);
5073 
5074   /* "yt/utilities/lib/basic_octree.pyx":325
5075  *         cdef np.int64_t n2
5076  *         cdef int i
5077  *         d2 = 0.0             # <<<<<<<<<<<<<<
5078  *         if node1 is node2: return 100000.0 # Just some large number.
5079  *         if self.top_grid_dims[1] == self.top_grid_dims[0] and \
5080  */
5081   __pyx_v_d2 = 0.0;
5082 
5083   /* "yt/utilities/lib/basic_octree.pyx":326
5084  *         cdef int i
5085  *         d2 = 0.0
5086  *         if node1 is node2: return 100000.0 # Just some large number.             # <<<<<<<<<<<<<<
5087  *         if self.top_grid_dims[1] == self.top_grid_dims[0] and \
5088  *                 self.top_grid_dims[2] == self.top_grid_dims[0]:
5089  */
5090   __pyx_t_1 = ((__pyx_v_node1 == __pyx_v_node2) != 0);
5091   if (__pyx_t_1) {
5092     __pyx_r = 100000.0;
5093     goto __pyx_L0;
5094   }
5095 
5096   /* "yt/utilities/lib/basic_octree.pyx":327
5097  *         d2 = 0.0
5098  *         if node1 is node2: return 100000.0 # Just some large number.
5099  *         if self.top_grid_dims[1] == self.top_grid_dims[0] and \             # <<<<<<<<<<<<<<
5100  *                 self.top_grid_dims[2] == self.top_grid_dims[0]:
5101  *             # Symmetric
5102  */
5103   __pyx_t_2 = (((__pyx_v_self->top_grid_dims[1]) == (__pyx_v_self->top_grid_dims[0])) != 0);
5104   if (__pyx_t_2) {
5105   } else {
5106     __pyx_t_1 = __pyx_t_2;
5107     goto __pyx_L5_bool_binop_done;
5108   }
5109 
5110   /* "yt/utilities/lib/basic_octree.pyx":328
5111  *         if node1 is node2: return 100000.0 # Just some large number.
5112  *         if self.top_grid_dims[1] == self.top_grid_dims[0] and \
5113  *                 self.top_grid_dims[2] == self.top_grid_dims[0]:             # <<<<<<<<<<<<<<
5114  *             # Symmetric
5115  *             n2 = self.po2[node2.level] * self.top_grid_dims[0]
5116  */
5117   __pyx_t_2 = (((__pyx_v_self->top_grid_dims[2]) == (__pyx_v_self->top_grid_dims[0])) != 0);
5118   __pyx_t_1 = __pyx_t_2;
5119   __pyx_L5_bool_binop_done:;
5120 
5121   /* "yt/utilities/lib/basic_octree.pyx":327
5122  *         d2 = 0.0
5123  *         if node1 is node2: return 100000.0 # Just some large number.
5124  *         if self.top_grid_dims[1] == self.top_grid_dims[0] and \             # <<<<<<<<<<<<<<
5125  *                 self.top_grid_dims[2] == self.top_grid_dims[0]:
5126  *             # Symmetric
5127  */
5128   if (__pyx_t_1) {
5129 
5130     /* "yt/utilities/lib/basic_octree.pyx":330
5131  *                 self.top_grid_dims[2] == self.top_grid_dims[0]:
5132  *             # Symmetric
5133  *             n2 = self.po2[node2.level] * self.top_grid_dims[0]             # <<<<<<<<<<<<<<
5134  *             d2 = 1. / (<np.float64_t> n2)
5135  *         else:
5136  */
5137     __pyx_v_n2 = ((__pyx_v_self->po2[__pyx_v_node2->level]) * (__pyx_v_self->top_grid_dims[0]));
5138 
5139     /* "yt/utilities/lib/basic_octree.pyx":331
5140  *             # Symmetric
5141  *             n2 = self.po2[node2.level] * self.top_grid_dims[0]
5142  *             d2 = 1. / (<np.float64_t> n2)             # <<<<<<<<<<<<<<
5143  *         else:
5144  *             # Not symmetric
5145  */
5146     __pyx_v_d2 = (1. / ((__pyx_t_5numpy_float64_t)__pyx_v_n2));
5147 
5148     /* "yt/utilities/lib/basic_octree.pyx":327
5149  *         d2 = 0.0
5150  *         if node1 is node2: return 100000.0 # Just some large number.
5151  *         if self.top_grid_dims[1] == self.top_grid_dims[0] and \             # <<<<<<<<<<<<<<
5152  *                 self.top_grid_dims[2] == self.top_grid_dims[0]:
5153  *             # Symmetric
5154  */
5155     goto __pyx_L4;
5156   }
5157 
5158   /* "yt/utilities/lib/basic_octree.pyx":334
5159  *         else:
5160  *             # Not symmetric
5161  *             for i in range(3):             # <<<<<<<<<<<<<<
5162  *                 n2 = self.po2[node2.level] * self.top_grid_dims[i]
5163  *                 dx2 = 1. / (<np.float64_t> n2)
5164  */
5165   /*else*/ {
5166     for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
5167       __pyx_v_i = __pyx_t_3;
5168 
5169       /* "yt/utilities/lib/basic_octree.pyx":335
5170  *             # Not symmetric
5171  *             for i in range(3):
5172  *                 n2 = self.po2[node2.level] * self.top_grid_dims[i]             # <<<<<<<<<<<<<<
5173  *                 dx2 = 1. / (<np.float64_t> n2)
5174  *                 d2 = f64max(d2, dx2)
5175  */
5176       __pyx_v_n2 = ((__pyx_v_self->po2[__pyx_v_node2->level]) * (__pyx_v_self->top_grid_dims[__pyx_v_i]));
5177 
5178       /* "yt/utilities/lib/basic_octree.pyx":336
5179  *             for i in range(3):
5180  *                 n2 = self.po2[node2.level] * self.top_grid_dims[i]
5181  *                 dx2 = 1. / (<np.float64_t> n2)             # <<<<<<<<<<<<<<
5182  *                 d2 = f64max(d2, dx2)
5183  *         # Now calculate the opening angle.
5184  */
5185       __pyx_v_dx2 = (1. / ((__pyx_t_5numpy_float64_t)__pyx_v_n2));
5186 
5187       /* "yt/utilities/lib/basic_octree.pyx":337
5188  *                 n2 = self.po2[node2.level] * self.top_grid_dims[i]
5189  *                 dx2 = 1. / (<np.float64_t> n2)
5190  *                 d2 = f64max(d2, dx2)             # <<<<<<<<<<<<<<
5191  *         # Now calculate the opening angle.
5192  *         dist = self.fbe_node_separation(node1, node2)
5193  */
5194       __pyx_v_d2 = __pyx_f_2yt_9utilities_3lib_12basic_octree_f64max(__pyx_v_d2, __pyx_v_dx2);
5195     }
5196   }
5197   __pyx_L4:;
5198 
5199   /* "yt/utilities/lib/basic_octree.pyx":339
5200  *                 d2 = f64max(d2, dx2)
5201  *         # Now calculate the opening angle.
5202  *         dist = self.fbe_node_separation(node1, node2)             # <<<<<<<<<<<<<<
5203  *         self.dist = dist
5204  *         return d2 / dist
5205  */
5206   __pyx_v_dist = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->fbe_node_separation(__pyx_v_self, __pyx_v_node1, __pyx_v_node2);
5207 
5208   /* "yt/utilities/lib/basic_octree.pyx":340
5209  *         # Now calculate the opening angle.
5210  *         dist = self.fbe_node_separation(node1, node2)
5211  *         self.dist = dist             # <<<<<<<<<<<<<<
5212  *         return d2 / dist
5213  *
5214  */
5215   __pyx_v_self->dist = __pyx_v_dist;
5216 
5217   /* "yt/utilities/lib/basic_octree.pyx":341
5218  *         dist = self.fbe_node_separation(node1, node2)
5219  *         self.dist = dist
5220  *         return d2 / dist             # <<<<<<<<<<<<<<
5221  *
5222  *     cdef void set_next(self, OctreeNode *node, int treecode):
5223  */
5224   __pyx_r = (__pyx_v_d2 / __pyx_v_dist);
5225   goto __pyx_L0;
5226 
5227   /* "yt/utilities/lib/basic_octree.pyx":314
5228  *
5229  *     @cython.cdivision(True)
5230  *     cdef np.float64_t fbe_opening_angle(self, OctreeNode *node1,             # <<<<<<<<<<<<<<
5231  *             OctreeNode *node2):
5232  *         # Calculate the opening angle of node2 upon the center of node1.
5233  */
5234 
5235   /* function exit code */
5236   __pyx_L0:;
5237   __Pyx_RefNannyFinishContext();
5238   return __pyx_r;
5239 }
5240 
5241 /* "yt/utilities/lib/basic_octree.pyx":343
5242  *         return d2 / dist
5243  *
5244  *     cdef void set_next(self, OctreeNode *node, int treecode):             # <<<<<<<<<<<<<<
5245  *         # This sets up the linked list, pointing node.next to the next node
5246  *         # in the iteration order.
5247  */
5248 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_next(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node,int __pyx_v_treecode)5249 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_next(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node, int __pyx_v_treecode) {
5250   int __pyx_v_i;
5251   int __pyx_v_j;
5252   int __pyx_v_k;
5253   __Pyx_RefNannyDeclarations
5254   int __pyx_t_1;
5255   int __pyx_t_2;
5256   int __pyx_t_3;
5257   int __pyx_t_4;
5258   int __pyx_t_5;
5259   __Pyx_RefNannySetupContext("set_next", 0);
5260 
5261   /* "yt/utilities/lib/basic_octree.pyx":347
5262  *         # in the iteration order.
5263  *         cdef int i, j, k
5264  *         if treecode and node.val[0] is not 0.:             # <<<<<<<<<<<<<<
5265  *             # In a treecode, we only make a new next link if this node has mass.
5266  *             self.last_node.next = node
5267  */
5268   __pyx_t_2 = (__pyx_v_treecode != 0);
5269   if (__pyx_t_2) {
5270   } else {
5271     __pyx_t_1 = __pyx_t_2;
5272     goto __pyx_L4_bool_binop_done;
5273   }
5274   __pyx_t_2 = (((__pyx_v_node->val[0]) != 0.) != 0);
5275   __pyx_t_1 = __pyx_t_2;
5276   __pyx_L4_bool_binop_done:;
5277   if (__pyx_t_1) {
5278 
5279     /* "yt/utilities/lib/basic_octree.pyx":349
5280  *         if treecode and node.val[0] is not 0.:
5281  *             # In a treecode, we only make a new next link if this node has mass.
5282  *             self.last_node.next = node             # <<<<<<<<<<<<<<
5283  *             self.last_node = node
5284  *         elif treecode and node.val[0] is 0.:
5285  */
5286     __pyx_v_self->last_node->next = __pyx_v_node;
5287 
5288     /* "yt/utilities/lib/basic_octree.pyx":350
5289  *             # In a treecode, we only make a new next link if this node has mass.
5290  *             self.last_node.next = node
5291  *             self.last_node = node             # <<<<<<<<<<<<<<
5292  *         elif treecode and node.val[0] is 0.:
5293  *             # No mass means it's children have no mass, no need to dig an
5294  */
5295     __pyx_v_self->last_node = __pyx_v_node;
5296 
5297     /* "yt/utilities/lib/basic_octree.pyx":347
5298  *         # in the iteration order.
5299  *         cdef int i, j, k
5300  *         if treecode and node.val[0] is not 0.:             # <<<<<<<<<<<<<<
5301  *             # In a treecode, we only make a new next link if this node has mass.
5302  *             self.last_node.next = node
5303  */
5304     goto __pyx_L3;
5305   }
5306 
5307   /* "yt/utilities/lib/basic_octree.pyx":351
5308  *             self.last_node.next = node
5309  *             self.last_node = node
5310  *         elif treecode and node.val[0] is 0.:             # <<<<<<<<<<<<<<
5311  *             # No mass means it's children have no mass, no need to dig an
5312  *             # further.
5313  */
5314   __pyx_t_2 = (__pyx_v_treecode != 0);
5315   if (__pyx_t_2) {
5316   } else {
5317     __pyx_t_1 = __pyx_t_2;
5318     goto __pyx_L6_bool_binop_done;
5319   }
5320   __pyx_t_2 = (((__pyx_v_node->val[0]) == 0.) != 0);
5321   __pyx_t_1 = __pyx_t_2;
5322   __pyx_L6_bool_binop_done:;
5323   if (__pyx_t_1) {
5324 
5325     /* "yt/utilities/lib/basic_octree.pyx":354
5326  *             # No mass means it's children have no mass, no need to dig an
5327  *             # further.
5328  *             return             # <<<<<<<<<<<<<<
5329  *         else:
5330  *             # We're not doing the treecode, but we still want a linked list,
5331  */
5332     goto __pyx_L0;
5333 
5334     /* "yt/utilities/lib/basic_octree.pyx":351
5335  *             self.last_node.next = node
5336  *             self.last_node = node
5337  *         elif treecode and node.val[0] is 0.:             # <<<<<<<<<<<<<<
5338  *             # No mass means it's children have no mass, no need to dig an
5339  *             # further.
5340  */
5341   }
5342 
5343   /* "yt/utilities/lib/basic_octree.pyx":358
5344  *             # We're not doing the treecode, but we still want a linked list,
5345  *             # we don't care about val[0] necessarily.
5346  *             self.last_node.next = node             # <<<<<<<<<<<<<<
5347  *             self.last_node = node
5348  *         if node.children[0][0][0] is NULL: return
5349  */
5350   /*else*/ {
5351     __pyx_v_self->last_node->next = __pyx_v_node;
5352 
5353     /* "yt/utilities/lib/basic_octree.pyx":359
5354  *             # we don't care about val[0] necessarily.
5355  *             self.last_node.next = node
5356  *             self.last_node = node             # <<<<<<<<<<<<<<
5357  *         if node.children[0][0][0] is NULL: return
5358  *         for i in range(2):
5359  */
5360     __pyx_v_self->last_node = __pyx_v_node;
5361   }
5362   __pyx_L3:;
5363 
5364   /* "yt/utilities/lib/basic_octree.pyx":360
5365  *             self.last_node.next = node
5366  *             self.last_node = node
5367  *         if node.children[0][0][0] is NULL: return             # <<<<<<<<<<<<<<
5368  *         for i in range(2):
5369  *             for j in range(2):
5370  */
5371   __pyx_t_1 = (((((__pyx_v_node->children[0])[0])[0]) == NULL) != 0);
5372   if (__pyx_t_1) {
5373     goto __pyx_L0;
5374   }
5375 
5376   /* "yt/utilities/lib/basic_octree.pyx":361
5377  *             self.last_node = node
5378  *         if node.children[0][0][0] is NULL: return
5379  *         for i in range(2):             # <<<<<<<<<<<<<<
5380  *             for j in range(2):
5381  *                 for k in range(2):
5382  */
5383   for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
5384     __pyx_v_i = __pyx_t_3;
5385 
5386     /* "yt/utilities/lib/basic_octree.pyx":362
5387  *         if node.children[0][0][0] is NULL: return
5388  *         for i in range(2):
5389  *             for j in range(2):             # <<<<<<<<<<<<<<
5390  *                 for k in range(2):
5391  *                     self.set_next(node.children[i][j][k], treecode)
5392  */
5393     for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
5394       __pyx_v_j = __pyx_t_4;
5395 
5396       /* "yt/utilities/lib/basic_octree.pyx":363
5397  *         for i in range(2):
5398  *             for j in range(2):
5399  *                 for k in range(2):             # <<<<<<<<<<<<<<
5400  *                     self.set_next(node.children[i][j][k], treecode)
5401  *         return
5402  */
5403       for (__pyx_t_5 = 0; __pyx_t_5 < 2; __pyx_t_5+=1) {
5404         __pyx_v_k = __pyx_t_5;
5405 
5406         /* "yt/utilities/lib/basic_octree.pyx":364
5407  *             for j in range(2):
5408  *                 for k in range(2):
5409  *                     self.set_next(node.children[i][j][k], treecode)             # <<<<<<<<<<<<<<
5410  *         return
5411  *
5412  */
5413         ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->set_next(__pyx_v_self, (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]), __pyx_v_treecode);
5414       }
5415     }
5416   }
5417 
5418   /* "yt/utilities/lib/basic_octree.pyx":365
5419  *                 for k in range(2):
5420  *                     self.set_next(node.children[i][j][k], treecode)
5421  *         return             # <<<<<<<<<<<<<<
5422  *
5423  *     cdef void set_up_next(self, OctreeNode *node):
5424  */
5425   goto __pyx_L0;
5426 
5427   /* "yt/utilities/lib/basic_octree.pyx":343
5428  *         return d2 / dist
5429  *
5430  *     cdef void set_next(self, OctreeNode *node, int treecode):             # <<<<<<<<<<<<<<
5431  *         # This sets up the linked list, pointing node.next to the next node
5432  *         # in the iteration order.
5433  */
5434 
5435   /* function exit code */
5436   __pyx_L0:;
5437   __Pyx_RefNannyFinishContext();
5438 }
5439 
5440 /* "yt/utilities/lib/basic_octree.pyx":367
5441  *         return
5442  *
5443  *     cdef void set_up_next(self, OctreeNode *node):             # <<<<<<<<<<<<<<
5444  *         # This sets up a second linked list, pointing node.up_next to the next
5445  *         # node in the list that is at the same or lower (coarser) level than
5446  */
5447 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_up_next(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node)5448 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_up_next(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node) {
5449   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_initial_next;
5450   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_temp_next;
5451   __Pyx_RefNannyDeclarations
5452   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_t_1;
5453   int __pyx_t_2;
5454   __Pyx_RefNannySetupContext("set_up_next", 0);
5455 
5456   /* "yt/utilities/lib/basic_octree.pyx":374
5457  *         cdef OctreeNode *initial_next
5458  *         cdef OctreeNode *temp_next
5459  *         initial_next = node.next             # <<<<<<<<<<<<<<
5460  *         temp_next = node.next
5461  *         if node.next is NULL: return
5462  */
5463   __pyx_t_1 = __pyx_v_node->next;
5464   __pyx_v_initial_next = __pyx_t_1;
5465 
5466   /* "yt/utilities/lib/basic_octree.pyx":375
5467  *         cdef OctreeNode *temp_next
5468  *         initial_next = node.next
5469  *         temp_next = node.next             # <<<<<<<<<<<<<<
5470  *         if node.next is NULL: return
5471  *         while temp_next.level > node.level:
5472  */
5473   __pyx_t_1 = __pyx_v_node->next;
5474   __pyx_v_temp_next = __pyx_t_1;
5475 
5476   /* "yt/utilities/lib/basic_octree.pyx":376
5477  *         initial_next = node.next
5478  *         temp_next = node.next
5479  *         if node.next is NULL: return             # <<<<<<<<<<<<<<
5480  *         while temp_next.level > node.level:
5481  *             temp_next = temp_next.next
5482  */
5483   __pyx_t_2 = ((__pyx_v_node->next == NULL) != 0);
5484   if (__pyx_t_2) {
5485     goto __pyx_L0;
5486   }
5487 
5488   /* "yt/utilities/lib/basic_octree.pyx":377
5489  *         temp_next = node.next
5490  *         if node.next is NULL: return
5491  *         while temp_next.level > node.level:             # <<<<<<<<<<<<<<
5492  *             temp_next = temp_next.next
5493  *             if temp_next is NULL: break
5494  */
5495   while (1) {
5496     __pyx_t_2 = ((__pyx_v_temp_next->level > __pyx_v_node->level) != 0);
5497     if (!__pyx_t_2) break;
5498 
5499     /* "yt/utilities/lib/basic_octree.pyx":378
5500  *         if node.next is NULL: return
5501  *         while temp_next.level > node.level:
5502  *             temp_next = temp_next.next             # <<<<<<<<<<<<<<
5503  *             if temp_next is NULL: break
5504  *         node.up_next = temp_next
5505  */
5506     __pyx_t_1 = __pyx_v_temp_next->next;
5507     __pyx_v_temp_next = __pyx_t_1;
5508 
5509     /* "yt/utilities/lib/basic_octree.pyx":379
5510  *         while temp_next.level > node.level:
5511  *             temp_next = temp_next.next
5512  *             if temp_next is NULL: break             # <<<<<<<<<<<<<<
5513  *         node.up_next = temp_next
5514  *         self.set_up_next(initial_next)
5515  */
5516     __pyx_t_2 = ((__pyx_v_temp_next == NULL) != 0);
5517     if (__pyx_t_2) {
5518       goto __pyx_L5_break;
5519     }
5520   }
5521   __pyx_L5_break:;
5522 
5523   /* "yt/utilities/lib/basic_octree.pyx":380
5524  *             temp_next = temp_next.next
5525  *             if temp_next is NULL: break
5526  *         node.up_next = temp_next             # <<<<<<<<<<<<<<
5527  *         self.set_up_next(initial_next)
5528  *
5529  */
5530   __pyx_v_node->up_next = __pyx_v_temp_next;
5531 
5532   /* "yt/utilities/lib/basic_octree.pyx":381
5533  *             if temp_next is NULL: break
5534  *         node.up_next = temp_next
5535  *         self.set_up_next(initial_next)             # <<<<<<<<<<<<<<
5536  *
5537  *     def finalize(self, int treecode = 0):
5538  */
5539   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->set_up_next(__pyx_v_self, __pyx_v_initial_next);
5540 
5541   /* "yt/utilities/lib/basic_octree.pyx":367
5542  *         return
5543  *
5544  *     cdef void set_up_next(self, OctreeNode *node):             # <<<<<<<<<<<<<<
5545  *         # This sets up a second linked list, pointing node.up_next to the next
5546  *         # node in the list that is at the same or lower (coarser) level than
5547  */
5548 
5549   /* function exit code */
5550   __pyx_L0:;
5551   __Pyx_RefNannyFinishContext();
5552 }
5553 
5554 /* "yt/utilities/lib/basic_octree.pyx":383
5555  *         self.set_up_next(initial_next)
5556  *
5557  *     def finalize(self, int treecode = 0):             # <<<<<<<<<<<<<<
5558  *         # Set up the linked list for the nodes.
5559  *         # Set treecode = 1 if nodes with no mass are to be skipped in the
5560  */
5561 
5562 /* Python wrapper */
5563 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_9finalize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_9finalize(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5564 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_9finalize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5565   int __pyx_v_treecode;
5566   PyObject *__pyx_r = 0;
5567   __Pyx_RefNannyDeclarations
5568   __Pyx_RefNannySetupContext("finalize (wrapper)", 0);
5569   {
5570     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_treecode,0};
5571     PyObject* values[1] = {0};
5572     if (unlikely(__pyx_kwds)) {
5573       Py_ssize_t kw_args;
5574       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5575       switch (pos_args) {
5576         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5577         CYTHON_FALLTHROUGH;
5578         case  0: break;
5579         default: goto __pyx_L5_argtuple_error;
5580       }
5581       kw_args = PyDict_Size(__pyx_kwds);
5582       switch (pos_args) {
5583         case  0:
5584         if (kw_args > 0) {
5585           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_treecode);
5586           if (value) { values[0] = value; kw_args--; }
5587         }
5588       }
5589       if (unlikely(kw_args > 0)) {
5590         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "finalize") < 0)) __PYX_ERR(0, 383, __pyx_L3_error)
5591       }
5592     } else {
5593       switch (PyTuple_GET_SIZE(__pyx_args)) {
5594         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5595         CYTHON_FALLTHROUGH;
5596         case  0: break;
5597         default: goto __pyx_L5_argtuple_error;
5598       }
5599     }
5600     if (values[0]) {
5601       __pyx_v_treecode = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_treecode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 383, __pyx_L3_error)
5602     } else {
5603       __pyx_v_treecode = ((int)0);
5604     }
5605   }
5606   goto __pyx_L4_argument_unpacking_done;
5607   __pyx_L5_argtuple_error:;
5608   __Pyx_RaiseArgtupleInvalid("finalize", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 383, __pyx_L3_error)
5609   __pyx_L3_error:;
5610   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
5611   __Pyx_RefNannyFinishContext();
5612   return NULL;
5613   __pyx_L4_argument_unpacking_done:;
5614   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_8finalize(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), __pyx_v_treecode);
5615 
5616   /* function exit code */
5617   __Pyx_RefNannyFinishContext();
5618   return __pyx_r;
5619 }
5620 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_8finalize(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,int __pyx_v_treecode)5621 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_8finalize(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_treecode) {
5622   int __pyx_v_i;
5623   int __pyx_v_j;
5624   int __pyx_v_k;
5625   int __pyx_v_sum;
5626   int __pyx_v_top_grid_total;
5627   int __pyx_v_ii;
5628   int __pyx_v_jj;
5629   int __pyx_v_kk;
5630   PyObject *__pyx_r = NULL;
5631   __Pyx_RefNannyDeclarations
5632   __pyx_t_5numpy_int64_t __pyx_t_1;
5633   __pyx_t_5numpy_int64_t __pyx_t_2;
5634   int __pyx_t_3;
5635   __pyx_t_5numpy_int64_t __pyx_t_4;
5636   __pyx_t_5numpy_int64_t __pyx_t_5;
5637   int __pyx_t_6;
5638   __pyx_t_5numpy_int64_t __pyx_t_7;
5639   __pyx_t_5numpy_int64_t __pyx_t_8;
5640   int __pyx_t_9;
5641   int __pyx_t_10;
5642   long __pyx_t_11;
5643   __Pyx_RefNannySetupContext("finalize", 0);
5644 
5645   /* "yt/utilities/lib/basic_octree.pyx":388
5646  *         # list.
5647  *         cdef int i, j, k, sum, top_grid_total, ii, jj, kk
5648  *         self.last_node = self.root_nodes[0][0][0]             # <<<<<<<<<<<<<<
5649  *         for i in range(self.top_grid_dims[0]):
5650  *             for j in range(self.top_grid_dims[1]):
5651  */
5652   __pyx_v_self->last_node = (((__pyx_v_self->root_nodes[0])[0])[0]);
5653 
5654   /* "yt/utilities/lib/basic_octree.pyx":389
5655  *         cdef int i, j, k, sum, top_grid_total, ii, jj, kk
5656  *         self.last_node = self.root_nodes[0][0][0]
5657  *         for i in range(self.top_grid_dims[0]):             # <<<<<<<<<<<<<<
5658  *             for j in range(self.top_grid_dims[1]):
5659  *                 for k in range(self.top_grid_dims[2]):
5660  */
5661   __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
5662   __pyx_t_2 = __pyx_t_1;
5663   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5664     __pyx_v_i = __pyx_t_3;
5665 
5666     /* "yt/utilities/lib/basic_octree.pyx":390
5667  *         self.last_node = self.root_nodes[0][0][0]
5668  *         for i in range(self.top_grid_dims[0]):
5669  *             for j in range(self.top_grid_dims[1]):             # <<<<<<<<<<<<<<
5670  *                 for k in range(self.top_grid_dims[2]):
5671  *                     self.set_next(self.root_nodes[i][j][k], treecode)
5672  */
5673     __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
5674     __pyx_t_5 = __pyx_t_4;
5675     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
5676       __pyx_v_j = __pyx_t_6;
5677 
5678       /* "yt/utilities/lib/basic_octree.pyx":391
5679  *         for i in range(self.top_grid_dims[0]):
5680  *             for j in range(self.top_grid_dims[1]):
5681  *                 for k in range(self.top_grid_dims[2]):             # <<<<<<<<<<<<<<
5682  *                     self.set_next(self.root_nodes[i][j][k], treecode)
5683  *         # Now we want to link to the next node in the list that is
5684  */
5685       __pyx_t_7 = (__pyx_v_self->top_grid_dims[2]);
5686       __pyx_t_8 = __pyx_t_7;
5687       for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
5688         __pyx_v_k = __pyx_t_9;
5689 
5690         /* "yt/utilities/lib/basic_octree.pyx":392
5691  *             for j in range(self.top_grid_dims[1]):
5692  *                 for k in range(self.top_grid_dims[2]):
5693  *                     self.set_next(self.root_nodes[i][j][k], treecode)             # <<<<<<<<<<<<<<
5694  *         # Now we want to link to the next node in the list that is
5695  *         # on a level the same or lower (coarser) than us. This will be used
5696  */
5697         ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->set_next(__pyx_v_self, (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]), __pyx_v_treecode);
5698       }
5699     }
5700   }
5701 
5702   /* "yt/utilities/lib/basic_octree.pyx":396
5703  *         # on a level the same or lower (coarser) than us. This will be used
5704  *         # during a treecode search so we can skip higher-level (finer) nodes.
5705  *         sum = 1             # <<<<<<<<<<<<<<
5706  *         top_grid_total = self.top_grid_dims[0] * self.top_grid_dims[1] * \
5707  *             self.top_grid_dims[2]
5708  */
5709   __pyx_v_sum = 1;
5710 
5711   /* "yt/utilities/lib/basic_octree.pyx":397
5712  *         # during a treecode search so we can skip higher-level (finer) nodes.
5713  *         sum = 1
5714  *         top_grid_total = self.top_grid_dims[0] * self.top_grid_dims[1] * \             # <<<<<<<<<<<<<<
5715  *             self.top_grid_dims[2]
5716  *         for i in range(self.top_grid_dims[0]):
5717  */
5718   __pyx_v_top_grid_total = (((__pyx_v_self->top_grid_dims[0]) * (__pyx_v_self->top_grid_dims[1])) * (__pyx_v_self->top_grid_dims[2]));
5719 
5720   /* "yt/utilities/lib/basic_octree.pyx":399
5721  *         top_grid_total = self.top_grid_dims[0] * self.top_grid_dims[1] * \
5722  *             self.top_grid_dims[2]
5723  *         for i in range(self.top_grid_dims[0]):             # <<<<<<<<<<<<<<
5724  *             for j in range(self.top_grid_dims[1]):
5725  *                 for k in range(self.top_grid_dims[2]):
5726  */
5727   __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
5728   __pyx_t_2 = __pyx_t_1;
5729   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5730     __pyx_v_i = __pyx_t_3;
5731 
5732     /* "yt/utilities/lib/basic_octree.pyx":400
5733  *             self.top_grid_dims[2]
5734  *         for i in range(self.top_grid_dims[0]):
5735  *             for j in range(self.top_grid_dims[1]):             # <<<<<<<<<<<<<<
5736  *                 for k in range(self.top_grid_dims[2]):
5737  *                     self.set_up_next(self.root_nodes[i][j][k])
5738  */
5739     __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
5740     __pyx_t_5 = __pyx_t_4;
5741     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
5742       __pyx_v_j = __pyx_t_6;
5743 
5744       /* "yt/utilities/lib/basic_octree.pyx":401
5745  *         for i in range(self.top_grid_dims[0]):
5746  *             for j in range(self.top_grid_dims[1]):
5747  *                 for k in range(self.top_grid_dims[2]):             # <<<<<<<<<<<<<<
5748  *                     self.set_up_next(self.root_nodes[i][j][k])
5749  *                     # Point the root_nodes.up_next to the next root_node in the
5750  */
5751       __pyx_t_7 = (__pyx_v_self->top_grid_dims[2]);
5752       __pyx_t_8 = __pyx_t_7;
5753       for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
5754         __pyx_v_k = __pyx_t_9;
5755 
5756         /* "yt/utilities/lib/basic_octree.pyx":402
5757  *             for j in range(self.top_grid_dims[1]):
5758  *                 for k in range(self.top_grid_dims[2]):
5759  *                     self.set_up_next(self.root_nodes[i][j][k])             # <<<<<<<<<<<<<<
5760  *                     # Point the root_nodes.up_next to the next root_node in the
5761  *                     # list, except for the last one which stays pointing to NULL.
5762  */
5763         ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->set_up_next(__pyx_v_self, (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]));
5764 
5765         /* "yt/utilities/lib/basic_octree.pyx":405
5766  *                     # Point the root_nodes.up_next to the next root_node in the
5767  *                     # list, except for the last one which stays pointing to NULL.
5768  *                     if sum < top_grid_total - 1:             # <<<<<<<<<<<<<<
5769  *                         ii = i
5770  *                         jj = j
5771  */
5772         __pyx_t_10 = ((__pyx_v_sum < (__pyx_v_top_grid_total - 1)) != 0);
5773         if (__pyx_t_10) {
5774 
5775           /* "yt/utilities/lib/basic_octree.pyx":406
5776  *                     # list, except for the last one which stays pointing to NULL.
5777  *                     if sum < top_grid_total - 1:
5778  *                         ii = i             # <<<<<<<<<<<<<<
5779  *                         jj = j
5780  *                         kk = (k + 1) % self.top_grid_dims[2]
5781  */
5782           __pyx_v_ii = __pyx_v_i;
5783 
5784           /* "yt/utilities/lib/basic_octree.pyx":407
5785  *                     if sum < top_grid_total - 1:
5786  *                         ii = i
5787  *                         jj = j             # <<<<<<<<<<<<<<
5788  *                         kk = (k + 1) % self.top_grid_dims[2]
5789  *                         if kk < k:
5790  */
5791           __pyx_v_jj = __pyx_v_j;
5792 
5793           /* "yt/utilities/lib/basic_octree.pyx":408
5794  *                         ii = i
5795  *                         jj = j
5796  *                         kk = (k + 1) % self.top_grid_dims[2]             # <<<<<<<<<<<<<<
5797  *                         if kk < k:
5798  *                             jj = (j + 1) % self.top_grid_dims[1]
5799  */
5800           __pyx_t_11 = (__pyx_v_k + 1);
5801           if (unlikely((__pyx_v_self->top_grid_dims[2]) == 0)) {
5802             PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
5803             __PYX_ERR(0, 408, __pyx_L1_error)
5804           }
5805           __pyx_v_kk = __Pyx_mod___pyx_t_5numpy_int64_t(__pyx_t_11, (__pyx_v_self->top_grid_dims[2]));
5806 
5807           /* "yt/utilities/lib/basic_octree.pyx":409
5808  *                         jj = j
5809  *                         kk = (k + 1) % self.top_grid_dims[2]
5810  *                         if kk < k:             # <<<<<<<<<<<<<<
5811  *                             jj = (j + 1) % self.top_grid_dims[1]
5812  *                             if jj < j:
5813  */
5814           __pyx_t_10 = ((__pyx_v_kk < __pyx_v_k) != 0);
5815           if (__pyx_t_10) {
5816 
5817             /* "yt/utilities/lib/basic_octree.pyx":410
5818  *                         kk = (k + 1) % self.top_grid_dims[2]
5819  *                         if kk < k:
5820  *                             jj = (j + 1) % self.top_grid_dims[1]             # <<<<<<<<<<<<<<
5821  *                             if jj < j:
5822  *                                 ii = (i + 1) % self.top_grid_dims[0]
5823  */
5824             __pyx_t_11 = (__pyx_v_j + 1);
5825             if (unlikely((__pyx_v_self->top_grid_dims[1]) == 0)) {
5826               PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
5827               __PYX_ERR(0, 410, __pyx_L1_error)
5828             }
5829             __pyx_v_jj = __Pyx_mod___pyx_t_5numpy_int64_t(__pyx_t_11, (__pyx_v_self->top_grid_dims[1]));
5830 
5831             /* "yt/utilities/lib/basic_octree.pyx":411
5832  *                         if kk < k:
5833  *                             jj = (j + 1) % self.top_grid_dims[1]
5834  *                             if jj < j:             # <<<<<<<<<<<<<<
5835  *                                 ii = (i + 1) % self.top_grid_dims[0]
5836  *                         self.root_nodes[i][j][k].up_next = \
5837  */
5838             __pyx_t_10 = ((__pyx_v_jj < __pyx_v_j) != 0);
5839             if (__pyx_t_10) {
5840 
5841               /* "yt/utilities/lib/basic_octree.pyx":412
5842  *                             jj = (j + 1) % self.top_grid_dims[1]
5843  *                             if jj < j:
5844  *                                 ii = (i + 1) % self.top_grid_dims[0]             # <<<<<<<<<<<<<<
5845  *                         self.root_nodes[i][j][k].up_next = \
5846  *                             self.root_nodes[ii][jj][kk]
5847  */
5848               __pyx_t_11 = (__pyx_v_i + 1);
5849               if (unlikely((__pyx_v_self->top_grid_dims[0]) == 0)) {
5850                 PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
5851                 __PYX_ERR(0, 412, __pyx_L1_error)
5852               }
5853               __pyx_v_ii = __Pyx_mod___pyx_t_5numpy_int64_t(__pyx_t_11, (__pyx_v_self->top_grid_dims[0]));
5854 
5855               /* "yt/utilities/lib/basic_octree.pyx":411
5856  *                         if kk < k:
5857  *                             jj = (j + 1) % self.top_grid_dims[1]
5858  *                             if jj < j:             # <<<<<<<<<<<<<<
5859  *                                 ii = (i + 1) % self.top_grid_dims[0]
5860  *                         self.root_nodes[i][j][k].up_next = \
5861  */
5862             }
5863 
5864             /* "yt/utilities/lib/basic_octree.pyx":409
5865  *                         jj = j
5866  *                         kk = (k + 1) % self.top_grid_dims[2]
5867  *                         if kk < k:             # <<<<<<<<<<<<<<
5868  *                             jj = (j + 1) % self.top_grid_dims[1]
5869  *                             if jj < j:
5870  */
5871           }
5872 
5873           /* "yt/utilities/lib/basic_octree.pyx":413
5874  *                             if jj < j:
5875  *                                 ii = (i + 1) % self.top_grid_dims[0]
5876  *                         self.root_nodes[i][j][k].up_next = \             # <<<<<<<<<<<<<<
5877  *                             self.root_nodes[ii][jj][kk]
5878  *                     sum += 1
5879  */
5880           (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k])->up_next = (((__pyx_v_self->root_nodes[__pyx_v_ii])[__pyx_v_jj])[__pyx_v_kk]);
5881 
5882           /* "yt/utilities/lib/basic_octree.pyx":405
5883  *                     # Point the root_nodes.up_next to the next root_node in the
5884  *                     # list, except for the last one which stays pointing to NULL.
5885  *                     if sum < top_grid_total - 1:             # <<<<<<<<<<<<<<
5886  *                         ii = i
5887  *                         jj = j
5888  */
5889         }
5890 
5891         /* "yt/utilities/lib/basic_octree.pyx":415
5892  *                         self.root_nodes[i][j][k].up_next = \
5893  *                             self.root_nodes[ii][jj][kk]
5894  *                     sum += 1             # <<<<<<<<<<<<<<
5895  *
5896  *     @cython.cdivision(True)
5897  */
5898         __pyx_v_sum = (__pyx_v_sum + 1);
5899       }
5900     }
5901   }
5902 
5903   /* "yt/utilities/lib/basic_octree.pyx":383
5904  *         self.set_up_next(initial_next)
5905  *
5906  *     def finalize(self, int treecode = 0):             # <<<<<<<<<<<<<<
5907  *         # Set up the linked list for the nodes.
5908  *         # Set treecode = 1 if nodes with no mass are to be skipped in the
5909  */
5910 
5911   /* function exit code */
5912   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5913   goto __pyx_L0;
5914   __pyx_L1_error:;
5915   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.finalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
5916   __pyx_r = NULL;
5917   __pyx_L0:;
5918   __Pyx_XGIVEREF(__pyx_r);
5919   __Pyx_RefNannyFinishContext();
5920   return __pyx_r;
5921 }
5922 
5923 /* "yt/utilities/lib/basic_octree.pyx":418
5924  *
5925  *     @cython.cdivision(True)
5926  *     cdef np.float64_t fbe_main(self, np.float64_t potential, int truncate,             # <<<<<<<<<<<<<<
5927  *             np.float64_t kinetic):
5928  *         # The work is done here. Starting at the top of the linked list of
5929  */
5930 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_main(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,__pyx_t_5numpy_float64_t __pyx_v_potential,int __pyx_v_truncate,__pyx_t_5numpy_float64_t __pyx_v_kinetic)5931 static __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_main(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, __pyx_t_5numpy_float64_t __pyx_v_potential, int __pyx_v_truncate, __pyx_t_5numpy_float64_t __pyx_v_kinetic) {
5932   __pyx_t_5numpy_float64_t __pyx_v_angle;
5933   __pyx_t_5numpy_float64_t __pyx_v_dist;
5934   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_this_node;
5935   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_pair_node;
5936   __pyx_t_5numpy_float64_t __pyx_r;
5937   __Pyx_RefNannyDeclarations
5938   int __pyx_t_1;
5939   struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_t_2;
5940   int __pyx_t_3;
5941   __Pyx_RefNannySetupContext("fbe_main", 0);
5942 
5943   /* "yt/utilities/lib/basic_octree.pyx":425
5944  *         cdef OctreeNode *this_node
5945  *         cdef OctreeNode *pair_node
5946  *         this_node = self.root_nodes[0][0][0]             # <<<<<<<<<<<<<<
5947  *         while this_node is not NULL:
5948  *             # Iterate down the list to a node that either has no children and
5949  */
5950   __pyx_v_this_node = (((__pyx_v_self->root_nodes[0])[0])[0]);
5951 
5952   /* "yt/utilities/lib/basic_octree.pyx":426
5953  *         cdef OctreeNode *pair_node
5954  *         this_node = self.root_nodes[0][0][0]
5955  *         while this_node is not NULL:             # <<<<<<<<<<<<<<
5956  *             # Iterate down the list to a node that either has no children and
5957  *             # is at the max_level of the tree, or to a node where
5958  */
5959   while (1) {
5960     __pyx_t_1 = ((__pyx_v_this_node != NULL) != 0);
5961     if (!__pyx_t_1) break;
5962 
5963     /* "yt/utilities/lib/basic_octree.pyx":431
5964  *             # all of its children are massless. The second case is when data
5965  *             # from a level that isn't the deepest has been added to the tree.
5966  *             while this_node.max_level is not this_node.level:             # <<<<<<<<<<<<<<
5967  *                 this_node = this_node.next
5968  *                 # In case we reach the end of the list...
5969  */
5970     while (1) {
5971       __pyx_t_1 = ((__pyx_v_this_node->max_level != __pyx_v_this_node->level) != 0);
5972       if (!__pyx_t_1) break;
5973 
5974       /* "yt/utilities/lib/basic_octree.pyx":432
5975  *             # from a level that isn't the deepest has been added to the tree.
5976  *             while this_node.max_level is not this_node.level:
5977  *                 this_node = this_node.next             # <<<<<<<<<<<<<<
5978  *                 # In case we reach the end of the list...
5979  *                 if this_node is NULL: break
5980  */
5981       __pyx_t_2 = __pyx_v_this_node->next;
5982       __pyx_v_this_node = __pyx_t_2;
5983 
5984       /* "yt/utilities/lib/basic_octree.pyx":434
5985  *                 this_node = this_node.next
5986  *                 # In case we reach the end of the list...
5987  *                 if this_node is NULL: break             # <<<<<<<<<<<<<<
5988  *             if this_node is NULL: break
5989  *             if truncate and potential > kinetic:
5990  */
5991       __pyx_t_1 = ((__pyx_v_this_node == NULL) != 0);
5992       if (__pyx_t_1) {
5993         goto __pyx_L6_break;
5994       }
5995     }
5996     __pyx_L6_break:;
5997 
5998     /* "yt/utilities/lib/basic_octree.pyx":435
5999  *                 # In case we reach the end of the list...
6000  *                 if this_node is NULL: break
6001  *             if this_node is NULL: break             # <<<<<<<<<<<<<<
6002  *             if truncate and potential > kinetic:
6003  *                 print('Truncating...')
6004  */
6005     __pyx_t_1 = ((__pyx_v_this_node == NULL) != 0);
6006     if (__pyx_t_1) {
6007       goto __pyx_L4_break;
6008     }
6009 
6010     /* "yt/utilities/lib/basic_octree.pyx":436
6011  *                 if this_node is NULL: break
6012  *             if this_node is NULL: break
6013  *             if truncate and potential > kinetic:             # <<<<<<<<<<<<<<
6014  *                 print('Truncating...')
6015  *                 break
6016  */
6017     __pyx_t_3 = (__pyx_v_truncate != 0);
6018     if (__pyx_t_3) {
6019     } else {
6020       __pyx_t_1 = __pyx_t_3;
6021       goto __pyx_L10_bool_binop_done;
6022     }
6023     __pyx_t_3 = ((__pyx_v_potential > __pyx_v_kinetic) != 0);
6024     __pyx_t_1 = __pyx_t_3;
6025     __pyx_L10_bool_binop_done:;
6026     if (__pyx_t_1) {
6027 
6028       /* "yt/utilities/lib/basic_octree.pyx":437
6029  *             if this_node is NULL: break
6030  *             if truncate and potential > kinetic:
6031  *                 print('Truncating...')             # <<<<<<<<<<<<<<
6032  *                 break
6033  *             pair_node = this_node.next
6034  */
6035       if (__Pyx_PrintOne(0, __pyx_kp_s_Truncating) < 0) __PYX_ERR(0, 437, __pyx_L1_error)
6036 
6037       /* "yt/utilities/lib/basic_octree.pyx":438
6038  *             if truncate and potential > kinetic:
6039  *                 print('Truncating...')
6040  *                 break             # <<<<<<<<<<<<<<
6041  *             pair_node = this_node.next
6042  *             while pair_node is not NULL:
6043  */
6044       goto __pyx_L4_break;
6045 
6046       /* "yt/utilities/lib/basic_octree.pyx":436
6047  *                 if this_node is NULL: break
6048  *             if this_node is NULL: break
6049  *             if truncate and potential > kinetic:             # <<<<<<<<<<<<<<
6050  *                 print('Truncating...')
6051  *                 break
6052  */
6053     }
6054 
6055     /* "yt/utilities/lib/basic_octree.pyx":439
6056  *                 print('Truncating...')
6057  *                 break
6058  *             pair_node = this_node.next             # <<<<<<<<<<<<<<
6059  *             while pair_node is not NULL:
6060  *                 # If pair_node is massless, we can jump to up_next, because
6061  */
6062     __pyx_t_2 = __pyx_v_this_node->next;
6063     __pyx_v_pair_node = __pyx_t_2;
6064 
6065     /* "yt/utilities/lib/basic_octree.pyx":440
6066  *                 break
6067  *             pair_node = this_node.next
6068  *             while pair_node is not NULL:             # <<<<<<<<<<<<<<
6069  *                 # If pair_node is massless, we can jump to up_next, because
6070  *                 # nothing pair_node contains will have mass either.
6071  */
6072     while (1) {
6073       __pyx_t_1 = ((__pyx_v_pair_node != NULL) != 0);
6074       if (!__pyx_t_1) break;
6075 
6076       /* "yt/utilities/lib/basic_octree.pyx":445
6077  *                 # I think that this should primarily happen for root_nodes
6078  *                 # created for padding to make the region cubical.
6079  *                 if pair_node.val[0] is 0.0:             # <<<<<<<<<<<<<<
6080  *                     pair_node = pair_node.up_next
6081  *                     continue
6082  */
6083       __pyx_t_1 = (((__pyx_v_pair_node->val[0]) == 0.0) != 0);
6084       if (__pyx_t_1) {
6085 
6086         /* "yt/utilities/lib/basic_octree.pyx":446
6087  *                 # created for padding to make the region cubical.
6088  *                 if pair_node.val[0] is 0.0:
6089  *                     pair_node = pair_node.up_next             # <<<<<<<<<<<<<<
6090  *                     continue
6091  *                 # If pair_node is a childless node, or is a coarser node with
6092  */
6093         __pyx_t_2 = __pyx_v_pair_node->up_next;
6094         __pyx_v_pair_node = __pyx_t_2;
6095 
6096         /* "yt/utilities/lib/basic_octree.pyx":447
6097  *                 if pair_node.val[0] is 0.0:
6098  *                     pair_node = pair_node.up_next
6099  *                     continue             # <<<<<<<<<<<<<<
6100  *                 # If pair_node is a childless node, or is a coarser node with
6101  *                 # no children, we can calculate the pot
6102  */
6103         goto __pyx_L12_continue;
6104 
6105         /* "yt/utilities/lib/basic_octree.pyx":445
6106  *                 # I think that this should primarily happen for root_nodes
6107  *                 # created for padding to make the region cubical.
6108  *                 if pair_node.val[0] is 0.0:             # <<<<<<<<<<<<<<
6109  *                     pair_node = pair_node.up_next
6110  *                     continue
6111  */
6112       }
6113 
6114       /* "yt/utilities/lib/basic_octree.pyx":451
6115  *                 # no children, we can calculate the pot
6116  *                 # right now, and get a new pair_node.
6117  *                 if pair_node.max_level is pair_node.level:             # <<<<<<<<<<<<<<
6118  *                     dist = self.fbe_node_separation(this_node, pair_node)
6119  *                     potential += this_node.val[0] * pair_node.val[0] / dist
6120  */
6121       __pyx_t_1 = ((__pyx_v_pair_node->max_level == __pyx_v_pair_node->level) != 0);
6122       if (__pyx_t_1) {
6123 
6124         /* "yt/utilities/lib/basic_octree.pyx":452
6125  *                 # right now, and get a new pair_node.
6126  *                 if pair_node.max_level is pair_node.level:
6127  *                     dist = self.fbe_node_separation(this_node, pair_node)             # <<<<<<<<<<<<<<
6128  *                     potential += this_node.val[0] * pair_node.val[0] / dist
6129  *                     if truncate and potential > kinetic: break
6130  */
6131         __pyx_v_dist = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->fbe_node_separation(__pyx_v_self, __pyx_v_this_node, __pyx_v_pair_node);
6132 
6133         /* "yt/utilities/lib/basic_octree.pyx":453
6134  *                 if pair_node.max_level is pair_node.level:
6135  *                     dist = self.fbe_node_separation(this_node, pair_node)
6136  *                     potential += this_node.val[0] * pair_node.val[0] / dist             # <<<<<<<<<<<<<<
6137  *                     if truncate and potential > kinetic: break
6138  *                     pair_node = pair_node.next
6139  */
6140         __pyx_v_potential = (__pyx_v_potential + (((__pyx_v_this_node->val[0]) * (__pyx_v_pair_node->val[0])) / __pyx_v_dist));
6141 
6142         /* "yt/utilities/lib/basic_octree.pyx":454
6143  *                     dist = self.fbe_node_separation(this_node, pair_node)
6144  *                     potential += this_node.val[0] * pair_node.val[0] / dist
6145  *                     if truncate and potential > kinetic: break             # <<<<<<<<<<<<<<
6146  *                     pair_node = pair_node.next
6147  *                     continue
6148  */
6149         __pyx_t_3 = (__pyx_v_truncate != 0);
6150         if (__pyx_t_3) {
6151         } else {
6152           __pyx_t_1 = __pyx_t_3;
6153           goto __pyx_L17_bool_binop_done;
6154         }
6155         __pyx_t_3 = ((__pyx_v_potential > __pyx_v_kinetic) != 0);
6156         __pyx_t_1 = __pyx_t_3;
6157         __pyx_L17_bool_binop_done:;
6158         if (__pyx_t_1) {
6159           goto __pyx_L13_break;
6160         }
6161 
6162         /* "yt/utilities/lib/basic_octree.pyx":455
6163  *                     potential += this_node.val[0] * pair_node.val[0] / dist
6164  *                     if truncate and potential > kinetic: break
6165  *                     pair_node = pair_node.next             # <<<<<<<<<<<<<<
6166  *                     continue
6167  *                 # Next, if the opening angle to pair_node is small enough,
6168  */
6169         __pyx_t_2 = __pyx_v_pair_node->next;
6170         __pyx_v_pair_node = __pyx_t_2;
6171 
6172         /* "yt/utilities/lib/basic_octree.pyx":456
6173  *                     if truncate and potential > kinetic: break
6174  *                     pair_node = pair_node.next
6175  *                     continue             # <<<<<<<<<<<<<<
6176  *                 # Next, if the opening angle to pair_node is small enough,
6177  *                 # calculate the potential and get a new pair_node using
6178  */
6179         goto __pyx_L12_continue;
6180 
6181         /* "yt/utilities/lib/basic_octree.pyx":451
6182  *                 # no children, we can calculate the pot
6183  *                 # right now, and get a new pair_node.
6184  *                 if pair_node.max_level is pair_node.level:             # <<<<<<<<<<<<<<
6185  *                     dist = self.fbe_node_separation(this_node, pair_node)
6186  *                     potential += this_node.val[0] * pair_node.val[0] / dist
6187  */
6188       }
6189 
6190       /* "yt/utilities/lib/basic_octree.pyx":460
6191  *                 # calculate the potential and get a new pair_node using
6192  *                 # up_next because we don't need to look at pair_node's children.
6193  *                 angle = self.fbe_opening_angle(this_node, pair_node)             # <<<<<<<<<<<<<<
6194  *                 if angle < self.opening_angle:
6195  *                     # self.dist was just set in fbe_opening_angle, so we
6196  */
6197       __pyx_v_angle = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->fbe_opening_angle(__pyx_v_self, __pyx_v_this_node, __pyx_v_pair_node);
6198 
6199       /* "yt/utilities/lib/basic_octree.pyx":461
6200  *                 # up_next because we don't need to look at pair_node's children.
6201  *                 angle = self.fbe_opening_angle(this_node, pair_node)
6202  *                 if angle < self.opening_angle:             # <<<<<<<<<<<<<<
6203  *                     # self.dist was just set in fbe_opening_angle, so we
6204  *                     # can use it here without re-calculating it for these two
6205  */
6206       __pyx_t_1 = ((__pyx_v_angle < __pyx_v_self->opening_angle) != 0);
6207       if (__pyx_t_1) {
6208 
6209         /* "yt/utilities/lib/basic_octree.pyx":465
6210  *                     # can use it here without re-calculating it for these two
6211  *                     # nodes.
6212  *                     potential += this_node.val[0] * pair_node.val[0] / self.dist             # <<<<<<<<<<<<<<
6213  *                     if truncate and potential > kinetic: break
6214  *                     # We can skip all the nodes that are contained within
6215  */
6216         __pyx_v_potential = (__pyx_v_potential + (((__pyx_v_this_node->val[0]) * (__pyx_v_pair_node->val[0])) / __pyx_v_self->dist));
6217 
6218         /* "yt/utilities/lib/basic_octree.pyx":466
6219  *                     # nodes.
6220  *                     potential += this_node.val[0] * pair_node.val[0] / self.dist
6221  *                     if truncate and potential > kinetic: break             # <<<<<<<<<<<<<<
6222  *                     # We can skip all the nodes that are contained within
6223  *                     # pair_node, saving time walking the linked list.
6224  */
6225         __pyx_t_3 = (__pyx_v_truncate != 0);
6226         if (__pyx_t_3) {
6227         } else {
6228           __pyx_t_1 = __pyx_t_3;
6229           goto __pyx_L21_bool_binop_done;
6230         }
6231         __pyx_t_3 = ((__pyx_v_potential > __pyx_v_kinetic) != 0);
6232         __pyx_t_1 = __pyx_t_3;
6233         __pyx_L21_bool_binop_done:;
6234         if (__pyx_t_1) {
6235           goto __pyx_L13_break;
6236         }
6237 
6238         /* "yt/utilities/lib/basic_octree.pyx":469
6239  *                     # We can skip all the nodes that are contained within
6240  *                     # pair_node, saving time walking the linked list.
6241  *                     pair_node = pair_node.up_next             # <<<<<<<<<<<<<<
6242  *                 # If we've gotten this far, pair_node has children, but it's
6243  *                 # too coarse, so we simply dig deeper using .next.
6244  */
6245         __pyx_t_2 = __pyx_v_pair_node->up_next;
6246         __pyx_v_pair_node = __pyx_t_2;
6247 
6248         /* "yt/utilities/lib/basic_octree.pyx":461
6249  *                 # up_next because we don't need to look at pair_node's children.
6250  *                 angle = self.fbe_opening_angle(this_node, pair_node)
6251  *                 if angle < self.opening_angle:             # <<<<<<<<<<<<<<
6252  *                     # self.dist was just set in fbe_opening_angle, so we
6253  *                     # can use it here without re-calculating it for these two
6254  */
6255         goto __pyx_L19;
6256       }
6257 
6258       /* "yt/utilities/lib/basic_octree.pyx":473
6259  *                 # too coarse, so we simply dig deeper using .next.
6260  *                 else:
6261  *                     pair_node = pair_node.next             # <<<<<<<<<<<<<<
6262  *             # We've exhausted the pair_nodes.
6263  *             # Now we find a new this_node in the list, and do more searches
6264  */
6265       /*else*/ {
6266         __pyx_t_2 = __pyx_v_pair_node->next;
6267         __pyx_v_pair_node = __pyx_t_2;
6268       }
6269       __pyx_L19:;
6270       __pyx_L12_continue:;
6271     }
6272     __pyx_L13_break:;
6273 
6274     /* "yt/utilities/lib/basic_octree.pyx":477
6275  *             # Now we find a new this_node in the list, and do more searches
6276  *             # over pair_node.
6277  *             this_node = this_node.next             # <<<<<<<<<<<<<<
6278  *         return potential
6279  *
6280  */
6281     __pyx_t_2 = __pyx_v_this_node->next;
6282     __pyx_v_this_node = __pyx_t_2;
6283   }
6284   __pyx_L4_break:;
6285 
6286   /* "yt/utilities/lib/basic_octree.pyx":478
6287  *             # over pair_node.
6288  *             this_node = this_node.next
6289  *         return potential             # <<<<<<<<<<<<<<
6290  *
6291  *     @cython.boundscheck(False)
6292  */
6293   __pyx_r = __pyx_v_potential;
6294   goto __pyx_L0;
6295 
6296   /* "yt/utilities/lib/basic_octree.pyx":418
6297  *
6298  *     @cython.cdivision(True)
6299  *     cdef np.float64_t fbe_main(self, np.float64_t potential, int truncate,             # <<<<<<<<<<<<<<
6300  *             np.float64_t kinetic):
6301  *         # The work is done here. Starting at the top of the linked list of
6302  */
6303 
6304   /* function exit code */
6305   __pyx_L1_error:;
6306   __Pyx_WriteUnraisable("yt.utilities.lib.basic_octree.Octree.fbe_main", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6307   __pyx_r = 0;
6308   __pyx_L0:;
6309   __Pyx_RefNannyFinishContext();
6310   return __pyx_r;
6311 }
6312 
6313 /* "yt/utilities/lib/basic_octree.pyx":482
6314  *     @cython.boundscheck(False)
6315  *     @cython.wraparound(False)
6316  *     def find_binding_energy(self, int truncate, np.float64_t kinetic,             # <<<<<<<<<<<<<<
6317  *         np.ndarray[np.float64_t, ndim=1] root_dx, float opening_angle = 1.0):
6318  *         r"""Find the binding energy of an ensemble of data points using the
6319  */
6320 
6321 /* Python wrapper */
6322 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_11find_binding_energy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6323 static char __pyx_doc_2yt_9utilities_3lib_12basic_octree_6Octree_10find_binding_energy[] = "Find the binding energy of an ensemble of data points using the\n        treecode method.\n\n        Note: The first entry of the vals array MUST be Mass. Any other\n        values will be ignored, including the weight array.\n        ";
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_11find_binding_energy(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6324 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_11find_binding_energy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6325   int __pyx_v_truncate;
6326   __pyx_t_5numpy_float64_t __pyx_v_kinetic;
6327   PyArrayObject *__pyx_v_root_dx = 0;
6328   float __pyx_v_opening_angle;
6329   PyObject *__pyx_r = 0;
6330   __Pyx_RefNannyDeclarations
6331   __Pyx_RefNannySetupContext("find_binding_energy (wrapper)", 0);
6332   {
6333     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_truncate,&__pyx_n_s_kinetic,&__pyx_n_s_root_dx,&__pyx_n_s_opening_angle,0};
6334     PyObject* values[4] = {0,0,0,0};
6335     if (unlikely(__pyx_kwds)) {
6336       Py_ssize_t kw_args;
6337       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6338       switch (pos_args) {
6339         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6340         CYTHON_FALLTHROUGH;
6341         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6342         CYTHON_FALLTHROUGH;
6343         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6344         CYTHON_FALLTHROUGH;
6345         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6346         CYTHON_FALLTHROUGH;
6347         case  0: break;
6348         default: goto __pyx_L5_argtuple_error;
6349       }
6350       kw_args = PyDict_Size(__pyx_kwds);
6351       switch (pos_args) {
6352         case  0:
6353         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_truncate)) != 0)) kw_args--;
6354         else goto __pyx_L5_argtuple_error;
6355         CYTHON_FALLTHROUGH;
6356         case  1:
6357         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kinetic)) != 0)) kw_args--;
6358         else {
6359           __Pyx_RaiseArgtupleInvalid("find_binding_energy", 0, 3, 4, 1); __PYX_ERR(0, 482, __pyx_L3_error)
6360         }
6361         CYTHON_FALLTHROUGH;
6362         case  2:
6363         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_root_dx)) != 0)) kw_args--;
6364         else {
6365           __Pyx_RaiseArgtupleInvalid("find_binding_energy", 0, 3, 4, 2); __PYX_ERR(0, 482, __pyx_L3_error)
6366         }
6367         CYTHON_FALLTHROUGH;
6368         case  3:
6369         if (kw_args > 0) {
6370           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_opening_angle);
6371           if (value) { values[3] = value; kw_args--; }
6372         }
6373       }
6374       if (unlikely(kw_args > 0)) {
6375         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_binding_energy") < 0)) __PYX_ERR(0, 482, __pyx_L3_error)
6376       }
6377     } else {
6378       switch (PyTuple_GET_SIZE(__pyx_args)) {
6379         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6380         CYTHON_FALLTHROUGH;
6381         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6382         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6383         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6384         break;
6385         default: goto __pyx_L5_argtuple_error;
6386       }
6387     }
6388     __pyx_v_truncate = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_truncate == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L3_error)
6389     __pyx_v_kinetic = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_kinetic == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L3_error)
6390     __pyx_v_root_dx = ((PyArrayObject *)values[2]);
6391     if (values[3]) {
6392       __pyx_v_opening_angle = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_opening_angle == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error)
6393     } else {
6394       __pyx_v_opening_angle = ((float)1.0);
6395     }
6396   }
6397   goto __pyx_L4_argument_unpacking_done;
6398   __pyx_L5_argtuple_error:;
6399   __Pyx_RaiseArgtupleInvalid("find_binding_energy", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 482, __pyx_L3_error)
6400   __pyx_L3_error:;
6401   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.find_binding_energy", __pyx_clineno, __pyx_lineno, __pyx_filename);
6402   __Pyx_RefNannyFinishContext();
6403   return NULL;
6404   __pyx_L4_argument_unpacking_done:;
6405   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root_dx), __pyx_ptype_5numpy_ndarray, 1, "root_dx", 0))) __PYX_ERR(0, 483, __pyx_L1_error)
6406   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_10find_binding_energy(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), __pyx_v_truncate, __pyx_v_kinetic, __pyx_v_root_dx, __pyx_v_opening_angle);
6407 
6408   /* function exit code */
6409   goto __pyx_L0;
6410   __pyx_L1_error:;
6411   __pyx_r = NULL;
6412   __pyx_L0:;
6413   __Pyx_RefNannyFinishContext();
6414   return __pyx_r;
6415 }
6416 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_10find_binding_energy(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,int __pyx_v_truncate,__pyx_t_5numpy_float64_t __pyx_v_kinetic,PyArrayObject * __pyx_v_root_dx,float __pyx_v_opening_angle)6417 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_10find_binding_energy(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, int __pyx_v_truncate, __pyx_t_5numpy_float64_t __pyx_v_kinetic, PyArrayObject *__pyx_v_root_dx, float __pyx_v_opening_angle) {
6418   int __pyx_v_i;
6419   __pyx_t_5numpy_float64_t __pyx_v_potential;
6420   __Pyx_LocalBuf_ND __pyx_pybuffernd_root_dx;
6421   __Pyx_Buffer __pyx_pybuffer_root_dx;
6422   PyObject *__pyx_r = NULL;
6423   __Pyx_RefNannyDeclarations
6424   int __pyx_t_1;
6425   Py_ssize_t __pyx_t_2;
6426   PyObject *__pyx_t_3 = NULL;
6427   __Pyx_RefNannySetupContext("find_binding_energy", 0);
6428   __pyx_pybuffer_root_dx.pybuffer.buf = NULL;
6429   __pyx_pybuffer_root_dx.refcount = 0;
6430   __pyx_pybuffernd_root_dx.data = NULL;
6431   __pyx_pybuffernd_root_dx.rcbuffer = &__pyx_pybuffer_root_dx;
6432   {
6433     __Pyx_BufFmt_StackElem __pyx_stack[1];
6434     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_root_dx.rcbuffer->pybuffer, (PyObject*)__pyx_v_root_dx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 482, __pyx_L1_error)
6435   }
6436   __pyx_pybuffernd_root_dx.diminfo[0].strides = __pyx_pybuffernd_root_dx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_root_dx.diminfo[0].shape = __pyx_pybuffernd_root_dx.rcbuffer->pybuffer.shape[0];
6437 
6438   /* "yt/utilities/lib/basic_octree.pyx":494
6439  *         cdef int i
6440  *         cdef np.float64_t potential
6441  *         potential = 0.0             # <<<<<<<<<<<<<<
6442  *         self.opening_angle = opening_angle
6443  *         for i in range(3):
6444  */
6445   __pyx_v_potential = 0.0;
6446 
6447   /* "yt/utilities/lib/basic_octree.pyx":495
6448  *         cdef np.float64_t potential
6449  *         potential = 0.0
6450  *         self.opening_angle = opening_angle             # <<<<<<<<<<<<<<
6451  *         for i in range(3):
6452  *             self.root_dx[i] = root_dx[i]
6453  */
6454   __pyx_v_self->opening_angle = __pyx_v_opening_angle;
6455 
6456   /* "yt/utilities/lib/basic_octree.pyx":496
6457  *         potential = 0.0
6458  *         self.opening_angle = opening_angle
6459  *         for i in range(3):             # <<<<<<<<<<<<<<
6460  *             self.root_dx[i] = root_dx[i]
6461  *         potential = self.fbe_main(potential, truncate, kinetic)
6462  */
6463   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
6464     __pyx_v_i = __pyx_t_1;
6465 
6466     /* "yt/utilities/lib/basic_octree.pyx":497
6467  *         self.opening_angle = opening_angle
6468  *         for i in range(3):
6469  *             self.root_dx[i] = root_dx[i]             # <<<<<<<<<<<<<<
6470  *         potential = self.fbe_main(potential, truncate, kinetic)
6471  *         return potential
6472  */
6473     __pyx_t_2 = __pyx_v_i;
6474     (__pyx_v_self->root_dx[__pyx_v_i]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_root_dx.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_root_dx.diminfo[0].strides));
6475   }
6476 
6477   /* "yt/utilities/lib/basic_octree.pyx":498
6478  *         for i in range(3):
6479  *             self.root_dx[i] = root_dx[i]
6480  *         potential = self.fbe_main(potential, truncate, kinetic)             # <<<<<<<<<<<<<<
6481  *         return potential
6482  *
6483  */
6484   __pyx_v_potential = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->fbe_main(__pyx_v_self, __pyx_v_potential, __pyx_v_truncate, __pyx_v_kinetic);
6485 
6486   /* "yt/utilities/lib/basic_octree.pyx":499
6487  *             self.root_dx[i] = root_dx[i]
6488  *         potential = self.fbe_main(potential, truncate, kinetic)
6489  *         return potential             # <<<<<<<<<<<<<<
6490  *
6491  *     cdef int node_ID(self, OctreeNode *node):
6492  */
6493   __Pyx_XDECREF(__pyx_r);
6494   __pyx_t_3 = PyFloat_FromDouble(__pyx_v_potential); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error)
6495   __Pyx_GOTREF(__pyx_t_3);
6496   __pyx_r = __pyx_t_3;
6497   __pyx_t_3 = 0;
6498   goto __pyx_L0;
6499 
6500   /* "yt/utilities/lib/basic_octree.pyx":482
6501  *     @cython.boundscheck(False)
6502  *     @cython.wraparound(False)
6503  *     def find_binding_energy(self, int truncate, np.float64_t kinetic,             # <<<<<<<<<<<<<<
6504  *         np.ndarray[np.float64_t, ndim=1] root_dx, float opening_angle = 1.0):
6505  *         r"""Find the binding energy of an ensemble of data points using the
6506  */
6507 
6508   /* function exit code */
6509   __pyx_L1_error:;
6510   __Pyx_XDECREF(__pyx_t_3);
6511   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6512     __Pyx_PyThreadState_declare
6513     __Pyx_PyThreadState_assign
6514     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6515     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_root_dx.rcbuffer->pybuffer);
6516   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6517   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.find_binding_energy", __pyx_clineno, __pyx_lineno, __pyx_filename);
6518   __pyx_r = NULL;
6519   goto __pyx_L2;
6520   __pyx_L0:;
6521   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_root_dx.rcbuffer->pybuffer);
6522   __pyx_L2:;
6523   __Pyx_XGIVEREF(__pyx_r);
6524   __Pyx_RefNannyFinishContext();
6525   return __pyx_r;
6526 }
6527 
6528 /* "yt/utilities/lib/basic_octree.pyx":501
6529  *         return potential
6530  *
6531  *     cdef int node_ID(self, OctreeNode *node):             # <<<<<<<<<<<<<<
6532  *         # Returns an unique ID for this node based on its position and level.
6533  *         cdef int ID, i, offset, root
6534  */
6535 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node)6536 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node) {
6537   int __pyx_v_ID;
6538   int __pyx_v_i;
6539   int __pyx_v_offset;
6540   int __pyx_v_root;
6541   __pyx_t_5numpy_int64_t __pyx_v_this_grid_dims[3];
6542   int __pyx_r;
6543   __Pyx_RefNannyDeclarations
6544   int __pyx_t_1;
6545   int __pyx_t_2;
6546   int __pyx_t_3;
6547   __Pyx_RefNannySetupContext("node_ID", 0);
6548 
6549   /* "yt/utilities/lib/basic_octree.pyx":505
6550  *         cdef int ID, i, offset, root
6551  *         cdef np.int64_t this_grid_dims[3]
6552  *         offset = 0             # <<<<<<<<<<<<<<
6553  *         root = 1
6554  *         for i in range(3):
6555  */
6556   __pyx_v_offset = 0;
6557 
6558   /* "yt/utilities/lib/basic_octree.pyx":506
6559  *         cdef np.int64_t this_grid_dims[3]
6560  *         offset = 0
6561  *         root = 1             # <<<<<<<<<<<<<<
6562  *         for i in range(3):
6563  *             root *= self.top_grid_dims[i]
6564  */
6565   __pyx_v_root = 1;
6566 
6567   /* "yt/utilities/lib/basic_octree.pyx":507
6568  *         offset = 0
6569  *         root = 1
6570  *         for i in range(3):             # <<<<<<<<<<<<<<
6571  *             root *= self.top_grid_dims[i]
6572  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
6573  */
6574   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
6575     __pyx_v_i = __pyx_t_1;
6576 
6577     /* "yt/utilities/lib/basic_octree.pyx":508
6578  *         root = 1
6579  *         for i in range(3):
6580  *             root *= self.top_grid_dims[i]             # <<<<<<<<<<<<<<
6581  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
6582  *         for i in range(node.level):
6583  */
6584     __pyx_v_root = (__pyx_v_root * (__pyx_v_self->top_grid_dims[__pyx_v_i]));
6585 
6586     /* "yt/utilities/lib/basic_octree.pyx":509
6587  *         for i in range(3):
6588  *             root *= self.top_grid_dims[i]
6589  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level             # <<<<<<<<<<<<<<
6590  *         for i in range(node.level):
6591  *             offset += root * 2**(3 * i)
6592  */
6593     (__pyx_v_this_grid_dims[__pyx_v_i]) = ((__pyx_v_self->top_grid_dims[__pyx_v_i]) * __Pyx_pow_long(2, ((long)__pyx_v_node->level)));
6594   }
6595 
6596   /* "yt/utilities/lib/basic_octree.pyx":510
6597  *             root *= self.top_grid_dims[i]
6598  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
6599  *         for i in range(node.level):             # <<<<<<<<<<<<<<
6600  *             offset += root * 2**(3 * i)
6601  *         ID = offset + (node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
6602  */
6603   __pyx_t_1 = __pyx_v_node->level;
6604   __pyx_t_2 = __pyx_t_1;
6605   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6606     __pyx_v_i = __pyx_t_3;
6607 
6608     /* "yt/utilities/lib/basic_octree.pyx":511
6609  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
6610  *         for i in range(node.level):
6611  *             offset += root * 2**(3 * i)             # <<<<<<<<<<<<<<
6612  *         ID = offset + (node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
6613  *             this_grid_dims[1] * node.pos[2]))
6614  */
6615     __pyx_v_offset = (__pyx_v_offset + (__pyx_v_root * __Pyx_pow_long(2, (3 * __pyx_v_i))));
6616   }
6617 
6618   /* "yt/utilities/lib/basic_octree.pyx":512
6619  *         for i in range(node.level):
6620  *             offset += root * 2**(3 * i)
6621  *         ID = offset + (node.pos[0] + this_grid_dims[0] * (node.pos[1] + \             # <<<<<<<<<<<<<<
6622  *             this_grid_dims[1] * node.pos[2]))
6623  *         return ID
6624  */
6625   __pyx_v_ID = (__pyx_v_offset + ((__pyx_v_node->pos[0]) + ((__pyx_v_this_grid_dims[0]) * ((__pyx_v_node->pos[1]) + ((__pyx_v_this_grid_dims[1]) * (__pyx_v_node->pos[2]))))));
6626 
6627   /* "yt/utilities/lib/basic_octree.pyx":514
6628  *         ID = offset + (node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
6629  *             this_grid_dims[1] * node.pos[2]))
6630  *         return ID             # <<<<<<<<<<<<<<
6631  *
6632  *     cdef int node_ID_on_level(self, OctreeNode *node):
6633  */
6634   __pyx_r = __pyx_v_ID;
6635   goto __pyx_L0;
6636 
6637   /* "yt/utilities/lib/basic_octree.pyx":501
6638  *         return potential
6639  *
6640  *     cdef int node_ID(self, OctreeNode *node):             # <<<<<<<<<<<<<<
6641  *         # Returns an unique ID for this node based on its position and level.
6642  *         cdef int ID, i, offset, root
6643  */
6644 
6645   /* function exit code */
6646   __pyx_L0:;
6647   __Pyx_RefNannyFinishContext();
6648   return __pyx_r;
6649 }
6650 
6651 /* "yt/utilities/lib/basic_octree.pyx":516
6652  *         return ID
6653  *
6654  *     cdef int node_ID_on_level(self, OctreeNode *node):             # <<<<<<<<<<<<<<
6655  *         # Returns the node ID on node.level for this node.
6656  *         cdef int ID, i
6657  */
6658 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID_on_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node)6659 static int __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID_on_level(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node) {
6660   int __pyx_v_ID;
6661   int __pyx_v_i;
6662   __pyx_t_5numpy_int64_t __pyx_v_this_grid_dims[3];
6663   int __pyx_r;
6664   __Pyx_RefNannyDeclarations
6665   int __pyx_t_1;
6666   __Pyx_RefNannySetupContext("node_ID_on_level", 0);
6667 
6668   /* "yt/utilities/lib/basic_octree.pyx":520
6669  *         cdef int ID, i
6670  *         cdef np.int64_t this_grid_dims[3]
6671  *         for i in range(3):             # <<<<<<<<<<<<<<
6672  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
6673  *         ID = node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
6674  */
6675   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
6676     __pyx_v_i = __pyx_t_1;
6677 
6678     /* "yt/utilities/lib/basic_octree.pyx":521
6679  *         cdef np.int64_t this_grid_dims[3]
6680  *         for i in range(3):
6681  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level             # <<<<<<<<<<<<<<
6682  *         ID = node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
6683  *             this_grid_dims[1] * node.pos[2])
6684  */
6685     (__pyx_v_this_grid_dims[__pyx_v_i]) = ((__pyx_v_self->top_grid_dims[__pyx_v_i]) * __Pyx_pow_long(2, ((long)__pyx_v_node->level)));
6686   }
6687 
6688   /* "yt/utilities/lib/basic_octree.pyx":522
6689  *         for i in range(3):
6690  *             this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
6691  *         ID = node.pos[0] + this_grid_dims[0] * (node.pos[1] + \             # <<<<<<<<<<<<<<
6692  *             this_grid_dims[1] * node.pos[2])
6693  *         return ID
6694  */
6695   __pyx_v_ID = ((__pyx_v_node->pos[0]) + ((__pyx_v_this_grid_dims[0]) * ((__pyx_v_node->pos[1]) + ((__pyx_v_this_grid_dims[1]) * (__pyx_v_node->pos[2])))));
6696 
6697   /* "yt/utilities/lib/basic_octree.pyx":524
6698  *         ID = node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
6699  *             this_grid_dims[1] * node.pos[2])
6700  *         return ID             # <<<<<<<<<<<<<<
6701  *
6702  *     cdef void print_node_info(self, OctreeNode *node):
6703  */
6704   __pyx_r = __pyx_v_ID;
6705   goto __pyx_L0;
6706 
6707   /* "yt/utilities/lib/basic_octree.pyx":516
6708  *         return ID
6709  *
6710  *     cdef int node_ID_on_level(self, OctreeNode *node):             # <<<<<<<<<<<<<<
6711  *         # Returns the node ID on node.level for this node.
6712  *         cdef int ID, i
6713  */
6714 
6715   /* function exit code */
6716   __pyx_L0:;
6717   __Pyx_RefNannyFinishContext();
6718   return __pyx_r;
6719 }
6720 
6721 /* "yt/utilities/lib/basic_octree.pyx":526
6722  *         return ID
6723  *
6724  *     cdef void print_node_info(self, OctreeNode *node):             # <<<<<<<<<<<<<<
6725  *         cdef int i, j, k
6726  *         line = "%d\t" % self.node_ID(node)
6727  */
6728 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_print_node_info(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node)6729 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_print_node_info(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node) {
6730   int __pyx_v_i;
6731   int __pyx_v_j;
6732   int __pyx_v_k;
6733   PyObject *__pyx_v_line = NULL;
6734   PyObject *__pyx_v_nline = NULL;
6735   __Pyx_RefNannyDeclarations
6736   PyObject *__pyx_t_1 = NULL;
6737   PyObject *__pyx_t_2 = NULL;
6738   int __pyx_t_3;
6739   PyObject *__pyx_t_4 = NULL;
6740   PyObject *__pyx_t_5 = NULL;
6741   PyObject *__pyx_t_6 = NULL;
6742   int __pyx_t_7;
6743   int __pyx_t_8;
6744   int __pyx_t_9;
6745   __Pyx_RefNannySetupContext("print_node_info", 0);
6746 
6747   /* "yt/utilities/lib/basic_octree.pyx":528
6748  *     cdef void print_node_info(self, OctreeNode *node):
6749  *         cdef int i, j, k
6750  *         line = "%d\t" % self.node_ID(node)             # <<<<<<<<<<<<<<
6751  *         if node.next is not NULL:
6752  *             line += "%d\t" % self.node_ID(node.next)
6753  */
6754   __pyx_t_1 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->node_ID(__pyx_v_self, __pyx_v_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error)
6755   __Pyx_GOTREF(__pyx_t_1);
6756   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error)
6757   __Pyx_GOTREF(__pyx_t_2);
6758   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6759   __pyx_v_line = __pyx_t_2;
6760   __pyx_t_2 = 0;
6761 
6762   /* "yt/utilities/lib/basic_octree.pyx":529
6763  *         cdef int i, j, k
6764  *         line = "%d\t" % self.node_ID(node)
6765  *         if node.next is not NULL:             # <<<<<<<<<<<<<<
6766  *             line += "%d\t" % self.node_ID(node.next)
6767  *         else: line += "-1\t"
6768  */
6769   __pyx_t_3 = ((__pyx_v_node->next != NULL) != 0);
6770   if (__pyx_t_3) {
6771 
6772     /* "yt/utilities/lib/basic_octree.pyx":530
6773  *         line = "%d\t" % self.node_ID(node)
6774  *         if node.next is not NULL:
6775  *             line += "%d\t" % self.node_ID(node.next)             # <<<<<<<<<<<<<<
6776  *         else: line += "-1\t"
6777  *         if node.up_next is not NULL:
6778  */
6779     __pyx_t_2 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->node_ID(__pyx_v_self, __pyx_v_node->next)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
6780     __Pyx_GOTREF(__pyx_t_2);
6781     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
6782     __Pyx_GOTREF(__pyx_t_1);
6783     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6784     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
6785     __Pyx_GOTREF(__pyx_t_2);
6786     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6787     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_2);
6788     __pyx_t_2 = 0;
6789 
6790     /* "yt/utilities/lib/basic_octree.pyx":529
6791  *         cdef int i, j, k
6792  *         line = "%d\t" % self.node_ID(node)
6793  *         if node.next is not NULL:             # <<<<<<<<<<<<<<
6794  *             line += "%d\t" % self.node_ID(node.next)
6795  *         else: line += "-1\t"
6796  */
6797     goto __pyx_L3;
6798   }
6799 
6800   /* "yt/utilities/lib/basic_octree.pyx":531
6801  *         if node.next is not NULL:
6802  *             line += "%d\t" % self.node_ID(node.next)
6803  *         else: line += "-1\t"             # <<<<<<<<<<<<<<
6804  *         if node.up_next is not NULL:
6805  *             line += "%d\t" % self.node_ID(node.up_next)
6806  */
6807   /*else*/ {
6808     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_kp_s_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error)
6809     __Pyx_GOTREF(__pyx_t_2);
6810     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_2);
6811     __pyx_t_2 = 0;
6812   }
6813   __pyx_L3:;
6814 
6815   /* "yt/utilities/lib/basic_octree.pyx":532
6816  *             line += "%d\t" % self.node_ID(node.next)
6817  *         else: line += "-1\t"
6818  *         if node.up_next is not NULL:             # <<<<<<<<<<<<<<
6819  *             line += "%d\t" % self.node_ID(node.up_next)
6820  *         else: line += "-1\t"
6821  */
6822   __pyx_t_3 = ((__pyx_v_node->up_next != NULL) != 0);
6823   if (__pyx_t_3) {
6824 
6825     /* "yt/utilities/lib/basic_octree.pyx":533
6826  *         else: line += "-1\t"
6827  *         if node.up_next is not NULL:
6828  *             line += "%d\t" % self.node_ID(node.up_next)             # <<<<<<<<<<<<<<
6829  *         else: line += "-1\t"
6830  *         line += "%d\t%d\t%d\t%d\t" % (node.level,node.pos[0],node.pos[1],node.pos[2])
6831  */
6832     __pyx_t_2 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->node_ID(__pyx_v_self, __pyx_v_node->up_next)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
6833     __Pyx_GOTREF(__pyx_t_2);
6834     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_d, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
6835     __Pyx_GOTREF(__pyx_t_1);
6836     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6837     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
6838     __Pyx_GOTREF(__pyx_t_2);
6839     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6840     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_2);
6841     __pyx_t_2 = 0;
6842 
6843     /* "yt/utilities/lib/basic_octree.pyx":532
6844  *             line += "%d\t" % self.node_ID(node.next)
6845  *         else: line += "-1\t"
6846  *         if node.up_next is not NULL:             # <<<<<<<<<<<<<<
6847  *             line += "%d\t" % self.node_ID(node.up_next)
6848  *         else: line += "-1\t"
6849  */
6850     goto __pyx_L4;
6851   }
6852 
6853   /* "yt/utilities/lib/basic_octree.pyx":534
6854  *         if node.up_next is not NULL:
6855  *             line += "%d\t" % self.node_ID(node.up_next)
6856  *         else: line += "-1\t"             # <<<<<<<<<<<<<<
6857  *         line += "%d\t%d\t%d\t%d\t" % (node.level,node.pos[0],node.pos[1],node.pos[2])
6858  *         for i in range(node.nvals):
6859  */
6860   /*else*/ {
6861     __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_kp_s_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error)
6862     __Pyx_GOTREF(__pyx_t_2);
6863     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_2);
6864     __pyx_t_2 = 0;
6865   }
6866   __pyx_L4:;
6867 
6868   /* "yt/utilities/lib/basic_octree.pyx":535
6869  *             line += "%d\t" % self.node_ID(node.up_next)
6870  *         else: line += "-1\t"
6871  *         line += "%d\t%d\t%d\t%d\t" % (node.level,node.pos[0],node.pos[1],node.pos[2])             # <<<<<<<<<<<<<<
6872  *         for i in range(node.nvals):
6873  *             line += "%1.5e\t" % node.val[i]
6874  */
6875   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_node->level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
6876   __Pyx_GOTREF(__pyx_t_2);
6877   __pyx_t_1 = __Pyx_PyInt_From_npy_int64((__pyx_v_node->pos[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
6878   __Pyx_GOTREF(__pyx_t_1);
6879   __pyx_t_4 = __Pyx_PyInt_From_npy_int64((__pyx_v_node->pos[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 535, __pyx_L1_error)
6880   __Pyx_GOTREF(__pyx_t_4);
6881   __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_node->pos[2])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 535, __pyx_L1_error)
6882   __Pyx_GOTREF(__pyx_t_5);
6883   __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error)
6884   __Pyx_GOTREF(__pyx_t_6);
6885   __Pyx_GIVEREF(__pyx_t_2);
6886   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
6887   __Pyx_GIVEREF(__pyx_t_1);
6888   PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
6889   __Pyx_GIVEREF(__pyx_t_4);
6890   PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
6891   __Pyx_GIVEREF(__pyx_t_5);
6892   PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
6893   __pyx_t_2 = 0;
6894   __pyx_t_1 = 0;
6895   __pyx_t_4 = 0;
6896   __pyx_t_5 = 0;
6897   __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d_d_d_d, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 535, __pyx_L1_error)
6898   __Pyx_GOTREF(__pyx_t_5);
6899   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6900   __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error)
6901   __Pyx_GOTREF(__pyx_t_6);
6902   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6903   __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_6);
6904   __pyx_t_6 = 0;
6905 
6906   /* "yt/utilities/lib/basic_octree.pyx":536
6907  *         else: line += "-1\t"
6908  *         line += "%d\t%d\t%d\t%d\t" % (node.level,node.pos[0],node.pos[1],node.pos[2])
6909  *         for i in range(node.nvals):             # <<<<<<<<<<<<<<
6910  *             line += "%1.5e\t" % node.val[i]
6911  *         line += "%f\t" % node.weight_val
6912  */
6913   __pyx_t_7 = __pyx_v_node->nvals;
6914   __pyx_t_8 = __pyx_t_7;
6915   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
6916     __pyx_v_i = __pyx_t_9;
6917 
6918     /* "yt/utilities/lib/basic_octree.pyx":537
6919  *         line += "%d\t%d\t%d\t%d\t" % (node.level,node.pos[0],node.pos[1],node.pos[2])
6920  *         for i in range(node.nvals):
6921  *             line += "%1.5e\t" % node.val[i]             # <<<<<<<<<<<<<<
6922  *         line += "%f\t" % node.weight_val
6923  *         line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)
6924  */
6925     __pyx_t_6 = PyFloat_FromDouble((__pyx_v_node->val[__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L1_error)
6926     __Pyx_GOTREF(__pyx_t_6);
6927     __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_1_5e, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error)
6928     __Pyx_GOTREF(__pyx_t_5);
6929     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6930     __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 537, __pyx_L1_error)
6931     __Pyx_GOTREF(__pyx_t_6);
6932     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6933     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_6);
6934     __pyx_t_6 = 0;
6935   }
6936 
6937   /* "yt/utilities/lib/basic_octree.pyx":538
6938  *         for i in range(node.nvals):
6939  *             line += "%1.5e\t" % node.val[i]
6940  *         line += "%f\t" % node.weight_val             # <<<<<<<<<<<<<<
6941  *         line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)
6942  *         if node.children[0][0][0] is not NULL:
6943  */
6944   __pyx_t_6 = PyFloat_FromDouble(__pyx_v_node->weight_val); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error)
6945   __Pyx_GOTREF(__pyx_t_6);
6946   __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_f, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 538, __pyx_L1_error)
6947   __Pyx_GOTREF(__pyx_t_5);
6948   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6949   __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 538, __pyx_L1_error)
6950   __Pyx_GOTREF(__pyx_t_6);
6951   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6952   __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_6);
6953   __pyx_t_6 = 0;
6954 
6955   /* "yt/utilities/lib/basic_octree.pyx":539
6956  *             line += "%1.5e\t" % node.val[i]
6957  *         line += "%f\t" % node.weight_val
6958  *         line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)             # <<<<<<<<<<<<<<
6959  *         if node.children[0][0][0] is not NULL:
6960  *             nline = ""
6961  */
6962   __pyx_t_6 = __Pyx_PyBool_FromLong(((((__pyx_v_node->children[0])[0])[0]) != NULL)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 539, __pyx_L1_error)
6963   __Pyx_GOTREF(__pyx_t_6);
6964   __pyx_t_5 = __Pyx_PyBool_FromLong((__pyx_v_node->parent != NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
6965   __Pyx_GOTREF(__pyx_t_5);
6966   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error)
6967   __Pyx_GOTREF(__pyx_t_4);
6968   __Pyx_GIVEREF(__pyx_t_6);
6969   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
6970   __Pyx_GIVEREF(__pyx_t_5);
6971   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
6972   __pyx_t_6 = 0;
6973   __pyx_t_5 = 0;
6974   __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error)
6975   __Pyx_GOTREF(__pyx_t_5);
6976   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6977   __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error)
6978   __Pyx_GOTREF(__pyx_t_4);
6979   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6980   __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_4);
6981   __pyx_t_4 = 0;
6982 
6983   /* "yt/utilities/lib/basic_octree.pyx":540
6984  *         line += "%f\t" % node.weight_val
6985  *         line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)
6986  *         if node.children[0][0][0] is not NULL:             # <<<<<<<<<<<<<<
6987  *             nline = ""
6988  *             for i in range(2):
6989  */
6990   __pyx_t_3 = (((((__pyx_v_node->children[0])[0])[0]) != NULL) != 0);
6991   if (__pyx_t_3) {
6992 
6993     /* "yt/utilities/lib/basic_octree.pyx":541
6994  *         line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)
6995  *         if node.children[0][0][0] is not NULL:
6996  *             nline = ""             # <<<<<<<<<<<<<<
6997  *             for i in range(2):
6998  *                 for j in range(2):
6999  */
7000     __Pyx_INCREF(__pyx_kp_s_);
7001     __pyx_v_nline = __pyx_kp_s_;
7002 
7003     /* "yt/utilities/lib/basic_octree.pyx":542
7004  *         if node.children[0][0][0] is not NULL:
7005  *             nline = ""
7006  *             for i in range(2):             # <<<<<<<<<<<<<<
7007  *                 for j in range(2):
7008  *                     for k in range(2):
7009  */
7010     for (__pyx_t_7 = 0; __pyx_t_7 < 2; __pyx_t_7+=1) {
7011       __pyx_v_i = __pyx_t_7;
7012 
7013       /* "yt/utilities/lib/basic_octree.pyx":543
7014  *             nline = ""
7015  *             for i in range(2):
7016  *                 for j in range(2):             # <<<<<<<<<<<<<<
7017  *                     for k in range(2):
7018  *                         nline += "%d," % self.node_ID(node.children[i][j][k])
7019  */
7020       for (__pyx_t_8 = 0; __pyx_t_8 < 2; __pyx_t_8+=1) {
7021         __pyx_v_j = __pyx_t_8;
7022 
7023         /* "yt/utilities/lib/basic_octree.pyx":544
7024  *             for i in range(2):
7025  *                 for j in range(2):
7026  *                     for k in range(2):             # <<<<<<<<<<<<<<
7027  *                         nline += "%d," % self.node_ID(node.children[i][j][k])
7028  *             line += nline
7029  */
7030         for (__pyx_t_9 = 0; __pyx_t_9 < 2; __pyx_t_9+=1) {
7031           __pyx_v_k = __pyx_t_9;
7032 
7033           /* "yt/utilities/lib/basic_octree.pyx":545
7034  *                 for j in range(2):
7035  *                     for k in range(2):
7036  *                         nline += "%d," % self.node_ID(node.children[i][j][k])             # <<<<<<<<<<<<<<
7037  *             line += nline
7038  *         print(line)
7039  */
7040           __pyx_t_4 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->node_ID(__pyx_v_self, (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error)
7041           __Pyx_GOTREF(__pyx_t_4);
7042           __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_d_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error)
7043           __Pyx_GOTREF(__pyx_t_5);
7044           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7045           __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_nline, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error)
7046           __Pyx_GOTREF(__pyx_t_4);
7047           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7048           __Pyx_DECREF_SET(__pyx_v_nline, __pyx_t_4);
7049           __pyx_t_4 = 0;
7050         }
7051       }
7052     }
7053 
7054     /* "yt/utilities/lib/basic_octree.pyx":546
7055  *                     for k in range(2):
7056  *                         nline += "%d," % self.node_ID(node.children[i][j][k])
7057  *             line += nline             # <<<<<<<<<<<<<<
7058  *         print(line)
7059  *         return
7060  */
7061     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_v_nline); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
7062     __Pyx_GOTREF(__pyx_t_4);
7063     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_4);
7064     __pyx_t_4 = 0;
7065 
7066     /* "yt/utilities/lib/basic_octree.pyx":540
7067  *         line += "%f\t" % node.weight_val
7068  *         line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)
7069  *         if node.children[0][0][0] is not NULL:             # <<<<<<<<<<<<<<
7070  *             nline = ""
7071  *             for i in range(2):
7072  */
7073   }
7074 
7075   /* "yt/utilities/lib/basic_octree.pyx":547
7076  *                         nline += "%d," % self.node_ID(node.children[i][j][k])
7077  *             line += nline
7078  *         print(line)             # <<<<<<<<<<<<<<
7079  *         return
7080  *
7081  */
7082   if (__Pyx_PrintOne(0, __pyx_v_line) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
7083 
7084   /* "yt/utilities/lib/basic_octree.pyx":548
7085  *             line += nline
7086  *         print(line)
7087  *         return             # <<<<<<<<<<<<<<
7088  *
7089  *     cdef void iterate_print_nodes(self, OctreeNode *node):
7090  */
7091   goto __pyx_L0;
7092 
7093   /* "yt/utilities/lib/basic_octree.pyx":526
7094  *         return ID
7095  *
7096  *     cdef void print_node_info(self, OctreeNode *node):             # <<<<<<<<<<<<<<
7097  *         cdef int i, j, k
7098  *         line = "%d\t" % self.node_ID(node)
7099  */
7100 
7101   /* function exit code */
7102   __pyx_L1_error:;
7103   __Pyx_XDECREF(__pyx_t_1);
7104   __Pyx_XDECREF(__pyx_t_2);
7105   __Pyx_XDECREF(__pyx_t_4);
7106   __Pyx_XDECREF(__pyx_t_5);
7107   __Pyx_XDECREF(__pyx_t_6);
7108   __Pyx_WriteUnraisable("yt.utilities.lib.basic_octree.Octree.print_node_info", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
7109   __pyx_L0:;
7110   __Pyx_XDECREF(__pyx_v_line);
7111   __Pyx_XDECREF(__pyx_v_nline);
7112   __Pyx_RefNannyFinishContext();
7113 }
7114 
7115 /* "yt/utilities/lib/basic_octree.pyx":550
7116  *         return
7117  *
7118  *     cdef void iterate_print_nodes(self, OctreeNode *node):             # <<<<<<<<<<<<<<
7119  *         cdef int i, j, k
7120  *         self.print_node_info(node)
7121  */
7122 
__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_iterate_print_nodes(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode * __pyx_v_node)7123 static void __pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_iterate_print_nodes(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *__pyx_v_node) {
7124   int __pyx_v_i;
7125   int __pyx_v_j;
7126   int __pyx_v_k;
7127   __Pyx_RefNannyDeclarations
7128   int __pyx_t_1;
7129   int __pyx_t_2;
7130   int __pyx_t_3;
7131   int __pyx_t_4;
7132   __Pyx_RefNannySetupContext("iterate_print_nodes", 0);
7133 
7134   /* "yt/utilities/lib/basic_octree.pyx":552
7135  *     cdef void iterate_print_nodes(self, OctreeNode *node):
7136  *         cdef int i, j, k
7137  *         self.print_node_info(node)             # <<<<<<<<<<<<<<
7138  *         if node.children[0][0][0] is NULL:
7139  *             return
7140  */
7141   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->print_node_info(__pyx_v_self, __pyx_v_node);
7142 
7143   /* "yt/utilities/lib/basic_octree.pyx":553
7144  *         cdef int i, j, k
7145  *         self.print_node_info(node)
7146  *         if node.children[0][0][0] is NULL:             # <<<<<<<<<<<<<<
7147  *             return
7148  *         for i in range(2):
7149  */
7150   __pyx_t_1 = (((((__pyx_v_node->children[0])[0])[0]) == NULL) != 0);
7151   if (__pyx_t_1) {
7152 
7153     /* "yt/utilities/lib/basic_octree.pyx":554
7154  *         self.print_node_info(node)
7155  *         if node.children[0][0][0] is NULL:
7156  *             return             # <<<<<<<<<<<<<<
7157  *         for i in range(2):
7158  *             for j in range(2):
7159  */
7160     goto __pyx_L0;
7161 
7162     /* "yt/utilities/lib/basic_octree.pyx":553
7163  *         cdef int i, j, k
7164  *         self.print_node_info(node)
7165  *         if node.children[0][0][0] is NULL:             # <<<<<<<<<<<<<<
7166  *             return
7167  *         for i in range(2):
7168  */
7169   }
7170 
7171   /* "yt/utilities/lib/basic_octree.pyx":555
7172  *         if node.children[0][0][0] is NULL:
7173  *             return
7174  *         for i in range(2):             # <<<<<<<<<<<<<<
7175  *             for j in range(2):
7176  *                 for k in range(2):
7177  */
7178   for (__pyx_t_2 = 0; __pyx_t_2 < 2; __pyx_t_2+=1) {
7179     __pyx_v_i = __pyx_t_2;
7180 
7181     /* "yt/utilities/lib/basic_octree.pyx":556
7182  *             return
7183  *         for i in range(2):
7184  *             for j in range(2):             # <<<<<<<<<<<<<<
7185  *                 for k in range(2):
7186  *                     self.iterate_print_nodes(node.children[i][j][k])
7187  */
7188     for (__pyx_t_3 = 0; __pyx_t_3 < 2; __pyx_t_3+=1) {
7189       __pyx_v_j = __pyx_t_3;
7190 
7191       /* "yt/utilities/lib/basic_octree.pyx":557
7192  *         for i in range(2):
7193  *             for j in range(2):
7194  *                 for k in range(2):             # <<<<<<<<<<<<<<
7195  *                     self.iterate_print_nodes(node.children[i][j][k])
7196  *         return
7197  */
7198       for (__pyx_t_4 = 0; __pyx_t_4 < 2; __pyx_t_4+=1) {
7199         __pyx_v_k = __pyx_t_4;
7200 
7201         /* "yt/utilities/lib/basic_octree.pyx":558
7202  *             for j in range(2):
7203  *                 for k in range(2):
7204  *                     self.iterate_print_nodes(node.children[i][j][k])             # <<<<<<<<<<<<<<
7205  *         return
7206  *
7207  */
7208         ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->iterate_print_nodes(__pyx_v_self, (((__pyx_v_node->children[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]));
7209       }
7210     }
7211   }
7212 
7213   /* "yt/utilities/lib/basic_octree.pyx":559
7214  *                 for k in range(2):
7215  *                     self.iterate_print_nodes(node.children[i][j][k])
7216  *         return             # <<<<<<<<<<<<<<
7217  *
7218  *     def print_all_nodes(self):
7219  */
7220   goto __pyx_L0;
7221 
7222   /* "yt/utilities/lib/basic_octree.pyx":550
7223  *         return
7224  *
7225  *     cdef void iterate_print_nodes(self, OctreeNode *node):             # <<<<<<<<<<<<<<
7226  *         cdef int i, j, k
7227  *         self.print_node_info(node)
7228  */
7229 
7230   /* function exit code */
7231   __pyx_L0:;
7232   __Pyx_RefNannyFinishContext();
7233 }
7234 
7235 /* "yt/utilities/lib/basic_octree.pyx":561
7236  *         return
7237  *
7238  *     def print_all_nodes(self):             # <<<<<<<<<<<<<<
7239  *         r"""
7240  *         Prints out information about all the nodes in the octree.
7241  */
7242 
7243 /* Python wrapper */
7244 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_13print_all_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7245 static char __pyx_doc_2yt_9utilities_3lib_12basic_octree_6Octree_12print_all_nodes[] = "\n        Prints out information about all the nodes in the octree.\n\n        Parameters\n        ----------\n        None.\n\n        Examples\n        --------\n        >>> octree.print_all_nodes()\n        (many lines of data)\n        ";
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_13print_all_nodes(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7246 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_13print_all_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7247   PyObject *__pyx_r = 0;
7248   __Pyx_RefNannyDeclarations
7249   __Pyx_RefNannySetupContext("print_all_nodes (wrapper)", 0);
7250   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_12print_all_nodes(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self));
7251 
7252   /* function exit code */
7253   __Pyx_RefNannyFinishContext();
7254   return __pyx_r;
7255 }
7256 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_12print_all_nodes(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self)7257 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_12print_all_nodes(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self) {
7258   int __pyx_v_i;
7259   int __pyx_v_j;
7260   int __pyx_v_k;
7261   PyObject *__pyx_v_line = NULL;
7262   PyObject *__pyx_r = NULL;
7263   __Pyx_RefNannyDeclarations
7264   PyObject *__pyx_t_1 = NULL;
7265   PyObject *__pyx_t_2 = NULL;
7266   PyObject *__pyx_t_3 = NULL;
7267   int __pyx_t_4;
7268   int __pyx_t_5;
7269   int __pyx_t_6;
7270   __pyx_t_5numpy_int64_t __pyx_t_7;
7271   __pyx_t_5numpy_int64_t __pyx_t_8;
7272   __pyx_t_5numpy_int64_t __pyx_t_9;
7273   __pyx_t_5numpy_int64_t __pyx_t_10;
7274   __pyx_t_5numpy_int64_t __pyx_t_11;
7275   __pyx_t_5numpy_int64_t __pyx_t_12;
7276   __Pyx_RefNannySetupContext("print_all_nodes", 0);
7277 
7278   /* "yt/utilities/lib/basic_octree.pyx":575
7279  *         """
7280  *         cdef int i, j, k
7281  *         sys.stdout.flush()             # <<<<<<<<<<<<<<
7282  *         sys.stderr.flush()
7283  *         line = "ID\tnext\tup_n\tlevel\tx\ty\tz\t"
7284  */
7285   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
7286   __Pyx_GOTREF(__pyx_t_2);
7287   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
7288   __Pyx_GOTREF(__pyx_t_3);
7289   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7290   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
7291   __Pyx_GOTREF(__pyx_t_2);
7292   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7293   __pyx_t_3 = NULL;
7294   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7295     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7296     if (likely(__pyx_t_3)) {
7297       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7298       __Pyx_INCREF(__pyx_t_3);
7299       __Pyx_INCREF(function);
7300       __Pyx_DECREF_SET(__pyx_t_2, function);
7301     }
7302   }
7303   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7304   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7305   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
7306   __Pyx_GOTREF(__pyx_t_1);
7307   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7308   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7309 
7310   /* "yt/utilities/lib/basic_octree.pyx":576
7311  *         cdef int i, j, k
7312  *         sys.stdout.flush()
7313  *         sys.stderr.flush()             # <<<<<<<<<<<<<<
7314  *         line = "ID\tnext\tup_n\tlevel\tx\ty\tz\t"
7315  *         for i in range(self.nvals):
7316  */
7317   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error)
7318   __Pyx_GOTREF(__pyx_t_2);
7319   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error)
7320   __Pyx_GOTREF(__pyx_t_3);
7321   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7322   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error)
7323   __Pyx_GOTREF(__pyx_t_2);
7324   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7325   __pyx_t_3 = NULL;
7326   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7327     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7328     if (likely(__pyx_t_3)) {
7329       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7330       __Pyx_INCREF(__pyx_t_3);
7331       __Pyx_INCREF(function);
7332       __Pyx_DECREF_SET(__pyx_t_2, function);
7333     }
7334   }
7335   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7336   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7337   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
7338   __Pyx_GOTREF(__pyx_t_1);
7339   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7340   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7341 
7342   /* "yt/utilities/lib/basic_octree.pyx":577
7343  *         sys.stdout.flush()
7344  *         sys.stderr.flush()
7345  *         line = "ID\tnext\tup_n\tlevel\tx\ty\tz\t"             # <<<<<<<<<<<<<<
7346  *         for i in range(self.nvals):
7347  *             line += "val%d\t\t" % i
7348  */
7349   __Pyx_INCREF(__pyx_kp_s_ID_next_up_n_level_x_y_z);
7350   __pyx_v_line = __pyx_kp_s_ID_next_up_n_level_x_y_z;
7351 
7352   /* "yt/utilities/lib/basic_octree.pyx":578
7353  *         sys.stderr.flush()
7354  *         line = "ID\tnext\tup_n\tlevel\tx\ty\tz\t"
7355  *         for i in range(self.nvals):             # <<<<<<<<<<<<<<
7356  *             line += "val%d\t\t" % i
7357  *         line += "weight\t\tchild?\tparent?\tchildren"
7358  */
7359   __pyx_t_4 = __pyx_v_self->nvals;
7360   __pyx_t_5 = __pyx_t_4;
7361   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
7362     __pyx_v_i = __pyx_t_6;
7363 
7364     /* "yt/utilities/lib/basic_octree.pyx":579
7365  *         line = "ID\tnext\tup_n\tlevel\tx\ty\tz\t"
7366  *         for i in range(self.nvals):
7367  *             line += "val%d\t\t" % i             # <<<<<<<<<<<<<<
7368  *         line += "weight\t\tchild?\tparent?\tchildren"
7369  *         print(line)
7370  */
7371     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error)
7372     __Pyx_GOTREF(__pyx_t_1);
7373     __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_val_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
7374     __Pyx_GOTREF(__pyx_t_2);
7375     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7376     __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error)
7377     __Pyx_GOTREF(__pyx_t_1);
7378     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7379     __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_1);
7380     __pyx_t_1 = 0;
7381   }
7382 
7383   /* "yt/utilities/lib/basic_octree.pyx":580
7384  *         for i in range(self.nvals):
7385  *             line += "val%d\t\t" % i
7386  *         line += "weight\t\tchild?\tparent?\tchildren"             # <<<<<<<<<<<<<<
7387  *         print(line)
7388  *         for i in range(self.top_grid_dims[0]):
7389  */
7390   __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_line, __pyx_kp_s_weight_child_parent_children); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
7391   __Pyx_GOTREF(__pyx_t_1);
7392   __Pyx_DECREF_SET(__pyx_v_line, __pyx_t_1);
7393   __pyx_t_1 = 0;
7394 
7395   /* "yt/utilities/lib/basic_octree.pyx":581
7396  *             line += "val%d\t\t" % i
7397  *         line += "weight\t\tchild?\tparent?\tchildren"
7398  *         print(line)             # <<<<<<<<<<<<<<
7399  *         for i in range(self.top_grid_dims[0]):
7400  *             for j in range(self.top_grid_dims[1]):
7401  */
7402   if (__Pyx_PrintOne(0, __pyx_v_line) < 0) __PYX_ERR(0, 581, __pyx_L1_error)
7403 
7404   /* "yt/utilities/lib/basic_octree.pyx":582
7405  *         line += "weight\t\tchild?\tparent?\tchildren"
7406  *         print(line)
7407  *         for i in range(self.top_grid_dims[0]):             # <<<<<<<<<<<<<<
7408  *             for j in range(self.top_grid_dims[1]):
7409  *                 for k in range(self.top_grid_dims[2]):
7410  */
7411   __pyx_t_7 = (__pyx_v_self->top_grid_dims[0]);
7412   __pyx_t_8 = __pyx_t_7;
7413   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_8; __pyx_t_4+=1) {
7414     __pyx_v_i = __pyx_t_4;
7415 
7416     /* "yt/utilities/lib/basic_octree.pyx":583
7417  *         print(line)
7418  *         for i in range(self.top_grid_dims[0]):
7419  *             for j in range(self.top_grid_dims[1]):             # <<<<<<<<<<<<<<
7420  *                 for k in range(self.top_grid_dims[2]):
7421  *                     self.iterate_print_nodes(self.root_nodes[i][j][k])
7422  */
7423     __pyx_t_9 = (__pyx_v_self->top_grid_dims[1]);
7424     __pyx_t_10 = __pyx_t_9;
7425     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_10; __pyx_t_5+=1) {
7426       __pyx_v_j = __pyx_t_5;
7427 
7428       /* "yt/utilities/lib/basic_octree.pyx":584
7429  *         for i in range(self.top_grid_dims[0]):
7430  *             for j in range(self.top_grid_dims[1]):
7431  *                 for k in range(self.top_grid_dims[2]):             # <<<<<<<<<<<<<<
7432  *                     self.iterate_print_nodes(self.root_nodes[i][j][k])
7433  *         sys.stdout.flush()
7434  */
7435       __pyx_t_11 = (__pyx_v_self->top_grid_dims[2]);
7436       __pyx_t_12 = __pyx_t_11;
7437       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_12; __pyx_t_6+=1) {
7438         __pyx_v_k = __pyx_t_6;
7439 
7440         /* "yt/utilities/lib/basic_octree.pyx":585
7441  *             for j in range(self.top_grid_dims[1]):
7442  *                 for k in range(self.top_grid_dims[2]):
7443  *                     self.iterate_print_nodes(self.root_nodes[i][j][k])             # <<<<<<<<<<<<<<
7444  *         sys.stdout.flush()
7445  *         sys.stderr.flush()
7446  */
7447         ((struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self->__pyx_vtab)->iterate_print_nodes(__pyx_v_self, (((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]));
7448       }
7449     }
7450   }
7451 
7452   /* "yt/utilities/lib/basic_octree.pyx":586
7453  *                 for k in range(self.top_grid_dims[2]):
7454  *                     self.iterate_print_nodes(self.root_nodes[i][j][k])
7455  *         sys.stdout.flush()             # <<<<<<<<<<<<<<
7456  *         sys.stderr.flush()
7457  *         return
7458  */
7459   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error)
7460   __Pyx_GOTREF(__pyx_t_2);
7461   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error)
7462   __Pyx_GOTREF(__pyx_t_3);
7463   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7464   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error)
7465   __Pyx_GOTREF(__pyx_t_2);
7466   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7467   __pyx_t_3 = NULL;
7468   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7469     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7470     if (likely(__pyx_t_3)) {
7471       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7472       __Pyx_INCREF(__pyx_t_3);
7473       __Pyx_INCREF(function);
7474       __Pyx_DECREF_SET(__pyx_t_2, function);
7475     }
7476   }
7477   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7478   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7479   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
7480   __Pyx_GOTREF(__pyx_t_1);
7481   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7482   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7483 
7484   /* "yt/utilities/lib/basic_octree.pyx":587
7485  *                     self.iterate_print_nodes(self.root_nodes[i][j][k])
7486  *         sys.stdout.flush()
7487  *         sys.stderr.flush()             # <<<<<<<<<<<<<<
7488  *         return
7489  *
7490  */
7491   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
7492   __Pyx_GOTREF(__pyx_t_2);
7493   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 587, __pyx_L1_error)
7494   __Pyx_GOTREF(__pyx_t_3);
7495   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7496   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
7497   __Pyx_GOTREF(__pyx_t_2);
7498   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7499   __pyx_t_3 = NULL;
7500   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7501     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7502     if (likely(__pyx_t_3)) {
7503       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7504       __Pyx_INCREF(__pyx_t_3);
7505       __Pyx_INCREF(function);
7506       __Pyx_DECREF_SET(__pyx_t_2, function);
7507     }
7508   }
7509   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7510   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7511   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
7512   __Pyx_GOTREF(__pyx_t_1);
7513   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7514   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7515 
7516   /* "yt/utilities/lib/basic_octree.pyx":588
7517  *         sys.stdout.flush()
7518  *         sys.stderr.flush()
7519  *         return             # <<<<<<<<<<<<<<
7520  *
7521  *     def __dealloc__(self):
7522  */
7523   __Pyx_XDECREF(__pyx_r);
7524   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7525   goto __pyx_L0;
7526 
7527   /* "yt/utilities/lib/basic_octree.pyx":561
7528  *         return
7529  *
7530  *     def print_all_nodes(self):             # <<<<<<<<<<<<<<
7531  *         r"""
7532  *         Prints out information about all the nodes in the octree.
7533  */
7534 
7535   /* function exit code */
7536   __pyx_L1_error:;
7537   __Pyx_XDECREF(__pyx_t_1);
7538   __Pyx_XDECREF(__pyx_t_2);
7539   __Pyx_XDECREF(__pyx_t_3);
7540   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.print_all_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
7541   __pyx_r = NULL;
7542   __pyx_L0:;
7543   __Pyx_XDECREF(__pyx_v_line);
7544   __Pyx_XGIVEREF(__pyx_r);
7545   __Pyx_RefNannyFinishContext();
7546   return __pyx_r;
7547 }
7548 
7549 /* "yt/utilities/lib/basic_octree.pyx":590
7550  *         return
7551  *
7552  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
7553  *         cdef int i, j, k
7554  *         for i in range(self.top_grid_dims[0]):
7555  */
7556 
7557 /* Python wrapper */
7558 static void __pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_15__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_15__dealloc__(PyObject * __pyx_v_self)7559 static void __pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_15__dealloc__(PyObject *__pyx_v_self) {
7560   __Pyx_RefNannyDeclarations
7561   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
7562   __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_14__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self));
7563 
7564   /* function exit code */
7565   __Pyx_RefNannyFinishContext();
7566 }
7567 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_14__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self)7568 static void __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_14__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self) {
7569   int __pyx_v_i;
7570   int __pyx_v_j;
7571   int __pyx_v_k;
7572   __Pyx_RefNannyDeclarations
7573   __pyx_t_5numpy_int64_t __pyx_t_1;
7574   __pyx_t_5numpy_int64_t __pyx_t_2;
7575   int __pyx_t_3;
7576   __pyx_t_5numpy_int64_t __pyx_t_4;
7577   __pyx_t_5numpy_int64_t __pyx_t_5;
7578   int __pyx_t_6;
7579   __pyx_t_5numpy_int64_t __pyx_t_7;
7580   __pyx_t_5numpy_int64_t __pyx_t_8;
7581   int __pyx_t_9;
7582   __Pyx_RefNannySetupContext("__dealloc__", 0);
7583 
7584   /* "yt/utilities/lib/basic_octree.pyx":592
7585  *     def __dealloc__(self):
7586  *         cdef int i, j, k
7587  *         for i in range(self.top_grid_dims[0]):             # <<<<<<<<<<<<<<
7588  *             for j in range(self.top_grid_dims[1]):
7589  *                 for k in range(self.top_grid_dims[2]):
7590  */
7591   __pyx_t_1 = (__pyx_v_self->top_grid_dims[0]);
7592   __pyx_t_2 = __pyx_t_1;
7593   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7594     __pyx_v_i = __pyx_t_3;
7595 
7596     /* "yt/utilities/lib/basic_octree.pyx":593
7597  *         cdef int i, j, k
7598  *         for i in range(self.top_grid_dims[0]):
7599  *             for j in range(self.top_grid_dims[1]):             # <<<<<<<<<<<<<<
7600  *                 for k in range(self.top_grid_dims[2]):
7601  *                     OTN_free(self.root_nodes[i][j][k])
7602  */
7603     __pyx_t_4 = (__pyx_v_self->top_grid_dims[1]);
7604     __pyx_t_5 = __pyx_t_4;
7605     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
7606       __pyx_v_j = __pyx_t_6;
7607 
7608       /* "yt/utilities/lib/basic_octree.pyx":594
7609  *         for i in range(self.top_grid_dims[0]):
7610  *             for j in range(self.top_grid_dims[1]):
7611  *                 for k in range(self.top_grid_dims[2]):             # <<<<<<<<<<<<<<
7612  *                     OTN_free(self.root_nodes[i][j][k])
7613  *                 free(self.root_nodes[i][j])
7614  */
7615       __pyx_t_7 = (__pyx_v_self->top_grid_dims[2]);
7616       __pyx_t_8 = __pyx_t_7;
7617       for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
7618         __pyx_v_k = __pyx_t_9;
7619 
7620         /* "yt/utilities/lib/basic_octree.pyx":595
7621  *             for j in range(self.top_grid_dims[1]):
7622  *                 for k in range(self.top_grid_dims[2]):
7623  *                     OTN_free(self.root_nodes[i][j][k])             # <<<<<<<<<<<<<<
7624  *                 free(self.root_nodes[i][j])
7625  *             free(self.root_nodes[i])
7626  */
7627         __pyx_f_2yt_9utilities_3lib_12basic_octree_OTN_free((((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j])[__pyx_v_k]));
7628       }
7629 
7630       /* "yt/utilities/lib/basic_octree.pyx":596
7631  *                 for k in range(self.top_grid_dims[2]):
7632  *                     OTN_free(self.root_nodes[i][j][k])
7633  *                 free(self.root_nodes[i][j])             # <<<<<<<<<<<<<<
7634  *             free(self.root_nodes[i])
7635  *         free(self.root_nodes)
7636  */
7637       free(((__pyx_v_self->root_nodes[__pyx_v_i])[__pyx_v_j]));
7638     }
7639 
7640     /* "yt/utilities/lib/basic_octree.pyx":597
7641  *                     OTN_free(self.root_nodes[i][j][k])
7642  *                 free(self.root_nodes[i][j])
7643  *             free(self.root_nodes[i])             # <<<<<<<<<<<<<<
7644  *         free(self.root_nodes)
7645  */
7646     free((__pyx_v_self->root_nodes[__pyx_v_i]));
7647   }
7648 
7649   /* "yt/utilities/lib/basic_octree.pyx":598
7650  *                 free(self.root_nodes[i][j])
7651  *             free(self.root_nodes[i])
7652  *         free(self.root_nodes)             # <<<<<<<<<<<<<<
7653  */
7654   free(__pyx_v_self->root_nodes);
7655 
7656   /* "yt/utilities/lib/basic_octree.pyx":590
7657  *         return
7658  *
7659  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
7660  *         cdef int i, j, k
7661  *         for i in range(self.top_grid_dims[0]):
7662  */
7663 
7664   /* function exit code */
7665   __Pyx_RefNannyFinishContext();
7666 }
7667 
7668 /* "(tree fragment)":1
7669  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7670  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7671  * def __setstate_cython__(self, __pyx_state):
7672  */
7673 
7674 /* Python wrapper */
7675 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_17__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)7676 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7677   PyObject *__pyx_r = 0;
7678   __Pyx_RefNannyDeclarations
7679   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
7680   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_16__reduce_cython__(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self));
7681 
7682   /* function exit code */
7683   __Pyx_RefNannyFinishContext();
7684   return __pyx_r;
7685 }
7686 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self)7687 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self) {
7688   PyObject *__pyx_r = NULL;
7689   __Pyx_RefNannyDeclarations
7690   PyObject *__pyx_t_1 = NULL;
7691   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
7692 
7693   /* "(tree fragment)":2
7694  * def __reduce_cython__(self):
7695  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
7696  * def __setstate_cython__(self, __pyx_state):
7697  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7698  */
7699   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
7700   __Pyx_GOTREF(__pyx_t_1);
7701   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7702   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7703   __PYX_ERR(1, 2, __pyx_L1_error)
7704 
7705   /* "(tree fragment)":1
7706  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
7707  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7708  * def __setstate_cython__(self, __pyx_state):
7709  */
7710 
7711   /* function exit code */
7712   __pyx_L1_error:;
7713   __Pyx_XDECREF(__pyx_t_1);
7714   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7715   __pyx_r = NULL;
7716   __Pyx_XGIVEREF(__pyx_r);
7717   __Pyx_RefNannyFinishContext();
7718   return __pyx_r;
7719 }
7720 
7721 /* "(tree fragment)":3
7722  * def __reduce_cython__(self):
7723  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7724  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
7725  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7726  */
7727 
7728 /* Python wrapper */
7729 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_19__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)7730 static PyObject *__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7731   PyObject *__pyx_r = 0;
7732   __Pyx_RefNannyDeclarations
7733   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
7734   __pyx_r = __pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_18__setstate_cython__(((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7735 
7736   /* function exit code */
7737   __Pyx_RefNannyFinishContext();
7738   return __pyx_r;
7739 }
7740 
__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)7741 static PyObject *__pyx_pf_2yt_9utilities_3lib_12basic_octree_6Octree_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
7742   PyObject *__pyx_r = NULL;
7743   __Pyx_RefNannyDeclarations
7744   PyObject *__pyx_t_1 = NULL;
7745   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
7746 
7747   /* "(tree fragment)":4
7748  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7749  * def __setstate_cython__(self, __pyx_state):
7750  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
7751  */
7752   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
7753   __Pyx_GOTREF(__pyx_t_1);
7754   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7755   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7756   __PYX_ERR(1, 4, __pyx_L1_error)
7757 
7758   /* "(tree fragment)":3
7759  * def __reduce_cython__(self):
7760  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7761  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
7762  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
7763  */
7764 
7765   /* function exit code */
7766   __pyx_L1_error:;
7767   __Pyx_XDECREF(__pyx_t_1);
7768   __Pyx_AddTraceback("yt.utilities.lib.basic_octree.Octree.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7769   __pyx_r = NULL;
7770   __Pyx_XGIVEREF(__pyx_r);
7771   __Pyx_RefNannyFinishContext();
7772   return __pyx_r;
7773 }
7774 
7775 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
7776  *         # experimental exception made for __getbuffer__ and __releasebuffer__
7777  *         # -- the details of this may change.
7778  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
7779  *             # This implementation of getbuffer is geared towards Cython
7780  *             # requirements, and does not yet fulfill the PEP.
7781  */
7782 
7783 /* Python wrapper */
7784 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)7785 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7786   int __pyx_r;
7787   __Pyx_RefNannyDeclarations
7788   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
7789   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
7790 
7791   /* function exit code */
7792   __Pyx_RefNannyFinishContext();
7793   return __pyx_r;
7794 }
7795 
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)7796 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7797   int __pyx_v_i;
7798   int __pyx_v_ndim;
7799   int __pyx_v_endian_detector;
7800   int __pyx_v_little_endian;
7801   int __pyx_v_t;
7802   char *__pyx_v_f;
7803   PyArray_Descr *__pyx_v_descr = 0;
7804   int __pyx_v_offset;
7805   int __pyx_r;
7806   __Pyx_RefNannyDeclarations
7807   int __pyx_t_1;
7808   int __pyx_t_2;
7809   PyObject *__pyx_t_3 = NULL;
7810   int __pyx_t_4;
7811   int __pyx_t_5;
7812   int __pyx_t_6;
7813   PyArray_Descr *__pyx_t_7;
7814   PyObject *__pyx_t_8 = NULL;
7815   char *__pyx_t_9;
7816   if (__pyx_v_info == NULL) {
7817     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
7818     return -1;
7819   }
7820   __Pyx_RefNannySetupContext("__getbuffer__", 0);
7821   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
7822   __Pyx_GIVEREF(__pyx_v_info->obj);
7823 
7824   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
7825  *
7826  *             cdef int i, ndim
7827  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
7828  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
7829  *
7830  */
7831   __pyx_v_endian_detector = 1;
7832 
7833   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
7834  *             cdef int i, ndim
7835  *             cdef int endian_detector = 1
7836  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
7837  *
7838  *             ndim = PyArray_NDIM(self)
7839  */
7840   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
7841 
7842   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
7843  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
7844  *
7845  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
7846  *
7847  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
7848  */
7849   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
7850 
7851   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
7852  *             ndim = PyArray_NDIM(self)
7853  *
7854  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
7855  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
7856  *                 raise ValueError(u"ndarray is not C contiguous")
7857  */
7858   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
7859   if (__pyx_t_2) {
7860   } else {
7861     __pyx_t_1 = __pyx_t_2;
7862     goto __pyx_L4_bool_binop_done;
7863   }
7864 
7865   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
7866  *
7867  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
7868  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
7869  *                 raise ValueError(u"ndarray is not C contiguous")
7870  *
7871  */
7872   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
7873   __pyx_t_1 = __pyx_t_2;
7874   __pyx_L4_bool_binop_done:;
7875 
7876   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
7877  *             ndim = PyArray_NDIM(self)
7878  *
7879  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
7880  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
7881  *                 raise ValueError(u"ndarray is not C contiguous")
7882  */
7883   if (unlikely(__pyx_t_1)) {
7884 
7885     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
7886  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
7887  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
7888  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
7889  *
7890  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
7891  */
7892     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
7893     __Pyx_GOTREF(__pyx_t_3);
7894     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7895     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7896     __PYX_ERR(2, 272, __pyx_L1_error)
7897 
7898     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
7899  *             ndim = PyArray_NDIM(self)
7900  *
7901  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
7902  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
7903  *                 raise ValueError(u"ndarray is not C contiguous")
7904  */
7905   }
7906 
7907   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
7908  *                 raise ValueError(u"ndarray is not C contiguous")
7909  *
7910  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
7911  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
7912  *                 raise ValueError(u"ndarray is not Fortran contiguous")
7913  */
7914   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
7915   if (__pyx_t_2) {
7916   } else {
7917     __pyx_t_1 = __pyx_t_2;
7918     goto __pyx_L7_bool_binop_done;
7919   }
7920 
7921   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
7922  *
7923  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
7924  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
7925  *                 raise ValueError(u"ndarray is not Fortran contiguous")
7926  *
7927  */
7928   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
7929   __pyx_t_1 = __pyx_t_2;
7930   __pyx_L7_bool_binop_done:;
7931 
7932   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
7933  *                 raise ValueError(u"ndarray is not C contiguous")
7934  *
7935  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
7936  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
7937  *                 raise ValueError(u"ndarray is not Fortran contiguous")
7938  */
7939   if (unlikely(__pyx_t_1)) {
7940 
7941     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
7942  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
7943  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
7944  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
7945  *
7946  *             info.buf = PyArray_DATA(self)
7947  */
7948     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
7949     __Pyx_GOTREF(__pyx_t_3);
7950     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7951     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7952     __PYX_ERR(2, 276, __pyx_L1_error)
7953 
7954     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
7955  *                 raise ValueError(u"ndarray is not C contiguous")
7956  *
7957  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
7958  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
7959  *                 raise ValueError(u"ndarray is not Fortran contiguous")
7960  */
7961   }
7962 
7963   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
7964  *                 raise ValueError(u"ndarray is not Fortran contiguous")
7965  *
7966  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
7967  *             info.ndim = ndim
7968  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
7969  */
7970   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
7971 
7972   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
7973  *
7974  *             info.buf = PyArray_DATA(self)
7975  *             info.ndim = ndim             # <<<<<<<<<<<<<<
7976  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
7977  *                 # Allocate new buffer for strides and shape info.
7978  */
7979   __pyx_v_info->ndim = __pyx_v_ndim;
7980 
7981   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
7982  *             info.buf = PyArray_DATA(self)
7983  *             info.ndim = ndim
7984  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
7985  *                 # Allocate new buffer for strides and shape info.
7986  *                 # This is allocated as one block, strides first.
7987  */
7988   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
7989   if (__pyx_t_1) {
7990 
7991     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
7992  *                 # Allocate new buffer for strides and shape info.
7993  *                 # This is allocated as one block, strides first.
7994  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
7995  *                 info.shape = info.strides + ndim
7996  *                 for i in range(ndim):
7997  */
7998     __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
7999 
8000     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
8001  *                 # This is allocated as one block, strides first.
8002  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
8003  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
8004  *                 for i in range(ndim):
8005  *                     info.strides[i] = PyArray_STRIDES(self)[i]
8006  */
8007     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
8008 
8009     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
8010  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
8011  *                 info.shape = info.strides + ndim
8012  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
8013  *                     info.strides[i] = PyArray_STRIDES(self)[i]
8014  *                     info.shape[i] = PyArray_DIMS(self)[i]
8015  */
8016     __pyx_t_4 = __pyx_v_ndim;
8017     __pyx_t_5 = __pyx_t_4;
8018     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
8019       __pyx_v_i = __pyx_t_6;
8020 
8021       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
8022  *                 info.shape = info.strides + ndim
8023  *                 for i in range(ndim):
8024  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
8025  *                     info.shape[i] = PyArray_DIMS(self)[i]
8026  *             else:
8027  */
8028       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
8029 
8030       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
8031  *                 for i in range(ndim):
8032  *                     info.strides[i] = PyArray_STRIDES(self)[i]
8033  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
8034  *             else:
8035  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8036  */
8037       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
8038     }
8039 
8040     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
8041  *             info.buf = PyArray_DATA(self)
8042  *             info.ndim = ndim
8043  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
8044  *                 # Allocate new buffer for strides and shape info.
8045  *                 # This is allocated as one block, strides first.
8046  */
8047     goto __pyx_L9;
8048   }
8049 
8050   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
8051  *                     info.shape[i] = PyArray_DIMS(self)[i]
8052  *             else:
8053  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
8054  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8055  *             info.suboffsets = NULL
8056  */
8057   /*else*/ {
8058     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
8059 
8060     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
8061  *             else:
8062  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8063  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
8064  *             info.suboffsets = NULL
8065  *             info.itemsize = PyArray_ITEMSIZE(self)
8066  */
8067     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
8068   }
8069   __pyx_L9:;
8070 
8071   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
8072  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8073  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8074  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
8075  *             info.itemsize = PyArray_ITEMSIZE(self)
8076  *             info.readonly = not PyArray_ISWRITEABLE(self)
8077  */
8078   __pyx_v_info->suboffsets = NULL;
8079 
8080   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
8081  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8082  *             info.suboffsets = NULL
8083  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
8084  *             info.readonly = not PyArray_ISWRITEABLE(self)
8085  *
8086  */
8087   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
8088 
8089   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
8090  *             info.suboffsets = NULL
8091  *             info.itemsize = PyArray_ITEMSIZE(self)
8092  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
8093  *
8094  *             cdef int t
8095  */
8096   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
8097 
8098   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
8099  *
8100  *             cdef int t
8101  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
8102  *             cdef dtype descr = <dtype>PyArray_DESCR(self)
8103  *             cdef int offset
8104  */
8105   __pyx_v_f = NULL;
8106 
8107   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
8108  *             cdef int t
8109  *             cdef char* f = NULL
8110  *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
8111  *             cdef int offset
8112  *
8113  */
8114   __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
8115   __pyx_t_3 = ((PyObject *)__pyx_t_7);
8116   __Pyx_INCREF(__pyx_t_3);
8117   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
8118   __pyx_t_3 = 0;
8119 
8120   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
8121  *             cdef int offset
8122  *
8123  *             info.obj = self             # <<<<<<<<<<<<<<
8124  *
8125  *             if not PyDataType_HASFIELDS(descr):
8126  */
8127   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8128   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8129   __Pyx_GOTREF(__pyx_v_info->obj);
8130   __Pyx_DECREF(__pyx_v_info->obj);
8131   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8132 
8133   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
8134  *             info.obj = self
8135  *
8136  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
8137  *                 t = descr.type_num
8138  *                 if ((descr.byteorder == c'>' and little_endian) or
8139  */
8140   __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
8141   if (__pyx_t_1) {
8142 
8143     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
8144  *
8145  *             if not PyDataType_HASFIELDS(descr):
8146  *                 t = descr.type_num             # <<<<<<<<<<<<<<
8147  *                 if ((descr.byteorder == c'>' and little_endian) or
8148  *                     (descr.byteorder == c'<' and not little_endian)):
8149  */
8150     __pyx_t_4 = __pyx_v_descr->type_num;
8151     __pyx_v_t = __pyx_t_4;
8152 
8153     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
8154  *             if not PyDataType_HASFIELDS(descr):
8155  *                 t = descr.type_num
8156  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
8157  *                     (descr.byteorder == c'<' and not little_endian)):
8158  *                     raise ValueError(u"Non-native byte order not supported")
8159  */
8160     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
8161     if (!__pyx_t_2) {
8162       goto __pyx_L15_next_or;
8163     } else {
8164     }
8165     __pyx_t_2 = (__pyx_v_little_endian != 0);
8166     if (!__pyx_t_2) {
8167     } else {
8168       __pyx_t_1 = __pyx_t_2;
8169       goto __pyx_L14_bool_binop_done;
8170     }
8171     __pyx_L15_next_or:;
8172 
8173     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
8174  *                 t = descr.type_num
8175  *                 if ((descr.byteorder == c'>' and little_endian) or
8176  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
8177  *                     raise ValueError(u"Non-native byte order not supported")
8178  *                 if   t == NPY_BYTE:        f = "b"
8179  */
8180     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
8181     if (__pyx_t_2) {
8182     } else {
8183       __pyx_t_1 = __pyx_t_2;
8184       goto __pyx_L14_bool_binop_done;
8185     }
8186     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
8187     __pyx_t_1 = __pyx_t_2;
8188     __pyx_L14_bool_binop_done:;
8189 
8190     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
8191  *             if not PyDataType_HASFIELDS(descr):
8192  *                 t = descr.type_num
8193  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
8194  *                     (descr.byteorder == c'<' and not little_endian)):
8195  *                     raise ValueError(u"Non-native byte order not supported")
8196  */
8197     if (unlikely(__pyx_t_1)) {
8198 
8199       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
8200  *                 if ((descr.byteorder == c'>' and little_endian) or
8201  *                     (descr.byteorder == c'<' and not little_endian)):
8202  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
8203  *                 if   t == NPY_BYTE:        f = "b"
8204  *                 elif t == NPY_UBYTE:       f = "B"
8205  */
8206       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
8207       __Pyx_GOTREF(__pyx_t_3);
8208       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8209       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8210       __PYX_ERR(2, 306, __pyx_L1_error)
8211 
8212       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
8213  *             if not PyDataType_HASFIELDS(descr):
8214  *                 t = descr.type_num
8215  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
8216  *                     (descr.byteorder == c'<' and not little_endian)):
8217  *                     raise ValueError(u"Non-native byte order not supported")
8218  */
8219     }
8220 
8221     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
8222  *                     (descr.byteorder == c'<' and not little_endian)):
8223  *                     raise ValueError(u"Non-native byte order not supported")
8224  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
8225  *                 elif t == NPY_UBYTE:       f = "B"
8226  *                 elif t == NPY_SHORT:       f = "h"
8227  */
8228     switch (__pyx_v_t) {
8229       case NPY_BYTE:
8230       __pyx_v_f = ((char *)"b");
8231       break;
8232       case NPY_UBYTE:
8233 
8234       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
8235  *                     raise ValueError(u"Non-native byte order not supported")
8236  *                 if   t == NPY_BYTE:        f = "b"
8237  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
8238  *                 elif t == NPY_SHORT:       f = "h"
8239  *                 elif t == NPY_USHORT:      f = "H"
8240  */
8241       __pyx_v_f = ((char *)"B");
8242       break;
8243       case NPY_SHORT:
8244 
8245       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
8246  *                 if   t == NPY_BYTE:        f = "b"
8247  *                 elif t == NPY_UBYTE:       f = "B"
8248  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
8249  *                 elif t == NPY_USHORT:      f = "H"
8250  *                 elif t == NPY_INT:         f = "i"
8251  */
8252       __pyx_v_f = ((char *)"h");
8253       break;
8254       case NPY_USHORT:
8255 
8256       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
8257  *                 elif t == NPY_UBYTE:       f = "B"
8258  *                 elif t == NPY_SHORT:       f = "h"
8259  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
8260  *                 elif t == NPY_INT:         f = "i"
8261  *                 elif t == NPY_UINT:        f = "I"
8262  */
8263       __pyx_v_f = ((char *)"H");
8264       break;
8265       case NPY_INT:
8266 
8267       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
8268  *                 elif t == NPY_SHORT:       f = "h"
8269  *                 elif t == NPY_USHORT:      f = "H"
8270  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
8271  *                 elif t == NPY_UINT:        f = "I"
8272  *                 elif t == NPY_LONG:        f = "l"
8273  */
8274       __pyx_v_f = ((char *)"i");
8275       break;
8276       case NPY_UINT:
8277 
8278       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
8279  *                 elif t == NPY_USHORT:      f = "H"
8280  *                 elif t == NPY_INT:         f = "i"
8281  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
8282  *                 elif t == NPY_LONG:        f = "l"
8283  *                 elif t == NPY_ULONG:       f = "L"
8284  */
8285       __pyx_v_f = ((char *)"I");
8286       break;
8287       case NPY_LONG:
8288 
8289       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
8290  *                 elif t == NPY_INT:         f = "i"
8291  *                 elif t == NPY_UINT:        f = "I"
8292  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
8293  *                 elif t == NPY_ULONG:       f = "L"
8294  *                 elif t == NPY_LONGLONG:    f = "q"
8295  */
8296       __pyx_v_f = ((char *)"l");
8297       break;
8298       case NPY_ULONG:
8299 
8300       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
8301  *                 elif t == NPY_UINT:        f = "I"
8302  *                 elif t == NPY_LONG:        f = "l"
8303  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
8304  *                 elif t == NPY_LONGLONG:    f = "q"
8305  *                 elif t == NPY_ULONGLONG:   f = "Q"
8306  */
8307       __pyx_v_f = ((char *)"L");
8308       break;
8309       case NPY_LONGLONG:
8310 
8311       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
8312  *                 elif t == NPY_LONG:        f = "l"
8313  *                 elif t == NPY_ULONG:       f = "L"
8314  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
8315  *                 elif t == NPY_ULONGLONG:   f = "Q"
8316  *                 elif t == NPY_FLOAT:       f = "f"
8317  */
8318       __pyx_v_f = ((char *)"q");
8319       break;
8320       case NPY_ULONGLONG:
8321 
8322       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
8323  *                 elif t == NPY_ULONG:       f = "L"
8324  *                 elif t == NPY_LONGLONG:    f = "q"
8325  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
8326  *                 elif t == NPY_FLOAT:       f = "f"
8327  *                 elif t == NPY_DOUBLE:      f = "d"
8328  */
8329       __pyx_v_f = ((char *)"Q");
8330       break;
8331       case NPY_FLOAT:
8332 
8333       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
8334  *                 elif t == NPY_LONGLONG:    f = "q"
8335  *                 elif t == NPY_ULONGLONG:   f = "Q"
8336  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
8337  *                 elif t == NPY_DOUBLE:      f = "d"
8338  *                 elif t == NPY_LONGDOUBLE:  f = "g"
8339  */
8340       __pyx_v_f = ((char *)"f");
8341       break;
8342       case NPY_DOUBLE:
8343 
8344       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
8345  *                 elif t == NPY_ULONGLONG:   f = "Q"
8346  *                 elif t == NPY_FLOAT:       f = "f"
8347  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
8348  *                 elif t == NPY_LONGDOUBLE:  f = "g"
8349  *                 elif t == NPY_CFLOAT:      f = "Zf"
8350  */
8351       __pyx_v_f = ((char *)"d");
8352       break;
8353       case NPY_LONGDOUBLE:
8354 
8355       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
8356  *                 elif t == NPY_FLOAT:       f = "f"
8357  *                 elif t == NPY_DOUBLE:      f = "d"
8358  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
8359  *                 elif t == NPY_CFLOAT:      f = "Zf"
8360  *                 elif t == NPY_CDOUBLE:     f = "Zd"
8361  */
8362       __pyx_v_f = ((char *)"g");
8363       break;
8364       case NPY_CFLOAT:
8365 
8366       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
8367  *                 elif t == NPY_DOUBLE:      f = "d"
8368  *                 elif t == NPY_LONGDOUBLE:  f = "g"
8369  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
8370  *                 elif t == NPY_CDOUBLE:     f = "Zd"
8371  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
8372  */
8373       __pyx_v_f = ((char *)"Zf");
8374       break;
8375       case NPY_CDOUBLE:
8376 
8377       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
8378  *                 elif t == NPY_LONGDOUBLE:  f = "g"
8379  *                 elif t == NPY_CFLOAT:      f = "Zf"
8380  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
8381  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
8382  *                 elif t == NPY_OBJECT:      f = "O"
8383  */
8384       __pyx_v_f = ((char *)"Zd");
8385       break;
8386       case NPY_CLONGDOUBLE:
8387 
8388       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
8389  *                 elif t == NPY_CFLOAT:      f = "Zf"
8390  *                 elif t == NPY_CDOUBLE:     f = "Zd"
8391  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
8392  *                 elif t == NPY_OBJECT:      f = "O"
8393  *                 else:
8394  */
8395       __pyx_v_f = ((char *)"Zg");
8396       break;
8397       case NPY_OBJECT:
8398 
8399       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
8400  *                 elif t == NPY_CDOUBLE:     f = "Zd"
8401  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
8402  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
8403  *                 else:
8404  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
8405  */
8406       __pyx_v_f = ((char *)"O");
8407       break;
8408       default:
8409 
8410       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
8411  *                 elif t == NPY_OBJECT:      f = "O"
8412  *                 else:
8413  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
8414  *                 info.format = f
8415  *                 return
8416  */
8417       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
8418       __Pyx_GOTREF(__pyx_t_3);
8419       __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)
8420       __Pyx_GOTREF(__pyx_t_8);
8421       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8422       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
8423       __Pyx_GOTREF(__pyx_t_3);
8424       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8425       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8426       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8427       __PYX_ERR(2, 325, __pyx_L1_error)
8428       break;
8429     }
8430 
8431     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
8432  *                 else:
8433  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
8434  *                 info.format = f             # <<<<<<<<<<<<<<
8435  *                 return
8436  *             else:
8437  */
8438     __pyx_v_info->format = __pyx_v_f;
8439 
8440     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
8441  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
8442  *                 info.format = f
8443  *                 return             # <<<<<<<<<<<<<<
8444  *             else:
8445  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
8446  */
8447     __pyx_r = 0;
8448     goto __pyx_L0;
8449 
8450     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
8451  *             info.obj = self
8452  *
8453  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
8454  *                 t = descr.type_num
8455  *                 if ((descr.byteorder == c'>' and little_endian) or
8456  */
8457   }
8458 
8459   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
8460  *                 return
8461  *             else:
8462  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
8463  *                 info.format[0] = c'^' # Native data types, manual alignment
8464  *                 offset = 0
8465  */
8466   /*else*/ {
8467     __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
8468 
8469     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
8470  *             else:
8471  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
8472  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
8473  *                 offset = 0
8474  *                 f = _util_dtypestring(descr, info.format + 1,
8475  */
8476     (__pyx_v_info->format[0]) = '^';
8477 
8478     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
8479  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
8480  *                 info.format[0] = c'^' # Native data types, manual alignment
8481  *                 offset = 0             # <<<<<<<<<<<<<<
8482  *                 f = _util_dtypestring(descr, info.format + 1,
8483  *                                       info.format + _buffer_format_string_len,
8484  */
8485     __pyx_v_offset = 0;
8486 
8487     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
8488  *                 info.format[0] = c'^' # Native data types, manual alignment
8489  *                 offset = 0
8490  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
8491  *                                       info.format + _buffer_format_string_len,
8492  *                                       &offset)
8493  */
8494     __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)
8495     __pyx_v_f = __pyx_t_9;
8496 
8497     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
8498  *                                       info.format + _buffer_format_string_len,
8499  *                                       &offset)
8500  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
8501  *
8502  *         def __releasebuffer__(ndarray self, Py_buffer* info):
8503  */
8504     (__pyx_v_f[0]) = '\x00';
8505   }
8506 
8507   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
8508  *         # experimental exception made for __getbuffer__ and __releasebuffer__
8509  *         # -- the details of this may change.
8510  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
8511  *             # This implementation of getbuffer is geared towards Cython
8512  *             # requirements, and does not yet fulfill the PEP.
8513  */
8514 
8515   /* function exit code */
8516   __pyx_r = 0;
8517   goto __pyx_L0;
8518   __pyx_L1_error:;
8519   __Pyx_XDECREF(__pyx_t_3);
8520   __Pyx_XDECREF(__pyx_t_8);
8521   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8522   __pyx_r = -1;
8523   if (__pyx_v_info->obj != NULL) {
8524     __Pyx_GOTREF(__pyx_v_info->obj);
8525     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8526   }
8527   goto __pyx_L2;
8528   __pyx_L0:;
8529   if (__pyx_v_info->obj == Py_None) {
8530     __Pyx_GOTREF(__pyx_v_info->obj);
8531     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8532   }
8533   __pyx_L2:;
8534   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
8535   __Pyx_RefNannyFinishContext();
8536   return __pyx_r;
8537 }
8538 
8539 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
8540  *                 f[0] = c'\0' # Terminate format string
8541  *
8542  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
8543  *             if PyArray_HASFIELDS(self):
8544  *                 PyObject_Free(info.format)
8545  */
8546 
8547 /* Python wrapper */
8548 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)8549 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
8550   __Pyx_RefNannyDeclarations
8551   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
8552   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
8553 
8554   /* function exit code */
8555   __Pyx_RefNannyFinishContext();
8556 }
8557 
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)8558 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
8559   __Pyx_RefNannyDeclarations
8560   int __pyx_t_1;
8561   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
8562 
8563   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
8564  *
8565  *         def __releasebuffer__(ndarray self, Py_buffer* info):
8566  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
8567  *                 PyObject_Free(info.format)
8568  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
8569  */
8570   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
8571   if (__pyx_t_1) {
8572 
8573     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
8574  *         def __releasebuffer__(ndarray self, Py_buffer* info):
8575  *             if PyArray_HASFIELDS(self):
8576  *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
8577  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
8578  *                 PyObject_Free(info.strides)
8579  */
8580     PyObject_Free(__pyx_v_info->format);
8581 
8582     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
8583  *
8584  *         def __releasebuffer__(ndarray self, Py_buffer* info):
8585  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
8586  *                 PyObject_Free(info.format)
8587  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
8588  */
8589   }
8590 
8591   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
8592  *             if PyArray_HASFIELDS(self):
8593  *                 PyObject_Free(info.format)
8594  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
8595  *                 PyObject_Free(info.strides)
8596  *                 # info.shape was stored after info.strides in the same block
8597  */
8598   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
8599   if (__pyx_t_1) {
8600 
8601     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
8602  *                 PyObject_Free(info.format)
8603  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
8604  *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
8605  *                 # info.shape was stored after info.strides in the same block
8606  *
8607  */
8608     PyObject_Free(__pyx_v_info->strides);
8609 
8610     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
8611  *             if PyArray_HASFIELDS(self):
8612  *                 PyObject_Free(info.format)
8613  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
8614  *                 PyObject_Free(info.strides)
8615  *                 # info.shape was stored after info.strides in the same block
8616  */
8617   }
8618 
8619   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
8620  *                 f[0] = c'\0' # Terminate format string
8621  *
8622  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
8623  *             if PyArray_HASFIELDS(self):
8624  *                 PyObject_Free(info.format)
8625  */
8626 
8627   /* function exit code */
8628   __Pyx_RefNannyFinishContext();
8629 }
8630 
8631 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
8632  * ctypedef npy_cdouble     complex_t
8633  *
8634  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
8635  *     return PyArray_MultiIterNew(1, <void*>a)
8636  *
8637  */
8638 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)8639 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
8640   PyObject *__pyx_r = NULL;
8641   __Pyx_RefNannyDeclarations
8642   PyObject *__pyx_t_1 = NULL;
8643   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
8644 
8645   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
8646  *
8647  * cdef inline object PyArray_MultiIterNew1(a):
8648  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
8649  *
8650  * cdef inline object PyArray_MultiIterNew2(a, b):
8651  */
8652   __Pyx_XDECREF(__pyx_r);
8653   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
8654   __Pyx_GOTREF(__pyx_t_1);
8655   __pyx_r = __pyx_t_1;
8656   __pyx_t_1 = 0;
8657   goto __pyx_L0;
8658 
8659   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
8660  * ctypedef npy_cdouble     complex_t
8661  *
8662  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
8663  *     return PyArray_MultiIterNew(1, <void*>a)
8664  *
8665  */
8666 
8667   /* function exit code */
8668   __pyx_L1_error:;
8669   __Pyx_XDECREF(__pyx_t_1);
8670   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
8671   __pyx_r = 0;
8672   __pyx_L0:;
8673   __Pyx_XGIVEREF(__pyx_r);
8674   __Pyx_RefNannyFinishContext();
8675   return __pyx_r;
8676 }
8677 
8678 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
8679  *     return PyArray_MultiIterNew(1, <void*>a)
8680  *
8681  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
8682  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
8683  *
8684  */
8685 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)8686 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
8687   PyObject *__pyx_r = NULL;
8688   __Pyx_RefNannyDeclarations
8689   PyObject *__pyx_t_1 = NULL;
8690   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
8691 
8692   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
8693  *
8694  * cdef inline object PyArray_MultiIterNew2(a, b):
8695  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
8696  *
8697  * cdef inline object PyArray_MultiIterNew3(a, b, c):
8698  */
8699   __Pyx_XDECREF(__pyx_r);
8700   __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)
8701   __Pyx_GOTREF(__pyx_t_1);
8702   __pyx_r = __pyx_t_1;
8703   __pyx_t_1 = 0;
8704   goto __pyx_L0;
8705 
8706   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
8707  *     return PyArray_MultiIterNew(1, <void*>a)
8708  *
8709  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
8710  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
8711  *
8712  */
8713 
8714   /* function exit code */
8715   __pyx_L1_error:;
8716   __Pyx_XDECREF(__pyx_t_1);
8717   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
8718   __pyx_r = 0;
8719   __pyx_L0:;
8720   __Pyx_XGIVEREF(__pyx_r);
8721   __Pyx_RefNannyFinishContext();
8722   return __pyx_r;
8723 }
8724 
8725 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
8726  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
8727  *
8728  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
8729  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
8730  *
8731  */
8732 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)8733 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
8734   PyObject *__pyx_r = NULL;
8735   __Pyx_RefNannyDeclarations
8736   PyObject *__pyx_t_1 = NULL;
8737   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
8738 
8739   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
8740  *
8741  * cdef inline object PyArray_MultiIterNew3(a, b, c):
8742  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
8743  *
8744  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
8745  */
8746   __Pyx_XDECREF(__pyx_r);
8747   __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)
8748   __Pyx_GOTREF(__pyx_t_1);
8749   __pyx_r = __pyx_t_1;
8750   __pyx_t_1 = 0;
8751   goto __pyx_L0;
8752 
8753   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
8754  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
8755  *
8756  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
8757  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
8758  *
8759  */
8760 
8761   /* function exit code */
8762   __pyx_L1_error:;
8763   __Pyx_XDECREF(__pyx_t_1);
8764   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
8765   __pyx_r = 0;
8766   __pyx_L0:;
8767   __Pyx_XGIVEREF(__pyx_r);
8768   __Pyx_RefNannyFinishContext();
8769   return __pyx_r;
8770 }
8771 
8772 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
8773  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
8774  *
8775  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
8776  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
8777  *
8778  */
8779 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)8780 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) {
8781   PyObject *__pyx_r = NULL;
8782   __Pyx_RefNannyDeclarations
8783   PyObject *__pyx_t_1 = NULL;
8784   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
8785 
8786   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
8787  *
8788  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
8789  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
8790  *
8791  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
8792  */
8793   __Pyx_XDECREF(__pyx_r);
8794   __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)
8795   __Pyx_GOTREF(__pyx_t_1);
8796   __pyx_r = __pyx_t_1;
8797   __pyx_t_1 = 0;
8798   goto __pyx_L0;
8799 
8800   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
8801  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
8802  *
8803  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
8804  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
8805  *
8806  */
8807 
8808   /* function exit code */
8809   __pyx_L1_error:;
8810   __Pyx_XDECREF(__pyx_t_1);
8811   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
8812   __pyx_r = 0;
8813   __pyx_L0:;
8814   __Pyx_XGIVEREF(__pyx_r);
8815   __Pyx_RefNannyFinishContext();
8816   return __pyx_r;
8817 }
8818 
8819 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
8820  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
8821  *
8822  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
8823  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
8824  *
8825  */
8826 
__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)8827 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) {
8828   PyObject *__pyx_r = NULL;
8829   __Pyx_RefNannyDeclarations
8830   PyObject *__pyx_t_1 = NULL;
8831   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
8832 
8833   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
8834  *
8835  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
8836  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
8837  *
8838  * cdef inline tuple PyDataType_SHAPE(dtype d):
8839  */
8840   __Pyx_XDECREF(__pyx_r);
8841   __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)
8842   __Pyx_GOTREF(__pyx_t_1);
8843   __pyx_r = __pyx_t_1;
8844   __pyx_t_1 = 0;
8845   goto __pyx_L0;
8846 
8847   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
8848  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
8849  *
8850  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
8851  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
8852  *
8853  */
8854 
8855   /* function exit code */
8856   __pyx_L1_error:;
8857   __Pyx_XDECREF(__pyx_t_1);
8858   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
8859   __pyx_r = 0;
8860   __pyx_L0:;
8861   __Pyx_XGIVEREF(__pyx_r);
8862   __Pyx_RefNannyFinishContext();
8863   return __pyx_r;
8864 }
8865 
8866 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
8867  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
8868  *
8869  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
8870  *     if PyDataType_HASSUBARRAY(d):
8871  *         return <tuple>d.subarray.shape
8872  */
8873 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)8874 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
8875   PyObject *__pyx_r = NULL;
8876   __Pyx_RefNannyDeclarations
8877   int __pyx_t_1;
8878   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
8879 
8880   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
8881  *
8882  * cdef inline tuple PyDataType_SHAPE(dtype d):
8883  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
8884  *         return <tuple>d.subarray.shape
8885  *     else:
8886  */
8887   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
8888   if (__pyx_t_1) {
8889 
8890     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
8891  * cdef inline tuple PyDataType_SHAPE(dtype d):
8892  *     if PyDataType_HASSUBARRAY(d):
8893  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
8894  *     else:
8895  *         return ()
8896  */
8897     __Pyx_XDECREF(__pyx_r);
8898     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
8899     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
8900     goto __pyx_L0;
8901 
8902     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
8903  *
8904  * cdef inline tuple PyDataType_SHAPE(dtype d):
8905  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
8906  *         return <tuple>d.subarray.shape
8907  *     else:
8908  */
8909   }
8910 
8911   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
8912  *         return <tuple>d.subarray.shape
8913  *     else:
8914  *         return ()             # <<<<<<<<<<<<<<
8915  *
8916  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
8917  */
8918   /*else*/ {
8919     __Pyx_XDECREF(__pyx_r);
8920     __Pyx_INCREF(__pyx_empty_tuple);
8921     __pyx_r = __pyx_empty_tuple;
8922     goto __pyx_L0;
8923   }
8924 
8925   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
8926  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
8927  *
8928  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
8929  *     if PyDataType_HASSUBARRAY(d):
8930  *         return <tuple>d.subarray.shape
8931  */
8932 
8933   /* function exit code */
8934   __pyx_L0:;
8935   __Pyx_XGIVEREF(__pyx_r);
8936   __Pyx_RefNannyFinishContext();
8937   return __pyx_r;
8938 }
8939 
8940 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
8941  *         return ()
8942  *
8943  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
8944  *     # Recursive utility function used in __getbuffer__ to get format
8945  *     # string. The new location in the format string is returned.
8946  */
8947 
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)8948 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) {
8949   PyArray_Descr *__pyx_v_child = 0;
8950   int __pyx_v_endian_detector;
8951   int __pyx_v_little_endian;
8952   PyObject *__pyx_v_fields = 0;
8953   PyObject *__pyx_v_childname = NULL;
8954   PyObject *__pyx_v_new_offset = NULL;
8955   PyObject *__pyx_v_t = NULL;
8956   char *__pyx_r;
8957   __Pyx_RefNannyDeclarations
8958   PyObject *__pyx_t_1 = NULL;
8959   Py_ssize_t __pyx_t_2;
8960   PyObject *__pyx_t_3 = NULL;
8961   PyObject *__pyx_t_4 = NULL;
8962   int __pyx_t_5;
8963   int __pyx_t_6;
8964   int __pyx_t_7;
8965   long __pyx_t_8;
8966   char *__pyx_t_9;
8967   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
8968 
8969   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
8970  *
8971  *     cdef dtype child
8972  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
8973  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8974  *     cdef tuple fields
8975  */
8976   __pyx_v_endian_detector = 1;
8977 
8978   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
8979  *     cdef dtype child
8980  *     cdef int endian_detector = 1
8981  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
8982  *     cdef tuple fields
8983  *
8984  */
8985   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
8986 
8987   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
8988  *     cdef tuple fields
8989  *
8990  *     for childname in descr.names:             # <<<<<<<<<<<<<<
8991  *         fields = descr.fields[childname]
8992  *         child, new_offset = fields
8993  */
8994   if (unlikely(__pyx_v_descr->names == Py_None)) {
8995     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8996     __PYX_ERR(2, 851, __pyx_L1_error)
8997   }
8998   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
8999   for (;;) {
9000     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
9001     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9002     __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)
9003     #else
9004     __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)
9005     __Pyx_GOTREF(__pyx_t_3);
9006     #endif
9007     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
9008     __pyx_t_3 = 0;
9009 
9010     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
9011  *
9012  *     for childname in descr.names:
9013  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
9014  *         child, new_offset = fields
9015  *
9016  */
9017     if (unlikely(__pyx_v_descr->fields == Py_None)) {
9018       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9019       __PYX_ERR(2, 852, __pyx_L1_error)
9020     }
9021     __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)
9022     __Pyx_GOTREF(__pyx_t_3);
9023     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)
9024     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
9025     __pyx_t_3 = 0;
9026 
9027     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
9028  *     for childname in descr.names:
9029  *         fields = descr.fields[childname]
9030  *         child, new_offset = fields             # <<<<<<<<<<<<<<
9031  *
9032  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
9033  */
9034     if (likely(__pyx_v_fields != Py_None)) {
9035       PyObject* sequence = __pyx_v_fields;
9036       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9037       if (unlikely(size != 2)) {
9038         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9039         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9040         __PYX_ERR(2, 853, __pyx_L1_error)
9041       }
9042       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9043       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
9044       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
9045       __Pyx_INCREF(__pyx_t_3);
9046       __Pyx_INCREF(__pyx_t_4);
9047       #else
9048       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
9049       __Pyx_GOTREF(__pyx_t_3);
9050       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
9051       __Pyx_GOTREF(__pyx_t_4);
9052       #endif
9053     } else {
9054       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
9055     }
9056     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
9057     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
9058     __pyx_t_3 = 0;
9059     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
9060     __pyx_t_4 = 0;
9061 
9062     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
9063  *         child, new_offset = fields
9064  *
9065  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
9066  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9067  *
9068  */
9069     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
9070     __Pyx_GOTREF(__pyx_t_4);
9071     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
9072     __Pyx_GOTREF(__pyx_t_3);
9073     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9074     __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)
9075     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9076     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
9077     if (unlikely(__pyx_t_6)) {
9078 
9079       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
9080  *
9081  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
9082  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
9083  *
9084  *         if ((child.byteorder == c'>' and little_endian) or
9085  */
9086       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
9087       __Pyx_GOTREF(__pyx_t_3);
9088       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9089       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9090       __PYX_ERR(2, 856, __pyx_L1_error)
9091 
9092       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
9093  *         child, new_offset = fields
9094  *
9095  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
9096  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9097  *
9098  */
9099     }
9100 
9101     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
9102  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9103  *
9104  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
9105  *             (child.byteorder == c'<' and not little_endian)):
9106  *             raise ValueError(u"Non-native byte order not supported")
9107  */
9108     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
9109     if (!__pyx_t_7) {
9110       goto __pyx_L8_next_or;
9111     } else {
9112     }
9113     __pyx_t_7 = (__pyx_v_little_endian != 0);
9114     if (!__pyx_t_7) {
9115     } else {
9116       __pyx_t_6 = __pyx_t_7;
9117       goto __pyx_L7_bool_binop_done;
9118     }
9119     __pyx_L8_next_or:;
9120 
9121     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
9122  *
9123  *         if ((child.byteorder == c'>' and little_endian) or
9124  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
9125  *             raise ValueError(u"Non-native byte order not supported")
9126  *             # One could encode it in the format string and have Cython
9127  */
9128     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
9129     if (__pyx_t_7) {
9130     } else {
9131       __pyx_t_6 = __pyx_t_7;
9132       goto __pyx_L7_bool_binop_done;
9133     }
9134     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
9135     __pyx_t_6 = __pyx_t_7;
9136     __pyx_L7_bool_binop_done:;
9137 
9138     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
9139  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9140  *
9141  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
9142  *             (child.byteorder == c'<' and not little_endian)):
9143  *             raise ValueError(u"Non-native byte order not supported")
9144  */
9145     if (unlikely(__pyx_t_6)) {
9146 
9147       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
9148  *         if ((child.byteorder == c'>' and little_endian) or
9149  *             (child.byteorder == c'<' and not little_endian)):
9150  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
9151  *             # One could encode it in the format string and have Cython
9152  *             # complain instead, BUT: < and > in format strings also imply
9153  */
9154       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
9155       __Pyx_GOTREF(__pyx_t_3);
9156       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9157       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9158       __PYX_ERR(2, 860, __pyx_L1_error)
9159 
9160       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
9161  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9162  *
9163  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
9164  *             (child.byteorder == c'<' and not little_endian)):
9165  *             raise ValueError(u"Non-native byte order not supported")
9166  */
9167     }
9168 
9169     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
9170  *
9171  *         # Output padding bytes
9172  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
9173  *             f[0] = 120 # "x"; pad byte
9174  *             f += 1
9175  */
9176     while (1) {
9177       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
9178       __Pyx_GOTREF(__pyx_t_3);
9179       __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)
9180       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9181       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
9182       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9183       if (!__pyx_t_6) break;
9184 
9185       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
9186  *         # Output padding bytes
9187  *         while offset[0] < new_offset:
9188  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
9189  *             f += 1
9190  *             offset[0] += 1
9191  */
9192       (__pyx_v_f[0]) = 0x78;
9193 
9194       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
9195  *         while offset[0] < new_offset:
9196  *             f[0] = 120 # "x"; pad byte
9197  *             f += 1             # <<<<<<<<<<<<<<
9198  *             offset[0] += 1
9199  *
9200  */
9201       __pyx_v_f = (__pyx_v_f + 1);
9202 
9203       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
9204  *             f[0] = 120 # "x"; pad byte
9205  *             f += 1
9206  *             offset[0] += 1             # <<<<<<<<<<<<<<
9207  *
9208  *         offset[0] += child.itemsize
9209  */
9210       __pyx_t_8 = 0;
9211       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
9212     }
9213 
9214     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
9215  *             offset[0] += 1
9216  *
9217  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
9218  *
9219  *         if not PyDataType_HASFIELDS(child):
9220  */
9221     __pyx_t_8 = 0;
9222     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
9223 
9224     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
9225  *         offset[0] += child.itemsize
9226  *
9227  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
9228  *             t = child.type_num
9229  *             if end - f < 5:
9230  */
9231     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
9232     if (__pyx_t_6) {
9233 
9234       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
9235  *
9236  *         if not PyDataType_HASFIELDS(child):
9237  *             t = child.type_num             # <<<<<<<<<<<<<<
9238  *             if end - f < 5:
9239  *                 raise RuntimeError(u"Format string allocated too short.")
9240  */
9241       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
9242       __Pyx_GOTREF(__pyx_t_4);
9243       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
9244       __pyx_t_4 = 0;
9245 
9246       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
9247  *         if not PyDataType_HASFIELDS(child):
9248  *             t = child.type_num
9249  *             if end - f < 5:             # <<<<<<<<<<<<<<
9250  *                 raise RuntimeError(u"Format string allocated too short.")
9251  *
9252  */
9253       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
9254       if (unlikely(__pyx_t_6)) {
9255 
9256         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
9257  *             t = child.type_num
9258  *             if end - f < 5:
9259  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
9260  *
9261  *             # Until ticket #99 is fixed, use integers to avoid warnings
9262  */
9263         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
9264         __Pyx_GOTREF(__pyx_t_4);
9265         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9266         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9267         __PYX_ERR(2, 880, __pyx_L1_error)
9268 
9269         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
9270  *         if not PyDataType_HASFIELDS(child):
9271  *             t = child.type_num
9272  *             if end - f < 5:             # <<<<<<<<<<<<<<
9273  *                 raise RuntimeError(u"Format string allocated too short.")
9274  *
9275  */
9276       }
9277 
9278       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
9279  *
9280  *             # Until ticket #99 is fixed, use integers to avoid warnings
9281  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
9282  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
9283  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
9284  */
9285       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
9286       __Pyx_GOTREF(__pyx_t_4);
9287       __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)
9288       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9289       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
9290       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9291       if (__pyx_t_6) {
9292         (__pyx_v_f[0]) = 98;
9293         goto __pyx_L15;
9294       }
9295 
9296       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
9297  *             # Until ticket #99 is fixed, use integers to avoid warnings
9298  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
9299  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
9300  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
9301  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
9302  */
9303       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
9304       __Pyx_GOTREF(__pyx_t_3);
9305       __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)
9306       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9307       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
9308       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9309       if (__pyx_t_6) {
9310         (__pyx_v_f[0]) = 66;
9311         goto __pyx_L15;
9312       }
9313 
9314       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
9315  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
9316  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
9317  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
9318  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
9319  *             elif t == NPY_INT:         f[0] = 105 #"i"
9320  */
9321       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
9322       __Pyx_GOTREF(__pyx_t_4);
9323       __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)
9324       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9325       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
9326       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9327       if (__pyx_t_6) {
9328         (__pyx_v_f[0]) = 0x68;
9329         goto __pyx_L15;
9330       }
9331 
9332       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
9333  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
9334  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
9335  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
9336  *             elif t == NPY_INT:         f[0] = 105 #"i"
9337  *             elif t == NPY_UINT:        f[0] =  73 #"I"
9338  */
9339       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
9340       __Pyx_GOTREF(__pyx_t_3);
9341       __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)
9342       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9343       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
9344       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9345       if (__pyx_t_6) {
9346         (__pyx_v_f[0]) = 72;
9347         goto __pyx_L15;
9348       }
9349 
9350       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
9351  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
9352  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
9353  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
9354  *             elif t == NPY_UINT:        f[0] =  73 #"I"
9355  *             elif t == NPY_LONG:        f[0] = 108 #"l"
9356  */
9357       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
9358       __Pyx_GOTREF(__pyx_t_4);
9359       __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)
9360       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9361       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
9362       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9363       if (__pyx_t_6) {
9364         (__pyx_v_f[0]) = 0x69;
9365         goto __pyx_L15;
9366       }
9367 
9368       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
9369  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
9370  *             elif t == NPY_INT:         f[0] = 105 #"i"
9371  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
9372  *             elif t == NPY_LONG:        f[0] = 108 #"l"
9373  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
9374  */
9375       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
9376       __Pyx_GOTREF(__pyx_t_3);
9377       __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)
9378       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9379       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
9380       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9381       if (__pyx_t_6) {
9382         (__pyx_v_f[0]) = 73;
9383         goto __pyx_L15;
9384       }
9385 
9386       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
9387  *             elif t == NPY_INT:         f[0] = 105 #"i"
9388  *             elif t == NPY_UINT:        f[0] =  73 #"I"
9389  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
9390  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
9391  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
9392  */
9393       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
9394       __Pyx_GOTREF(__pyx_t_4);
9395       __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)
9396       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9397       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
9398       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9399       if (__pyx_t_6) {
9400         (__pyx_v_f[0]) = 0x6C;
9401         goto __pyx_L15;
9402       }
9403 
9404       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
9405  *             elif t == NPY_UINT:        f[0] =  73 #"I"
9406  *             elif t == NPY_LONG:        f[0] = 108 #"l"
9407  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
9408  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
9409  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
9410  */
9411       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
9412       __Pyx_GOTREF(__pyx_t_3);
9413       __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)
9414       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9415       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
9416       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9417       if (__pyx_t_6) {
9418         (__pyx_v_f[0]) = 76;
9419         goto __pyx_L15;
9420       }
9421 
9422       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
9423  *             elif t == NPY_LONG:        f[0] = 108 #"l"
9424  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
9425  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
9426  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
9427  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
9428  */
9429       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
9430       __Pyx_GOTREF(__pyx_t_4);
9431       __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)
9432       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9433       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
9434       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9435       if (__pyx_t_6) {
9436         (__pyx_v_f[0]) = 0x71;
9437         goto __pyx_L15;
9438       }
9439 
9440       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
9441  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
9442  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
9443  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
9444  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
9445  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
9446  */
9447       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
9448       __Pyx_GOTREF(__pyx_t_3);
9449       __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)
9450       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9451       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
9452       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9453       if (__pyx_t_6) {
9454         (__pyx_v_f[0]) = 81;
9455         goto __pyx_L15;
9456       }
9457 
9458       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
9459  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
9460  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
9461  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
9462  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
9463  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
9464  */
9465       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
9466       __Pyx_GOTREF(__pyx_t_4);
9467       __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)
9468       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9469       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
9470       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9471       if (__pyx_t_6) {
9472         (__pyx_v_f[0]) = 0x66;
9473         goto __pyx_L15;
9474       }
9475 
9476       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
9477  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
9478  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
9479  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
9480  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
9481  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
9482  */
9483       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
9484       __Pyx_GOTREF(__pyx_t_3);
9485       __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)
9486       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9487       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
9488       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9489       if (__pyx_t_6) {
9490         (__pyx_v_f[0]) = 0x64;
9491         goto __pyx_L15;
9492       }
9493 
9494       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
9495  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
9496  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
9497  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
9498  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
9499  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
9500  */
9501       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
9502       __Pyx_GOTREF(__pyx_t_4);
9503       __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)
9504       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9505       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
9506       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9507       if (__pyx_t_6) {
9508         (__pyx_v_f[0]) = 0x67;
9509         goto __pyx_L15;
9510       }
9511 
9512       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
9513  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
9514  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
9515  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
9516  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
9517  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
9518  */
9519       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
9520       __Pyx_GOTREF(__pyx_t_3);
9521       __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)
9522       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9523       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
9524       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9525       if (__pyx_t_6) {
9526         (__pyx_v_f[0]) = 90;
9527         (__pyx_v_f[1]) = 0x66;
9528         __pyx_v_f = (__pyx_v_f + 1);
9529         goto __pyx_L15;
9530       }
9531 
9532       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
9533  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
9534  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
9535  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
9536  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
9537  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
9538  */
9539       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
9540       __Pyx_GOTREF(__pyx_t_4);
9541       __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)
9542       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9543       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
9544       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9545       if (__pyx_t_6) {
9546         (__pyx_v_f[0]) = 90;
9547         (__pyx_v_f[1]) = 0x64;
9548         __pyx_v_f = (__pyx_v_f + 1);
9549         goto __pyx_L15;
9550       }
9551 
9552       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
9553  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
9554  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
9555  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
9556  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
9557  *             else:
9558  */
9559       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
9560       __Pyx_GOTREF(__pyx_t_3);
9561       __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)
9562       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9563       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
9564       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9565       if (__pyx_t_6) {
9566         (__pyx_v_f[0]) = 90;
9567         (__pyx_v_f[1]) = 0x67;
9568         __pyx_v_f = (__pyx_v_f + 1);
9569         goto __pyx_L15;
9570       }
9571 
9572       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
9573  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
9574  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
9575  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
9576  *             else:
9577  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9578  */
9579       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
9580       __Pyx_GOTREF(__pyx_t_4);
9581       __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)
9582       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9583       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
9584       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9585       if (likely(__pyx_t_6)) {
9586         (__pyx_v_f[0]) = 79;
9587         goto __pyx_L15;
9588       }
9589 
9590       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
9591  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
9592  *             else:
9593  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
9594  *             f += 1
9595  *         else:
9596  */
9597       /*else*/ {
9598         __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)
9599         __Pyx_GOTREF(__pyx_t_3);
9600         __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
9601         __Pyx_GOTREF(__pyx_t_4);
9602         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9603         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9604         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9605         __PYX_ERR(2, 901, __pyx_L1_error)
9606       }
9607       __pyx_L15:;
9608 
9609       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
9610  *             else:
9611  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9612  *             f += 1             # <<<<<<<<<<<<<<
9613  *         else:
9614  *             # Cython ignores struct boundary information ("T{...}"),
9615  */
9616       __pyx_v_f = (__pyx_v_f + 1);
9617 
9618       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
9619  *         offset[0] += child.itemsize
9620  *
9621  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
9622  *             t = child.type_num
9623  *             if end - f < 5:
9624  */
9625       goto __pyx_L13;
9626     }
9627 
9628     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
9629  *             # Cython ignores struct boundary information ("T{...}"),
9630  *             # so don't output it
9631  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
9632  *     return f
9633  *
9634  */
9635     /*else*/ {
9636       __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)
9637       __pyx_v_f = __pyx_t_9;
9638     }
9639     __pyx_L13:;
9640 
9641     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
9642  *     cdef tuple fields
9643  *
9644  *     for childname in descr.names:             # <<<<<<<<<<<<<<
9645  *         fields = descr.fields[childname]
9646  *         child, new_offset = fields
9647  */
9648   }
9649   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9650 
9651   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
9652  *             # so don't output it
9653  *             f = _util_dtypestring(child, f, end, offset)
9654  *     return f             # <<<<<<<<<<<<<<
9655  *
9656  *
9657  */
9658   __pyx_r = __pyx_v_f;
9659   goto __pyx_L0;
9660 
9661   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
9662  *         return ()
9663  *
9664  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
9665  *     # Recursive utility function used in __getbuffer__ to get format
9666  *     # string. The new location in the format string is returned.
9667  */
9668 
9669   /* function exit code */
9670   __pyx_L1_error:;
9671   __Pyx_XDECREF(__pyx_t_1);
9672   __Pyx_XDECREF(__pyx_t_3);
9673   __Pyx_XDECREF(__pyx_t_4);
9674   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
9675   __pyx_r = NULL;
9676   __pyx_L0:;
9677   __Pyx_XDECREF((PyObject *)__pyx_v_child);
9678   __Pyx_XDECREF(__pyx_v_fields);
9679   __Pyx_XDECREF(__pyx_v_childname);
9680   __Pyx_XDECREF(__pyx_v_new_offset);
9681   __Pyx_XDECREF(__pyx_v_t);
9682   __Pyx_RefNannyFinishContext();
9683   return __pyx_r;
9684 }
9685 
9686 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
9687  *     int _import_umath() except -1
9688  *
9689  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
9690  *     Py_INCREF(base) # important to do this before stealing the reference below!
9691  *     PyArray_SetBaseObject(arr, base)
9692  */
9693 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)9694 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
9695   __Pyx_RefNannyDeclarations
9696   __Pyx_RefNannySetupContext("set_array_base", 0);
9697 
9698   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
9699  *
9700  * cdef inline void set_array_base(ndarray arr, object base):
9701  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
9702  *     PyArray_SetBaseObject(arr, base)
9703  *
9704  */
9705   Py_INCREF(__pyx_v_base);
9706 
9707   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
9708  * cdef inline void set_array_base(ndarray arr, object base):
9709  *     Py_INCREF(base) # important to do this before stealing the reference below!
9710  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
9711  *
9712  * cdef inline object get_array_base(ndarray arr):
9713  */
9714   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
9715 
9716   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
9717  *     int _import_umath() except -1
9718  *
9719  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
9720  *     Py_INCREF(base) # important to do this before stealing the reference below!
9721  *     PyArray_SetBaseObject(arr, base)
9722  */
9723 
9724   /* function exit code */
9725   __Pyx_RefNannyFinishContext();
9726 }
9727 
9728 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
9729  *     PyArray_SetBaseObject(arr, base)
9730  *
9731  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
9732  *     base = PyArray_BASE(arr)
9733  *     if base is NULL:
9734  */
9735 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)9736 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
9737   PyObject *__pyx_v_base;
9738   PyObject *__pyx_r = NULL;
9739   __Pyx_RefNannyDeclarations
9740   int __pyx_t_1;
9741   __Pyx_RefNannySetupContext("get_array_base", 0);
9742 
9743   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
9744  *
9745  * cdef inline object get_array_base(ndarray arr):
9746  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
9747  *     if base is NULL:
9748  *         return None
9749  */
9750   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
9751 
9752   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
9753  * cdef inline object get_array_base(ndarray arr):
9754  *     base = PyArray_BASE(arr)
9755  *     if base is NULL:             # <<<<<<<<<<<<<<
9756  *         return None
9757  *     return <object>base
9758  */
9759   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
9760   if (__pyx_t_1) {
9761 
9762     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
9763  *     base = PyArray_BASE(arr)
9764  *     if base is NULL:
9765  *         return None             # <<<<<<<<<<<<<<
9766  *     return <object>base
9767  *
9768  */
9769     __Pyx_XDECREF(__pyx_r);
9770     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9771     goto __pyx_L0;
9772 
9773     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
9774  * cdef inline object get_array_base(ndarray arr):
9775  *     base = PyArray_BASE(arr)
9776  *     if base is NULL:             # <<<<<<<<<<<<<<
9777  *         return None
9778  *     return <object>base
9779  */
9780   }
9781 
9782   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
9783  *     if base is NULL:
9784  *         return None
9785  *     return <object>base             # <<<<<<<<<<<<<<
9786  *
9787  * # Versions of the import_* functions which are more suitable for
9788  */
9789   __Pyx_XDECREF(__pyx_r);
9790   __Pyx_INCREF(((PyObject *)__pyx_v_base));
9791   __pyx_r = ((PyObject *)__pyx_v_base);
9792   goto __pyx_L0;
9793 
9794   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
9795  *     PyArray_SetBaseObject(arr, base)
9796  *
9797  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
9798  *     base = PyArray_BASE(arr)
9799  *     if base is NULL:
9800  */
9801 
9802   /* function exit code */
9803   __pyx_L0:;
9804   __Pyx_XGIVEREF(__pyx_r);
9805   __Pyx_RefNannyFinishContext();
9806   return __pyx_r;
9807 }
9808 
9809 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
9810  * # Versions of the import_* functions which are more suitable for
9811  * # Cython code.
9812  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
9813  *     try:
9814  *         _import_array()
9815  */
9816 
__pyx_f_5numpy_import_array(void)9817 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
9818   int __pyx_r;
9819   __Pyx_RefNannyDeclarations
9820   PyObject *__pyx_t_1 = NULL;
9821   PyObject *__pyx_t_2 = NULL;
9822   PyObject *__pyx_t_3 = NULL;
9823   int __pyx_t_4;
9824   PyObject *__pyx_t_5 = NULL;
9825   PyObject *__pyx_t_6 = NULL;
9826   PyObject *__pyx_t_7 = NULL;
9827   PyObject *__pyx_t_8 = NULL;
9828   __Pyx_RefNannySetupContext("import_array", 0);
9829 
9830   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
9831  * # Cython code.
9832  * cdef inline int import_array() except -1:
9833  *     try:             # <<<<<<<<<<<<<<
9834  *         _import_array()
9835  *     except Exception:
9836  */
9837   {
9838     __Pyx_PyThreadState_declare
9839     __Pyx_PyThreadState_assign
9840     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
9841     __Pyx_XGOTREF(__pyx_t_1);
9842     __Pyx_XGOTREF(__pyx_t_2);
9843     __Pyx_XGOTREF(__pyx_t_3);
9844     /*try:*/ {
9845 
9846       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
9847  * cdef inline int import_array() except -1:
9848  *     try:
9849  *         _import_array()             # <<<<<<<<<<<<<<
9850  *     except Exception:
9851  *         raise ImportError("numpy.core.multiarray failed to import")
9852  */
9853       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)
9854 
9855       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
9856  * # Cython code.
9857  * cdef inline int import_array() except -1:
9858  *     try:             # <<<<<<<<<<<<<<
9859  *         _import_array()
9860  *     except Exception:
9861  */
9862     }
9863     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9864     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9865     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9866     goto __pyx_L8_try_end;
9867     __pyx_L3_error:;
9868 
9869     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
9870  *     try:
9871  *         _import_array()
9872  *     except Exception:             # <<<<<<<<<<<<<<
9873  *         raise ImportError("numpy.core.multiarray failed to import")
9874  *
9875  */
9876     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
9877     if (__pyx_t_4) {
9878       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
9879       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
9880       __Pyx_GOTREF(__pyx_t_5);
9881       __Pyx_GOTREF(__pyx_t_6);
9882       __Pyx_GOTREF(__pyx_t_7);
9883 
9884       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
9885  *         _import_array()
9886  *     except Exception:
9887  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
9888  *
9889  * cdef inline int import_umath() except -1:
9890  */
9891       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
9892       __Pyx_GOTREF(__pyx_t_8);
9893       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
9894       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9895       __PYX_ERR(2, 1038, __pyx_L5_except_error)
9896     }
9897     goto __pyx_L5_except_error;
9898     __pyx_L5_except_error:;
9899 
9900     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
9901  * # Cython code.
9902  * cdef inline int import_array() except -1:
9903  *     try:             # <<<<<<<<<<<<<<
9904  *         _import_array()
9905  *     except Exception:
9906  */
9907     __Pyx_XGIVEREF(__pyx_t_1);
9908     __Pyx_XGIVEREF(__pyx_t_2);
9909     __Pyx_XGIVEREF(__pyx_t_3);
9910     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
9911     goto __pyx_L1_error;
9912     __pyx_L8_try_end:;
9913   }
9914 
9915   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
9916  * # Versions of the import_* functions which are more suitable for
9917  * # Cython code.
9918  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
9919  *     try:
9920  *         _import_array()
9921  */
9922 
9923   /* function exit code */
9924   __pyx_r = 0;
9925   goto __pyx_L0;
9926   __pyx_L1_error:;
9927   __Pyx_XDECREF(__pyx_t_5);
9928   __Pyx_XDECREF(__pyx_t_6);
9929   __Pyx_XDECREF(__pyx_t_7);
9930   __Pyx_XDECREF(__pyx_t_8);
9931   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
9932   __pyx_r = -1;
9933   __pyx_L0:;
9934   __Pyx_RefNannyFinishContext();
9935   return __pyx_r;
9936 }
9937 
9938 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
9939  *         raise ImportError("numpy.core.multiarray failed to import")
9940  *
9941  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
9942  *     try:
9943  *         _import_umath()
9944  */
9945 
__pyx_f_5numpy_import_umath(void)9946 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
9947   int __pyx_r;
9948   __Pyx_RefNannyDeclarations
9949   PyObject *__pyx_t_1 = NULL;
9950   PyObject *__pyx_t_2 = NULL;
9951   PyObject *__pyx_t_3 = NULL;
9952   int __pyx_t_4;
9953   PyObject *__pyx_t_5 = NULL;
9954   PyObject *__pyx_t_6 = NULL;
9955   PyObject *__pyx_t_7 = NULL;
9956   PyObject *__pyx_t_8 = NULL;
9957   __Pyx_RefNannySetupContext("import_umath", 0);
9958 
9959   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
9960  *
9961  * cdef inline int import_umath() except -1:
9962  *     try:             # <<<<<<<<<<<<<<
9963  *         _import_umath()
9964  *     except Exception:
9965  */
9966   {
9967     __Pyx_PyThreadState_declare
9968     __Pyx_PyThreadState_assign
9969     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
9970     __Pyx_XGOTREF(__pyx_t_1);
9971     __Pyx_XGOTREF(__pyx_t_2);
9972     __Pyx_XGOTREF(__pyx_t_3);
9973     /*try:*/ {
9974 
9975       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
9976  * cdef inline int import_umath() except -1:
9977  *     try:
9978  *         _import_umath()             # <<<<<<<<<<<<<<
9979  *     except Exception:
9980  *         raise ImportError("numpy.core.umath failed to import")
9981  */
9982       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)
9983 
9984       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
9985  *
9986  * cdef inline int import_umath() except -1:
9987  *     try:             # <<<<<<<<<<<<<<
9988  *         _import_umath()
9989  *     except Exception:
9990  */
9991     }
9992     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9993     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9994     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9995     goto __pyx_L8_try_end;
9996     __pyx_L3_error:;
9997 
9998     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
9999  *     try:
10000  *         _import_umath()
10001  *     except Exception:             # <<<<<<<<<<<<<<
10002  *         raise ImportError("numpy.core.umath failed to import")
10003  *
10004  */
10005     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10006     if (__pyx_t_4) {
10007       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
10008       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
10009       __Pyx_GOTREF(__pyx_t_5);
10010       __Pyx_GOTREF(__pyx_t_6);
10011       __Pyx_GOTREF(__pyx_t_7);
10012 
10013       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
10014  *         _import_umath()
10015  *     except Exception:
10016  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
10017  *
10018  * cdef inline int import_ufunc() except -1:
10019  */
10020       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
10021       __Pyx_GOTREF(__pyx_t_8);
10022       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10023       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10024       __PYX_ERR(2, 1044, __pyx_L5_except_error)
10025     }
10026     goto __pyx_L5_except_error;
10027     __pyx_L5_except_error:;
10028 
10029     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
10030  *
10031  * cdef inline int import_umath() except -1:
10032  *     try:             # <<<<<<<<<<<<<<
10033  *         _import_umath()
10034  *     except Exception:
10035  */
10036     __Pyx_XGIVEREF(__pyx_t_1);
10037     __Pyx_XGIVEREF(__pyx_t_2);
10038     __Pyx_XGIVEREF(__pyx_t_3);
10039     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10040     goto __pyx_L1_error;
10041     __pyx_L8_try_end:;
10042   }
10043 
10044   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
10045  *         raise ImportError("numpy.core.multiarray failed to import")
10046  *
10047  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
10048  *     try:
10049  *         _import_umath()
10050  */
10051 
10052   /* function exit code */
10053   __pyx_r = 0;
10054   goto __pyx_L0;
10055   __pyx_L1_error:;
10056   __Pyx_XDECREF(__pyx_t_5);
10057   __Pyx_XDECREF(__pyx_t_6);
10058   __Pyx_XDECREF(__pyx_t_7);
10059   __Pyx_XDECREF(__pyx_t_8);
10060   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
10061   __pyx_r = -1;
10062   __pyx_L0:;
10063   __Pyx_RefNannyFinishContext();
10064   return __pyx_r;
10065 }
10066 
10067 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
10068  *         raise ImportError("numpy.core.umath failed to import")
10069  *
10070  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
10071  *     try:
10072  *         _import_umath()
10073  */
10074 
__pyx_f_5numpy_import_ufunc(void)10075 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
10076   int __pyx_r;
10077   __Pyx_RefNannyDeclarations
10078   PyObject *__pyx_t_1 = NULL;
10079   PyObject *__pyx_t_2 = NULL;
10080   PyObject *__pyx_t_3 = NULL;
10081   int __pyx_t_4;
10082   PyObject *__pyx_t_5 = NULL;
10083   PyObject *__pyx_t_6 = NULL;
10084   PyObject *__pyx_t_7 = NULL;
10085   PyObject *__pyx_t_8 = NULL;
10086   __Pyx_RefNannySetupContext("import_ufunc", 0);
10087 
10088   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
10089  *
10090  * cdef inline int import_ufunc() except -1:
10091  *     try:             # <<<<<<<<<<<<<<
10092  *         _import_umath()
10093  *     except Exception:
10094  */
10095   {
10096     __Pyx_PyThreadState_declare
10097     __Pyx_PyThreadState_assign
10098     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10099     __Pyx_XGOTREF(__pyx_t_1);
10100     __Pyx_XGOTREF(__pyx_t_2);
10101     __Pyx_XGOTREF(__pyx_t_3);
10102     /*try:*/ {
10103 
10104       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
10105  * cdef inline int import_ufunc() except -1:
10106  *     try:
10107  *         _import_umath()             # <<<<<<<<<<<<<<
10108  *     except Exception:
10109  *         raise ImportError("numpy.core.umath failed to import")
10110  */
10111       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)
10112 
10113       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
10114  *
10115  * cdef inline int import_ufunc() except -1:
10116  *     try:             # <<<<<<<<<<<<<<
10117  *         _import_umath()
10118  *     except Exception:
10119  */
10120     }
10121     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10122     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10123     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10124     goto __pyx_L8_try_end;
10125     __pyx_L3_error:;
10126 
10127     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
10128  *     try:
10129  *         _import_umath()
10130  *     except Exception:             # <<<<<<<<<<<<<<
10131  *         raise ImportError("numpy.core.umath failed to import")
10132  */
10133     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10134     if (__pyx_t_4) {
10135       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
10136       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
10137       __Pyx_GOTREF(__pyx_t_5);
10138       __Pyx_GOTREF(__pyx_t_6);
10139       __Pyx_GOTREF(__pyx_t_7);
10140 
10141       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
10142  *         _import_umath()
10143  *     except Exception:
10144  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
10145  */
10146       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
10147       __Pyx_GOTREF(__pyx_t_8);
10148       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10149       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10150       __PYX_ERR(2, 1050, __pyx_L5_except_error)
10151     }
10152     goto __pyx_L5_except_error;
10153     __pyx_L5_except_error:;
10154 
10155     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
10156  *
10157  * cdef inline int import_ufunc() except -1:
10158  *     try:             # <<<<<<<<<<<<<<
10159  *         _import_umath()
10160  *     except Exception:
10161  */
10162     __Pyx_XGIVEREF(__pyx_t_1);
10163     __Pyx_XGIVEREF(__pyx_t_2);
10164     __Pyx_XGIVEREF(__pyx_t_3);
10165     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10166     goto __pyx_L1_error;
10167     __pyx_L8_try_end:;
10168   }
10169 
10170   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
10171  *         raise ImportError("numpy.core.umath failed to import")
10172  *
10173  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
10174  *     try:
10175  *         _import_umath()
10176  */
10177 
10178   /* function exit code */
10179   __pyx_r = 0;
10180   goto __pyx_L0;
10181   __pyx_L1_error:;
10182   __Pyx_XDECREF(__pyx_t_5);
10183   __Pyx_XDECREF(__pyx_t_6);
10184   __Pyx_XDECREF(__pyx_t_7);
10185   __Pyx_XDECREF(__pyx_t_8);
10186   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
10187   __pyx_r = -1;
10188   __pyx_L0:;
10189   __Pyx_RefNannyFinishContext();
10190   return __pyx_r;
10191 }
10192 
10193 /* "yt/utilities/lib/fp_utils.pxd":13
10194  *
10195  *
10196  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10197  *     if i0 > i1: return i0
10198  *     return i1
10199  */
10200 
__pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)10201 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) {
10202   __pyx_t_5numpy_int64_t __pyx_r;
10203   int __pyx_t_1;
10204 
10205   /* "yt/utilities/lib/fp_utils.pxd":14
10206  *
10207  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:
10208  *     if i0 > i1: return i0             # <<<<<<<<<<<<<<
10209  *     return i1
10210  *
10211  */
10212   __pyx_t_1 = ((__pyx_v_i0 > __pyx_v_i1) != 0);
10213   if (__pyx_t_1) {
10214     __pyx_r = __pyx_v_i0;
10215     goto __pyx_L0;
10216   }
10217 
10218   /* "yt/utilities/lib/fp_utils.pxd":15
10219  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:
10220  *     if i0 > i1: return i0
10221  *     return i1             # <<<<<<<<<<<<<<
10222  *
10223  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
10224  */
10225   __pyx_r = __pyx_v_i1;
10226   goto __pyx_L0;
10227 
10228   /* "yt/utilities/lib/fp_utils.pxd":13
10229  *
10230  *
10231  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10232  *     if i0 > i1: return i0
10233  *     return i1
10234  */
10235 
10236   /* function exit code */
10237   __pyx_L0:;
10238   return __pyx_r;
10239 }
10240 
10241 /* "yt/utilities/lib/fp_utils.pxd":17
10242  *     return i1
10243  *
10244  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
10245  *     if f0 > f1: return f0
10246  *     return f1
10247  */
10248 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)10249 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) {
10250   __pyx_t_5numpy_float64_t __pyx_r;
10251   int __pyx_t_1;
10252 
10253   /* "yt/utilities/lib/fp_utils.pxd":18
10254  *
10255  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
10256  *     if f0 > f1: return f0             # <<<<<<<<<<<<<<
10257  *     return f1
10258  *
10259  */
10260   __pyx_t_1 = ((__pyx_v_f0 > __pyx_v_f1) != 0);
10261   if (__pyx_t_1) {
10262     __pyx_r = __pyx_v_f0;
10263     goto __pyx_L0;
10264   }
10265 
10266   /* "yt/utilities/lib/fp_utils.pxd":19
10267  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
10268  *     if f0 > f1: return f0
10269  *     return f1             # <<<<<<<<<<<<<<
10270  *
10271  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
10272  */
10273   __pyx_r = __pyx_v_f1;
10274   goto __pyx_L0;
10275 
10276   /* "yt/utilities/lib/fp_utils.pxd":17
10277  *     return i1
10278  *
10279  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
10280  *     if f0 > f1: return f0
10281  *     return f1
10282  */
10283 
10284   /* function exit code */
10285   __pyx_L0:;
10286   return __pyx_r;
10287 }
10288 
10289 /* "yt/utilities/lib/fp_utils.pxd":21
10290  *     return f1
10291  *
10292  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10293  *     if i0 < i1: return i0
10294  *     return i1
10295  */
10296 
__pyx_f_2yt_9utilities_3lib_8fp_utils_imin(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)10297 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) {
10298   __pyx_t_5numpy_int64_t __pyx_r;
10299   int __pyx_t_1;
10300 
10301   /* "yt/utilities/lib/fp_utils.pxd":22
10302  *
10303  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
10304  *     if i0 < i1: return i0             # <<<<<<<<<<<<<<
10305  *     return i1
10306  *
10307  */
10308   __pyx_t_1 = ((__pyx_v_i0 < __pyx_v_i1) != 0);
10309   if (__pyx_t_1) {
10310     __pyx_r = __pyx_v_i0;
10311     goto __pyx_L0;
10312   }
10313 
10314   /* "yt/utilities/lib/fp_utils.pxd":23
10315  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
10316  *     if i0 < i1: return i0
10317  *     return i1             # <<<<<<<<<<<<<<
10318  *
10319  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
10320  */
10321   __pyx_r = __pyx_v_i1;
10322   goto __pyx_L0;
10323 
10324   /* "yt/utilities/lib/fp_utils.pxd":21
10325  *     return f1
10326  *
10327  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10328  *     if i0 < i1: return i0
10329  *     return i1
10330  */
10331 
10332   /* function exit code */
10333   __pyx_L0:;
10334   return __pyx_r;
10335 }
10336 
10337 /* "yt/utilities/lib/fp_utils.pxd":25
10338  *     return i1
10339  *
10340  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
10341  *     if f0 < f1: return f0
10342  *     return f1
10343  */
10344 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)10345 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) {
10346   __pyx_t_5numpy_float64_t __pyx_r;
10347   int __pyx_t_1;
10348 
10349   /* "yt/utilities/lib/fp_utils.pxd":26
10350  *
10351  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
10352  *     if f0 < f1: return f0             # <<<<<<<<<<<<<<
10353  *     return f1
10354  *
10355  */
10356   __pyx_t_1 = ((__pyx_v_f0 < __pyx_v_f1) != 0);
10357   if (__pyx_t_1) {
10358     __pyx_r = __pyx_v_f0;
10359     goto __pyx_L0;
10360   }
10361 
10362   /* "yt/utilities/lib/fp_utils.pxd":27
10363  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
10364  *     if f0 < f1: return f0
10365  *     return f1             # <<<<<<<<<<<<<<
10366  *
10367  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
10368  */
10369   __pyx_r = __pyx_v_f1;
10370   goto __pyx_L0;
10371 
10372   /* "yt/utilities/lib/fp_utils.pxd":25
10373  *     return i1
10374  *
10375  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
10376  *     if f0 < f1: return f0
10377  *     return f1
10378  */
10379 
10380   /* function exit code */
10381   __pyx_L0:;
10382   return __pyx_r;
10383 }
10384 
10385 /* "yt/utilities/lib/fp_utils.pxd":29
10386  *     return f1
10387  *
10388  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:             # <<<<<<<<<<<<<<
10389  *     if f0 < 0.0: return -f0
10390  *     return f0
10391  */
10392 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0)10393 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0) {
10394   __pyx_t_5numpy_float64_t __pyx_r;
10395   int __pyx_t_1;
10396 
10397   /* "yt/utilities/lib/fp_utils.pxd":30
10398  *
10399  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
10400  *     if f0 < 0.0: return -f0             # <<<<<<<<<<<<<<
10401  *     return f0
10402  *
10403  */
10404   __pyx_t_1 = ((__pyx_v_f0 < 0.0) != 0);
10405   if (__pyx_t_1) {
10406     __pyx_r = (-__pyx_v_f0);
10407     goto __pyx_L0;
10408   }
10409 
10410   /* "yt/utilities/lib/fp_utils.pxd":31
10411  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
10412  *     if f0 < 0.0: return -f0
10413  *     return f0             # <<<<<<<<<<<<<<
10414  *
10415  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
10416  */
10417   __pyx_r = __pyx_v_f0;
10418   goto __pyx_L0;
10419 
10420   /* "yt/utilities/lib/fp_utils.pxd":29
10421  *     return f1
10422  *
10423  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:             # <<<<<<<<<<<<<<
10424  *     if f0 < 0.0: return -f0
10425  *     return f0
10426  */
10427 
10428   /* function exit code */
10429   __pyx_L0:;
10430   return __pyx_r;
10431 }
10432 
10433 /* "yt/utilities/lib/fp_utils.pxd":33
10434  *     return f0
10435  *
10436  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
10437  *     if i < a: return a
10438  *     if i > b: return b
10439  */
10440 
__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)10441 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) {
10442   __pyx_t_5numpy_int64_t __pyx_r;
10443   int __pyx_t_1;
10444 
10445   /* "yt/utilities/lib/fp_utils.pxd":34
10446  *
10447  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
10448  *     if i < a: return a             # <<<<<<<<<<<<<<
10449  *     if i > b: return b
10450  *     return i
10451  */
10452   __pyx_t_1 = ((__pyx_v_i < __pyx_v_a) != 0);
10453   if (__pyx_t_1) {
10454     __pyx_r = __pyx_v_a;
10455     goto __pyx_L0;
10456   }
10457 
10458   /* "yt/utilities/lib/fp_utils.pxd":35
10459  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
10460  *     if i < a: return a
10461  *     if i > b: return b             # <<<<<<<<<<<<<<
10462  *     return i
10463  *
10464  */
10465   __pyx_t_1 = ((__pyx_v_i > __pyx_v_b) != 0);
10466   if (__pyx_t_1) {
10467     __pyx_r = __pyx_v_b;
10468     goto __pyx_L0;
10469   }
10470 
10471   /* "yt/utilities/lib/fp_utils.pxd":36
10472  *     if i < a: return a
10473  *     if i > b: return b
10474  *     return i             # <<<<<<<<<<<<<<
10475  *
10476  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
10477  */
10478   __pyx_r = __pyx_v_i;
10479   goto __pyx_L0;
10480 
10481   /* "yt/utilities/lib/fp_utils.pxd":33
10482  *     return f0
10483  *
10484  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
10485  *     if i < a: return a
10486  *     if i > b: return b
10487  */
10488 
10489   /* function exit code */
10490   __pyx_L0:;
10491   return __pyx_r;
10492 }
10493 
10494 /* "yt/utilities/lib/fp_utils.pxd":38
10495  *     return i
10496  *
10497  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
10498  *     if i < a: return a
10499  *     if i > b: return b
10500  */
10501 
__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)10502 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) {
10503   __pyx_t_5numpy_int64_t __pyx_r;
10504   int __pyx_t_1;
10505 
10506   /* "yt/utilities/lib/fp_utils.pxd":39
10507  *
10508  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
10509  *     if i < a: return a             # <<<<<<<<<<<<<<
10510  *     if i > b: return b
10511  *     return i
10512  */
10513   __pyx_t_1 = ((__pyx_v_i < __pyx_v_a) != 0);
10514   if (__pyx_t_1) {
10515     __pyx_r = __pyx_v_a;
10516     goto __pyx_L0;
10517   }
10518 
10519   /* "yt/utilities/lib/fp_utils.pxd":40
10520  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
10521  *     if i < a: return a
10522  *     if i > b: return b             # <<<<<<<<<<<<<<
10523  *     return i
10524  *
10525  */
10526   __pyx_t_1 = ((__pyx_v_i > __pyx_v_b) != 0);
10527   if (__pyx_t_1) {
10528     __pyx_r = __pyx_v_b;
10529     goto __pyx_L0;
10530   }
10531 
10532   /* "yt/utilities/lib/fp_utils.pxd":41
10533  *     if i < a: return a
10534  *     if i > b: return b
10535  *     return i             # <<<<<<<<<<<<<<
10536  *
10537  * cdef inline np.float64_t fclip(np.float64_t f,
10538  */
10539   __pyx_r = __pyx_v_i;
10540   goto __pyx_L0;
10541 
10542   /* "yt/utilities/lib/fp_utils.pxd":38
10543  *     return i
10544  *
10545  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
10546  *     if i < a: return a
10547  *     if i > b: return b
10548  */
10549 
10550   /* function exit code */
10551   __pyx_L0:;
10552   return __pyx_r;
10553 }
10554 
10555 /* "yt/utilities/lib/fp_utils.pxd":43
10556  *     return i
10557  *
10558  * cdef inline np.float64_t fclip(np.float64_t f,             # <<<<<<<<<<<<<<
10559  *                       np.float64_t a, np.float64_t b) nogil:
10560  *     return fmin(fmax(f, a), b)
10561  */
10562 
__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)10563 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) {
10564   __pyx_t_5numpy_float64_t __pyx_r;
10565 
10566   /* "yt/utilities/lib/fp_utils.pxd":45
10567  * cdef inline np.float64_t fclip(np.float64_t f,
10568  *                       np.float64_t a, np.float64_t b) nogil:
10569  *     return fmin(fmax(f, a), b)             # <<<<<<<<<<<<<<
10570  *
10571  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
10572  */
10573   __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);
10574   goto __pyx_L0;
10575 
10576   /* "yt/utilities/lib/fp_utils.pxd":43
10577  *     return i
10578  *
10579  * cdef inline np.float64_t fclip(np.float64_t f,             # <<<<<<<<<<<<<<
10580  *                       np.float64_t a, np.float64_t b) nogil:
10581  *     return fmin(fmax(f, a), b)
10582  */
10583 
10584   /* function exit code */
10585   __pyx_L0:;
10586   return __pyx_r;
10587 }
10588 
10589 /* "yt/utilities/lib/fp_utils.pxd":47
10590  *     return fmin(fmax(f, a), b)
10591  *
10592  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10593  *     if i0 > i1: return i0
10594  *     return i1
10595  */
10596 
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)10597 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) {
10598   __pyx_t_5numpy_int64_t __pyx_r;
10599   int __pyx_t_1;
10600 
10601   /* "yt/utilities/lib/fp_utils.pxd":48
10602  *
10603  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
10604  *     if i0 > i1: return i0             # <<<<<<<<<<<<<<
10605  *     return i1
10606  *
10607  */
10608   __pyx_t_1 = ((__pyx_v_i0 > __pyx_v_i1) != 0);
10609   if (__pyx_t_1) {
10610     __pyx_r = __pyx_v_i0;
10611     goto __pyx_L0;
10612   }
10613 
10614   /* "yt/utilities/lib/fp_utils.pxd":49
10615  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
10616  *     if i0 > i1: return i0
10617  *     return i1             # <<<<<<<<<<<<<<
10618  *
10619  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
10620  */
10621   __pyx_r = __pyx_v_i1;
10622   goto __pyx_L0;
10623 
10624   /* "yt/utilities/lib/fp_utils.pxd":47
10625  *     return fmin(fmax(f, a), b)
10626  *
10627  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10628  *     if i0 > i1: return i0
10629  *     return i1
10630  */
10631 
10632   /* function exit code */
10633   __pyx_L0:;
10634   return __pyx_r;
10635 }
10636 
10637 /* "yt/utilities/lib/fp_utils.pxd":51
10638  *     return i1
10639  *
10640  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10641  *     if i0 < i1: return i0
10642  *     return i1
10643  */
10644 
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)10645 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) {
10646   __pyx_t_5numpy_int64_t __pyx_r;
10647   int __pyx_t_1;
10648 
10649   /* "yt/utilities/lib/fp_utils.pxd":52
10650  *
10651  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
10652  *     if i0 < i1: return i0             # <<<<<<<<<<<<<<
10653  *     return i1
10654  *
10655  */
10656   __pyx_t_1 = ((__pyx_v_i0 < __pyx_v_i1) != 0);
10657   if (__pyx_t_1) {
10658     __pyx_r = __pyx_v_i0;
10659     goto __pyx_L0;
10660   }
10661 
10662   /* "yt/utilities/lib/fp_utils.pxd":53
10663  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
10664  *     if i0 < i1: return i0
10665  *     return i1             # <<<<<<<<<<<<<<
10666  *
10667  * cdef inline _ensure_code(arr):
10668  */
10669   __pyx_r = __pyx_v_i1;
10670   goto __pyx_L0;
10671 
10672   /* "yt/utilities/lib/fp_utils.pxd":51
10673  *     return i1
10674  *
10675  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
10676  *     if i0 < i1: return i0
10677  *     return i1
10678  */
10679 
10680   /* function exit code */
10681   __pyx_L0:;
10682   return __pyx_r;
10683 }
10684 
10685 /* "yt/utilities/lib/fp_utils.pxd":55
10686  *     return i1
10687  *
10688  * cdef inline _ensure_code(arr):             # <<<<<<<<<<<<<<
10689  *     if hasattr(arr, "units"):
10690  *         if "code_length" == str(arr.units):
10691  */
10692 
__pyx_f_2yt_9utilities_3lib_8fp_utils__ensure_code(PyObject * __pyx_v_arr)10693 static CYTHON_INLINE PyObject *__pyx_f_2yt_9utilities_3lib_8fp_utils__ensure_code(PyObject *__pyx_v_arr) {
10694   PyObject *__pyx_r = NULL;
10695   __Pyx_RefNannyDeclarations
10696   int __pyx_t_1;
10697   int __pyx_t_2;
10698   PyObject *__pyx_t_3 = NULL;
10699   PyObject *__pyx_t_4 = NULL;
10700   PyObject *__pyx_t_5 = NULL;
10701   __Pyx_RefNannySetupContext("_ensure_code", 0);
10702 
10703   /* "yt/utilities/lib/fp_utils.pxd":56
10704  *
10705  * cdef inline _ensure_code(arr):
10706  *     if hasattr(arr, "units"):             # <<<<<<<<<<<<<<
10707  *         if "code_length" == str(arr.units):
10708  *             return arr
10709  */
10710   __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)
10711   __pyx_t_2 = (__pyx_t_1 != 0);
10712   if (__pyx_t_2) {
10713 
10714     /* "yt/utilities/lib/fp_utils.pxd":57
10715  * cdef inline _ensure_code(arr):
10716  *     if hasattr(arr, "units"):
10717  *         if "code_length" == str(arr.units):             # <<<<<<<<<<<<<<
10718  *             return arr
10719  *         arr.convert_to_units("code_length")
10720  */
10721     __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)
10722     __Pyx_GOTREF(__pyx_t_3);
10723     __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 57, __pyx_L1_error)
10724     __Pyx_GOTREF(__pyx_t_4);
10725     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10726     __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)
10727     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10728     if (__pyx_t_2) {
10729 
10730       /* "yt/utilities/lib/fp_utils.pxd":58
10731  *     if hasattr(arr, "units"):
10732  *         if "code_length" == str(arr.units):
10733  *             return arr             # <<<<<<<<<<<<<<
10734  *         arr.convert_to_units("code_length")
10735  *     return arr
10736  */
10737       __Pyx_XDECREF(__pyx_r);
10738       __Pyx_INCREF(__pyx_v_arr);
10739       __pyx_r = __pyx_v_arr;
10740       goto __pyx_L0;
10741 
10742       /* "yt/utilities/lib/fp_utils.pxd":57
10743  * cdef inline _ensure_code(arr):
10744  *     if hasattr(arr, "units"):
10745  *         if "code_length" == str(arr.units):             # <<<<<<<<<<<<<<
10746  *             return arr
10747  *         arr.convert_to_units("code_length")
10748  */
10749     }
10750 
10751     /* "yt/utilities/lib/fp_utils.pxd":59
10752  *         if "code_length" == str(arr.units):
10753  *             return arr
10754  *         arr.convert_to_units("code_length")             # <<<<<<<<<<<<<<
10755  *     return arr
10756  */
10757     __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)
10758     __Pyx_GOTREF(__pyx_t_3);
10759     __pyx_t_5 = NULL;
10760     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
10761       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
10762       if (likely(__pyx_t_5)) {
10763         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10764         __Pyx_INCREF(__pyx_t_5);
10765         __Pyx_INCREF(function);
10766         __Pyx_DECREF_SET(__pyx_t_3, function);
10767       }
10768     }
10769     __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);
10770     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10771     if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 59, __pyx_L1_error)
10772     __Pyx_GOTREF(__pyx_t_4);
10773     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10774     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10775 
10776     /* "yt/utilities/lib/fp_utils.pxd":56
10777  *
10778  * cdef inline _ensure_code(arr):
10779  *     if hasattr(arr, "units"):             # <<<<<<<<<<<<<<
10780  *         if "code_length" == str(arr.units):
10781  *             return arr
10782  */
10783   }
10784 
10785   /* "yt/utilities/lib/fp_utils.pxd":60
10786  *             return arr
10787  *         arr.convert_to_units("code_length")
10788  *     return arr             # <<<<<<<<<<<<<<
10789  */
10790   __Pyx_XDECREF(__pyx_r);
10791   __Pyx_INCREF(__pyx_v_arr);
10792   __pyx_r = __pyx_v_arr;
10793   goto __pyx_L0;
10794 
10795   /* "yt/utilities/lib/fp_utils.pxd":55
10796  *     return i1
10797  *
10798  * cdef inline _ensure_code(arr):             # <<<<<<<<<<<<<<
10799  *     if hasattr(arr, "units"):
10800  *         if "code_length" == str(arr.units):
10801  */
10802 
10803   /* function exit code */
10804   __pyx_L1_error:;
10805   __Pyx_XDECREF(__pyx_t_3);
10806   __Pyx_XDECREF(__pyx_t_4);
10807   __Pyx_XDECREF(__pyx_t_5);
10808   __Pyx_AddTraceback("yt.utilities.lib.fp_utils._ensure_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
10809   __pyx_r = 0;
10810   __pyx_L0:;
10811   __Pyx_XGIVEREF(__pyx_r);
10812   __Pyx_RefNannyFinishContext();
10813   return __pyx_r;
10814 }
10815 static struct __pyx_vtabstruct_2yt_9utilities_3lib_12basic_octree_Octree __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree;
10816 
__pyx_tp_new_2yt_9utilities_3lib_12basic_octree_Octree(PyTypeObject * t,PyObject * a,PyObject * k)10817 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_12basic_octree_Octree(PyTypeObject *t, PyObject *a, PyObject *k) {
10818   struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *p;
10819   PyObject *o;
10820   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10821     o = (*t->tp_alloc)(t, 0);
10822   } else {
10823     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10824   }
10825   if (unlikely(!o)) return 0;
10826   p = ((struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *)o);
10827   p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_12basic_octree_Octree;
10828   if (unlikely(__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_1__cinit__(o, a, k) < 0)) goto bad;
10829   return o;
10830   bad:
10831   Py_DECREF(o); o = 0;
10832   return NULL;
10833 }
10834 
__pyx_tp_dealloc_2yt_9utilities_3lib_12basic_octree_Octree(PyObject * o)10835 static void __pyx_tp_dealloc_2yt_9utilities_3lib_12basic_octree_Octree(PyObject *o) {
10836   #if CYTHON_USE_TP_FINALIZE
10837   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))) {
10838     if (PyObject_CallFinalizerFromDealloc(o)) return;
10839   }
10840   #endif
10841   {
10842     PyObject *etype, *eval, *etb;
10843     PyErr_Fetch(&etype, &eval, &etb);
10844     ++Py_REFCNT(o);
10845     __pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_15__dealloc__(o);
10846     --Py_REFCNT(o);
10847     PyErr_Restore(etype, eval, etb);
10848   }
10849   (*Py_TYPE(o)->tp_free)(o);
10850 }
10851 
10852 static PyMethodDef __pyx_methods_2yt_9utilities_3lib_12basic_octree_Octree[] = {
10853   {"add_array_to_tree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_3add_array_to_tree, METH_VARARGS|METH_KEYWORDS, 0},
10854   {"add_grid_to_tree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_5add_grid_to_tree, METH_VARARGS|METH_KEYWORDS, 0},
10855   {"get_all_from_level", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_7get_all_from_level, METH_VARARGS|METH_KEYWORDS, 0},
10856   {"finalize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_9finalize, METH_VARARGS|METH_KEYWORDS, 0},
10857   {"find_binding_energy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_11find_binding_energy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_12basic_octree_6Octree_10find_binding_energy},
10858   {"print_all_nodes", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_13print_all_nodes, METH_NOARGS, __pyx_doc_2yt_9utilities_3lib_12basic_octree_6Octree_12print_all_nodes},
10859   {"__reduce_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_17__reduce_cython__, METH_NOARGS, 0},
10860   {"__setstate_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_12basic_octree_6Octree_19__setstate_cython__, METH_O, 0},
10861   {0, 0, 0, 0}
10862 };
10863 
10864 static PyTypeObject __pyx_type_2yt_9utilities_3lib_12basic_octree_Octree = {
10865   PyVarObject_HEAD_INIT(0, 0)
10866   "yt.utilities.lib.basic_octree.Octree", /*tp_name*/
10867   sizeof(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree), /*tp_basicsize*/
10868   0, /*tp_itemsize*/
10869   __pyx_tp_dealloc_2yt_9utilities_3lib_12basic_octree_Octree, /*tp_dealloc*/
10870   0, /*tp_print*/
10871   0, /*tp_getattr*/
10872   0, /*tp_setattr*/
10873   #if PY_MAJOR_VERSION < 3
10874   0, /*tp_compare*/
10875   #endif
10876   #if PY_MAJOR_VERSION >= 3
10877   0, /*tp_as_async*/
10878   #endif
10879   0, /*tp_repr*/
10880   0, /*tp_as_number*/
10881   0, /*tp_as_sequence*/
10882   0, /*tp_as_mapping*/
10883   0, /*tp_hash*/
10884   0, /*tp_call*/
10885   0, /*tp_str*/
10886   0, /*tp_getattro*/
10887   0, /*tp_setattro*/
10888   0, /*tp_as_buffer*/
10889   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10890   0, /*tp_doc*/
10891   0, /*tp_traverse*/
10892   0, /*tp_clear*/
10893   0, /*tp_richcompare*/
10894   0, /*tp_weaklistoffset*/
10895   0, /*tp_iter*/
10896   0, /*tp_iternext*/
10897   __pyx_methods_2yt_9utilities_3lib_12basic_octree_Octree, /*tp_methods*/
10898   0, /*tp_members*/
10899   0, /*tp_getset*/
10900   0, /*tp_base*/
10901   0, /*tp_dict*/
10902   0, /*tp_descr_get*/
10903   0, /*tp_descr_set*/
10904   0, /*tp_dictoffset*/
10905   0, /*tp_init*/
10906   0, /*tp_alloc*/
10907   __pyx_tp_new_2yt_9utilities_3lib_12basic_octree_Octree, /*tp_new*/
10908   0, /*tp_free*/
10909   0, /*tp_is_gc*/
10910   0, /*tp_bases*/
10911   0, /*tp_mro*/
10912   0, /*tp_cache*/
10913   0, /*tp_subclasses*/
10914   0, /*tp_weaklist*/
10915   0, /*tp_del*/
10916   0, /*tp_version_tag*/
10917   #if PY_VERSION_HEX >= 0x030400a1
10918   0, /*tp_finalize*/
10919   #endif
10920   #if PY_VERSION_HEX >= 0x030800b1
10921   0, /*tp_vectorcall*/
10922   #endif
10923 };
10924 
10925 static PyMethodDef __pyx_methods[] = {
10926   {0, 0, 0, 0}
10927 };
10928 
10929 #if PY_MAJOR_VERSION >= 3
10930 #if CYTHON_PEP489_MULTI_PHASE_INIT
10931 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
10932 static int __pyx_pymod_exec_basic_octree(PyObject* module); /*proto*/
10933 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
10934   {Py_mod_create, (void*)__pyx_pymod_create},
10935   {Py_mod_exec, (void*)__pyx_pymod_exec_basic_octree},
10936   {0, NULL}
10937 };
10938 #endif
10939 
10940 static struct PyModuleDef __pyx_moduledef = {
10941     PyModuleDef_HEAD_INIT,
10942     "basic_octree",
10943     __pyx_k_A_refine_by_two_AMR_specific_oc, /* m_doc */
10944   #if CYTHON_PEP489_MULTI_PHASE_INIT
10945     0, /* m_size */
10946   #else
10947     -1, /* m_size */
10948   #endif
10949     __pyx_methods /* m_methods */,
10950   #if CYTHON_PEP489_MULTI_PHASE_INIT
10951     __pyx_moduledef_slots, /* m_slots */
10952   #else
10953     NULL, /* m_reload */
10954   #endif
10955     NULL, /* m_traverse */
10956     NULL, /* m_clear */
10957     NULL /* m_free */
10958 };
10959 #endif
10960 #ifndef CYTHON_SMALL_CODE
10961 #if defined(__clang__)
10962     #define CYTHON_SMALL_CODE
10963 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
10964     #define CYTHON_SMALL_CODE __attribute__((cold))
10965 #else
10966     #define CYTHON_SMALL_CODE
10967 #endif
10968 #endif
10969 
10970 static __Pyx_StringTabEntry __pyx_string_tab[] = {
10971   {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
10972   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
10973   {&__pyx_kp_s_1_5e, __pyx_k_1_5e, sizeof(__pyx_k_1_5e), 0, 0, 1, 0},
10974   {&__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},
10975   {&__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},
10976   {&__pyx_kp_s_ID_next_up_n_level_x_y_z, __pyx_k_ID_next_up_n_level_x_y_z, sizeof(__pyx_k_ID_next_up_n_level_x_y_z), 0, 0, 1, 0},
10977   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
10978   {&__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},
10979   {&__pyx_n_s_Octree, __pyx_k_Octree, sizeof(__pyx_k_Octree), 0, 0, 1, 1},
10980   {&__pyx_kp_u_Octree_print_all_nodes_line_561, __pyx_k_Octree_print_all_nodes_line_561, sizeof(__pyx_k_Octree_print_all_nodes_line_561), 0, 1, 0, 0},
10981   {&__pyx_kp_u_Prints_out_information_about_al, __pyx_k_Prints_out_information_about_al, sizeof(__pyx_k_Prints_out_information_about_al), 0, 1, 0, 0},
10982   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
10983   {&__pyx_kp_s_Truncating, __pyx_k_Truncating, sizeof(__pyx_k_Truncating), 0, 0, 1, 0},
10984   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
10985   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
10986   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
10987   {&__pyx_n_s_cm, __pyx_k_cm, sizeof(__pyx_k_cm), 0, 0, 1, 1},
10988   {&__pyx_n_s_code_length, __pyx_k_code_length, sizeof(__pyx_k_code_length), 0, 0, 1, 1},
10989   {&__pyx_n_s_convert_to_units, __pyx_k_convert_to_units, sizeof(__pyx_k_convert_to_units), 0, 0, 1, 1},
10990   {&__pyx_n_s_count_only, __pyx_k_count_only, sizeof(__pyx_k_count_only), 0, 0, 1, 1},
10991   {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0},
10992   {&__pyx_kp_s_d_2, __pyx_k_d_2, sizeof(__pyx_k_d_2), 0, 0, 1, 0},
10993   {&__pyx_kp_s_d_d_d_d, __pyx_k_d_d_d_d, sizeof(__pyx_k_d_d_d_d), 0, 0, 1, 0},
10994   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
10995   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
10996   {&__pyx_kp_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 0},
10997   {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
10998   {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
10999   {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
11000   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
11001   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11002   {&__pyx_n_s_incremental, __pyx_k_incremental, sizeof(__pyx_k_incremental), 0, 0, 1, 1},
11003   {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
11004   {&__pyx_n_s_kinetic, __pyx_k_kinetic, sizeof(__pyx_k_kinetic), 0, 0, 1, 1},
11005   {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
11006   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11007   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
11008   {&__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},
11009   {&__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},
11010   {&__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},
11011   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
11012   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
11013   {&__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},
11014   {&__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},
11015   {&__pyx_n_s_nvals, __pyx_k_nvals, sizeof(__pyx_k_nvals), 0, 0, 1, 1},
11016   {&__pyx_n_s_opening_angle, __pyx_k_opening_angle, sizeof(__pyx_k_opening_angle), 0, 0, 1, 1},
11017   {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
11018   {&__pyx_n_s_pvals, __pyx_k_pvals, sizeof(__pyx_k_pvals), 0, 0, 1, 1},
11019   {&__pyx_n_s_pweight_vals, __pyx_k_pweight_vals, sizeof(__pyx_k_pweight_vals), 0, 0, 1, 1},
11020   {&__pyx_n_s_pxs, __pyx_k_pxs, sizeof(__pyx_k_pxs), 0, 0, 1, 1},
11021   {&__pyx_n_s_pys, __pyx_k_pys, sizeof(__pyx_k_pys), 0, 0, 1, 1},
11022   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
11023   {&__pyx_n_s_pzs, __pyx_k_pzs, sizeof(__pyx_k_pzs), 0, 0, 1, 1},
11024   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
11025   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
11026   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
11027   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
11028   {&__pyx_n_s_root_dx, __pyx_k_root_dx, sizeof(__pyx_k_root_dx), 0, 0, 1, 1},
11029   {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0},
11030   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
11031   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
11032   {&__pyx_n_s_start_index, __pyx_k_start_index, sizeof(__pyx_k_start_index), 0, 0, 1, 1},
11033   {&__pyx_n_s_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 0, 0, 1, 1},
11034   {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
11035   {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
11036   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11037   {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
11038   {&__pyx_n_s_top_grid_dims, __pyx_k_top_grid_dims, sizeof(__pyx_k_top_grid_dims), 0, 0, 1, 1},
11039   {&__pyx_n_s_treecode, __pyx_k_treecode, sizeof(__pyx_k_treecode), 0, 0, 1, 1},
11040   {&__pyx_n_s_truncate, __pyx_k_truncate, sizeof(__pyx_k_truncate), 0, 0, 1, 1},
11041   {&__pyx_n_s_units, __pyx_k_units, sizeof(__pyx_k_units), 0, 0, 1, 1},
11042   {&__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},
11043   {&__pyx_kp_s_val_d, __pyx_k_val_d, sizeof(__pyx_k_val_d), 0, 0, 1, 0},
11044   {&__pyx_kp_s_weight_child_parent_children, __pyx_k_weight_child_parent_children, sizeof(__pyx_k_weight_child_parent_children), 0, 0, 1, 0},
11045   {&__pyx_n_s_wvals, __pyx_k_wvals, sizeof(__pyx_k_wvals), 0, 0, 1, 1},
11046   {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
11047   {0, 0, 0, 0, 0, 0, 0}
11048 };
__Pyx_InitCachedBuiltins(void)11049 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
11050   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 53, __pyx_L1_error)
11051   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
11052   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 272, __pyx_L1_error)
11053   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 856, __pyx_L1_error)
11054   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
11055   return 0;
11056   __pyx_L1_error:;
11057   return -1;
11058 }
11059 
__Pyx_InitCachedConstants(void)11060 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
11061   __Pyx_RefNannyDeclarations
11062   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11063 
11064   /* "(tree fragment)":2
11065  * def __reduce_cython__(self):
11066  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11067  * def __setstate_cython__(self, __pyx_state):
11068  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11069  */
11070   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
11071   __Pyx_GOTREF(__pyx_tuple__2);
11072   __Pyx_GIVEREF(__pyx_tuple__2);
11073 
11074   /* "(tree fragment)":4
11075  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11076  * def __setstate_cython__(self, __pyx_state):
11077  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
11078  */
11079   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
11080   __Pyx_GOTREF(__pyx_tuple__3);
11081   __Pyx_GIVEREF(__pyx_tuple__3);
11082 
11083   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
11084  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
11085  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
11086  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
11087  *
11088  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11089  */
11090   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 272, __pyx_L1_error)
11091   __Pyx_GOTREF(__pyx_tuple__4);
11092   __Pyx_GIVEREF(__pyx_tuple__4);
11093 
11094   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
11095  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11096  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
11097  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
11098  *
11099  *             info.buf = PyArray_DATA(self)
11100  */
11101   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 276, __pyx_L1_error)
11102   __Pyx_GOTREF(__pyx_tuple__5);
11103   __Pyx_GIVEREF(__pyx_tuple__5);
11104 
11105   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
11106  *                 if ((descr.byteorder == c'>' and little_endian) or
11107  *                     (descr.byteorder == c'<' and not little_endian)):
11108  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
11109  *                 if   t == NPY_BYTE:        f = "b"
11110  *                 elif t == NPY_UBYTE:       f = "B"
11111  */
11112   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 306, __pyx_L1_error)
11113   __Pyx_GOTREF(__pyx_tuple__6);
11114   __Pyx_GIVEREF(__pyx_tuple__6);
11115 
11116   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
11117  *
11118  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
11119  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
11120  *
11121  *         if ((child.byteorder == c'>' and little_endian) or
11122  */
11123   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 856, __pyx_L1_error)
11124   __Pyx_GOTREF(__pyx_tuple__7);
11125   __Pyx_GIVEREF(__pyx_tuple__7);
11126 
11127   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
11128  *             t = child.type_num
11129  *             if end - f < 5:
11130  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
11131  *
11132  *             # Until ticket #99 is fixed, use integers to avoid warnings
11133  */
11134   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 880, __pyx_L1_error)
11135   __Pyx_GOTREF(__pyx_tuple__8);
11136   __Pyx_GIVEREF(__pyx_tuple__8);
11137 
11138   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
11139  *         _import_array()
11140  *     except Exception:
11141  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
11142  *
11143  * cdef inline int import_umath() except -1:
11144  */
11145   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 1038, __pyx_L1_error)
11146   __Pyx_GOTREF(__pyx_tuple__9);
11147   __Pyx_GIVEREF(__pyx_tuple__9);
11148 
11149   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
11150  *         _import_umath()
11151  *     except Exception:
11152  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
11153  *
11154  * cdef inline int import_ufunc() except -1:
11155  */
11156   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 1044, __pyx_L1_error)
11157   __Pyx_GOTREF(__pyx_tuple__10);
11158   __Pyx_GIVEREF(__pyx_tuple__10);
11159   __Pyx_RefNannyFinishContext();
11160   return 0;
11161   __pyx_L1_error:;
11162   __Pyx_RefNannyFinishContext();
11163   return -1;
11164 }
11165 
__Pyx_InitGlobals(void)11166 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
11167   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
11168   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 2, __pyx_L1_error)
11169   return 0;
11170   __pyx_L1_error:;
11171   return -1;
11172 }
11173 
11174 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
11175 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
11176 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
11177 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
11178 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
11179 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
11180 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
11181 
__Pyx_modinit_global_init_code(void)11182 static int __Pyx_modinit_global_init_code(void) {
11183   __Pyx_RefNannyDeclarations
11184   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
11185   /*--- Global init code ---*/
11186   __Pyx_RefNannyFinishContext();
11187   return 0;
11188 }
11189 
__Pyx_modinit_variable_export_code(void)11190 static int __Pyx_modinit_variable_export_code(void) {
11191   __Pyx_RefNannyDeclarations
11192   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
11193   /*--- Variable export code ---*/
11194   __Pyx_RefNannyFinishContext();
11195   return 0;
11196 }
11197 
__Pyx_modinit_function_export_code(void)11198 static int __Pyx_modinit_function_export_code(void) {
11199   __Pyx_RefNannyDeclarations
11200   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
11201   /*--- Function export code ---*/
11202   __Pyx_RefNannyFinishContext();
11203   return 0;
11204 }
11205 
__Pyx_modinit_type_init_code(void)11206 static int __Pyx_modinit_type_init_code(void) {
11207   __Pyx_RefNannyDeclarations
11208   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
11209   /*--- Type init code ---*/
11210   __pyx_vtabptr_2yt_9utilities_3lib_12basic_octree_Octree = &__pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree;
11211   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.add_to_position = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, int, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t, PyObject *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_add_to_position;
11212   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.find_on_root_level = (struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *(*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, __pyx_t_5numpy_int64_t *, int))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_find_on_root_level;
11213   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.count_at_level = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, int))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_count_at_level;
11214   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.fill_from_level = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fill_from_level;
11215   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.fbe_node_separation = (__pyx_t_5numpy_float64_t (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_node_separation;
11216   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.fbe_opening_angle = (__pyx_t_5numpy_float64_t (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_opening_angle;
11217   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.set_next = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *, int))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_next;
11218   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.set_up_next = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_set_up_next;
11219   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.fbe_main = (__pyx_t_5numpy_float64_t (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, __pyx_t_5numpy_float64_t, int, __pyx_t_5numpy_float64_t))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_fbe_main;
11220   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.node_ID = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID;
11221   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.node_ID_on_level = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_node_ID_on_level;
11222   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.print_node_info = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_print_node_info;
11223   __pyx_vtable_2yt_9utilities_3lib_12basic_octree_Octree.iterate_print_nodes = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_12basic_octree_Octree *, struct __pyx_t_2yt_9utilities_3lib_12basic_octree_OctreeNode *))__pyx_f_2yt_9utilities_3lib_12basic_octree_6Octree_iterate_print_nodes;
11224   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_12basic_octree_Octree) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
11225   #if PY_VERSION_HEX < 0x030800B1
11226   __pyx_type_2yt_9utilities_3lib_12basic_octree_Octree.tp_print = 0;
11227   #endif
11228   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_12basic_octree_Octree.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_12basic_octree_Octree.tp_getattro == PyObject_GenericGetAttr)) {
11229     __pyx_type_2yt_9utilities_3lib_12basic_octree_Octree.tp_getattro = __Pyx_PyObject_GenericGetAttr;
11230   }
11231   if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_12basic_octree_Octree.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_12basic_octree_Octree) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
11232   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Octree, (PyObject *)&__pyx_type_2yt_9utilities_3lib_12basic_octree_Octree) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
11233   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2yt_9utilities_3lib_12basic_octree_Octree) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
11234   __pyx_ptype_2yt_9utilities_3lib_12basic_octree_Octree = &__pyx_type_2yt_9utilities_3lib_12basic_octree_Octree;
11235   __Pyx_RefNannyFinishContext();
11236   return 0;
11237   __pyx_L1_error:;
11238   __Pyx_RefNannyFinishContext();
11239   return -1;
11240 }
11241 
__Pyx_modinit_type_import_code(void)11242 static int __Pyx_modinit_type_import_code(void) {
11243   __Pyx_RefNannyDeclarations
11244   PyObject *__pyx_t_1 = NULL;
11245   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
11246   /*--- Type import code ---*/
11247   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
11248   __Pyx_GOTREF(__pyx_t_1);
11249   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
11250   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
11251   sizeof(PyTypeObject),
11252   #else
11253   sizeof(PyHeapTypeObject),
11254   #endif
11255   __Pyx_ImportType_CheckSize_Warn);
11256    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error)
11257   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11258   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
11259   __Pyx_GOTREF(__pyx_t_1);
11260   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
11261    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
11262   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
11263    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
11264   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
11265    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
11266   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
11267    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
11268   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
11269    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
11270   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11271   __Pyx_RefNannyFinishContext();
11272   return 0;
11273   __pyx_L1_error:;
11274   __Pyx_XDECREF(__pyx_t_1);
11275   __Pyx_RefNannyFinishContext();
11276   return -1;
11277 }
11278 
__Pyx_modinit_variable_import_code(void)11279 static int __Pyx_modinit_variable_import_code(void) {
11280   __Pyx_RefNannyDeclarations
11281   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
11282   /*--- Variable import code ---*/
11283   __Pyx_RefNannyFinishContext();
11284   return 0;
11285 }
11286 
__Pyx_modinit_function_import_code(void)11287 static int __Pyx_modinit_function_import_code(void) {
11288   __Pyx_RefNannyDeclarations
11289   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
11290   /*--- Function import code ---*/
11291   __Pyx_RefNannyFinishContext();
11292   return 0;
11293 }
11294 
11295 
11296 #if PY_MAJOR_VERSION < 3
11297 #ifdef CYTHON_NO_PYINIT_EXPORT
11298 #define __Pyx_PyMODINIT_FUNC void
11299 #else
11300 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
11301 #endif
11302 #else
11303 #ifdef CYTHON_NO_PYINIT_EXPORT
11304 #define __Pyx_PyMODINIT_FUNC PyObject *
11305 #else
11306 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
11307 #endif
11308 #endif
11309 
11310 
11311 #if PY_MAJOR_VERSION < 3
11312 __Pyx_PyMODINIT_FUNC initbasic_octree(void) CYTHON_SMALL_CODE; /*proto*/
initbasic_octree(void)11313 __Pyx_PyMODINIT_FUNC initbasic_octree(void)
11314 #else
11315 __Pyx_PyMODINIT_FUNC PyInit_basic_octree(void) CYTHON_SMALL_CODE; /*proto*/
11316 __Pyx_PyMODINIT_FUNC PyInit_basic_octree(void)
11317 #if CYTHON_PEP489_MULTI_PHASE_INIT
11318 {
11319   return PyModuleDef_Init(&__pyx_moduledef);
11320 }
11321 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
11322     #if PY_VERSION_HEX >= 0x030700A1
11323     static PY_INT64_T main_interpreter_id = -1;
11324     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
11325     if (main_interpreter_id == -1) {
11326         main_interpreter_id = current_id;
11327         return (unlikely(current_id == -1)) ? -1 : 0;
11328     } else if (unlikely(main_interpreter_id != current_id))
11329     #else
11330     static PyInterpreterState *main_interpreter = NULL;
11331     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
11332     if (!main_interpreter) {
11333         main_interpreter = current_interpreter;
11334     } else if (unlikely(main_interpreter != current_interpreter))
11335     #endif
11336     {
11337         PyErr_SetString(
11338             PyExc_ImportError,
11339             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
11340         return -1;
11341     }
11342     return 0;
11343 }
11344 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) {
11345     PyObject *value = PyObject_GetAttrString(spec, from_name);
11346     int result = 0;
11347     if (likely(value)) {
11348         if (allow_none || value != Py_None) {
11349             result = PyDict_SetItemString(moddict, to_name, value);
11350         }
11351         Py_DECREF(value);
11352     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
11353         PyErr_Clear();
11354     } else {
11355         result = -1;
11356     }
11357     return result;
11358 }
11359 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
11360     PyObject *module = NULL, *moddict, *modname;
11361     if (__Pyx_check_single_interpreter())
11362         return NULL;
11363     if (__pyx_m)
11364         return __Pyx_NewRef(__pyx_m);
11365     modname = PyObject_GetAttrString(spec, "name");
11366     if (unlikely(!modname)) goto bad;
11367     module = PyModule_NewObject(modname);
11368     Py_DECREF(modname);
11369     if (unlikely(!module)) goto bad;
11370     moddict = PyModule_GetDict(module);
11371     if (unlikely(!moddict)) goto bad;
11372     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
11373     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
11374     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
11375     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
11376     return module;
11377 bad:
11378     Py_XDECREF(module);
11379     return NULL;
11380 }
11381 
11382 
11383 static CYTHON_SMALL_CODE int __pyx_pymod_exec_basic_octree(PyObject *__pyx_pyinit_module)
11384 #endif
11385 #endif
11386 {
11387   PyObject *__pyx_t_1 = NULL;
11388   __Pyx_RefNannyDeclarations
11389   #if CYTHON_PEP489_MULTI_PHASE_INIT
11390   if (__pyx_m) {
11391     if (__pyx_m == __pyx_pyinit_module) return 0;
11392     PyErr_SetString(PyExc_RuntimeError, "Module 'basic_octree' has already been imported. Re-initialisation is not supported.");
11393     return -1;
11394   }
11395   #elif PY_MAJOR_VERSION >= 3
11396   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
11397   #endif
11398   #if CYTHON_REFNANNY
11399 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
11400 if (!__Pyx_RefNanny) {
11401   PyErr_Clear();
11402   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
11403   if (!__Pyx_RefNanny)
11404       Py_FatalError("failed to import 'refnanny' module");
11405 }
11406 #endif
11407   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_basic_octree(void)", 0);
11408   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11409   #ifdef __Pxy_PyFrame_Initialize_Offsets
11410   __Pxy_PyFrame_Initialize_Offsets();
11411   #endif
11412   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
11413   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
11414   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
11415   #ifdef __Pyx_CyFunction_USED
11416   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11417   #endif
11418   #ifdef __Pyx_FusedFunction_USED
11419   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11420   #endif
11421   #ifdef __Pyx_Coroutine_USED
11422   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11423   #endif
11424   #ifdef __Pyx_Generator_USED
11425   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11426   #endif
11427   #ifdef __Pyx_AsyncGen_USED
11428   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11429   #endif
11430   #ifdef __Pyx_StopAsyncIteration_USED
11431   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11432   #endif
11433   /*--- Library function declarations ---*/
11434   /*--- Threads initialization code ---*/
11435   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
11436   #ifdef WITH_THREAD /* Python build with threading support? */
11437   PyEval_InitThreads();
11438   #endif
11439   #endif
11440   /*--- Module creation code ---*/
11441   #if CYTHON_PEP489_MULTI_PHASE_INIT
11442   __pyx_m = __pyx_pyinit_module;
11443   Py_INCREF(__pyx_m);
11444   #else
11445   #if PY_MAJOR_VERSION < 3
11446   __pyx_m = Py_InitModule4("basic_octree", __pyx_methods, __pyx_k_A_refine_by_two_AMR_specific_oc, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
11447   #else
11448   __pyx_m = PyModule_Create(&__pyx_moduledef);
11449   #endif
11450   if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
11451   #endif
11452   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
11453   Py_INCREF(__pyx_d);
11454   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
11455   Py_INCREF(__pyx_b);
11456   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
11457   Py_INCREF(__pyx_cython_runtime);
11458   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
11459   /*--- Initialize various global constants etc. ---*/
11460   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11461   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
11462   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11463   #endif
11464   if (__pyx_module_is_main_yt__utilities__lib__basic_octree) {
11465     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11466   }
11467   #if PY_MAJOR_VERSION >= 3
11468   {
11469     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
11470     if (!PyDict_GetItemString(modules, "yt.utilities.lib.basic_octree")) {
11471       if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.basic_octree", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
11472     }
11473   }
11474   #endif
11475   /*--- Builtin init code ---*/
11476   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
11477   /*--- Constants init code ---*/
11478   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
11479   /*--- Global type/function init code ---*/
11480   (void)__Pyx_modinit_global_init_code();
11481   (void)__Pyx_modinit_variable_export_code();
11482   (void)__Pyx_modinit_function_export_code();
11483   if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
11484   if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
11485   (void)__Pyx_modinit_variable_import_code();
11486   (void)__Pyx_modinit_function_import_code();
11487   /*--- Execution code ---*/
11488   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
11489   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11490   #endif
11491 
11492   /* "yt/utilities/lib/basic_octree.pyx":12
11493  *
11494  *
11495  * import numpy as np             # <<<<<<<<<<<<<<
11496  *
11497  * cimport cython
11498  */
11499   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
11500   __Pyx_GOTREF(__pyx_t_1);
11501   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
11502   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11503 
11504   /* "yt/utilities/lib/basic_octree.pyx":23
11505  * from yt.utilities.lib.fp_utils cimport fclip, fmax, fmin, iclip, imax, imin
11506  *
11507  * import sys             # <<<<<<<<<<<<<<
11508  * import time
11509  *
11510  */
11511   __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
11512   __Pyx_GOTREF(__pyx_t_1);
11513   if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
11514   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11515 
11516   /* "yt/utilities/lib/basic_octree.pyx":24
11517  *
11518  * import sys
11519  * import time             # <<<<<<<<<<<<<<
11520  *
11521  *
11522  */
11523   __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
11524   __Pyx_GOTREF(__pyx_t_1);
11525   if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
11526   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11527 
11528   /* "yt/utilities/lib/basic_octree.pyx":2
11529  *
11530  * # distutils: libraries = STD_LIBS             # <<<<<<<<<<<<<<
11531  * """
11532  * A refine-by-two AMR-specific octree
11533  */
11534   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
11535   __Pyx_GOTREF(__pyx_t_1);
11536   if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_Octree_print_all_nodes_line_561, __pyx_kp_u_Prints_out_information_about_al) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11537   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
11538   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11539 
11540   /* "yt/utilities/lib/fp_utils.pxd":55
11541  *     return i1
11542  *
11543  * cdef inline _ensure_code(arr):             # <<<<<<<<<<<<<<
11544  *     if hasattr(arr, "units"):
11545  *         if "code_length" == str(arr.units):
11546  */
11547 
11548   /*--- Wrapped vars code ---*/
11549 
11550   goto __pyx_L0;
11551   __pyx_L1_error:;
11552   __Pyx_XDECREF(__pyx_t_1);
11553   if (__pyx_m) {
11554     if (__pyx_d) {
11555       __Pyx_AddTraceback("init yt.utilities.lib.basic_octree", __pyx_clineno, __pyx_lineno, __pyx_filename);
11556     }
11557     Py_CLEAR(__pyx_m);
11558   } else if (!PyErr_Occurred()) {
11559     PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.basic_octree");
11560   }
11561   __pyx_L0:;
11562   __Pyx_RefNannyFinishContext();
11563   #if CYTHON_PEP489_MULTI_PHASE_INIT
11564   return (__pyx_m != NULL) ? 0 : -1;
11565   #elif PY_MAJOR_VERSION >= 3
11566   return __pyx_m;
11567   #else
11568   return;
11569   #endif
11570 }
11571 
11572 /* --- Runtime support code --- */
11573 /* Refnanny */
11574 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)11575 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
11576     PyObject *m = NULL, *p = NULL;
11577     void *r = NULL;
11578     m = PyImport_ImportModule(modname);
11579     if (!m) goto end;
11580     p = PyObject_GetAttrString(m, "RefNannyAPI");
11581     if (!p) goto end;
11582     r = PyLong_AsVoidPtr(p);
11583 end:
11584     Py_XDECREF(p);
11585     Py_XDECREF(m);
11586     return (__Pyx_RefNannyAPIStruct *)r;
11587 }
11588 #endif
11589 
11590 /* PyObjectGetAttrStr */
11591 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)11592 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
11593     PyTypeObject* tp = Py_TYPE(obj);
11594     if (likely(tp->tp_getattro))
11595         return tp->tp_getattro(obj, attr_name);
11596 #if PY_MAJOR_VERSION < 3
11597     if (likely(tp->tp_getattr))
11598         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
11599 #endif
11600     return PyObject_GetAttr(obj, attr_name);
11601 }
11602 #endif
11603 
11604 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)11605 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
11606     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
11607     if (unlikely(!result)) {
11608         PyErr_Format(PyExc_NameError,
11609 #if PY_MAJOR_VERSION >= 3
11610             "name '%U' is not defined", name);
11611 #else
11612             "name '%.200s' is not defined", PyString_AS_STRING(name));
11613 #endif
11614     }
11615     return result;
11616 }
11617 
11618 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)11619 static void __Pyx_RaiseArgtupleInvalid(
11620     const char* func_name,
11621     int exact,
11622     Py_ssize_t num_min,
11623     Py_ssize_t num_max,
11624     Py_ssize_t num_found)
11625 {
11626     Py_ssize_t num_expected;
11627     const char *more_or_less;
11628     if (num_found < num_min) {
11629         num_expected = num_min;
11630         more_or_less = "at least";
11631     } else {
11632         num_expected = num_max;
11633         more_or_less = "at most";
11634     }
11635     if (exact) {
11636         more_or_less = "exactly";
11637     }
11638     PyErr_Format(PyExc_TypeError,
11639                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
11640                  func_name, more_or_less, num_expected,
11641                  (num_expected == 1) ? "" : "s", num_found);
11642 }
11643 
11644 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)11645 static void __Pyx_RaiseDoubleKeywordsError(
11646     const char* func_name,
11647     PyObject* kw_name)
11648 {
11649     PyErr_Format(PyExc_TypeError,
11650         #if PY_MAJOR_VERSION >= 3
11651         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
11652         #else
11653         "%s() got multiple values for keyword argument '%s'", func_name,
11654         PyString_AsString(kw_name));
11655         #endif
11656 }
11657 
11658 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)11659 static int __Pyx_ParseOptionalKeywords(
11660     PyObject *kwds,
11661     PyObject **argnames[],
11662     PyObject *kwds2,
11663     PyObject *values[],
11664     Py_ssize_t num_pos_args,
11665     const char* function_name)
11666 {
11667     PyObject *key = 0, *value = 0;
11668     Py_ssize_t pos = 0;
11669     PyObject*** name;
11670     PyObject*** first_kw_arg = argnames + num_pos_args;
11671     while (PyDict_Next(kwds, &pos, &key, &value)) {
11672         name = first_kw_arg;
11673         while (*name && (**name != key)) name++;
11674         if (*name) {
11675             values[name-argnames] = value;
11676             continue;
11677         }
11678         name = first_kw_arg;
11679         #if PY_MAJOR_VERSION < 3
11680         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
11681             while (*name) {
11682                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
11683                         && _PyString_Eq(**name, key)) {
11684                     values[name-argnames] = value;
11685                     break;
11686                 }
11687                 name++;
11688             }
11689             if (*name) continue;
11690             else {
11691                 PyObject*** argname = argnames;
11692                 while (argname != first_kw_arg) {
11693                     if ((**argname == key) || (
11694                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
11695                              && _PyString_Eq(**argname, key))) {
11696                         goto arg_passed_twice;
11697                     }
11698                     argname++;
11699                 }
11700             }
11701         } else
11702         #endif
11703         if (likely(PyUnicode_Check(key))) {
11704             while (*name) {
11705                 int cmp = (**name == key) ? 0 :
11706                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11707                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
11708                 #endif
11709                     PyUnicode_Compare(**name, key);
11710                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11711                 if (cmp == 0) {
11712                     values[name-argnames] = value;
11713                     break;
11714                 }
11715                 name++;
11716             }
11717             if (*name) continue;
11718             else {
11719                 PyObject*** argname = argnames;
11720                 while (argname != first_kw_arg) {
11721                     int cmp = (**argname == key) ? 0 :
11722                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
11723                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
11724                     #endif
11725                         PyUnicode_Compare(**argname, key);
11726                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
11727                     if (cmp == 0) goto arg_passed_twice;
11728                     argname++;
11729                 }
11730             }
11731         } else
11732             goto invalid_keyword_type;
11733         if (kwds2) {
11734             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
11735         } else {
11736             goto invalid_keyword;
11737         }
11738     }
11739     return 0;
11740 arg_passed_twice:
11741     __Pyx_RaiseDoubleKeywordsError(function_name, key);
11742     goto bad;
11743 invalid_keyword_type:
11744     PyErr_Format(PyExc_TypeError,
11745         "%.200s() keywords must be strings", function_name);
11746     goto bad;
11747 invalid_keyword:
11748     PyErr_Format(PyExc_TypeError,
11749     #if PY_MAJOR_VERSION < 3
11750         "%.200s() got an unexpected keyword argument '%.200s'",
11751         function_name, PyString_AsString(key));
11752     #else
11753         "%s() got an unexpected keyword argument '%U'",
11754         function_name, key);
11755     #endif
11756 bad:
11757     return -1;
11758 }
11759 
11760 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)11761 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
11762 {
11763     if (unlikely(!type)) {
11764         PyErr_SetString(PyExc_SystemError, "Missing type object");
11765         return 0;
11766     }
11767     else if (exact) {
11768         #if PY_MAJOR_VERSION == 2
11769         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
11770         #endif
11771     }
11772     else {
11773         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
11774     }
11775     PyErr_Format(PyExc_TypeError,
11776         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
11777         name, type->tp_name, Py_TYPE(obj)->tp_name);
11778     return 0;
11779 }
11780 
11781 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)11782 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
11783 {
11784   union {
11785     uint32_t u32;
11786     uint8_t u8[4];
11787   } S;
11788   S.u32 = 0x01020304;
11789   return S.u8[0] == 4;
11790 }
11791 
11792 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)11793 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
11794                               __Pyx_BufFmt_StackElem* stack,
11795                               __Pyx_TypeInfo* type) {
11796   stack[0].field = &ctx->root;
11797   stack[0].parent_offset = 0;
11798   ctx->root.type = type;
11799   ctx->root.name = "buffer dtype";
11800   ctx->root.offset = 0;
11801   ctx->head = stack;
11802   ctx->head->field = &ctx->root;
11803   ctx->fmt_offset = 0;
11804   ctx->head->parent_offset = 0;
11805   ctx->new_packmode = '@';
11806   ctx->enc_packmode = '@';
11807   ctx->new_count = 1;
11808   ctx->enc_count = 0;
11809   ctx->enc_type = 0;
11810   ctx->is_complex = 0;
11811   ctx->is_valid_array = 0;
11812   ctx->struct_alignment = 0;
11813   while (type->typegroup == 'S') {
11814     ++ctx->head;
11815     ctx->head->field = type->fields;
11816     ctx->head->parent_offset = 0;
11817     type = type->fields->type;
11818   }
11819 }
__Pyx_BufFmt_ParseNumber(const char ** ts)11820 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
11821     int count;
11822     const char* t = *ts;
11823     if (*t < '0' || *t > '9') {
11824       return -1;
11825     } else {
11826         count = *t++ - '0';
11827         while (*t >= '0' && *t <= '9') {
11828             count *= 10;
11829             count += *t++ - '0';
11830         }
11831     }
11832     *ts = t;
11833     return count;
11834 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)11835 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
11836     int number = __Pyx_BufFmt_ParseNumber(ts);
11837     if (number == -1)
11838         PyErr_Format(PyExc_ValueError,\
11839                      "Does not understand character buffer dtype format string ('%c')", **ts);
11840     return number;
11841 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)11842 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
11843   PyErr_Format(PyExc_ValueError,
11844                "Unexpected format string character: '%c'", ch);
11845 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)11846 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
11847   switch (ch) {
11848     case 'c': return "'char'";
11849     case 'b': return "'signed char'";
11850     case 'B': return "'unsigned char'";
11851     case 'h': return "'short'";
11852     case 'H': return "'unsigned short'";
11853     case 'i': return "'int'";
11854     case 'I': return "'unsigned int'";
11855     case 'l': return "'long'";
11856     case 'L': return "'unsigned long'";
11857     case 'q': return "'long long'";
11858     case 'Q': return "'unsigned long long'";
11859     case 'f': return (is_complex ? "'complex float'" : "'float'");
11860     case 'd': return (is_complex ? "'complex double'" : "'double'");
11861     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
11862     case 'T': return "a struct";
11863     case 'O': return "Python object";
11864     case 'P': return "a pointer";
11865     case 's': case 'p': return "a string";
11866     case 0: return "end";
11867     default: return "unparseable format string";
11868   }
11869 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)11870 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
11871   switch (ch) {
11872     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
11873     case 'h': case 'H': return 2;
11874     case 'i': case 'I': case 'l': case 'L': return 4;
11875     case 'q': case 'Q': return 8;
11876     case 'f': return (is_complex ? 8 : 4);
11877     case 'd': return (is_complex ? 16 : 8);
11878     case 'g': {
11879       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
11880       return 0;
11881     }
11882     case 'O': case 'P': return sizeof(void*);
11883     default:
11884       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
11885       return 0;
11886     }
11887 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)11888 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
11889   switch (ch) {
11890     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
11891     case 'h': case 'H': return sizeof(short);
11892     case 'i': case 'I': return sizeof(int);
11893     case 'l': case 'L': return sizeof(long);
11894     #ifdef HAVE_LONG_LONG
11895     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
11896     #endif
11897     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
11898     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
11899     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
11900     case 'O': case 'P': return sizeof(void*);
11901     default: {
11902       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
11903       return 0;
11904     }
11905   }
11906 }
11907 typedef struct { char c; short x; } __Pyx_st_short;
11908 typedef struct { char c; int x; } __Pyx_st_int;
11909 typedef struct { char c; long x; } __Pyx_st_long;
11910 typedef struct { char c; float x; } __Pyx_st_float;
11911 typedef struct { char c; double x; } __Pyx_st_double;
11912 typedef struct { char c; long double x; } __Pyx_st_longdouble;
11913 typedef struct { char c; void *x; } __Pyx_st_void_p;
11914 #ifdef HAVE_LONG_LONG
11915 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
11916 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)11917 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
11918   switch (ch) {
11919     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
11920     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
11921     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
11922     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
11923 #ifdef HAVE_LONG_LONG
11924     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
11925 #endif
11926     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
11927     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
11928     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
11929     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
11930     default:
11931       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
11932       return 0;
11933     }
11934 }
11935 /* These are for computing the padding at the end of the struct to align
11936    on the first member of the struct. This will probably the same as above,
11937    but we don't have any guarantees.
11938  */
11939 typedef struct { short x; char c; } __Pyx_pad_short;
11940 typedef struct { int x; char c; } __Pyx_pad_int;
11941 typedef struct { long x; char c; } __Pyx_pad_long;
11942 typedef struct { float x; char c; } __Pyx_pad_float;
11943 typedef struct { double x; char c; } __Pyx_pad_double;
11944 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
11945 typedef struct { void *x; char c; } __Pyx_pad_void_p;
11946 #ifdef HAVE_LONG_LONG
11947 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
11948 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)11949 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
11950   switch (ch) {
11951     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
11952     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
11953     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
11954     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
11955 #ifdef HAVE_LONG_LONG
11956     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
11957 #endif
11958     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
11959     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
11960     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
11961     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
11962     default:
11963       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
11964       return 0;
11965     }
11966 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)11967 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
11968   switch (ch) {
11969     case 'c':
11970         return 'H';
11971     case 'b': case 'h': case 'i':
11972     case 'l': case 'q': case 's': case 'p':
11973         return 'I';
11974     case 'B': case 'H': case 'I': case 'L': case 'Q':
11975         return 'U';
11976     case 'f': case 'd': case 'g':
11977         return (is_complex ? 'C' : 'R');
11978     case 'O':
11979         return 'O';
11980     case 'P':
11981         return 'P';
11982     default: {
11983       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
11984       return 0;
11985     }
11986   }
11987 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)11988 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
11989   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
11990     const char* expected;
11991     const char* quote;
11992     if (ctx->head == NULL) {
11993       expected = "end";
11994       quote = "";
11995     } else {
11996       expected = ctx->head->field->type->name;
11997       quote = "'";
11998     }
11999     PyErr_Format(PyExc_ValueError,
12000                  "Buffer dtype mismatch, expected %s%s%s but got %s",
12001                  quote, expected, quote,
12002                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
12003   } else {
12004     __Pyx_StructField* field = ctx->head->field;
12005     __Pyx_StructField* parent = (ctx->head - 1)->field;
12006     PyErr_Format(PyExc_ValueError,
12007                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
12008                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
12009                  parent->type->name, field->name);
12010   }
12011 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)12012 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
12013   char group;
12014   size_t size, offset, arraysize = 1;
12015   if (ctx->enc_type == 0) return 0;
12016   if (ctx->head->field->type->arraysize[0]) {
12017     int i, ndim = 0;
12018     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
12019         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
12020         ndim = 1;
12021         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
12022             PyErr_Format(PyExc_ValueError,
12023                          "Expected a dimension of size %zu, got %zu",
12024                          ctx->head->field->type->arraysize[0], ctx->enc_count);
12025             return -1;
12026         }
12027     }
12028     if (!ctx->is_valid_array) {
12029       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
12030                    ctx->head->field->type->ndim, ndim);
12031       return -1;
12032     }
12033     for (i = 0; i < ctx->head->field->type->ndim; i++) {
12034       arraysize *= ctx->head->field->type->arraysize[i];
12035     }
12036     ctx->is_valid_array = 0;
12037     ctx->enc_count = 1;
12038   }
12039   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
12040   do {
12041     __Pyx_StructField* field = ctx->head->field;
12042     __Pyx_TypeInfo* type = field->type;
12043     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
12044       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
12045     } else {
12046       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
12047     }
12048     if (ctx->enc_packmode == '@') {
12049       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
12050       size_t align_mod_offset;
12051       if (align_at == 0) return -1;
12052       align_mod_offset = ctx->fmt_offset % align_at;
12053       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
12054       if (ctx->struct_alignment == 0)
12055           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
12056                                                                  ctx->is_complex);
12057     }
12058     if (type->size != size || type->typegroup != group) {
12059       if (type->typegroup == 'C' && type->fields != NULL) {
12060         size_t parent_offset = ctx->head->parent_offset + field->offset;
12061         ++ctx->head;
12062         ctx->head->field = type->fields;
12063         ctx->head->parent_offset = parent_offset;
12064         continue;
12065       }
12066       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
12067       } else {
12068           __Pyx_BufFmt_RaiseExpected(ctx);
12069           return -1;
12070       }
12071     }
12072     offset = ctx->head->parent_offset + field->offset;
12073     if (ctx->fmt_offset != offset) {
12074       PyErr_Format(PyExc_ValueError,
12075                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
12076                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
12077       return -1;
12078     }
12079     ctx->fmt_offset += size;
12080     if (arraysize)
12081       ctx->fmt_offset += (arraysize - 1) * size;
12082     --ctx->enc_count;
12083     while (1) {
12084       if (field == &ctx->root) {
12085         ctx->head = NULL;
12086         if (ctx->enc_count != 0) {
12087           __Pyx_BufFmt_RaiseExpected(ctx);
12088           return -1;
12089         }
12090         break;
12091       }
12092       ctx->head->field = ++field;
12093       if (field->type == NULL) {
12094         --ctx->head;
12095         field = ctx->head->field;
12096         continue;
12097       } else if (field->type->typegroup == 'S') {
12098         size_t parent_offset = ctx->head->parent_offset + field->offset;
12099         if (field->type->fields->type == NULL) continue;
12100         field = field->type->fields;
12101         ++ctx->head;
12102         ctx->head->field = field;
12103         ctx->head->parent_offset = parent_offset;
12104         break;
12105       } else {
12106         break;
12107       }
12108     }
12109   } while (ctx->enc_count);
12110   ctx->enc_type = 0;
12111   ctx->is_complex = 0;
12112   return 0;
12113 }
12114 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)12115 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
12116 {
12117     const char *ts = *tsp;
12118     int i = 0, number;
12119     int ndim = ctx->head->field->type->ndim;
12120 ;
12121     ++ts;
12122     if (ctx->new_count != 1) {
12123         PyErr_SetString(PyExc_ValueError,
12124                         "Cannot handle repeated arrays in format string");
12125         return NULL;
12126     }
12127     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12128     while (*ts && *ts != ')') {
12129         switch (*ts) {
12130             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
12131             default:  break;
12132         }
12133         number = __Pyx_BufFmt_ExpectNumber(&ts);
12134         if (number == -1) return NULL;
12135         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
12136             return PyErr_Format(PyExc_ValueError,
12137                         "Expected a dimension of size %zu, got %d",
12138                         ctx->head->field->type->arraysize[i], number);
12139         if (*ts != ',' && *ts != ')')
12140             return PyErr_Format(PyExc_ValueError,
12141                                 "Expected a comma in format string, got '%c'", *ts);
12142         if (*ts == ',') ts++;
12143         i++;
12144     }
12145     if (i != ndim)
12146         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
12147                             ctx->head->field->type->ndim, i);
12148     if (!*ts) {
12149         PyErr_SetString(PyExc_ValueError,
12150                         "Unexpected end of format string, expected ')'");
12151         return NULL;
12152     }
12153     ctx->is_valid_array = 1;
12154     ctx->new_count = 1;
12155     *tsp = ++ts;
12156     return Py_None;
12157 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)12158 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
12159   int got_Z = 0;
12160   while (1) {
12161     switch(*ts) {
12162       case 0:
12163         if (ctx->enc_type != 0 && ctx->head == NULL) {
12164           __Pyx_BufFmt_RaiseExpected(ctx);
12165           return NULL;
12166         }
12167         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12168         if (ctx->head != NULL) {
12169           __Pyx_BufFmt_RaiseExpected(ctx);
12170           return NULL;
12171         }
12172         return ts;
12173       case ' ':
12174       case '\r':
12175       case '\n':
12176         ++ts;
12177         break;
12178       case '<':
12179         if (!__Pyx_Is_Little_Endian()) {
12180           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
12181           return NULL;
12182         }
12183         ctx->new_packmode = '=';
12184         ++ts;
12185         break;
12186       case '>':
12187       case '!':
12188         if (__Pyx_Is_Little_Endian()) {
12189           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
12190           return NULL;
12191         }
12192         ctx->new_packmode = '=';
12193         ++ts;
12194         break;
12195       case '=':
12196       case '@':
12197       case '^':
12198         ctx->new_packmode = *ts++;
12199         break;
12200       case 'T':
12201         {
12202           const char* ts_after_sub;
12203           size_t i, struct_count = ctx->new_count;
12204           size_t struct_alignment = ctx->struct_alignment;
12205           ctx->new_count = 1;
12206           ++ts;
12207           if (*ts != '{') {
12208             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
12209             return NULL;
12210           }
12211           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12212           ctx->enc_type = 0;
12213           ctx->enc_count = 0;
12214           ctx->struct_alignment = 0;
12215           ++ts;
12216           ts_after_sub = ts;
12217           for (i = 0; i != struct_count; ++i) {
12218             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
12219             if (!ts_after_sub) return NULL;
12220           }
12221           ts = ts_after_sub;
12222           if (struct_alignment) ctx->struct_alignment = struct_alignment;
12223         }
12224         break;
12225       case '}':
12226         {
12227           size_t alignment = ctx->struct_alignment;
12228           ++ts;
12229           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12230           ctx->enc_type = 0;
12231           if (alignment && ctx->fmt_offset % alignment) {
12232             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
12233           }
12234         }
12235         return ts;
12236       case 'x':
12237         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12238         ctx->fmt_offset += ctx->new_count;
12239         ctx->new_count = 1;
12240         ctx->enc_count = 0;
12241         ctx->enc_type = 0;
12242         ctx->enc_packmode = ctx->new_packmode;
12243         ++ts;
12244         break;
12245       case 'Z':
12246         got_Z = 1;
12247         ++ts;
12248         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
12249           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
12250           return NULL;
12251         }
12252         CYTHON_FALLTHROUGH;
12253       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
12254       case 'l': case 'L': case 'q': case 'Q':
12255       case 'f': case 'd': case 'g':
12256       case 'O': case 'p':
12257         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
12258             ctx->enc_packmode == ctx->new_packmode) {
12259           ctx->enc_count += ctx->new_count;
12260           ctx->new_count = 1;
12261           got_Z = 0;
12262           ++ts;
12263           break;
12264         }
12265         CYTHON_FALLTHROUGH;
12266       case 's':
12267         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
12268         ctx->enc_count = ctx->new_count;
12269         ctx->enc_packmode = ctx->new_packmode;
12270         ctx->enc_type = *ts;
12271         ctx->is_complex = got_Z;
12272         ++ts;
12273         ctx->new_count = 1;
12274         got_Z = 0;
12275         break;
12276       case ':':
12277         ++ts;
12278         while(*ts != ':') ++ts;
12279         ++ts;
12280         break;
12281       case '(':
12282         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
12283         break;
12284       default:
12285         {
12286           int number = __Pyx_BufFmt_ExpectNumber(&ts);
12287           if (number == -1) return NULL;
12288           ctx->new_count = (size_t)number;
12289         }
12290     }
12291   }
12292 }
12293 
12294 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)12295   static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
12296   if (unlikely(info->buf == NULL)) return;
12297   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
12298   __Pyx_ReleaseBuffer(info);
12299 }
__Pyx_ZeroBuffer(Py_buffer * buf)12300 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
12301   buf->buf = NULL;
12302   buf->obj = NULL;
12303   buf->strides = __Pyx_zeros;
12304   buf->shape = __Pyx_zeros;
12305   buf->suboffsets = __Pyx_minusones;
12306 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)12307 static int __Pyx__GetBufferAndValidate(
12308         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
12309         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
12310 {
12311   buf->buf = NULL;
12312   if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
12313     __Pyx_ZeroBuffer(buf);
12314     return -1;
12315   }
12316   if (unlikely(buf->ndim != nd)) {
12317     PyErr_Format(PyExc_ValueError,
12318                  "Buffer has wrong number of dimensions (expected %d, got %d)",
12319                  nd, buf->ndim);
12320     goto fail;
12321   }
12322   if (!cast) {
12323     __Pyx_BufFmt_Context ctx;
12324     __Pyx_BufFmt_Init(&ctx, stack, dtype);
12325     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
12326   }
12327   if (unlikely((size_t)buf->itemsize != dtype->size)) {
12328     PyErr_Format(PyExc_ValueError,
12329       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
12330       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
12331       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
12332     goto fail;
12333   }
12334   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
12335   return 0;
12336 fail:;
12337   __Pyx_SafeReleaseBuffer(buf);
12338   return -1;
12339 }
12340 
12341 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)12342   static void __Pyx_RaiseBufferIndexError(int axis) {
12343   PyErr_Format(PyExc_IndexError,
12344      "Out of bounds on buffer access (axis %d)", axis);
12345 }
12346 
12347 /* PyErrFetchRestore */
12348   #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)12349 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12350     PyObject *tmp_type, *tmp_value, *tmp_tb;
12351     tmp_type = tstate->curexc_type;
12352     tmp_value = tstate->curexc_value;
12353     tmp_tb = tstate->curexc_traceback;
12354     tstate->curexc_type = type;
12355     tstate->curexc_value = value;
12356     tstate->curexc_traceback = tb;
12357     Py_XDECREF(tmp_type);
12358     Py_XDECREF(tmp_value);
12359     Py_XDECREF(tmp_tb);
12360 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12361 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12362     *type = tstate->curexc_type;
12363     *value = tstate->curexc_value;
12364     *tb = tstate->curexc_traceback;
12365     tstate->curexc_type = 0;
12366     tstate->curexc_value = 0;
12367     tstate->curexc_traceback = 0;
12368 }
12369 #endif
12370 
12371 /* 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)12372   static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
12373                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
12374                                   int full_traceback, CYTHON_UNUSED int nogil) {
12375     PyObject *old_exc, *old_val, *old_tb;
12376     PyObject *ctx;
12377     __Pyx_PyThreadState_declare
12378 #ifdef WITH_THREAD
12379     PyGILState_STATE state;
12380     if (nogil)
12381         state = PyGILState_Ensure();
12382 #ifdef _MSC_VER
12383     else state = (PyGILState_STATE)-1;
12384 #endif
12385 #endif
12386     __Pyx_PyThreadState_assign
12387     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
12388     if (full_traceback) {
12389         Py_XINCREF(old_exc);
12390         Py_XINCREF(old_val);
12391         Py_XINCREF(old_tb);
12392         __Pyx_ErrRestore(old_exc, old_val, old_tb);
12393         PyErr_PrintEx(1);
12394     }
12395     #if PY_MAJOR_VERSION < 3
12396     ctx = PyString_FromString(name);
12397     #else
12398     ctx = PyUnicode_FromString(name);
12399     #endif
12400     __Pyx_ErrRestore(old_exc, old_val, old_tb);
12401     if (!ctx) {
12402         PyErr_WriteUnraisable(Py_None);
12403     } else {
12404         PyErr_WriteUnraisable(ctx);
12405         Py_DECREF(ctx);
12406     }
12407 #ifdef WITH_THREAD
12408     if (nogil)
12409         PyGILState_Release(state);
12410 #endif
12411 }
12412 
12413 /* None */
__Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a,__pyx_t_5numpy_int64_t b)12414   static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_div___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a, __pyx_t_5numpy_int64_t b) {
12415     __pyx_t_5numpy_int64_t q = a / b;
12416     __pyx_t_5numpy_int64_t r = a - q*b;
12417     q -= ((r != 0) & ((r ^ b) < 0));
12418     return q;
12419 }
12420 
12421 /* PyDictVersioning */
12422   #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)12423 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
12424     PyObject *dict = Py_TYPE(obj)->tp_dict;
12425     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
12426 }
__Pyx_get_object_dict_version(PyObject * obj)12427 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
12428     PyObject **dictptr = NULL;
12429     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
12430     if (offset) {
12431 #if CYTHON_COMPILING_IN_CPYTHON
12432         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
12433 #else
12434         dictptr = _PyObject_GetDictPtr(obj);
12435 #endif
12436     }
12437     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
12438 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)12439 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
12440     PyObject *dict = Py_TYPE(obj)->tp_dict;
12441     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
12442         return 0;
12443     return obj_dict_version == __Pyx_get_object_dict_version(obj);
12444 }
12445 #endif
12446 
12447 /* GetModuleGlobalName */
12448   #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)12449 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
12450 #else
12451 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
12452 #endif
12453 {
12454     PyObject *result;
12455 #if !CYTHON_AVOID_BORROWED_REFS
12456 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
12457     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
12458     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
12459     if (likely(result)) {
12460         return __Pyx_NewRef(result);
12461     } else if (unlikely(PyErr_Occurred())) {
12462         return NULL;
12463     }
12464 #else
12465     result = PyDict_GetItem(__pyx_d, name);
12466     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
12467     if (likely(result)) {
12468         return __Pyx_NewRef(result);
12469     }
12470 #endif
12471 #else
12472     result = PyObject_GetItem(__pyx_d, name);
12473     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
12474     if (likely(result)) {
12475         return __Pyx_NewRef(result);
12476     }
12477     PyErr_Clear();
12478 #endif
12479     return __Pyx_GetBuiltinName(name);
12480 }
12481 
12482 /* PyObjectCall */
12483   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)12484 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
12485     PyObject *result;
12486     ternaryfunc call = func->ob_type->tp_call;
12487     if (unlikely(!call))
12488         return PyObject_Call(func, arg, kw);
12489     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
12490         return NULL;
12491     result = (*call)(func, arg, kw);
12492     Py_LeaveRecursiveCall();
12493     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
12494         PyErr_SetString(
12495             PyExc_SystemError,
12496             "NULL result without error in PyObject_Call");
12497     }
12498     return result;
12499 }
12500 #endif
12501 
12502 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)12503   static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
12504     if (unlikely(!type)) {
12505         PyErr_SetString(PyExc_SystemError, "Missing type object");
12506         return 0;
12507     }
12508     if (likely(__Pyx_TypeCheck(obj, type)))
12509         return 1;
12510     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
12511                  Py_TYPE(obj)->tp_name, type->tp_name);
12512     return 0;
12513 }
12514 
12515 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)12516   static void __Pyx_RaiseBufferFallbackError(void) {
12517   PyErr_SetString(PyExc_ValueError,
12518      "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
12519 }
12520 
12521 /* None */
__Pyx_mod___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a,__pyx_t_5numpy_int64_t b)12522   static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_mod___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t a, __pyx_t_5numpy_int64_t b) {
12523     __pyx_t_5numpy_int64_t r = a % b;
12524     r += ((r != 0) & ((r ^ b) < 0)) * b;
12525     return r;
12526 }
12527 
12528 /* PyFunctionFastCall */
12529   #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)12530 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
12531                                                PyObject *globals) {
12532     PyFrameObject *f;
12533     PyThreadState *tstate = __Pyx_PyThreadState_Current;
12534     PyObject **fastlocals;
12535     Py_ssize_t i;
12536     PyObject *result;
12537     assert(globals != NULL);
12538     /* XXX Perhaps we should create a specialized
12539        PyFrame_New() that doesn't take locals, but does
12540        take builtins without sanity checking them.
12541        */
12542     assert(tstate != NULL);
12543     f = PyFrame_New(tstate, co, globals, NULL);
12544     if (f == NULL) {
12545         return NULL;
12546     }
12547     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
12548     for (i = 0; i < na; i++) {
12549         Py_INCREF(*args);
12550         fastlocals[i] = *args++;
12551     }
12552     result = PyEval_EvalFrameEx(f,0);
12553     ++tstate->recursion_depth;
12554     Py_DECREF(f);
12555     --tstate->recursion_depth;
12556     return result;
12557 }
12558 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)12559 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
12560     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
12561     PyObject *globals = PyFunction_GET_GLOBALS(func);
12562     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
12563     PyObject *closure;
12564 #if PY_MAJOR_VERSION >= 3
12565     PyObject *kwdefs;
12566 #endif
12567     PyObject *kwtuple, **k;
12568     PyObject **d;
12569     Py_ssize_t nd;
12570     Py_ssize_t nk;
12571     PyObject *result;
12572     assert(kwargs == NULL || PyDict_Check(kwargs));
12573     nk = kwargs ? PyDict_Size(kwargs) : 0;
12574     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
12575         return NULL;
12576     }
12577     if (
12578 #if PY_MAJOR_VERSION >= 3
12579             co->co_kwonlyargcount == 0 &&
12580 #endif
12581             likely(kwargs == NULL || nk == 0) &&
12582             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
12583         if (argdefs == NULL && co->co_argcount == nargs) {
12584             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
12585             goto done;
12586         }
12587         else if (nargs == 0 && argdefs != NULL
12588                  && co->co_argcount == Py_SIZE(argdefs)) {
12589             /* function called with no arguments, but all parameters have
12590                a default value: use default values as arguments .*/
12591             args = &PyTuple_GET_ITEM(argdefs, 0);
12592             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
12593             goto done;
12594         }
12595     }
12596     if (kwargs != NULL) {
12597         Py_ssize_t pos, i;
12598         kwtuple = PyTuple_New(2 * nk);
12599         if (kwtuple == NULL) {
12600             result = NULL;
12601             goto done;
12602         }
12603         k = &PyTuple_GET_ITEM(kwtuple, 0);
12604         pos = i = 0;
12605         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
12606             Py_INCREF(k[i]);
12607             Py_INCREF(k[i+1]);
12608             i += 2;
12609         }
12610         nk = i / 2;
12611     }
12612     else {
12613         kwtuple = NULL;
12614         k = NULL;
12615     }
12616     closure = PyFunction_GET_CLOSURE(func);
12617 #if PY_MAJOR_VERSION >= 3
12618     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
12619 #endif
12620     if (argdefs != NULL) {
12621         d = &PyTuple_GET_ITEM(argdefs, 0);
12622         nd = Py_SIZE(argdefs);
12623     }
12624     else {
12625         d = NULL;
12626         nd = 0;
12627     }
12628 #if PY_MAJOR_VERSION >= 3
12629     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
12630                                args, (int)nargs,
12631                                k, (int)nk,
12632                                d, (int)nd, kwdefs, closure);
12633 #else
12634     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
12635                                args, (int)nargs,
12636                                k, (int)nk,
12637                                d, (int)nd, closure);
12638 #endif
12639     Py_XDECREF(kwtuple);
12640 done:
12641     Py_LeaveRecursiveCall();
12642     return result;
12643 }
12644 #endif
12645 #endif
12646 
12647 /* PyObjectCallMethO */
12648   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)12649 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
12650     PyObject *self, *result;
12651     PyCFunction cfunc;
12652     cfunc = PyCFunction_GET_FUNCTION(func);
12653     self = PyCFunction_GET_SELF(func);
12654     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
12655         return NULL;
12656     result = cfunc(self, arg);
12657     Py_LeaveRecursiveCall();
12658     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
12659         PyErr_SetString(
12660             PyExc_SystemError,
12661             "NULL result without error in PyObject_Call");
12662     }
12663     return result;
12664 }
12665 #endif
12666 
12667 /* PyObjectCallNoArg */
12668   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)12669 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
12670 #if CYTHON_FAST_PYCALL
12671     if (PyFunction_Check(func)) {
12672         return __Pyx_PyFunction_FastCall(func, NULL, 0);
12673     }
12674 #endif
12675 #ifdef __Pyx_CyFunction_USED
12676     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
12677 #else
12678     if (likely(PyCFunction_Check(func)))
12679 #endif
12680     {
12681         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
12682             return __Pyx_PyObject_CallMethO(func, NULL);
12683         }
12684     }
12685     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
12686 }
12687 #endif
12688 
12689 /* PyCFunctionFastCall */
12690   #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)12691 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
12692     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
12693     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
12694     PyObject *self = PyCFunction_GET_SELF(func);
12695     int flags = PyCFunction_GET_FLAGS(func);
12696     assert(PyCFunction_Check(func));
12697     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
12698     assert(nargs >= 0);
12699     assert(nargs == 0 || args != NULL);
12700     /* _PyCFunction_FastCallDict() must not be called with an exception set,
12701        because it may clear it (directly or indirectly) and so the
12702        caller loses its exception */
12703     assert(!PyErr_Occurred());
12704     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
12705         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
12706     } else {
12707         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
12708     }
12709 }
12710 #endif
12711 
12712 /* PyObjectCallOneArg */
12713   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)12714 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12715     PyObject *result;
12716     PyObject *args = PyTuple_New(1);
12717     if (unlikely(!args)) return NULL;
12718     Py_INCREF(arg);
12719     PyTuple_SET_ITEM(args, 0, arg);
12720     result = __Pyx_PyObject_Call(func, args, NULL);
12721     Py_DECREF(args);
12722     return result;
12723 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)12724 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12725 #if CYTHON_FAST_PYCALL
12726     if (PyFunction_Check(func)) {
12727         return __Pyx_PyFunction_FastCall(func, &arg, 1);
12728     }
12729 #endif
12730     if (likely(PyCFunction_Check(func))) {
12731         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
12732             return __Pyx_PyObject_CallMethO(func, arg);
12733 #if CYTHON_FAST_PYCCALL
12734         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
12735             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
12736 #endif
12737         }
12738     }
12739     return __Pyx__PyObject_CallOneArg(func, arg);
12740 }
12741 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)12742 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12743     PyObject *result;
12744     PyObject *args = PyTuple_Pack(1, arg);
12745     if (unlikely(!args)) return NULL;
12746     result = __Pyx_PyObject_Call(func, args, NULL);
12747     Py_DECREF(args);
12748     return result;
12749 }
12750 #endif
12751 
12752 /* RaiseException */
12753   #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)12754 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
12755                         CYTHON_UNUSED PyObject *cause) {
12756     __Pyx_PyThreadState_declare
12757     Py_XINCREF(type);
12758     if (!value || value == Py_None)
12759         value = NULL;
12760     else
12761         Py_INCREF(value);
12762     if (!tb || tb == Py_None)
12763         tb = NULL;
12764     else {
12765         Py_INCREF(tb);
12766         if (!PyTraceBack_Check(tb)) {
12767             PyErr_SetString(PyExc_TypeError,
12768                 "raise: arg 3 must be a traceback or None");
12769             goto raise_error;
12770         }
12771     }
12772     if (PyType_Check(type)) {
12773 #if CYTHON_COMPILING_IN_PYPY
12774         if (!value) {
12775             Py_INCREF(Py_None);
12776             value = Py_None;
12777         }
12778 #endif
12779         PyErr_NormalizeException(&type, &value, &tb);
12780     } else {
12781         if (value) {
12782             PyErr_SetString(PyExc_TypeError,
12783                 "instance exception may not have a separate value");
12784             goto raise_error;
12785         }
12786         value = type;
12787         type = (PyObject*) Py_TYPE(type);
12788         Py_INCREF(type);
12789         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
12790             PyErr_SetString(PyExc_TypeError,
12791                 "raise: exception class must be a subclass of BaseException");
12792             goto raise_error;
12793         }
12794     }
12795     __Pyx_PyThreadState_assign
12796     __Pyx_ErrRestore(type, value, tb);
12797     return;
12798 raise_error:
12799     Py_XDECREF(value);
12800     Py_XDECREF(type);
12801     Py_XDECREF(tb);
12802     return;
12803 }
12804 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)12805 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12806     PyObject* owned_instance = NULL;
12807     if (tb == Py_None) {
12808         tb = 0;
12809     } else if (tb && !PyTraceBack_Check(tb)) {
12810         PyErr_SetString(PyExc_TypeError,
12811             "raise: arg 3 must be a traceback or None");
12812         goto bad;
12813     }
12814     if (value == Py_None)
12815         value = 0;
12816     if (PyExceptionInstance_Check(type)) {
12817         if (value) {
12818             PyErr_SetString(PyExc_TypeError,
12819                 "instance exception may not have a separate value");
12820             goto bad;
12821         }
12822         value = type;
12823         type = (PyObject*) Py_TYPE(value);
12824     } else if (PyExceptionClass_Check(type)) {
12825         PyObject *instance_class = NULL;
12826         if (value && PyExceptionInstance_Check(value)) {
12827             instance_class = (PyObject*) Py_TYPE(value);
12828             if (instance_class != type) {
12829                 int is_subclass = PyObject_IsSubclass(instance_class, type);
12830                 if (!is_subclass) {
12831                     instance_class = NULL;
12832                 } else if (unlikely(is_subclass == -1)) {
12833                     goto bad;
12834                 } else {
12835                     type = instance_class;
12836                 }
12837             }
12838         }
12839         if (!instance_class) {
12840             PyObject *args;
12841             if (!value)
12842                 args = PyTuple_New(0);
12843             else if (PyTuple_Check(value)) {
12844                 Py_INCREF(value);
12845                 args = value;
12846             } else
12847                 args = PyTuple_Pack(1, value);
12848             if (!args)
12849                 goto bad;
12850             owned_instance = PyObject_Call(type, args, NULL);
12851             Py_DECREF(args);
12852             if (!owned_instance)
12853                 goto bad;
12854             value = owned_instance;
12855             if (!PyExceptionInstance_Check(value)) {
12856                 PyErr_Format(PyExc_TypeError,
12857                              "calling %R should have returned an instance of "
12858                              "BaseException, not %R",
12859                              type, Py_TYPE(value));
12860                 goto bad;
12861             }
12862         }
12863     } else {
12864         PyErr_SetString(PyExc_TypeError,
12865             "raise: exception class must be a subclass of BaseException");
12866         goto bad;
12867     }
12868     if (cause) {
12869         PyObject *fixed_cause;
12870         if (cause == Py_None) {
12871             fixed_cause = NULL;
12872         } else if (PyExceptionClass_Check(cause)) {
12873             fixed_cause = PyObject_CallObject(cause, NULL);
12874             if (fixed_cause == NULL)
12875                 goto bad;
12876         } else if (PyExceptionInstance_Check(cause)) {
12877             fixed_cause = cause;
12878             Py_INCREF(fixed_cause);
12879         } else {
12880             PyErr_SetString(PyExc_TypeError,
12881                             "exception causes must derive from "
12882                             "BaseException");
12883             goto bad;
12884         }
12885         PyException_SetCause(value, fixed_cause);
12886     }
12887     PyErr_SetObject(type, value);
12888     if (tb) {
12889 #if CYTHON_COMPILING_IN_PYPY
12890         PyObject *tmp_type, *tmp_value, *tmp_tb;
12891         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12892         Py_INCREF(tb);
12893         PyErr_Restore(tmp_type, tmp_value, tb);
12894         Py_XDECREF(tmp_tb);
12895 #else
12896         PyThreadState *tstate = __Pyx_PyThreadState_Current;
12897         PyObject* tmp_tb = tstate->curexc_traceback;
12898         if (tb != tmp_tb) {
12899             Py_INCREF(tb);
12900             tstate->curexc_traceback = tb;
12901             Py_XDECREF(tmp_tb);
12902         }
12903 #endif
12904     }
12905 bad:
12906     Py_XDECREF(owned_instance);
12907     return;
12908 }
12909 #endif
12910 
12911 /* DictGetItem */
12912   #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)12913 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
12914     PyObject *value;
12915     value = PyDict_GetItemWithError(d, key);
12916     if (unlikely(!value)) {
12917         if (!PyErr_Occurred()) {
12918             if (unlikely(PyTuple_Check(key))) {
12919                 PyObject* args = PyTuple_Pack(1, key);
12920                 if (likely(args)) {
12921                     PyErr_SetObject(PyExc_KeyError, args);
12922                     Py_DECREF(args);
12923                 }
12924             } else {
12925                 PyErr_SetObject(PyExc_KeyError, key);
12926             }
12927         }
12928         return NULL;
12929     }
12930     Py_INCREF(value);
12931     return value;
12932 }
12933 #endif
12934 
12935 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)12936   static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
12937     PyErr_Format(PyExc_ValueError,
12938                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
12939 }
12940 
12941 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)12942   static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
12943     PyErr_Format(PyExc_ValueError,
12944                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
12945                  index, (index == 1) ? "" : "s");
12946 }
12947 
12948 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)12949   static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
12950     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
12951 }
12952 
12953 /* GetTopmostException */
12954   #if CYTHON_USE_EXC_INFO_STACK
12955 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)12956 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
12957 {
12958     _PyErr_StackItem *exc_info = tstate->exc_info;
12959     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
12960            exc_info->previous_item != NULL)
12961     {
12962         exc_info = exc_info->previous_item;
12963     }
12964     return exc_info;
12965 }
12966 #endif
12967 
12968 /* SaveResetException */
12969   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)12970 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12971     #if CYTHON_USE_EXC_INFO_STACK
12972     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
12973     *type = exc_info->exc_type;
12974     *value = exc_info->exc_value;
12975     *tb = exc_info->exc_traceback;
12976     #else
12977     *type = tstate->exc_type;
12978     *value = tstate->exc_value;
12979     *tb = tstate->exc_traceback;
12980     #endif
12981     Py_XINCREF(*type);
12982     Py_XINCREF(*value);
12983     Py_XINCREF(*tb);
12984 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)12985 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12986     PyObject *tmp_type, *tmp_value, *tmp_tb;
12987     #if CYTHON_USE_EXC_INFO_STACK
12988     _PyErr_StackItem *exc_info = tstate->exc_info;
12989     tmp_type = exc_info->exc_type;
12990     tmp_value = exc_info->exc_value;
12991     tmp_tb = exc_info->exc_traceback;
12992     exc_info->exc_type = type;
12993     exc_info->exc_value = value;
12994     exc_info->exc_traceback = tb;
12995     #else
12996     tmp_type = tstate->exc_type;
12997     tmp_value = tstate->exc_value;
12998     tmp_tb = tstate->exc_traceback;
12999     tstate->exc_type = type;
13000     tstate->exc_value = value;
13001     tstate->exc_traceback = tb;
13002     #endif
13003     Py_XDECREF(tmp_type);
13004     Py_XDECREF(tmp_value);
13005     Py_XDECREF(tmp_tb);
13006 }
13007 #endif
13008 
13009 /* PyErrExceptionMatches */
13010   #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)13011 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
13012     Py_ssize_t i, n;
13013     n = PyTuple_GET_SIZE(tuple);
13014 #if PY_MAJOR_VERSION >= 3
13015     for (i=0; i<n; i++) {
13016         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
13017     }
13018 #endif
13019     for (i=0; i<n; i++) {
13020         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
13021     }
13022     return 0;
13023 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)13024 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
13025     PyObject *exc_type = tstate->curexc_type;
13026     if (exc_type == err) return 1;
13027     if (unlikely(!exc_type)) return 0;
13028     if (unlikely(PyTuple_Check(err)))
13029         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
13030     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
13031 }
13032 #endif
13033 
13034 /* GetException */
13035   #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)13036 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
13037 #else
13038 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
13039 #endif
13040 {
13041     PyObject *local_type, *local_value, *local_tb;
13042 #if CYTHON_FAST_THREAD_STATE
13043     PyObject *tmp_type, *tmp_value, *tmp_tb;
13044     local_type = tstate->curexc_type;
13045     local_value = tstate->curexc_value;
13046     local_tb = tstate->curexc_traceback;
13047     tstate->curexc_type = 0;
13048     tstate->curexc_value = 0;
13049     tstate->curexc_traceback = 0;
13050 #else
13051     PyErr_Fetch(&local_type, &local_value, &local_tb);
13052 #endif
13053     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
13054 #if CYTHON_FAST_THREAD_STATE
13055     if (unlikely(tstate->curexc_type))
13056 #else
13057     if (unlikely(PyErr_Occurred()))
13058 #endif
13059         goto bad;
13060     #if PY_MAJOR_VERSION >= 3
13061     if (local_tb) {
13062         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
13063             goto bad;
13064     }
13065     #endif
13066     Py_XINCREF(local_tb);
13067     Py_XINCREF(local_type);
13068     Py_XINCREF(local_value);
13069     *type = local_type;
13070     *value = local_value;
13071     *tb = local_tb;
13072 #if CYTHON_FAST_THREAD_STATE
13073     #if CYTHON_USE_EXC_INFO_STACK
13074     {
13075         _PyErr_StackItem *exc_info = tstate->exc_info;
13076         tmp_type = exc_info->exc_type;
13077         tmp_value = exc_info->exc_value;
13078         tmp_tb = exc_info->exc_traceback;
13079         exc_info->exc_type = local_type;
13080         exc_info->exc_value = local_value;
13081         exc_info->exc_traceback = local_tb;
13082     }
13083     #else
13084     tmp_type = tstate->exc_type;
13085     tmp_value = tstate->exc_value;
13086     tmp_tb = tstate->exc_traceback;
13087     tstate->exc_type = local_type;
13088     tstate->exc_value = local_value;
13089     tstate->exc_traceback = local_tb;
13090     #endif
13091     Py_XDECREF(tmp_type);
13092     Py_XDECREF(tmp_value);
13093     Py_XDECREF(tmp_tb);
13094 #else
13095     PyErr_SetExcInfo(local_type, local_value, local_tb);
13096 #endif
13097     return 0;
13098 bad:
13099     *type = 0;
13100     *value = 0;
13101     *tb = 0;
13102     Py_XDECREF(local_type);
13103     Py_XDECREF(local_value);
13104     Py_XDECREF(local_tb);
13105     return -1;
13106 }
13107 
13108 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)13109   static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
13110 #if CYTHON_USE_TYPE_SLOTS
13111 #if PY_MAJOR_VERSION >= 3
13112     if (likely(PyUnicode_Check(n)))
13113 #else
13114     if (likely(PyString_Check(n)))
13115 #endif
13116         return __Pyx_PyObject_GetAttrStr(o, n);
13117 #endif
13118     return PyObject_GetAttr(o, n);
13119 }
13120 
13121 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)13122   static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
13123     PyObject *r;
13124     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
13125         PyErr_SetString(PyExc_TypeError,
13126                         "hasattr(): attribute name must be string");
13127         return -1;
13128     }
13129     r = __Pyx_GetAttr(o, n);
13130     if (unlikely(!r)) {
13131         PyErr_Clear();
13132         return 0;
13133     } else {
13134         Py_DECREF(r);
13135         return 1;
13136     }
13137 }
13138 
13139 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)13140   static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
13141 #if CYTHON_COMPILING_IN_PYPY
13142     return PyObject_RichCompareBool(s1, s2, equals);
13143 #else
13144     if (s1 == s2) {
13145         return (equals == Py_EQ);
13146     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
13147         const char *ps1, *ps2;
13148         Py_ssize_t length = PyBytes_GET_SIZE(s1);
13149         if (length != PyBytes_GET_SIZE(s2))
13150             return (equals == Py_NE);
13151         ps1 = PyBytes_AS_STRING(s1);
13152         ps2 = PyBytes_AS_STRING(s2);
13153         if (ps1[0] != ps2[0]) {
13154             return (equals == Py_NE);
13155         } else if (length == 1) {
13156             return (equals == Py_EQ);
13157         } else {
13158             int result;
13159 #if CYTHON_USE_UNICODE_INTERNALS
13160             Py_hash_t hash1, hash2;
13161             hash1 = ((PyBytesObject*)s1)->ob_shash;
13162             hash2 = ((PyBytesObject*)s2)->ob_shash;
13163             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
13164                 return (equals == Py_NE);
13165             }
13166 #endif
13167             result = memcmp(ps1, ps2, (size_t)length);
13168             return (equals == Py_EQ) ? (result == 0) : (result != 0);
13169         }
13170     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
13171         return (equals == Py_NE);
13172     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
13173         return (equals == Py_NE);
13174     } else {
13175         int result;
13176         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
13177         if (!py_result)
13178             return -1;
13179         result = __Pyx_PyObject_IsTrue(py_result);
13180         Py_DECREF(py_result);
13181         return result;
13182     }
13183 #endif
13184 }
13185 
13186 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)13187   static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
13188 #if CYTHON_COMPILING_IN_PYPY
13189     return PyObject_RichCompareBool(s1, s2, equals);
13190 #else
13191 #if PY_MAJOR_VERSION < 3
13192     PyObject* owned_ref = NULL;
13193 #endif
13194     int s1_is_unicode, s2_is_unicode;
13195     if (s1 == s2) {
13196         goto return_eq;
13197     }
13198     s1_is_unicode = PyUnicode_CheckExact(s1);
13199     s2_is_unicode = PyUnicode_CheckExact(s2);
13200 #if PY_MAJOR_VERSION < 3
13201     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
13202         owned_ref = PyUnicode_FromObject(s2);
13203         if (unlikely(!owned_ref))
13204             return -1;
13205         s2 = owned_ref;
13206         s2_is_unicode = 1;
13207     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
13208         owned_ref = PyUnicode_FromObject(s1);
13209         if (unlikely(!owned_ref))
13210             return -1;
13211         s1 = owned_ref;
13212         s1_is_unicode = 1;
13213     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
13214         return __Pyx_PyBytes_Equals(s1, s2, equals);
13215     }
13216 #endif
13217     if (s1_is_unicode & s2_is_unicode) {
13218         Py_ssize_t length;
13219         int kind;
13220         void *data1, *data2;
13221         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
13222             return -1;
13223         length = __Pyx_PyUnicode_GET_LENGTH(s1);
13224         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
13225             goto return_ne;
13226         }
13227 #if CYTHON_USE_UNICODE_INTERNALS
13228         {
13229             Py_hash_t hash1, hash2;
13230         #if CYTHON_PEP393_ENABLED
13231             hash1 = ((PyASCIIObject*)s1)->hash;
13232             hash2 = ((PyASCIIObject*)s2)->hash;
13233         #else
13234             hash1 = ((PyUnicodeObject*)s1)->hash;
13235             hash2 = ((PyUnicodeObject*)s2)->hash;
13236         #endif
13237             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
13238                 goto return_ne;
13239             }
13240         }
13241 #endif
13242         kind = __Pyx_PyUnicode_KIND(s1);
13243         if (kind != __Pyx_PyUnicode_KIND(s2)) {
13244             goto return_ne;
13245         }
13246         data1 = __Pyx_PyUnicode_DATA(s1);
13247         data2 = __Pyx_PyUnicode_DATA(s2);
13248         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
13249             goto return_ne;
13250         } else if (length == 1) {
13251             goto return_eq;
13252         } else {
13253             int result = memcmp(data1, data2, (size_t)(length * kind));
13254             #if PY_MAJOR_VERSION < 3
13255             Py_XDECREF(owned_ref);
13256             #endif
13257             return (equals == Py_EQ) ? (result == 0) : (result != 0);
13258         }
13259     } else if ((s1 == Py_None) & s2_is_unicode) {
13260         goto return_ne;
13261     } else if ((s2 == Py_None) & s1_is_unicode) {
13262         goto return_ne;
13263     } else {
13264         int result;
13265         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
13266         #if PY_MAJOR_VERSION < 3
13267         Py_XDECREF(owned_ref);
13268         #endif
13269         if (!py_result)
13270             return -1;
13271         result = __Pyx_PyObject_IsTrue(py_result);
13272         Py_DECREF(py_result);
13273         return result;
13274     }
13275 return_eq:
13276     #if PY_MAJOR_VERSION < 3
13277     Py_XDECREF(owned_ref);
13278     #endif
13279     return (equals == Py_EQ);
13280 return_ne:
13281     #if PY_MAJOR_VERSION < 3
13282     Py_XDECREF(owned_ref);
13283     #endif
13284     return (equals == Py_NE);
13285 #endif
13286 }
13287 
13288 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)13289   static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
13290     PyObject *args, *result = NULL;
13291     #if CYTHON_FAST_PYCALL
13292     if (PyFunction_Check(function)) {
13293         PyObject *args[2] = {arg1, arg2};
13294         return __Pyx_PyFunction_FastCall(function, args, 2);
13295     }
13296     #endif
13297     #if CYTHON_FAST_PYCCALL
13298     if (__Pyx_PyFastCFunction_Check(function)) {
13299         PyObject *args[2] = {arg1, arg2};
13300         return __Pyx_PyCFunction_FastCall(function, args, 2);
13301     }
13302     #endif
13303     args = PyTuple_New(2);
13304     if (unlikely(!args)) goto done;
13305     Py_INCREF(arg1);
13306     PyTuple_SET_ITEM(args, 0, arg1);
13307     Py_INCREF(arg2);
13308     PyTuple_SET_ITEM(args, 1, arg2);
13309     Py_INCREF(function);
13310     result = __Pyx_PyObject_Call(function, args, NULL);
13311     Py_DECREF(args);
13312     Py_DECREF(function);
13313 done:
13314     return result;
13315 }
13316 
13317 /* PyObject_GenericGetAttrNoDict */
13318   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)13319 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
13320     PyErr_Format(PyExc_AttributeError,
13321 #if PY_MAJOR_VERSION >= 3
13322                  "'%.50s' object has no attribute '%U'",
13323                  tp->tp_name, attr_name);
13324 #else
13325                  "'%.50s' object has no attribute '%.400s'",
13326                  tp->tp_name, PyString_AS_STRING(attr_name));
13327 #endif
13328     return NULL;
13329 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)13330 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
13331     PyObject *descr;
13332     PyTypeObject *tp = Py_TYPE(obj);
13333     if (unlikely(!PyString_Check(attr_name))) {
13334         return PyObject_GenericGetAttr(obj, attr_name);
13335     }
13336     assert(!tp->tp_dictoffset);
13337     descr = _PyType_Lookup(tp, attr_name);
13338     if (unlikely(!descr)) {
13339         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
13340     }
13341     Py_INCREF(descr);
13342     #if PY_MAJOR_VERSION < 3
13343     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
13344     #endif
13345     {
13346         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
13347         if (unlikely(f)) {
13348             PyObject *res = f(descr, obj, (PyObject *)tp);
13349             Py_DECREF(descr);
13350             return res;
13351         }
13352     }
13353     return descr;
13354 }
13355 #endif
13356 
13357 /* PyObject_GenericGetAttr */
13358   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)13359 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
13360     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
13361         return PyObject_GenericGetAttr(obj, attr_name);
13362     }
13363     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
13364 }
13365 #endif
13366 
13367 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)13368   static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
13369 #if PY_VERSION_HEX >= 0x02070000
13370     PyObject *ob = PyCapsule_New(vtable, 0, 0);
13371 #else
13372     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
13373 #endif
13374     if (!ob)
13375         goto bad;
13376     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
13377         goto bad;
13378     Py_DECREF(ob);
13379     return 0;
13380 bad:
13381     Py_XDECREF(ob);
13382     return -1;
13383 }
13384 
13385 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)13386   static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
13387   int ret;
13388   PyObject *name_attr;
13389   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
13390   if (likely(name_attr)) {
13391       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
13392   } else {
13393       ret = -1;
13394   }
13395   if (unlikely(ret < 0)) {
13396       PyErr_Clear();
13397       ret = 0;
13398   }
13399   Py_XDECREF(name_attr);
13400   return ret;
13401 }
__Pyx_setup_reduce(PyObject * type_obj)13402 static int __Pyx_setup_reduce(PyObject* type_obj) {
13403     int ret = 0;
13404     PyObject *object_reduce = NULL;
13405     PyObject *object_reduce_ex = NULL;
13406     PyObject *reduce = NULL;
13407     PyObject *reduce_ex = NULL;
13408     PyObject *reduce_cython = NULL;
13409     PyObject *setstate = NULL;
13410     PyObject *setstate_cython = NULL;
13411 #if CYTHON_USE_PYTYPE_LOOKUP
13412     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
13413 #else
13414     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
13415 #endif
13416 #if CYTHON_USE_PYTYPE_LOOKUP
13417     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
13418 #else
13419     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
13420 #endif
13421     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
13422     if (reduce_ex == object_reduce_ex) {
13423 #if CYTHON_USE_PYTYPE_LOOKUP
13424         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
13425 #else
13426         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
13427 #endif
13428         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
13429         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
13430             reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
13431             ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
13432             ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
13433             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
13434             if (!setstate) PyErr_Clear();
13435             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
13436                 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
13437                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
13438                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
13439             }
13440             PyType_Modified((PyTypeObject*)type_obj);
13441         }
13442     }
13443     goto GOOD;
13444 BAD:
13445     if (!PyErr_Occurred())
13446         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
13447     ret = -1;
13448 GOOD:
13449 #if !CYTHON_USE_PYTYPE_LOOKUP
13450     Py_XDECREF(object_reduce);
13451     Py_XDECREF(object_reduce_ex);
13452 #endif
13453     Py_XDECREF(reduce);
13454     Py_XDECREF(reduce_ex);
13455     Py_XDECREF(reduce_cython);
13456     Py_XDECREF(setstate);
13457     Py_XDECREF(setstate_cython);
13458     return ret;
13459 }
13460 
13461 /* TypeImport */
13462   #ifndef __PYX_HAVE_RT_ImportType
13463 #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)13464 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
13465     size_t size, enum __Pyx_ImportType_CheckSize check_size)
13466 {
13467     PyObject *result = 0;
13468     char warning[200];
13469     Py_ssize_t basicsize;
13470 #ifdef Py_LIMITED_API
13471     PyObject *py_basicsize;
13472 #endif
13473     result = PyObject_GetAttrString(module, class_name);
13474     if (!result)
13475         goto bad;
13476     if (!PyType_Check(result)) {
13477         PyErr_Format(PyExc_TypeError,
13478             "%.200s.%.200s is not a type object",
13479             module_name, class_name);
13480         goto bad;
13481     }
13482 #ifndef Py_LIMITED_API
13483     basicsize = ((PyTypeObject *)result)->tp_basicsize;
13484 #else
13485     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
13486     if (!py_basicsize)
13487         goto bad;
13488     basicsize = PyLong_AsSsize_t(py_basicsize);
13489     Py_DECREF(py_basicsize);
13490     py_basicsize = 0;
13491     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
13492         goto bad;
13493 #endif
13494     if ((size_t)basicsize < size) {
13495         PyErr_Format(PyExc_ValueError,
13496             "%.200s.%.200s size changed, may indicate binary incompatibility. "
13497             "Expected %zd from C header, got %zd from PyObject",
13498             module_name, class_name, size, basicsize);
13499         goto bad;
13500     }
13501     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
13502         PyErr_Format(PyExc_ValueError,
13503             "%.200s.%.200s size changed, may indicate binary incompatibility. "
13504             "Expected %zd from C header, got %zd from PyObject",
13505             module_name, class_name, size, basicsize);
13506         goto bad;
13507     }
13508     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
13509         PyOS_snprintf(warning, sizeof(warning),
13510             "%s.%s size changed, may indicate binary incompatibility. "
13511             "Expected %zd from C header, got %zd from PyObject",
13512             module_name, class_name, size, basicsize);
13513         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
13514     }
13515     return (PyTypeObject *)result;
13516 bad:
13517     Py_XDECREF(result);
13518     return NULL;
13519 }
13520 #endif
13521 
13522 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)13523   static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
13524     PyObject *empty_list = 0;
13525     PyObject *module = 0;
13526     PyObject *global_dict = 0;
13527     PyObject *empty_dict = 0;
13528     PyObject *list;
13529     #if PY_MAJOR_VERSION < 3
13530     PyObject *py_import;
13531     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
13532     if (!py_import)
13533         goto bad;
13534     #endif
13535     if (from_list)
13536         list = from_list;
13537     else {
13538         empty_list = PyList_New(0);
13539         if (!empty_list)
13540             goto bad;
13541         list = empty_list;
13542     }
13543     global_dict = PyModule_GetDict(__pyx_m);
13544     if (!global_dict)
13545         goto bad;
13546     empty_dict = PyDict_New();
13547     if (!empty_dict)
13548         goto bad;
13549     {
13550         #if PY_MAJOR_VERSION >= 3
13551         if (level == -1) {
13552             if (strchr(__Pyx_MODULE_NAME, '.')) {
13553                 module = PyImport_ImportModuleLevelObject(
13554                     name, global_dict, empty_dict, list, 1);
13555                 if (!module) {
13556                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
13557                         goto bad;
13558                     PyErr_Clear();
13559                 }
13560             }
13561             level = 0;
13562         }
13563         #endif
13564         if (!module) {
13565             #if PY_MAJOR_VERSION < 3
13566             PyObject *py_level = PyInt_FromLong(level);
13567             if (!py_level)
13568                 goto bad;
13569             module = PyObject_CallFunctionObjArgs(py_import,
13570                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
13571             Py_DECREF(py_level);
13572             #else
13573             module = PyImport_ImportModuleLevelObject(
13574                 name, global_dict, empty_dict, list, level);
13575             #endif
13576         }
13577     }
13578 bad:
13579     #if PY_MAJOR_VERSION < 3
13580     Py_XDECREF(py_import);
13581     #endif
13582     Py_XDECREF(empty_list);
13583     Py_XDECREF(empty_dict);
13584     return module;
13585 }
13586 
13587 /* CLineInTraceback */
13588   #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)13589 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
13590     PyObject *use_cline;
13591     PyObject *ptype, *pvalue, *ptraceback;
13592 #if CYTHON_COMPILING_IN_CPYTHON
13593     PyObject **cython_runtime_dict;
13594 #endif
13595     if (unlikely(!__pyx_cython_runtime)) {
13596         return c_line;
13597     }
13598     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
13599 #if CYTHON_COMPILING_IN_CPYTHON
13600     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
13601     if (likely(cython_runtime_dict)) {
13602         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
13603             use_cline, *cython_runtime_dict,
13604             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
13605     } else
13606 #endif
13607     {
13608       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
13609       if (use_cline_obj) {
13610         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
13611         Py_DECREF(use_cline_obj);
13612       } else {
13613         PyErr_Clear();
13614         use_cline = NULL;
13615       }
13616     }
13617     if (!use_cline) {
13618         c_line = 0;
13619         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
13620     }
13621     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
13622         c_line = 0;
13623     }
13624     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
13625     return c_line;
13626 }
13627 #endif
13628 
13629 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)13630   static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
13631     int start = 0, mid = 0, end = count - 1;
13632     if (end >= 0 && code_line > entries[end].code_line) {
13633         return count;
13634     }
13635     while (start < end) {
13636         mid = start + (end - start) / 2;
13637         if (code_line < entries[mid].code_line) {
13638             end = mid;
13639         } else if (code_line > entries[mid].code_line) {
13640              start = mid + 1;
13641         } else {
13642             return mid;
13643         }
13644     }
13645     if (code_line <= entries[mid].code_line) {
13646         return mid;
13647     } else {
13648         return mid + 1;
13649     }
13650 }
__pyx_find_code_object(int code_line)13651 static PyCodeObject *__pyx_find_code_object(int code_line) {
13652     PyCodeObject* code_object;
13653     int pos;
13654     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
13655         return NULL;
13656     }
13657     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13658     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
13659         return NULL;
13660     }
13661     code_object = __pyx_code_cache.entries[pos].code_object;
13662     Py_INCREF(code_object);
13663     return code_object;
13664 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)13665 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
13666     int pos, i;
13667     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
13668     if (unlikely(!code_line)) {
13669         return;
13670     }
13671     if (unlikely(!entries)) {
13672         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
13673         if (likely(entries)) {
13674             __pyx_code_cache.entries = entries;
13675             __pyx_code_cache.max_count = 64;
13676             __pyx_code_cache.count = 1;
13677             entries[0].code_line = code_line;
13678             entries[0].code_object = code_object;
13679             Py_INCREF(code_object);
13680         }
13681         return;
13682     }
13683     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
13684     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
13685         PyCodeObject* tmp = entries[pos].code_object;
13686         entries[pos].code_object = code_object;
13687         Py_DECREF(tmp);
13688         return;
13689     }
13690     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
13691         int new_max = __pyx_code_cache.max_count + 64;
13692         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
13693             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
13694         if (unlikely(!entries)) {
13695             return;
13696         }
13697         __pyx_code_cache.entries = entries;
13698         __pyx_code_cache.max_count = new_max;
13699     }
13700     for (i=__pyx_code_cache.count; i>pos; i--) {
13701         entries[i] = entries[i-1];
13702     }
13703     entries[pos].code_line = code_line;
13704     entries[pos].code_object = code_object;
13705     __pyx_code_cache.count++;
13706     Py_INCREF(code_object);
13707 }
13708 
13709 /* AddTraceback */
13710   #include "compile.h"
13711 #include "frameobject.h"
13712 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)13713 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
13714             const char *funcname, int c_line,
13715             int py_line, const char *filename) {
13716     PyCodeObject *py_code = 0;
13717     PyObject *py_srcfile = 0;
13718     PyObject *py_funcname = 0;
13719     #if PY_MAJOR_VERSION < 3
13720     py_srcfile = PyString_FromString(filename);
13721     #else
13722     py_srcfile = PyUnicode_FromString(filename);
13723     #endif
13724     if (!py_srcfile) goto bad;
13725     if (c_line) {
13726         #if PY_MAJOR_VERSION < 3
13727         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13728         #else
13729         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
13730         #endif
13731     }
13732     else {
13733         #if PY_MAJOR_VERSION < 3
13734         py_funcname = PyString_FromString(funcname);
13735         #else
13736         py_funcname = PyUnicode_FromString(funcname);
13737         #endif
13738     }
13739     if (!py_funcname) goto bad;
13740     py_code = __Pyx_PyCode_New(
13741         0,
13742         0,
13743         0,
13744         0,
13745         0,
13746         __pyx_empty_bytes, /*PyObject *code,*/
13747         __pyx_empty_tuple, /*PyObject *consts,*/
13748         __pyx_empty_tuple, /*PyObject *names,*/
13749         __pyx_empty_tuple, /*PyObject *varnames,*/
13750         __pyx_empty_tuple, /*PyObject *freevars,*/
13751         __pyx_empty_tuple, /*PyObject *cellvars,*/
13752         py_srcfile,   /*PyObject *filename,*/
13753         py_funcname,  /*PyObject *name,*/
13754         py_line,
13755         __pyx_empty_bytes  /*PyObject *lnotab*/
13756     );
13757     Py_DECREF(py_srcfile);
13758     Py_DECREF(py_funcname);
13759     return py_code;
13760 bad:
13761     Py_XDECREF(py_srcfile);
13762     Py_XDECREF(py_funcname);
13763     return NULL;
13764 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)13765 static void __Pyx_AddTraceback(const char *funcname, int c_line,
13766                                int py_line, const char *filename) {
13767     PyCodeObject *py_code = 0;
13768     PyFrameObject *py_frame = 0;
13769     PyThreadState *tstate = __Pyx_PyThreadState_Current;
13770     if (c_line) {
13771         c_line = __Pyx_CLineForTraceback(tstate, c_line);
13772     }
13773     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
13774     if (!py_code) {
13775         py_code = __Pyx_CreateCodeObjectForTraceback(
13776             funcname, c_line, py_line, filename);
13777         if (!py_code) goto bad;
13778         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
13779     }
13780     py_frame = PyFrame_New(
13781         tstate,            /*PyThreadState *tstate,*/
13782         py_code,           /*PyCodeObject *code,*/
13783         __pyx_d,    /*PyObject *globals,*/
13784         0                  /*PyObject *locals*/
13785     );
13786     if (!py_frame) goto bad;
13787     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
13788     PyTraceBack_Here(py_frame);
13789 bad:
13790     Py_XDECREF(py_code);
13791     Py_XDECREF(py_frame);
13792 }
13793 
13794 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)13795 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
13796     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
13797         if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
13798     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
13799     return -1;
13800 }
__Pyx_ReleaseBuffer(Py_buffer * view)13801 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
13802     PyObject *obj = view->obj;
13803     if (!obj) return;
13804     if (PyObject_CheckBuffer(obj)) {
13805         PyBuffer_Release(view);
13806         return;
13807     }
13808     if ((0)) {}
13809         else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
13810     view->obj = NULL;
13811     Py_DECREF(obj);
13812 }
13813 #endif
13814 
13815 
13816   /* CIntFromPyVerify */
13817   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
13818     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
13819 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
13820     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
13821 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
13822     {\
13823         func_type value = func_value;\
13824         if (sizeof(target_type) < sizeof(func_type)) {\
13825             if (unlikely(value != (func_type) (target_type) value)) {\
13826                 func_type zero = 0;\
13827                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
13828                     return (target_type) -1;\
13829                 if (is_unsigned && unlikely(value < zero))\
13830                     goto raise_neg_overflow;\
13831                 else\
13832                     goto raise_overflow;\
13833             }\
13834         }\
13835         return (target_type) value;\
13836     }
13837 
13838 /* CIntToPy */
__Pyx_PyInt_From_int(int value)13839   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
13840     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
13841     const int is_unsigned = neg_one > const_zero;
13842     if (is_unsigned) {
13843         if (sizeof(int) < sizeof(long)) {
13844             return PyInt_FromLong((long) value);
13845         } else if (sizeof(int) <= sizeof(unsigned long)) {
13846             return PyLong_FromUnsignedLong((unsigned long) value);
13847 #ifdef HAVE_LONG_LONG
13848         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
13849             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13850 #endif
13851         }
13852     } else {
13853         if (sizeof(int) <= sizeof(long)) {
13854             return PyInt_FromLong((long) value);
13855 #ifdef HAVE_LONG_LONG
13856         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
13857             return PyLong_FromLongLong((PY_LONG_LONG) value);
13858 #endif
13859         }
13860     }
13861     {
13862         int one = 1; int little = (int)*(unsigned char *)&one;
13863         unsigned char *bytes = (unsigned char *)&value;
13864         return _PyLong_FromByteArray(bytes, sizeof(int),
13865                                      little, !is_unsigned);
13866     }
13867 }
13868 
13869 /* None */
__Pyx_pow_long(long b,long e)13870   static CYTHON_INLINE long __Pyx_pow_long(long b, long e) {
13871     long t = b;
13872     switch (e) {
13873         case 3:
13874             t *= b;
13875         CYTHON_FALLTHROUGH;
13876         case 2:
13877             t *= b;
13878         CYTHON_FALLTHROUGH;
13879         case 1:
13880             return t;
13881         case 0:
13882             return 1;
13883     }
13884     #if 1
13885     if (unlikely(e<0)) return 0;
13886     #endif
13887     t = 1;
13888     while (likely(e)) {
13889         t *= (b * (e&1)) | ((~e)&1);
13890         b *= b;
13891         e >>= 1;
13892     }
13893     return t;
13894 }
13895 
13896 /* CIntToPy */
__Pyx_PyInt_From_npy_int64(npy_int64 value)13897   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
13898     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
13899     const int is_unsigned = neg_one > const_zero;
13900     if (is_unsigned) {
13901         if (sizeof(npy_int64) < sizeof(long)) {
13902             return PyInt_FromLong((long) value);
13903         } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
13904             return PyLong_FromUnsignedLong((unsigned long) value);
13905 #ifdef HAVE_LONG_LONG
13906         } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
13907             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13908 #endif
13909         }
13910     } else {
13911         if (sizeof(npy_int64) <= sizeof(long)) {
13912             return PyInt_FromLong((long) value);
13913 #ifdef HAVE_LONG_LONG
13914         } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
13915             return PyLong_FromLongLong((PY_LONG_LONG) value);
13916 #endif
13917         }
13918     }
13919     {
13920         int one = 1; int little = (int)*(unsigned char *)&one;
13921         unsigned char *bytes = (unsigned char *)&value;
13922         return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
13923                                      little, !is_unsigned);
13924     }
13925 }
13926 
13927 /* Print */
13928   #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_GetStdout(void)13929 static PyObject *__Pyx_GetStdout(void) {
13930     PyObject *f = PySys_GetObject((char *)"stdout");
13931     if (!f) {
13932         PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
13933     }
13934     return f;
13935 }
__Pyx_Print(PyObject * f,PyObject * arg_tuple,int newline)13936 static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
13937     int i;
13938     if (!f) {
13939         if (!(f = __Pyx_GetStdout()))
13940             return -1;
13941     }
13942     Py_INCREF(f);
13943     for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
13944         PyObject* v;
13945         if (PyFile_SoftSpace(f, 1)) {
13946             if (PyFile_WriteString(" ", f) < 0)
13947                 goto error;
13948         }
13949         v = PyTuple_GET_ITEM(arg_tuple, i);
13950         if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
13951             goto error;
13952         if (PyString_Check(v)) {
13953             char *s = PyString_AsString(v);
13954             Py_ssize_t len = PyString_Size(v);
13955             if (len > 0) {
13956                 switch (s[len-1]) {
13957                     case ' ': break;
13958                     case '\f': case '\r': case '\n': case '\t': case '\v':
13959                         PyFile_SoftSpace(f, 0);
13960                         break;
13961                     default:  break;
13962                 }
13963             }
13964         }
13965     }
13966     if (newline) {
13967         if (PyFile_WriteString("\n", f) < 0)
13968             goto error;
13969         PyFile_SoftSpace(f, 0);
13970     }
13971     Py_DECREF(f);
13972     return 0;
13973 error:
13974     Py_DECREF(f);
13975     return -1;
13976 }
13977 #else
__Pyx_Print(PyObject * stream,PyObject * arg_tuple,int newline)13978 static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
13979     PyObject* kwargs = 0;
13980     PyObject* result = 0;
13981     PyObject* end_string;
13982     if (unlikely(!__pyx_print)) {
13983         __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
13984         if (!__pyx_print)
13985             return -1;
13986     }
13987     if (stream) {
13988         kwargs = PyDict_New();
13989         if (unlikely(!kwargs))
13990             return -1;
13991         if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
13992             goto bad;
13993         if (!newline) {
13994             end_string = PyUnicode_FromStringAndSize(" ", 1);
13995             if (unlikely(!end_string))
13996                 goto bad;
13997             if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
13998                 Py_DECREF(end_string);
13999                 goto bad;
14000             }
14001             Py_DECREF(end_string);
14002         }
14003     } else if (!newline) {
14004         if (unlikely(!__pyx_print_kwargs)) {
14005             __pyx_print_kwargs = PyDict_New();
14006             if (unlikely(!__pyx_print_kwargs))
14007                 return -1;
14008             end_string = PyUnicode_FromStringAndSize(" ", 1);
14009             if (unlikely(!end_string))
14010                 return -1;
14011             if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
14012                 Py_DECREF(end_string);
14013                 return -1;
14014             }
14015             Py_DECREF(end_string);
14016         }
14017         kwargs = __pyx_print_kwargs;
14018     }
14019     result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
14020     if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
14021         Py_DECREF(kwargs);
14022     if (!result)
14023         return -1;
14024     Py_DECREF(result);
14025     return 0;
14026 bad:
14027     if (kwargs != __pyx_print_kwargs)
14028         Py_XDECREF(kwargs);
14029     return -1;
14030 }
14031 #endif
14032 
14033 /* Declarations */
14034   #if CYTHON_CCOMPLEX
14035   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)14036     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14037       return ::std::complex< float >(x, y);
14038     }
14039   #else
__pyx_t_float_complex_from_parts(float x,float y)14040     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14041       return x + y*(__pyx_t_float_complex)_Complex_I;
14042     }
14043   #endif
14044 #else
__pyx_t_float_complex_from_parts(float x,float y)14045     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14046       __pyx_t_float_complex z;
14047       z.real = x;
14048       z.imag = y;
14049       return z;
14050     }
14051 #endif
14052 
14053 /* Arithmetic */
14054   #if CYTHON_CCOMPLEX
14055 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14056     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14057        return (a.real == b.real) && (a.imag == b.imag);
14058     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14059     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14060         __pyx_t_float_complex z;
14061         z.real = a.real + b.real;
14062         z.imag = a.imag + b.imag;
14063         return z;
14064     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14065     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14066         __pyx_t_float_complex z;
14067         z.real = a.real - b.real;
14068         z.imag = a.imag - b.imag;
14069         return z;
14070     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14071     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14072         __pyx_t_float_complex z;
14073         z.real = a.real * b.real - a.imag * b.imag;
14074         z.imag = a.real * b.imag + a.imag * b.real;
14075         return z;
14076     }
14077     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14078     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14079         if (b.imag == 0) {
14080             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
14081         } else if (fabsf(b.real) >= fabsf(b.imag)) {
14082             if (b.real == 0 && b.imag == 0) {
14083                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
14084             } else {
14085                 float r = b.imag / b.real;
14086                 float s = (float)(1.0) / (b.real + b.imag * r);
14087                 return __pyx_t_float_complex_from_parts(
14088                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
14089             }
14090         } else {
14091             float r = b.real / b.imag;
14092             float s = (float)(1.0) / (b.imag + b.real * r);
14093             return __pyx_t_float_complex_from_parts(
14094                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
14095         }
14096     }
14097     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14098     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14099         if (b.imag == 0) {
14100             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
14101         } else {
14102             float denom = b.real * b.real + b.imag * b.imag;
14103             return __pyx_t_float_complex_from_parts(
14104                 (a.real * b.real + a.imag * b.imag) / denom,
14105                 (a.imag * b.real - a.real * b.imag) / denom);
14106         }
14107     }
14108     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)14109     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
14110         __pyx_t_float_complex z;
14111         z.real = -a.real;
14112         z.imag = -a.imag;
14113         return z;
14114     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)14115     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
14116        return (a.real == 0) && (a.imag == 0);
14117     }
__Pyx_c_conj_float(__pyx_t_float_complex a)14118     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
14119         __pyx_t_float_complex z;
14120         z.real =  a.real;
14121         z.imag = -a.imag;
14122         return z;
14123     }
14124     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)14125         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
14126           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
14127             return sqrtf(z.real*z.real + z.imag*z.imag);
14128           #else
14129             return hypotf(z.real, z.imag);
14130           #endif
14131         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)14132         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14133             __pyx_t_float_complex z;
14134             float r, lnr, theta, z_r, z_theta;
14135             if (b.imag == 0 && b.real == (int)b.real) {
14136                 if (b.real < 0) {
14137                     float denom = a.real * a.real + a.imag * a.imag;
14138                     a.real = a.real / denom;
14139                     a.imag = -a.imag / denom;
14140                     b.real = -b.real;
14141                 }
14142                 switch ((int)b.real) {
14143                     case 0:
14144                         z.real = 1;
14145                         z.imag = 0;
14146                         return z;
14147                     case 1:
14148                         return a;
14149                     case 2:
14150                         z = __Pyx_c_prod_float(a, a);
14151                         return __Pyx_c_prod_float(a, a);
14152                     case 3:
14153                         z = __Pyx_c_prod_float(a, a);
14154                         return __Pyx_c_prod_float(z, a);
14155                     case 4:
14156                         z = __Pyx_c_prod_float(a, a);
14157                         return __Pyx_c_prod_float(z, z);
14158                 }
14159             }
14160             if (a.imag == 0) {
14161                 if (a.real == 0) {
14162                     return a;
14163                 } else if (b.imag == 0) {
14164                     z.real = powf(a.real, b.real);
14165                     z.imag = 0;
14166                     return z;
14167                 } else if (a.real > 0) {
14168                     r = a.real;
14169                     theta = 0;
14170                 } else {
14171                     r = -a.real;
14172                     theta = atan2f(0.0, -1.0);
14173                 }
14174             } else {
14175                 r = __Pyx_c_abs_float(a);
14176                 theta = atan2f(a.imag, a.real);
14177             }
14178             lnr = logf(r);
14179             z_r = expf(lnr * b.real - theta * b.imag);
14180             z_theta = theta * b.real + lnr * b.imag;
14181             z.real = z_r * cosf(z_theta);
14182             z.imag = z_r * sinf(z_theta);
14183             return z;
14184         }
14185     #endif
14186 #endif
14187 
14188 /* Declarations */
14189   #if CYTHON_CCOMPLEX
14190   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)14191     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14192       return ::std::complex< double >(x, y);
14193     }
14194   #else
__pyx_t_double_complex_from_parts(double x,double y)14195     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14196       return x + y*(__pyx_t_double_complex)_Complex_I;
14197     }
14198   #endif
14199 #else
__pyx_t_double_complex_from_parts(double x,double y)14200     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14201       __pyx_t_double_complex z;
14202       z.real = x;
14203       z.imag = y;
14204       return z;
14205     }
14206 #endif
14207 
14208 /* Arithmetic */
14209   #if CYTHON_CCOMPLEX
14210 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14211     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14212        return (a.real == b.real) && (a.imag == b.imag);
14213     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14214     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14215         __pyx_t_double_complex z;
14216         z.real = a.real + b.real;
14217         z.imag = a.imag + b.imag;
14218         return z;
14219     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14220     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14221         __pyx_t_double_complex z;
14222         z.real = a.real - b.real;
14223         z.imag = a.imag - b.imag;
14224         return z;
14225     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14226     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14227         __pyx_t_double_complex z;
14228         z.real = a.real * b.real - a.imag * b.imag;
14229         z.imag = a.real * b.imag + a.imag * b.real;
14230         return z;
14231     }
14232     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14233     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14234         if (b.imag == 0) {
14235             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
14236         } else if (fabs(b.real) >= fabs(b.imag)) {
14237             if (b.real == 0 && b.imag == 0) {
14238                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
14239             } else {
14240                 double r = b.imag / b.real;
14241                 double s = (double)(1.0) / (b.real + b.imag * r);
14242                 return __pyx_t_double_complex_from_parts(
14243                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
14244             }
14245         } else {
14246             double r = b.real / b.imag;
14247             double s = (double)(1.0) / (b.imag + b.real * r);
14248             return __pyx_t_double_complex_from_parts(
14249                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
14250         }
14251     }
14252     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14253     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14254         if (b.imag == 0) {
14255             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
14256         } else {
14257             double denom = b.real * b.real + b.imag * b.imag;
14258             return __pyx_t_double_complex_from_parts(
14259                 (a.real * b.real + a.imag * b.imag) / denom,
14260                 (a.imag * b.real - a.real * b.imag) / denom);
14261         }
14262     }
14263     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)14264     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
14265         __pyx_t_double_complex z;
14266         z.real = -a.real;
14267         z.imag = -a.imag;
14268         return z;
14269     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)14270     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
14271        return (a.real == 0) && (a.imag == 0);
14272     }
__Pyx_c_conj_double(__pyx_t_double_complex a)14273     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
14274         __pyx_t_double_complex z;
14275         z.real =  a.real;
14276         z.imag = -a.imag;
14277         return z;
14278     }
14279     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)14280         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
14281           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
14282             return sqrt(z.real*z.real + z.imag*z.imag);
14283           #else
14284             return hypot(z.real, z.imag);
14285           #endif
14286         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)14287         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14288             __pyx_t_double_complex z;
14289             double r, lnr, theta, z_r, z_theta;
14290             if (b.imag == 0 && b.real == (int)b.real) {
14291                 if (b.real < 0) {
14292                     double denom = a.real * a.real + a.imag * a.imag;
14293                     a.real = a.real / denom;
14294                     a.imag = -a.imag / denom;
14295                     b.real = -b.real;
14296                 }
14297                 switch ((int)b.real) {
14298                     case 0:
14299                         z.real = 1;
14300                         z.imag = 0;
14301                         return z;
14302                     case 1:
14303                         return a;
14304                     case 2:
14305                         z = __Pyx_c_prod_double(a, a);
14306                         return __Pyx_c_prod_double(a, a);
14307                     case 3:
14308                         z = __Pyx_c_prod_double(a, a);
14309                         return __Pyx_c_prod_double(z, a);
14310                     case 4:
14311                         z = __Pyx_c_prod_double(a, a);
14312                         return __Pyx_c_prod_double(z, z);
14313                 }
14314             }
14315             if (a.imag == 0) {
14316                 if (a.real == 0) {
14317                     return a;
14318                 } else if (b.imag == 0) {
14319                     z.real = pow(a.real, b.real);
14320                     z.imag = 0;
14321                     return z;
14322                 } else if (a.real > 0) {
14323                     r = a.real;
14324                     theta = 0;
14325                 } else {
14326                     r = -a.real;
14327                     theta = atan2(0.0, -1.0);
14328                 }
14329             } else {
14330                 r = __Pyx_c_abs_double(a);
14331                 theta = atan2(a.imag, a.real);
14332             }
14333             lnr = log(r);
14334             z_r = exp(lnr * b.real - theta * b.imag);
14335             z_theta = theta * b.real + lnr * b.imag;
14336             z.real = z_r * cos(z_theta);
14337             z.imag = z_r * sin(z_theta);
14338             return z;
14339         }
14340     #endif
14341 #endif
14342 
14343 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)14344   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
14345     const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
14346     const int is_unsigned = neg_one > const_zero;
14347     if (is_unsigned) {
14348         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
14349             return PyInt_FromLong((long) value);
14350         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
14351             return PyLong_FromUnsignedLong((unsigned long) value);
14352 #ifdef HAVE_LONG_LONG
14353         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
14354             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14355 #endif
14356         }
14357     } else {
14358         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
14359             return PyInt_FromLong((long) value);
14360 #ifdef HAVE_LONG_LONG
14361         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
14362             return PyLong_FromLongLong((PY_LONG_LONG) value);
14363 #endif
14364         }
14365     }
14366     {
14367         int one = 1; int little = (int)*(unsigned char *)&one;
14368         unsigned char *bytes = (unsigned char *)&value;
14369         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
14370                                      little, !is_unsigned);
14371     }
14372 }
14373 
14374 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)14375   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
14376     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
14377     const int is_unsigned = neg_one > const_zero;
14378 #if PY_MAJOR_VERSION < 3
14379     if (likely(PyInt_Check(x))) {
14380         if (sizeof(int) < sizeof(long)) {
14381             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
14382         } else {
14383             long val = PyInt_AS_LONG(x);
14384             if (is_unsigned && unlikely(val < 0)) {
14385                 goto raise_neg_overflow;
14386             }
14387             return (int) val;
14388         }
14389     } else
14390 #endif
14391     if (likely(PyLong_Check(x))) {
14392         if (is_unsigned) {
14393 #if CYTHON_USE_PYLONG_INTERNALS
14394             const digit* digits = ((PyLongObject*)x)->ob_digit;
14395             switch (Py_SIZE(x)) {
14396                 case  0: return (int) 0;
14397                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
14398                 case 2:
14399                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
14400                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14401                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14402                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
14403                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
14404                         }
14405                     }
14406                     break;
14407                 case 3:
14408                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
14409                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
14410                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14411                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
14412                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
14413                         }
14414                     }
14415                     break;
14416                 case 4:
14417                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
14418                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
14419                             __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])))
14420                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
14421                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
14422                         }
14423                     }
14424                     break;
14425             }
14426 #endif
14427 #if CYTHON_COMPILING_IN_CPYTHON
14428             if (unlikely(Py_SIZE(x) < 0)) {
14429                 goto raise_neg_overflow;
14430             }
14431 #else
14432             {
14433                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14434                 if (unlikely(result < 0))
14435                     return (int) -1;
14436                 if (unlikely(result == 1))
14437                     goto raise_neg_overflow;
14438             }
14439 #endif
14440             if (sizeof(int) <= sizeof(unsigned long)) {
14441                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
14442 #ifdef HAVE_LONG_LONG
14443             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
14444                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14445 #endif
14446             }
14447         } else {
14448 #if CYTHON_USE_PYLONG_INTERNALS
14449             const digit* digits = ((PyLongObject*)x)->ob_digit;
14450             switch (Py_SIZE(x)) {
14451                 case  0: return (int) 0;
14452                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
14453                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
14454                 case -2:
14455                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
14456                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14457                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14458                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
14459                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14460                         }
14461                     }
14462                     break;
14463                 case 2:
14464                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
14465                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14466                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14467                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
14468                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14469                         }
14470                     }
14471                     break;
14472                 case -3:
14473                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
14474                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
14475                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14476                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
14477                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14478                         }
14479                     }
14480                     break;
14481                 case 3:
14482                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
14483                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
14484                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14485                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
14486                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14487                         }
14488                     }
14489                     break;
14490                 case -4:
14491                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
14492                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
14493                             __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])))
14494                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
14495                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14496                         }
14497                     }
14498                     break;
14499                 case 4:
14500                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
14501                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
14502                             __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])))
14503                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
14504                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
14505                         }
14506                     }
14507                     break;
14508             }
14509 #endif
14510             if (sizeof(int) <= sizeof(long)) {
14511                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
14512 #ifdef HAVE_LONG_LONG
14513             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
14514                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
14515 #endif
14516             }
14517         }
14518         {
14519 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
14520             PyErr_SetString(PyExc_RuntimeError,
14521                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
14522 #else
14523             int val;
14524             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
14525  #if PY_MAJOR_VERSION < 3
14526             if (likely(v) && !PyLong_Check(v)) {
14527                 PyObject *tmp = v;
14528                 v = PyNumber_Long(tmp);
14529                 Py_DECREF(tmp);
14530             }
14531  #endif
14532             if (likely(v)) {
14533                 int one = 1; int is_little = (int)*(unsigned char *)&one;
14534                 unsigned char *bytes = (unsigned char *)&val;
14535                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
14536                                               bytes, sizeof(val),
14537                                               is_little, !is_unsigned);
14538                 Py_DECREF(v);
14539                 if (likely(!ret))
14540                     return val;
14541             }
14542 #endif
14543             return (int) -1;
14544         }
14545     } else {
14546         int val;
14547         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14548         if (!tmp) return (int) -1;
14549         val = __Pyx_PyInt_As_int(tmp);
14550         Py_DECREF(tmp);
14551         return val;
14552     }
14553 raise_overflow:
14554     PyErr_SetString(PyExc_OverflowError,
14555         "value too large to convert to int");
14556     return (int) -1;
14557 raise_neg_overflow:
14558     PyErr_SetString(PyExc_OverflowError,
14559         "can't convert negative value to int");
14560     return (int) -1;
14561 }
14562 
14563 /* PrintOne */
14564   #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_PrintOne(PyObject * f,PyObject * o)14565 static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
14566     if (!f) {
14567         if (!(f = __Pyx_GetStdout()))
14568             return -1;
14569     }
14570     Py_INCREF(f);
14571     if (PyFile_SoftSpace(f, 0)) {
14572         if (PyFile_WriteString(" ", f) < 0)
14573             goto error;
14574     }
14575     if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
14576         goto error;
14577     if (PyFile_WriteString("\n", f) < 0)
14578         goto error;
14579     Py_DECREF(f);
14580     return 0;
14581 error:
14582     Py_DECREF(f);
14583     return -1;
14584     /* the line below is just to avoid C compiler
14585      * warnings about unused functions */
14586     return __Pyx_Print(f, NULL, 0);
14587 }
14588 #else
__Pyx_PrintOne(PyObject * stream,PyObject * o)14589 static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
14590     int res;
14591     PyObject* arg_tuple = PyTuple_Pack(1, o);
14592     if (unlikely(!arg_tuple))
14593         return -1;
14594     res = __Pyx_Print(stream, arg_tuple, 1);
14595     Py_DECREF(arg_tuple);
14596     return res;
14597 }
14598 #endif
14599 
14600 /* CIntToPy */
__Pyx_PyInt_From_long(long value)14601   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
14602     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
14603     const int is_unsigned = neg_one > const_zero;
14604     if (is_unsigned) {
14605         if (sizeof(long) < sizeof(long)) {
14606             return PyInt_FromLong((long) value);
14607         } else if (sizeof(long) <= sizeof(unsigned long)) {
14608             return PyLong_FromUnsignedLong((unsigned long) value);
14609 #ifdef HAVE_LONG_LONG
14610         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
14611             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14612 #endif
14613         }
14614     } else {
14615         if (sizeof(long) <= sizeof(long)) {
14616             return PyInt_FromLong((long) value);
14617 #ifdef HAVE_LONG_LONG
14618         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
14619             return PyLong_FromLongLong((PY_LONG_LONG) value);
14620 #endif
14621         }
14622     }
14623     {
14624         int one = 1; int little = (int)*(unsigned char *)&one;
14625         unsigned char *bytes = (unsigned char *)&value;
14626         return _PyLong_FromByteArray(bytes, sizeof(long),
14627                                      little, !is_unsigned);
14628     }
14629 }
14630 
14631 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)14632   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
14633     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
14634     const int is_unsigned = neg_one > const_zero;
14635 #if PY_MAJOR_VERSION < 3
14636     if (likely(PyInt_Check(x))) {
14637         if (sizeof(long) < sizeof(long)) {
14638             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
14639         } else {
14640             long val = PyInt_AS_LONG(x);
14641             if (is_unsigned && unlikely(val < 0)) {
14642                 goto raise_neg_overflow;
14643             }
14644             return (long) val;
14645         }
14646     } else
14647 #endif
14648     if (likely(PyLong_Check(x))) {
14649         if (is_unsigned) {
14650 #if CYTHON_USE_PYLONG_INTERNALS
14651             const digit* digits = ((PyLongObject*)x)->ob_digit;
14652             switch (Py_SIZE(x)) {
14653                 case  0: return (long) 0;
14654                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
14655                 case 2:
14656                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
14657                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14658                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14659                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
14660                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14661                         }
14662                     }
14663                     break;
14664                 case 3:
14665                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
14666                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
14667                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14668                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
14669                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14670                         }
14671                     }
14672                     break;
14673                 case 4:
14674                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
14675                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
14676                             __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])))
14677                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
14678                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
14679                         }
14680                     }
14681                     break;
14682             }
14683 #endif
14684 #if CYTHON_COMPILING_IN_CPYTHON
14685             if (unlikely(Py_SIZE(x) < 0)) {
14686                 goto raise_neg_overflow;
14687             }
14688 #else
14689             {
14690                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
14691                 if (unlikely(result < 0))
14692                     return (long) -1;
14693                 if (unlikely(result == 1))
14694                     goto raise_neg_overflow;
14695             }
14696 #endif
14697             if (sizeof(long) <= sizeof(unsigned long)) {
14698                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
14699 #ifdef HAVE_LONG_LONG
14700             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
14701                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
14702 #endif
14703             }
14704         } else {
14705 #if CYTHON_USE_PYLONG_INTERNALS
14706             const digit* digits = ((PyLongObject*)x)->ob_digit;
14707             switch (Py_SIZE(x)) {
14708                 case  0: return (long) 0;
14709                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
14710                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
14711                 case -2:
14712                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
14713                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14714                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14715                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
14716                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14717                         }
14718                     }
14719                     break;
14720                 case 2:
14721                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
14722                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
14723                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14724                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
14725                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14726                         }
14727                     }
14728                     break;
14729                 case -3:
14730                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
14731                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
14732                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14733                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
14734                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14735                         }
14736                     }
14737                     break;
14738                 case 3:
14739                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
14740                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
14741                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
14742                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
14743                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14744                         }
14745                     }
14746                     break;
14747                 case -4:
14748                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
14749                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
14750                             __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])))
14751                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
14752                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14753                         }
14754                     }
14755                     break;
14756                 case 4:
14757                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
14758                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
14759                             __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])))
14760                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
14761                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
14762                         }
14763                     }
14764                     break;
14765             }
14766 #endif
14767             if (sizeof(long) <= sizeof(long)) {
14768                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
14769 #ifdef HAVE_LONG_LONG
14770             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
14771                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
14772 #endif
14773             }
14774         }
14775         {
14776 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
14777             PyErr_SetString(PyExc_RuntimeError,
14778                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
14779 #else
14780             long val;
14781             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
14782  #if PY_MAJOR_VERSION < 3
14783             if (likely(v) && !PyLong_Check(v)) {
14784                 PyObject *tmp = v;
14785                 v = PyNumber_Long(tmp);
14786                 Py_DECREF(tmp);
14787             }
14788  #endif
14789             if (likely(v)) {
14790                 int one = 1; int is_little = (int)*(unsigned char *)&one;
14791                 unsigned char *bytes = (unsigned char *)&val;
14792                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
14793                                               bytes, sizeof(val),
14794                                               is_little, !is_unsigned);
14795                 Py_DECREF(v);
14796                 if (likely(!ret))
14797                     return val;
14798             }
14799 #endif
14800             return (long) -1;
14801         }
14802     } else {
14803         long val;
14804         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
14805         if (!tmp) return (long) -1;
14806         val = __Pyx_PyInt_As_long(tmp);
14807         Py_DECREF(tmp);
14808         return val;
14809     }
14810 raise_overflow:
14811     PyErr_SetString(PyExc_OverflowError,
14812         "value too large to convert to long");
14813     return (long) -1;
14814 raise_neg_overflow:
14815     PyErr_SetString(PyExc_OverflowError,
14816         "can't convert negative value to long");
14817     return (long) -1;
14818 }
14819 
14820 /* FastTypeChecks */
14821   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)14822 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
14823     while (a) {
14824         a = a->tp_base;
14825         if (a == b)
14826             return 1;
14827     }
14828     return b == &PyBaseObject_Type;
14829 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)14830 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
14831     PyObject *mro;
14832     if (a == b) return 1;
14833     mro = a->tp_mro;
14834     if (likely(mro)) {
14835         Py_ssize_t i, n;
14836         n = PyTuple_GET_SIZE(mro);
14837         for (i = 0; i < n; i++) {
14838             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
14839                 return 1;
14840         }
14841         return 0;
14842     }
14843     return __Pyx_InBases(a, b);
14844 }
14845 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14846 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
14847     PyObject *exception, *value, *tb;
14848     int res;
14849     __Pyx_PyThreadState_declare
14850     __Pyx_PyThreadState_assign
14851     __Pyx_ErrFetch(&exception, &value, &tb);
14852     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
14853     if (unlikely(res == -1)) {
14854         PyErr_WriteUnraisable(err);
14855         res = 0;
14856     }
14857     if (!res) {
14858         res = PyObject_IsSubclass(err, exc_type2);
14859         if (unlikely(res == -1)) {
14860             PyErr_WriteUnraisable(err);
14861             res = 0;
14862         }
14863     }
14864     __Pyx_ErrRestore(exception, value, tb);
14865     return res;
14866 }
14867 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14868 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
14869     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
14870     if (!res) {
14871         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
14872     }
14873     return res;
14874 }
14875 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)14876 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
14877     Py_ssize_t i, n;
14878     assert(PyExceptionClass_Check(exc_type));
14879     n = PyTuple_GET_SIZE(tuple);
14880 #if PY_MAJOR_VERSION >= 3
14881     for (i=0; i<n; i++) {
14882         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
14883     }
14884 #endif
14885     for (i=0; i<n; i++) {
14886         PyObject *t = PyTuple_GET_ITEM(tuple, i);
14887         #if PY_MAJOR_VERSION < 3
14888         if (likely(exc_type == t)) return 1;
14889         #endif
14890         if (likely(PyExceptionClass_Check(t))) {
14891             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
14892         } else {
14893         }
14894     }
14895     return 0;
14896 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)14897 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
14898     if (likely(err == exc_type)) return 1;
14899     if (likely(PyExceptionClass_Check(err))) {
14900         if (likely(PyExceptionClass_Check(exc_type))) {
14901             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
14902         } else if (likely(PyTuple_Check(exc_type))) {
14903             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
14904         } else {
14905         }
14906     }
14907     return PyErr_GivenExceptionMatches(err, exc_type);
14908 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)14909 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
14910     assert(PyExceptionClass_Check(exc_type1));
14911     assert(PyExceptionClass_Check(exc_type2));
14912     if (likely(err == exc_type1 || err == exc_type2)) return 1;
14913     if (likely(PyExceptionClass_Check(err))) {
14914         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
14915     }
14916     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
14917 }
14918 #endif
14919 
14920 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)14921   static int __Pyx_check_binary_version(void) {
14922     char ctversion[4], rtversion[4];
14923     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
14924     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
14925     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
14926         char message[200];
14927         PyOS_snprintf(message, sizeof(message),
14928                       "compiletime version %s of module '%.100s' "
14929                       "does not match runtime version %s",
14930                       ctversion, __Pyx_MODULE_NAME, rtversion);
14931         return PyErr_WarnEx(NULL, message, 1);
14932     }
14933     return 0;
14934 }
14935 
14936 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)14937   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
14938     while (t->p) {
14939         #if PY_MAJOR_VERSION < 3
14940         if (t->is_unicode) {
14941             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
14942         } else if (t->intern) {
14943             *t->p = PyString_InternFromString(t->s);
14944         } else {
14945             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
14946         }
14947         #else
14948         if (t->is_unicode | t->is_str) {
14949             if (t->intern) {
14950                 *t->p = PyUnicode_InternFromString(t->s);
14951             } else if (t->encoding) {
14952                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
14953             } else {
14954                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
14955             }
14956         } else {
14957             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
14958         }
14959         #endif
14960         if (!*t->p)
14961             return -1;
14962         if (PyObject_Hash(*t->p) == -1)
14963             return -1;
14964         ++t;
14965     }
14966     return 0;
14967 }
14968 
__Pyx_PyUnicode_FromString(const char * c_str)14969 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
14970     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
14971 }
__Pyx_PyObject_AsString(PyObject * o)14972 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
14973     Py_ssize_t ignore;
14974     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
14975 }
14976 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
14977 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)14978 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
14979     char* defenc_c;
14980     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
14981     if (!defenc) return NULL;
14982     defenc_c = PyBytes_AS_STRING(defenc);
14983 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
14984     {
14985         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
14986         char* c;
14987         for (c = defenc_c; c < end; c++) {
14988             if ((unsigned char) (*c) >= 128) {
14989                 PyUnicode_AsASCIIString(o);
14990                 return NULL;
14991             }
14992         }
14993     }
14994 #endif
14995     *length = PyBytes_GET_SIZE(defenc);
14996     return defenc_c;
14997 }
14998 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)14999 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15000     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
15001 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15002     if (likely(PyUnicode_IS_ASCII(o))) {
15003         *length = PyUnicode_GET_LENGTH(o);
15004         return PyUnicode_AsUTF8(o);
15005     } else {
15006         PyUnicode_AsASCIIString(o);
15007         return NULL;
15008     }
15009 #else
15010     return PyUnicode_AsUTF8AndSize(o, length);
15011 #endif
15012 }
15013 #endif
15014 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)15015 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15016 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
15017     if (
15018 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15019             __Pyx_sys_getdefaultencoding_not_ascii &&
15020 #endif
15021             PyUnicode_Check(o)) {
15022         return __Pyx_PyUnicode_AsStringAndSize(o, length);
15023     } else
15024 #endif
15025 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
15026     if (PyByteArray_Check(o)) {
15027         *length = PyByteArray_GET_SIZE(o);
15028         return PyByteArray_AS_STRING(o);
15029     } else
15030 #endif
15031     {
15032         char* result;
15033         int r = PyBytes_AsStringAndSize(o, &result, length);
15034         if (unlikely(r < 0)) {
15035             return NULL;
15036         } else {
15037             return result;
15038         }
15039     }
15040 }
__Pyx_PyObject_IsTrue(PyObject * x)15041 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
15042    int is_true = x == Py_True;
15043    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
15044    else return PyObject_IsTrue(x);
15045 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)15046 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
15047     int retval;
15048     if (unlikely(!x)) return -1;
15049     retval = __Pyx_PyObject_IsTrue(x);
15050     Py_DECREF(x);
15051     return retval;
15052 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)15053 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
15054 #if PY_MAJOR_VERSION >= 3
15055     if (PyLong_Check(result)) {
15056         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
15057                 "__int__ returned non-int (type %.200s).  "
15058                 "The ability to return an instance of a strict subclass of int "
15059                 "is deprecated, and may be removed in a future version of Python.",
15060                 Py_TYPE(result)->tp_name)) {
15061             Py_DECREF(result);
15062             return NULL;
15063         }
15064         return result;
15065     }
15066 #endif
15067     PyErr_Format(PyExc_TypeError,
15068                  "__%.4s__ returned non-%.4s (type %.200s)",
15069                  type_name, type_name, Py_TYPE(result)->tp_name);
15070     Py_DECREF(result);
15071     return NULL;
15072 }
__Pyx_PyNumber_IntOrLong(PyObject * x)15073 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
15074 #if CYTHON_USE_TYPE_SLOTS
15075   PyNumberMethods *m;
15076 #endif
15077   const char *name = NULL;
15078   PyObject *res = NULL;
15079 #if PY_MAJOR_VERSION < 3
15080   if (likely(PyInt_Check(x) || PyLong_Check(x)))
15081 #else
15082   if (likely(PyLong_Check(x)))
15083 #endif
15084     return __Pyx_NewRef(x);
15085 #if CYTHON_USE_TYPE_SLOTS
15086   m = Py_TYPE(x)->tp_as_number;
15087   #if PY_MAJOR_VERSION < 3
15088   if (m && m->nb_int) {
15089     name = "int";
15090     res = m->nb_int(x);
15091   }
15092   else if (m && m->nb_long) {
15093     name = "long";
15094     res = m->nb_long(x);
15095   }
15096   #else
15097   if (likely(m && m->nb_int)) {
15098     name = "int";
15099     res = m->nb_int(x);
15100   }
15101   #endif
15102 #else
15103   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
15104     res = PyNumber_Int(x);
15105   }
15106 #endif
15107   if (likely(res)) {
15108 #if PY_MAJOR_VERSION < 3
15109     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
15110 #else
15111     if (unlikely(!PyLong_CheckExact(res))) {
15112 #endif
15113         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
15114     }
15115   }
15116   else if (!PyErr_Occurred()) {
15117     PyErr_SetString(PyExc_TypeError,
15118                     "an integer is required");
15119   }
15120   return res;
15121 }
15122 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
15123   Py_ssize_t ival;
15124   PyObject *x;
15125 #if PY_MAJOR_VERSION < 3
15126   if (likely(PyInt_CheckExact(b))) {
15127     if (sizeof(Py_ssize_t) >= sizeof(long))
15128         return PyInt_AS_LONG(b);
15129     else
15130         return PyInt_AsSsize_t(b);
15131   }
15132 #endif
15133   if (likely(PyLong_CheckExact(b))) {
15134     #if CYTHON_USE_PYLONG_INTERNALS
15135     const digit* digits = ((PyLongObject*)b)->ob_digit;
15136     const Py_ssize_t size = Py_SIZE(b);
15137     if (likely(__Pyx_sst_abs(size) <= 1)) {
15138         ival = likely(size) ? digits[0] : 0;
15139         if (size == -1) ival = -ival;
15140         return ival;
15141     } else {
15142       switch (size) {
15143          case 2:
15144            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
15145              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15146            }
15147            break;
15148          case -2:
15149            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
15150              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15151            }
15152            break;
15153          case 3:
15154            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
15155              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15156            }
15157            break;
15158          case -3:
15159            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
15160              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15161            }
15162            break;
15163          case 4:
15164            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
15165              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]));
15166            }
15167            break;
15168          case -4:
15169            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
15170              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]));
15171            }
15172            break;
15173       }
15174     }
15175     #endif
15176     return PyLong_AsSsize_t(b);
15177   }
15178   x = PyNumber_Index(b);
15179   if (!x) return -1;
15180   ival = PyInt_AsSsize_t(x);
15181   Py_DECREF(x);
15182   return ival;
15183 }
15184 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
15185   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
15186 }
15187 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
15188     return PyInt_FromSize_t(ival);
15189 }
15190 
15191 
15192 #endif /* Py_PYTHON_H */
15193