proteus  1.8.1
C/C++/Fortran libraries
Isosurface.c
Go to the documentation of this file.
1 /* Generated by Cython 0.29.30 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8  #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10  #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_30"
13 #define CYTHON_HEX_VERSION 0x001D1EF0
14 #define CYTHON_FUTURE_DIVISION 0
15 #include <stddef.h>
16 #ifndef offsetof
17  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20  #ifndef __stdcall
21  #define __stdcall
22  #endif
23  #ifndef __cdecl
24  #define __cdecl
25  #endif
26  #ifndef __fastcall
27  #define __fastcall
28  #endif
29 #endif
30 #ifndef DL_IMPORT
31  #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34  #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38  #if PY_VERSION_HEX >= 0x02070000
39  #define HAVE_LONG_LONG
40  #endif
41 #endif
42 #ifndef PY_LONG_LONG
43  #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46  #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49  #define CYTHON_COMPILING_IN_PYPY 1
50  #define CYTHON_COMPILING_IN_PYSTON 0
51  #define CYTHON_COMPILING_IN_CPYTHON 0
52  #undef CYTHON_USE_TYPE_SLOTS
53  #define CYTHON_USE_TYPE_SLOTS 0
54  #undef CYTHON_USE_PYTYPE_LOOKUP
55  #define CYTHON_USE_PYTYPE_LOOKUP 0
56  #if PY_VERSION_HEX < 0x03050000
57  #undef CYTHON_USE_ASYNC_SLOTS
58  #define CYTHON_USE_ASYNC_SLOTS 0
59  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60  #define CYTHON_USE_ASYNC_SLOTS 1
61  #endif
62  #undef CYTHON_USE_PYLIST_INTERNALS
63  #define CYTHON_USE_PYLIST_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_INTERNALS
65  #define CYTHON_USE_UNICODE_INTERNALS 0
66  #undef CYTHON_USE_UNICODE_WRITER
67  #define CYTHON_USE_UNICODE_WRITER 0
68  #undef CYTHON_USE_PYLONG_INTERNALS
69  #define CYTHON_USE_PYLONG_INTERNALS 0
70  #undef CYTHON_AVOID_BORROWED_REFS
71  #define CYTHON_AVOID_BORROWED_REFS 1
72  #undef CYTHON_ASSUME_SAFE_MACROS
73  #define CYTHON_ASSUME_SAFE_MACROS 0
74  #undef CYTHON_UNPACK_METHODS
75  #define CYTHON_UNPACK_METHODS 0
76  #undef CYTHON_FAST_THREAD_STATE
77  #define CYTHON_FAST_THREAD_STATE 0
78  #undef CYTHON_FAST_PYCALL
79  #define CYTHON_FAST_PYCALL 0
80  #undef CYTHON_PEP489_MULTI_PHASE_INIT
81  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82  #undef CYTHON_USE_TP_FINALIZE
83  #define CYTHON_USE_TP_FINALIZE 0
84  #undef CYTHON_USE_DICT_VERSIONS
85  #define CYTHON_USE_DICT_VERSIONS 0
86  #undef CYTHON_USE_EXC_INFO_STACK
87  #define CYTHON_USE_EXC_INFO_STACK 0
88  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
89  #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
90  #endif
91 #elif defined(PYSTON_VERSION)
92  #define CYTHON_COMPILING_IN_PYPY 0
93  #define CYTHON_COMPILING_IN_PYSTON 1
94  #define CYTHON_COMPILING_IN_CPYTHON 0
95  #ifndef CYTHON_USE_TYPE_SLOTS
96  #define CYTHON_USE_TYPE_SLOTS 1
97  #endif
98  #undef CYTHON_USE_PYTYPE_LOOKUP
99  #define CYTHON_USE_PYTYPE_LOOKUP 0
100  #undef CYTHON_USE_ASYNC_SLOTS
101  #define CYTHON_USE_ASYNC_SLOTS 0
102  #undef CYTHON_USE_PYLIST_INTERNALS
103  #define CYTHON_USE_PYLIST_INTERNALS 0
104  #ifndef CYTHON_USE_UNICODE_INTERNALS
105  #define CYTHON_USE_UNICODE_INTERNALS 1
106  #endif
107  #undef CYTHON_USE_UNICODE_WRITER
108  #define CYTHON_USE_UNICODE_WRITER 0
109  #undef CYTHON_USE_PYLONG_INTERNALS
110  #define CYTHON_USE_PYLONG_INTERNALS 0
111  #ifndef CYTHON_AVOID_BORROWED_REFS
112  #define CYTHON_AVOID_BORROWED_REFS 0
113  #endif
114  #ifndef CYTHON_ASSUME_SAFE_MACROS
115  #define CYTHON_ASSUME_SAFE_MACROS 1
116  #endif
117  #ifndef CYTHON_UNPACK_METHODS
118  #define CYTHON_UNPACK_METHODS 1
119  #endif
120  #undef CYTHON_FAST_THREAD_STATE
121  #define CYTHON_FAST_THREAD_STATE 0
122  #undef CYTHON_FAST_PYCALL
123  #define CYTHON_FAST_PYCALL 0
124  #undef CYTHON_PEP489_MULTI_PHASE_INIT
125  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
126  #undef CYTHON_USE_TP_FINALIZE
127  #define CYTHON_USE_TP_FINALIZE 0
128  #undef CYTHON_USE_DICT_VERSIONS
129  #define CYTHON_USE_DICT_VERSIONS 0
130  #undef CYTHON_USE_EXC_INFO_STACK
131  #define CYTHON_USE_EXC_INFO_STACK 0
132  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
133  #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
134  #endif
135 #else
136  #define CYTHON_COMPILING_IN_PYPY 0
137  #define CYTHON_COMPILING_IN_PYSTON 0
138  #define CYTHON_COMPILING_IN_CPYTHON 1
139  #ifndef CYTHON_USE_TYPE_SLOTS
140  #define CYTHON_USE_TYPE_SLOTS 1
141  #endif
142  #if PY_VERSION_HEX < 0x02070000
143  #undef CYTHON_USE_PYTYPE_LOOKUP
144  #define CYTHON_USE_PYTYPE_LOOKUP 0
145  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
146  #define CYTHON_USE_PYTYPE_LOOKUP 1
147  #endif
148  #if PY_MAJOR_VERSION < 3
149  #undef CYTHON_USE_ASYNC_SLOTS
150  #define CYTHON_USE_ASYNC_SLOTS 0
151  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
152  #define CYTHON_USE_ASYNC_SLOTS 1
153  #endif
154  #if PY_VERSION_HEX < 0x02070000
155  #undef CYTHON_USE_PYLONG_INTERNALS
156  #define CYTHON_USE_PYLONG_INTERNALS 0
157  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
158  #define CYTHON_USE_PYLONG_INTERNALS 1
159  #endif
160  #ifndef CYTHON_USE_PYLIST_INTERNALS
161  #define CYTHON_USE_PYLIST_INTERNALS 1
162  #endif
163  #ifndef CYTHON_USE_UNICODE_INTERNALS
164  #define CYTHON_USE_UNICODE_INTERNALS 1
165  #endif
166  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
167  #undef CYTHON_USE_UNICODE_WRITER
168  #define CYTHON_USE_UNICODE_WRITER 0
169  #elif !defined(CYTHON_USE_UNICODE_WRITER)
170  #define CYTHON_USE_UNICODE_WRITER 1
171  #endif
172  #ifndef CYTHON_AVOID_BORROWED_REFS
173  #define CYTHON_AVOID_BORROWED_REFS 0
174  #endif
175  #ifndef CYTHON_ASSUME_SAFE_MACROS
176  #define CYTHON_ASSUME_SAFE_MACROS 1
177  #endif
178  #ifndef CYTHON_UNPACK_METHODS
179  #define CYTHON_UNPACK_METHODS 1
180  #endif
181  #if PY_VERSION_HEX >= 0x030B00A4
182  #undef CYTHON_FAST_THREAD_STATE
183  #define CYTHON_FAST_THREAD_STATE 0
184  #elif !defined(CYTHON_FAST_THREAD_STATE)
185  #define CYTHON_FAST_THREAD_STATE 1
186  #endif
187  #ifndef CYTHON_FAST_PYCALL
188  #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
189  #endif
190  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
191  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
192  #endif
193  #ifndef CYTHON_USE_TP_FINALIZE
194  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
195  #endif
196  #ifndef CYTHON_USE_DICT_VERSIONS
197  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
198  #endif
199  #if PY_VERSION_HEX >= 0x030B00A4
200  #undef CYTHON_USE_EXC_INFO_STACK
201  #define CYTHON_USE_EXC_INFO_STACK 0
202  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
203  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
204  #endif
205  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
206  #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
207  #endif
208 #endif
209 #if !defined(CYTHON_FAST_PYCCALL)
210 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
211 #endif
212 #if CYTHON_USE_PYLONG_INTERNALS
213  #if PY_MAJOR_VERSION < 3
214  #include "longintrepr.h"
215  #endif
216  #undef SHIFT
217  #undef BASE
218  #undef MASK
219  #ifdef SIZEOF_VOID_P
220  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
221  #endif
222 #endif
223 #ifndef __has_attribute
224  #define __has_attribute(x) 0
225 #endif
226 #ifndef __has_cpp_attribute
227  #define __has_cpp_attribute(x) 0
228 #endif
229 #ifndef CYTHON_RESTRICT
230  #if defined(__GNUC__)
231  #define CYTHON_RESTRICT __restrict__
232  #elif defined(_MSC_VER) && _MSC_VER >= 1400
233  #define CYTHON_RESTRICT __restrict
234  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
235  #define CYTHON_RESTRICT restrict
236  #else
237  #define CYTHON_RESTRICT
238  #endif
239 #endif
240 #ifndef CYTHON_UNUSED
241 # if defined(__GNUC__)
242 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
243 # define CYTHON_UNUSED __attribute__ ((__unused__))
244 # else
245 # define CYTHON_UNUSED
246 # endif
247 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
248 # define CYTHON_UNUSED __attribute__ ((__unused__))
249 # else
250 # define CYTHON_UNUSED
251 # endif
252 #endif
253 #ifndef CYTHON_MAYBE_UNUSED_VAR
254 # if defined(__cplusplus)
255  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
256 # else
257 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
258 # endif
259 #endif
260 #ifndef CYTHON_NCP_UNUSED
261 # if CYTHON_COMPILING_IN_CPYTHON
262 # define CYTHON_NCP_UNUSED
263 # else
264 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
265 # endif
266 #endif
267 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
268 #ifdef _MSC_VER
269  #ifndef _MSC_STDINT_H_
270  #if _MSC_VER < 1300
271  typedef unsigned char uint8_t;
272  typedef unsigned int uint32_t;
273  #else
274  typedef unsigned __int8 uint8_t;
275  typedef unsigned __int32 uint32_t;
276  #endif
277  #endif
278 #else
279  #include <stdint.h>
280 #endif
281 #ifndef CYTHON_FALLTHROUGH
282  #if defined(__cplusplus) && __cplusplus >= 201103L
283  #if __has_cpp_attribute(fallthrough)
284  #define CYTHON_FALLTHROUGH [[fallthrough]]
285  #elif __has_cpp_attribute(clang::fallthrough)
286  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
287  #elif __has_cpp_attribute(gnu::fallthrough)
288  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
289  #endif
290  #endif
291  #ifndef CYTHON_FALLTHROUGH
292  #if __has_attribute(fallthrough)
293  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
294  #else
295  #define CYTHON_FALLTHROUGH
296  #endif
297  #endif
298  #if defined(__clang__ ) && defined(__apple_build_version__)
299  #if __apple_build_version__ < 7000000
300  #undef CYTHON_FALLTHROUGH
301  #define CYTHON_FALLTHROUGH
302  #endif
303  #endif
304 #endif
305 
306 #ifndef CYTHON_INLINE
307  #if defined(__clang__)
308  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
309  #elif defined(__GNUC__)
310  #define CYTHON_INLINE __inline__
311  #elif defined(_MSC_VER)
312  #define CYTHON_INLINE __inline
313  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
314  #define CYTHON_INLINE inline
315  #else
316  #define CYTHON_INLINE
317  #endif
318 #endif
319 
320 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
321  #define Py_OptimizeFlag 0
322 #endif
323 #define __PYX_BUILD_PY_SSIZE_T "n"
324 #define CYTHON_FORMAT_SSIZE_T "z"
325 #if PY_MAJOR_VERSION < 3
326  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
327  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
328  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
329  #define __Pyx_DefaultClassType PyClass_Type
330 #else
331  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
332  #define __Pyx_DefaultClassType PyType_Type
333 #if PY_VERSION_HEX >= 0x030B00A1
334  static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
335  PyObject *code, PyObject *c, PyObject* n, PyObject *v,
336  PyObject *fv, PyObject *cell, PyObject* fn,
337  PyObject *name, int fline, PyObject *lnos) {
338  PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
339  PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
340  const char *fn_cstr=NULL;
341  const char *name_cstr=NULL;
342  PyCodeObject* co=NULL;
343  PyObject *type, *value, *traceback;
344  PyErr_Fetch(&type, &value, &traceback);
345  if (!(kwds=PyDict_New())) goto end;
346  if (!(argcount=PyLong_FromLong(a))) goto end;
347  if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
348  if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
349  if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
350  if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
351  if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
352  if (!(nlocals=PyLong_FromLong(l))) goto end;
353  if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
354  if (!(stacksize=PyLong_FromLong(s))) goto end;
355  if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
356  if (!(flags=PyLong_FromLong(f))) goto end;
357  if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
358  if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
359  if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
360  if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
361  if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
362  if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
363  if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
364  if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
365  if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
366  if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
367  if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
368  if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
369  if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
370  if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
371  Py_XDECREF((PyObject*)co);
372  co = (PyCodeObject*)call_result;
373  call_result = NULL;
374  if (0) {
375  cleanup_code_too:
376  Py_XDECREF((PyObject*)co);
377  co = NULL;
378  }
379  end:
380  Py_XDECREF(kwds);
381  Py_XDECREF(argcount);
382  Py_XDECREF(posonlyargcount);
383  Py_XDECREF(kwonlyargcount);
384  Py_XDECREF(nlocals);
385  Py_XDECREF(stacksize);
386  Py_XDECREF(replace);
387  Py_XDECREF(call_result);
388  Py_XDECREF(empty);
389  if (type) {
390  PyErr_Restore(type, value, traceback);
391  }
392  return co;
393  }
394 #else
395  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
396  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
397 #endif
398  #define __Pyx_DefaultClassType PyType_Type
399 #endif
400 #ifndef Py_TPFLAGS_CHECKTYPES
401  #define Py_TPFLAGS_CHECKTYPES 0
402 #endif
403 #ifndef Py_TPFLAGS_HAVE_INDEX
404  #define Py_TPFLAGS_HAVE_INDEX 0
405 #endif
406 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
407  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
408 #endif
409 #ifndef Py_TPFLAGS_HAVE_FINALIZE
410  #define Py_TPFLAGS_HAVE_FINALIZE 0
411 #endif
412 #ifndef METH_STACKLESS
413  #define METH_STACKLESS 0
414 #endif
415 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
416  #ifndef METH_FASTCALL
417  #define METH_FASTCALL 0x80
418  #endif
419  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
420  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
421  Py_ssize_t nargs, PyObject *kwnames);
422 #else
423  #define __Pyx_PyCFunctionFast _PyCFunctionFast
424  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
425 #endif
426 #if CYTHON_FAST_PYCCALL
427 #define __Pyx_PyFastCFunction_Check(func)\
428  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
429 #else
430 #define __Pyx_PyFastCFunction_Check(func) 0
431 #endif
432 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
433  #define PyObject_Malloc(s) PyMem_Malloc(s)
434  #define PyObject_Free(p) PyMem_Free(p)
435  #define PyObject_Realloc(p) PyMem_Realloc(p)
436 #endif
437 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
438  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
439  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
440  #define PyMem_RawFree(p) PyMem_Free(p)
441 #endif
442 #if CYTHON_COMPILING_IN_PYSTON
443  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
444  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
445 #else
446  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
447  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
448 #endif
449 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
450  #define __Pyx_PyThreadState_Current PyThreadState_GET()
451 #elif PY_VERSION_HEX >= 0x03060000
452  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
453 #elif PY_VERSION_HEX >= 0x03000000
454  #define __Pyx_PyThreadState_Current PyThreadState_GET()
455 #else
456  #define __Pyx_PyThreadState_Current _PyThreadState_Current
457 #endif
458 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
459 #include "pythread.h"
460 #define Py_tss_NEEDS_INIT 0
461 typedef int Py_tss_t;
462 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
463  *key = PyThread_create_key();
464  return 0;
465 }
466 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
467  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
468  *key = Py_tss_NEEDS_INIT;
469  return key;
470 }
471 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
472  PyObject_Free(key);
473 }
474 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
475  return *key != Py_tss_NEEDS_INIT;
476 }
477 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
478  PyThread_delete_key(*key);
479  *key = Py_tss_NEEDS_INIT;
480 }
481 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
482  return PyThread_set_key_value(*key, value);
483 }
484 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
485  return PyThread_get_key_value(*key);
486 }
487 #endif
488 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
489 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
490 #else
491 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
492 #endif
493 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
494  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
495  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
496 #else
497  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
498  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
499 #endif
500 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
501 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
502 #else
503 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
504 #endif
505 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
506  #define CYTHON_PEP393_ENABLED 1
507  #if defined(PyUnicode_IS_READY)
508  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
509  0 : _PyUnicode_Ready((PyObject *)(op)))
510  #else
511  #define __Pyx_PyUnicode_READY(op) (0)
512  #endif
513  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
514  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
515  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
516  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
517  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
518  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
519  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
520  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
521  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
522  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
523  #else
524  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
525  #endif
526  #else
527  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
528  #endif
529 #else
530  #define CYTHON_PEP393_ENABLED 0
531  #define PyUnicode_1BYTE_KIND 1
532  #define PyUnicode_2BYTE_KIND 2
533  #define PyUnicode_4BYTE_KIND 4
534  #define __Pyx_PyUnicode_READY(op) (0)
535  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
536  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
537  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
538  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
539  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
540  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
541  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
542  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
543 #endif
544 #if CYTHON_COMPILING_IN_PYPY
545  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
546  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
547 #else
548  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
549  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
550  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
551 #endif
552 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
553  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
554 #endif
555 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
556  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
557 #endif
558 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
559  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
560 #endif
561 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
562 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
563 #if PY_MAJOR_VERSION >= 3
564  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
565 #else
566  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
567 #endif
568 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
569  #define PyObject_ASCII(o) PyObject_Repr(o)
570 #endif
571 #if PY_MAJOR_VERSION >= 3
572  #define PyBaseString_Type PyUnicode_Type
573  #define PyStringObject PyUnicodeObject
574  #define PyString_Type PyUnicode_Type
575  #define PyString_Check PyUnicode_Check
576  #define PyString_CheckExact PyUnicode_CheckExact
577 #ifndef PyObject_Unicode
578  #define PyObject_Unicode PyObject_Str
579 #endif
580 #endif
581 #if PY_MAJOR_VERSION >= 3
582  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
583  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
584 #else
585  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
586  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
587 #endif
588 #ifndef PySet_CheckExact
589  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
590 #endif
591 #if PY_VERSION_HEX >= 0x030900A4
592  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
593  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
594 #else
595  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
596  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
597 #endif
598 #if CYTHON_ASSUME_SAFE_MACROS
599  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
600 #else
601  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
602 #endif
603 #if PY_MAJOR_VERSION >= 3
604  #define PyIntObject PyLongObject
605  #define PyInt_Type PyLong_Type
606  #define PyInt_Check(op) PyLong_Check(op)
607  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
608  #define PyInt_FromString PyLong_FromString
609  #define PyInt_FromUnicode PyLong_FromUnicode
610  #define PyInt_FromLong PyLong_FromLong
611  #define PyInt_FromSize_t PyLong_FromSize_t
612  #define PyInt_FromSsize_t PyLong_FromSsize_t
613  #define PyInt_AsLong PyLong_AsLong
614  #define PyInt_AS_LONG PyLong_AS_LONG
615  #define PyInt_AsSsize_t PyLong_AsSsize_t
616  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
617  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
618  #define PyNumber_Int PyNumber_Long
619 #endif
620 #if PY_MAJOR_VERSION >= 3
621  #define PyBoolObject PyLongObject
622 #endif
623 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
624  #ifndef PyUnicode_InternFromString
625  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
626  #endif
627 #endif
628 #if PY_VERSION_HEX < 0x030200A4
629  typedef long Py_hash_t;
630  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
631  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
632 #else
633  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
634  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
635 #endif
636 #if PY_MAJOR_VERSION >= 3
637  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
638 #else
639  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
640 #endif
641 #if CYTHON_USE_ASYNC_SLOTS
642  #if PY_VERSION_HEX >= 0x030500B1
643  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
644  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
645  #else
646  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
647  #endif
648 #else
649  #define __Pyx_PyType_AsAsync(obj) NULL
650 #endif
651 #ifndef __Pyx_PyAsyncMethodsStruct
652  typedef struct {
653  unaryfunc am_await;
654  unaryfunc am_aiter;
655  unaryfunc am_anext;
656  } __Pyx_PyAsyncMethodsStruct;
657 #endif
658 
659 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
660  #if !defined(_USE_MATH_DEFINES)
661  #define _USE_MATH_DEFINES
662  #endif
663 #endif
664 #include <math.h>
665 #ifdef NAN
666 #define __PYX_NAN() ((float) NAN)
667 #else
668 static CYTHON_INLINE float __PYX_NAN() {
669  float value;
670  memset(&value, 0xFF, sizeof(value));
671  return value;
672 }
673 #endif
674 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
675 #define __Pyx_truncl trunc
676 #else
677 #define __Pyx_truncl truncl
678 #endif
679 
680 #define __PYX_MARK_ERR_POS(f_index, lineno) \
681  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
682 #define __PYX_ERR(f_index, lineno, Ln_error) \
683  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
684 
685 #ifndef __PYX_EXTERN_C
686  #ifdef __cplusplus
687  #define __PYX_EXTERN_C extern "C"
688  #else
689  #define __PYX_EXTERN_C extern
690  #endif
691 #endif
692 
693 #define __PYX_HAVE__Isosurface
694 #define __PYX_HAVE_API__Isosurface
695 /* Early includes */
696 #include <string.h>
697 #include <stdio.h>
698 #include "numpy/arrayobject.h"
699 #include "numpy/ndarrayobject.h"
700 #include "numpy/ndarraytypes.h"
701 #include "numpy/arrayscalars.h"
702 #include "numpy/ufuncobject.h"
703 
704  /* NumPy API declarations from "numpy/__init__.pxd" */
705 
706 #include <math.h>
707 #ifdef _OPENMP
708 #include <omp.h>
709 #endif /* _OPENMP */
710 
711 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
712 #define CYTHON_WITHOUT_ASSERTIONS
713 #endif
714 
715 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
716  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
717 
718 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
719 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
720 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
721 #define __PYX_DEFAULT_STRING_ENCODING ""
722 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
723 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
724 #define __Pyx_uchar_cast(c) ((unsigned char)c)
725 #define __Pyx_long_cast(x) ((long)x)
726 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
727  (sizeof(type) < sizeof(Py_ssize_t)) ||\
728  (sizeof(type) > sizeof(Py_ssize_t) &&\
729  likely(v < (type)PY_SSIZE_T_MAX ||\
730  v == (type)PY_SSIZE_T_MAX) &&\
731  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
732  v == (type)PY_SSIZE_T_MIN))) ||\
733  (sizeof(type) == sizeof(Py_ssize_t) &&\
734  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
735  v == (type)PY_SSIZE_T_MAX))) )
736 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
737  return (size_t) i < (size_t) limit;
738 }
739 #if defined (__cplusplus) && __cplusplus >= 201103L
740  #include <cstdlib>
741  #define __Pyx_sst_abs(value) std::abs(value)
742 #elif SIZEOF_INT >= SIZEOF_SIZE_T
743  #define __Pyx_sst_abs(value) abs(value)
744 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
745  #define __Pyx_sst_abs(value) labs(value)
746 #elif defined (_MSC_VER)
747  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
748 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
749  #define __Pyx_sst_abs(value) llabs(value)
750 #elif defined (__GNUC__)
751  #define __Pyx_sst_abs(value) __builtin_llabs(value)
752 #else
753  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
754 #endif
755 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
756 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
757 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
758 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
759 #define __Pyx_PyBytes_FromString PyBytes_FromString
760 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
761 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
762 #if PY_MAJOR_VERSION < 3
763  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
764  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
765 #else
766  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
767  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
768 #endif
769 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
770 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
771 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
772 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
773 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
774 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
775 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
776 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
777 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
778 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
779 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
780 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
781 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
782 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
783 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
784 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
785 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
786  const Py_UNICODE *u_end = u;
787  while (*u_end++) ;
788  return (size_t)(u_end - u - 1);
789 }
790 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
791 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
792 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
793 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
794 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
795 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
796 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
797 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
798 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
799 #define __Pyx_PySequence_Tuple(obj)\
800  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
801 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
802 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
803 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
804 #if CYTHON_ASSUME_SAFE_MACROS
805 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
806 #else
807 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
808 #endif
809 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
810 #if PY_MAJOR_VERSION >= 3
811 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
812 #else
813 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
814 #endif
815 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
816 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
817 static int __Pyx_sys_getdefaultencoding_not_ascii;
818 static int __Pyx_init_sys_getdefaultencoding_params(void) {
819  PyObject* sys;
820  PyObject* default_encoding = NULL;
821  PyObject* ascii_chars_u = NULL;
822  PyObject* ascii_chars_b = NULL;
823  const char* default_encoding_c;
824  sys = PyImport_ImportModule("sys");
825  if (!sys) goto bad;
826  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
827  Py_DECREF(sys);
828  if (!default_encoding) goto bad;
829  default_encoding_c = PyBytes_AsString(default_encoding);
830  if (!default_encoding_c) goto bad;
831  if (strcmp(default_encoding_c, "ascii") == 0) {
832  __Pyx_sys_getdefaultencoding_not_ascii = 0;
833  } else {
834  char ascii_chars[128];
835  int c;
836  for (c = 0; c < 128; c++) {
837  ascii_chars[c] = c;
838  }
839  __Pyx_sys_getdefaultencoding_not_ascii = 1;
840  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
841  if (!ascii_chars_u) goto bad;
842  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
843  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
844  PyErr_Format(
845  PyExc_ValueError,
846  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
847  default_encoding_c);
848  goto bad;
849  }
850  Py_DECREF(ascii_chars_u);
851  Py_DECREF(ascii_chars_b);
852  }
853  Py_DECREF(default_encoding);
854  return 0;
855 bad:
856  Py_XDECREF(default_encoding);
857  Py_XDECREF(ascii_chars_u);
858  Py_XDECREF(ascii_chars_b);
859  return -1;
860 }
861 #endif
862 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
863 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
864 #else
865 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
866 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
867 static char* __PYX_DEFAULT_STRING_ENCODING;
868 static int __Pyx_init_sys_getdefaultencoding_params(void) {
869  PyObject* sys;
870  PyObject* default_encoding = NULL;
871  char* default_encoding_c;
872  sys = PyImport_ImportModule("sys");
873  if (!sys) goto bad;
874  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
875  Py_DECREF(sys);
876  if (!default_encoding) goto bad;
877  default_encoding_c = PyBytes_AsString(default_encoding);
878  if (!default_encoding_c) goto bad;
879  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
880  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
881  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
882  Py_DECREF(default_encoding);
883  return 0;
884 bad:
885  Py_XDECREF(default_encoding);
886  return -1;
887 }
888 #endif
889 #endif
890 
891 
892 /* Test for GCC > 2.95 */
893 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
894  #define likely(x) __builtin_expect(!!(x), 1)
895  #define unlikely(x) __builtin_expect(!!(x), 0)
896 #else /* !__GNUC__ or GCC < 2.95 */
897  #define likely(x) (x)
898  #define unlikely(x) (x)
899 #endif /* __GNUC__ */
900 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
901 
902 static PyObject *__pyx_m = NULL;
903 static PyObject *__pyx_d;
904 static PyObject *__pyx_b;
905 static PyObject *__pyx_cython_runtime = NULL;
906 static PyObject *__pyx_empty_tuple;
907 static PyObject *__pyx_empty_bytes;
908 static PyObject *__pyx_empty_unicode;
909 static int __pyx_lineno;
910 static int __pyx_clineno = 0;
911 static const char * __pyx_cfilenm= __FILE__;
912 static const char *__pyx_filename;
913 
914 /* Header.proto */
915 #if !defined(CYTHON_CCOMPLEX)
916  #if defined(__cplusplus)
917  #define CYTHON_CCOMPLEX 1
918  #elif defined(_Complex_I)
919  #define CYTHON_CCOMPLEX 1
920  #else
921  #define CYTHON_CCOMPLEX 0
922  #endif
923 #endif
924 #if CYTHON_CCOMPLEX
925  #ifdef __cplusplus
926  #include <complex>
927  #else
928  #include <complex.h>
929  #endif
930 #endif
931 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
932  #undef _Complex_I
933  #define _Complex_I 1.0fj
934 #endif
935 
936 
937 static const char *__pyx_f[] = {
938  "proteus/Isosurface.pyx",
939  "__init__.pxd",
940  "type.pxd",
941 };
942 /* BufferFormatStructs.proto */
943 #define IS_UNSIGNED(type) (((type) -1) > 0)
944 struct __Pyx_StructField_;
945 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
946 typedef struct {
947  const char* name;
948  struct __Pyx_StructField_* fields;
949  size_t size;
950  size_t arraysize[8];
951  int ndim;
952  char typegroup;
953  char is_unsigned;
954  int flags;
955 } __Pyx_TypeInfo;
956 typedef struct __Pyx_StructField_ {
957  __Pyx_TypeInfo* type;
958  const char* name;
959  size_t offset;
960 } __Pyx_StructField;
961 typedef struct {
962  __Pyx_StructField* field;
963  size_t parent_offset;
964 } __Pyx_BufFmt_StackElem;
965 typedef struct {
966  __Pyx_StructField root;
967  __Pyx_BufFmt_StackElem* head;
968  size_t fmt_offset;
969  size_t new_count, enc_count;
970  size_t struct_alignment;
971  int is_complex;
972  char enc_type;
973  char new_packmode;
974  char enc_packmode;
975  char is_valid_array;
976 } __Pyx_BufFmt_Context;
977 
978 
979 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":690
980  * # in Cython to enable them only on the right systems.
981  *
982  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
983  * ctypedef npy_int16 int16_t
984  * ctypedef npy_int32 int32_t
985  */
986 typedef npy_int8 __pyx_t_5numpy_int8_t;
987 
988 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":691
989  *
990  * ctypedef npy_int8 int8_t
991  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
992  * ctypedef npy_int32 int32_t
993  * ctypedef npy_int64 int64_t
994  */
995 typedef npy_int16 __pyx_t_5numpy_int16_t;
996 
997 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":692
998  * ctypedef npy_int8 int8_t
999  * ctypedef npy_int16 int16_t
1000  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
1001  * ctypedef npy_int64 int64_t
1002  * #ctypedef npy_int96 int96_t
1003  */
1004 typedef npy_int32 __pyx_t_5numpy_int32_t;
1005 
1006 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":693
1007  * ctypedef npy_int16 int16_t
1008  * ctypedef npy_int32 int32_t
1009  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
1010  * #ctypedef npy_int96 int96_t
1011  * #ctypedef npy_int128 int128_t
1012  */
1013 typedef npy_int64 __pyx_t_5numpy_int64_t;
1014 
1015 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":697
1016  * #ctypedef npy_int128 int128_t
1017  *
1018  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
1019  * ctypedef npy_uint16 uint16_t
1020  * ctypedef npy_uint32 uint32_t
1021  */
1022 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1023 
1024 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":698
1025  *
1026  * ctypedef npy_uint8 uint8_t
1027  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1028  * ctypedef npy_uint32 uint32_t
1029  * ctypedef npy_uint64 uint64_t
1030  */
1031 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1032 
1033 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":699
1034  * ctypedef npy_uint8 uint8_t
1035  * ctypedef npy_uint16 uint16_t
1036  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1037  * ctypedef npy_uint64 uint64_t
1038  * #ctypedef npy_uint96 uint96_t
1039  */
1040 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1041 
1042 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":700
1043  * ctypedef npy_uint16 uint16_t
1044  * ctypedef npy_uint32 uint32_t
1045  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1046  * #ctypedef npy_uint96 uint96_t
1047  * #ctypedef npy_uint128 uint128_t
1048  */
1049 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1050 
1051 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":704
1052  * #ctypedef npy_uint128 uint128_t
1053  *
1054  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1055  * ctypedef npy_float64 float64_t
1056  * #ctypedef npy_float80 float80_t
1057  */
1058 typedef npy_float32 __pyx_t_5numpy_float32_t;
1059 
1060 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":705
1061  *
1062  * ctypedef npy_float32 float32_t
1063  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1064  * #ctypedef npy_float80 float80_t
1065  * #ctypedef npy_float128 float128_t
1066  */
1067 typedef npy_float64 __pyx_t_5numpy_float64_t;
1068 
1069 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":714
1070  * # The int types are mapped a bit surprising --
1071  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1072  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1073  * ctypedef npy_longlong long_t
1074  * ctypedef npy_longlong longlong_t
1075  */
1076 typedef npy_long __pyx_t_5numpy_int_t;
1077 
1078 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":715
1079  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1080  * ctypedef npy_long int_t
1081  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1082  * ctypedef npy_longlong longlong_t
1083  *
1084  */
1085 typedef npy_longlong __pyx_t_5numpy_long_t;
1086 
1087 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":716
1088  * ctypedef npy_long int_t
1089  * ctypedef npy_longlong long_t
1090  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1091  *
1092  * ctypedef npy_ulong uint_t
1093  */
1094 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1095 
1096 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":718
1097  * ctypedef npy_longlong longlong_t
1098  *
1099  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1100  * ctypedef npy_ulonglong ulong_t
1101  * ctypedef npy_ulonglong ulonglong_t
1102  */
1103 typedef npy_ulong __pyx_t_5numpy_uint_t;
1104 
1105 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":719
1106  *
1107  * ctypedef npy_ulong uint_t
1108  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1109  * ctypedef npy_ulonglong ulonglong_t
1110  *
1111  */
1112 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1113 
1114 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":720
1115  * ctypedef npy_ulong uint_t
1116  * ctypedef npy_ulonglong ulong_t
1117  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1118  *
1119  * ctypedef npy_intp intp_t
1120  */
1121 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1122 
1123 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":722
1124  * ctypedef npy_ulonglong ulonglong_t
1125  *
1126  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1127  * ctypedef npy_uintp uintp_t
1128  *
1129  */
1130 typedef npy_intp __pyx_t_5numpy_intp_t;
1131 
1132 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":723
1133  *
1134  * ctypedef npy_intp intp_t
1135  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1136  *
1137  * ctypedef npy_double float_t
1138  */
1139 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1140 
1141 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":725
1142  * ctypedef npy_uintp uintp_t
1143  *
1144  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1145  * ctypedef npy_double double_t
1146  * ctypedef npy_longdouble longdouble_t
1147  */
1148 typedef npy_double __pyx_t_5numpy_float_t;
1149 
1150 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":726
1151  *
1152  * ctypedef npy_double float_t
1153  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1154  * ctypedef npy_longdouble longdouble_t
1155  *
1156  */
1157 typedef npy_double __pyx_t_5numpy_double_t;
1158 
1159 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":727
1160  * ctypedef npy_double float_t
1161  * ctypedef npy_double double_t
1162  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1163  *
1164  * ctypedef npy_cfloat cfloat_t
1165  */
1166 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1167 /* Declarations.proto */
1168 #if CYTHON_CCOMPLEX
1169  #ifdef __cplusplus
1170  typedef ::std::complex< float > __pyx_t_float_complex;
1171  #else
1172  typedef float _Complex __pyx_t_float_complex;
1173  #endif
1174 #else
1175  typedef struct { float real, imag; } __pyx_t_float_complex;
1176 #endif
1177 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1178 
1179 /* Declarations.proto */
1180 #if CYTHON_CCOMPLEX
1181  #ifdef __cplusplus
1182  typedef ::std::complex< double > __pyx_t_double_complex;
1183  #else
1184  typedef double _Complex __pyx_t_double_complex;
1185  #endif
1186 #else
1187  typedef struct { double real, imag; } __pyx_t_double_complex;
1188 #endif
1189 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1190 
1191 
1192 /*--- Type declarations ---*/
1193 struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel;
1194 struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr;
1195 
1196 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":729
1197  * ctypedef npy_longdouble longdouble_t
1198  *
1199  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1200  * ctypedef npy_cdouble cdouble_t
1201  * ctypedef npy_clongdouble clongdouble_t
1202  */
1203 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1204 
1205 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":730
1206  *
1207  * ctypedef npy_cfloat cfloat_t
1208  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1209  * ctypedef npy_clongdouble clongdouble_t
1210  *
1211  */
1212 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1213 
1214 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":731
1215  * ctypedef npy_cfloat cfloat_t
1216  * ctypedef npy_cdouble cdouble_t
1217  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1218  *
1219  * ctypedef npy_cdouble complex_t
1220  */
1221 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1222 
1223 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":733
1224  * ctypedef npy_clongdouble clongdouble_t
1225  *
1226  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1227  *
1228  * cdef inline object PyArray_MultiIterNew1(a):
1229  */
1230 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1231 struct __pyx_opt_args_10Isosurface_EVec;
1232 
1233 /* "Isosurface.pyx":28
1234  * DEF Z=2
1235  *
1236  * cdef np.ndarray[np.float64_t,ndim=1] EVec(double x=0.0, double y=0.0, double z=0.0): # <<<<<<<<<<<<<<
1237  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d')
1238  * v[X] = x
1239  */
1240 struct __pyx_opt_args_10Isosurface_EVec {
1241  int __pyx_n;
1242  double x;
1243  double y;
1244  double z;
1245 };
1246 
1247 /* "Isosurface.pyx":108
1248  * self.fileprefix = 'isosurface'
1249  *
1250  * def attachModel(self, model, ar): # <<<<<<<<<<<<<<
1251  * """ Attach this isosurface to the given simulation model.
1252  * """
1253  */
1254 struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel {
1255  PyObject_HEAD
1256  PyObject *__pyx_v_self;
1257 };
1258 
1259 
1260 /* "Isosurface.pyx":125
1261  * self.exteriorElementBoundariesArray
1262  * ].flatten())
1263  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes)) # <<<<<<<<<<<<<<
1264  * self.nodeArray = fine_grid.mesh.nodeArray
1265  * self.num_owned_elements = fine_grid.mesh.nElements_global
1266  */
1267 struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr {
1268  PyObject_HEAD
1269  struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *__pyx_outer_scope;
1270  PyObject *__pyx_v_bn;
1271  PyObject *__pyx_v_gn;
1272 };
1273 
1274 
1275 /* --- Runtime support code (head) --- */
1276 /* Refnanny.proto */
1277 #ifndef CYTHON_REFNANNY
1278  #define CYTHON_REFNANNY 0
1279 #endif
1280 #if CYTHON_REFNANNY
1281  typedef struct {
1282  void (*INCREF)(void*, PyObject*, int);
1283  void (*DECREF)(void*, PyObject*, int);
1284  void (*GOTREF)(void*, PyObject*, int);
1285  void (*GIVEREF)(void*, PyObject*, int);
1286  void* (*SetupContext)(const char*, int, const char*);
1287  void (*FinishContext)(void**);
1288  } __Pyx_RefNannyAPIStruct;
1289  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1290  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1291  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1292 #ifdef WITH_THREAD
1293  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1294  if (acquire_gil) {\
1295  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1296  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1297  PyGILState_Release(__pyx_gilstate_save);\
1298  } else {\
1299  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1300  }
1301 #else
1302  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1303  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1304 #endif
1305  #define __Pyx_RefNannyFinishContext()\
1306  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1307  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1308  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1309  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1310  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1311  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1312  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1313  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1314  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1315 #else
1316  #define __Pyx_RefNannyDeclarations
1317  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1318  #define __Pyx_RefNannyFinishContext()
1319  #define __Pyx_INCREF(r) Py_INCREF(r)
1320  #define __Pyx_DECREF(r) Py_DECREF(r)
1321  #define __Pyx_GOTREF(r)
1322  #define __Pyx_GIVEREF(r)
1323  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1324  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1325  #define __Pyx_XGOTREF(r)
1326  #define __Pyx_XGIVEREF(r)
1327 #endif
1328 #define __Pyx_XDECREF_SET(r, v) do {\
1329  PyObject *tmp = (PyObject *) r;\
1330  r = v; __Pyx_XDECREF(tmp);\
1331  } while (0)
1332 #define __Pyx_DECREF_SET(r, v) do {\
1333  PyObject *tmp = (PyObject *) r;\
1334  r = v; __Pyx_DECREF(tmp);\
1335  } while (0)
1336 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1337 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1338 
1339 /* PyObjectGetAttrStr.proto */
1340 #if CYTHON_USE_TYPE_SLOTS
1341 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1342 #else
1343 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1344 #endif
1345 
1346 /* GetBuiltinName.proto */
1347 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1348 
1349 /* PyDictVersioning.proto */
1350 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1351 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1352 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1353 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1354  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1355  (cache_var) = (value);
1356 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1357  static PY_UINT64_T __pyx_dict_version = 0;\
1358  static PyObject *__pyx_dict_cached_value = NULL;\
1359  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1360  (VAR) = __pyx_dict_cached_value;\
1361  } else {\
1362  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1363  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1364  }\
1365 }
1366 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1367 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1368 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1369 #else
1370 #define __PYX_GET_DICT_VERSION(dict) (0)
1371 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1372 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1373 #endif
1374 
1375 /* GetModuleGlobalName.proto */
1376 #if CYTHON_USE_DICT_VERSIONS
1377 #define __Pyx_GetModuleGlobalName(var, name) {\
1378  static PY_UINT64_T __pyx_dict_version = 0;\
1379  static PyObject *__pyx_dict_cached_value = NULL;\
1380  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1381  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1382  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1383 }
1384 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1385  PY_UINT64_T __pyx_dict_version;\
1386  PyObject *__pyx_dict_cached_value;\
1387  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1388 }
1389 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1390 #else
1391 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1392 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1393 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1394 #endif
1395 
1396 /* PyObjectCall.proto */
1397 #if CYTHON_COMPILING_IN_CPYTHON
1398 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1399 #else
1400 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1401 #endif
1402 
1403 /* ExtTypeTest.proto */
1404 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1405 
1406 /* IsLittleEndian.proto */
1407 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1408 
1409 /* BufferFormatCheck.proto */
1410 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1411 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1412  __Pyx_BufFmt_StackElem* stack,
1413  __Pyx_TypeInfo* type);
1414 
1415 /* BufferGetAndValidate.proto */
1416 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1417  ((obj == Py_None || obj == NULL) ?\
1418  (__Pyx_ZeroBuffer(buf), 0) :\
1419  __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1420 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1421  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1422 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1423 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1424 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1425 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1426 
1427 /* BufferIndexError.proto */
1428 static void __Pyx_RaiseBufferIndexError(int axis);
1429 
1430 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1431 /* PyThreadStateGet.proto */
1432 #if CYTHON_FAST_THREAD_STATE
1433 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1434 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1435 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1436 #else
1437 #define __Pyx_PyThreadState_declare
1438 #define __Pyx_PyThreadState_assign
1439 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1440 #endif
1441 
1442 /* PyErrFetchRestore.proto */
1443 #if CYTHON_FAST_THREAD_STATE
1444 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1445 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1446 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1447 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1448 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1449 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1450 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1451 #if CYTHON_COMPILING_IN_CPYTHON
1452 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1453 #else
1454 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1455 #endif
1456 #else
1457 #define __Pyx_PyErr_Clear() PyErr_Clear()
1458 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1459 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1460 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1461 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1462 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1463 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1464 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1465 #endif
1466 
1467 /* WriteUnraisableException.proto */
1468 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1469  int lineno, const char *filename,
1470  int full_traceback, int nogil);
1471 
1472 /* RaiseArgTupleInvalid.proto */
1473 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1474  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1475 
1476 /* RaiseDoubleKeywords.proto */
1477 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1478 
1479 /* ParseKeywords.proto */
1480 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1481  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1482  const char* function_name);
1483 
1484 /* PyObjectSetAttrStr.proto */
1485 #if CYTHON_USE_TYPE_SLOTS
1486 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1487 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1488 #else
1489 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1490 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1491 #endif
1492 
1493 /* RaiseTooManyValuesToUnpack.proto */
1494 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1495 
1496 /* RaiseNeedMoreValuesToUnpack.proto */
1497 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1498 
1499 /* IterFinish.proto */
1500 static CYTHON_INLINE int __Pyx_IterFinish(void);
1501 
1502 /* UnpackItemEndCheck.proto */
1503 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1504 
1505 /* PyFloatBinop.proto */
1506 #if !CYTHON_COMPILING_IN_PYPY
1507 static PyObject* __Pyx_PyFloat_EqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1508 #else
1509 #define __Pyx_PyFloat_EqObjC(op1, op2, floatval, inplace, zerodivision_check)\
1510  (PyObject_RichCompare(op1, op2, Py_EQ))
1511  #endif
1512 
1513 /* PyFunctionFastCall.proto */
1514 #if CYTHON_FAST_PYCALL
1515 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1516  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1517 #if 1 || PY_VERSION_HEX < 0x030600B1
1518 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1519 #else
1520 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1521 #endif
1522 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1523  (sizeof(char [1 - 2*!(cond)]) - 1)
1524 #ifndef Py_MEMBER_SIZE
1525 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1526 #endif
1527 #if CYTHON_FAST_PYCALL
1528  static size_t __pyx_pyframe_localsplus_offset = 0;
1529  #include "frameobject.h"
1530 #if PY_VERSION_HEX >= 0x030b00a6
1531  #ifndef Py_BUILD_CORE
1532  #define Py_BUILD_CORE 1
1533  #endif
1534  #include "internal/pycore_frame.h"
1535 #endif
1536  #define __Pxy_PyFrame_Initialize_Offsets()\
1537  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1538  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1539  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1540  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1541 #endif // CYTHON_FAST_PYCALL
1542 #endif
1543 
1544 /* PyObjectCallMethO.proto */
1545 #if CYTHON_COMPILING_IN_CPYTHON
1546 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1547 #endif
1548 
1549 /* PyObjectCallNoArg.proto */
1550 #if CYTHON_COMPILING_IN_CPYTHON
1551 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1552 #else
1553 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1554 #endif
1555 
1556 /* PyCFunctionFastCall.proto */
1557 #if CYTHON_FAST_PYCCALL
1558 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1559 #else
1560 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1561 #endif
1562 
1563 /* PyObjectCallOneArg.proto */
1564 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1565 
1566 /* None.proto */
1567 static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
1568 
1569 /* PyIntBinop.proto */
1570 #if !CYTHON_COMPILING_IN_PYPY
1571 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1572 #else
1573 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1574  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1575 #endif
1576 
1577 /* GetItemInt.proto */
1578 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1579  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1580  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1581  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1582  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1583 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1584  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1585  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1586  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1587 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1588  int wraparound, int boundscheck);
1589 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1590  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1591  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1592  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1593 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1594  int wraparound, int boundscheck);
1595 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1596 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1597  int is_list, int wraparound, int boundscheck);
1598 
1599 /* ObjectGetItem.proto */
1600 #if CYTHON_USE_TYPE_SLOTS
1601 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1602 #else
1603 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1604 #endif
1605 
1606 /* Import.proto */
1607 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1608 
1609 /* ImportFrom.proto */
1610 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1611 
1612 /* ListCompAppend.proto */
1613 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1614 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1615  PyListObject* L = (PyListObject*) list;
1616  Py_ssize_t len = Py_SIZE(list);
1617  if (likely(L->allocated > len)) {
1618  Py_INCREF(x);
1619  PyList_SET_ITEM(list, len, x);
1620  __Pyx_SET_SIZE(list, len + 1);
1621  return 0;
1622  }
1623  return PyList_Append(list, x);
1624 }
1625 #else
1626 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1627 #endif
1628 
1629 /* PyObjectCall2Args.proto */
1630 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1631 
1632 /* SliceObject.proto */
1633 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1634  PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1635  PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1636  int has_cstart, int has_cstop, int wraparound);
1637 
1638 /* PyIntCompare.proto */
1639 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1640 
1641 /* PyFloatBinop.proto */
1642 #if !CYTHON_COMPILING_IN_PYPY
1643 static PyObject* __Pyx_PyFloat_NeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1644 #else
1645 #define __Pyx_PyFloat_NeObjC(op1, op2, floatval, inplace, zerodivision_check)\
1646  (PyObject_RichCompare(op1, op2, Py_NE))
1647  #endif
1648 
1649 /* RaiseException.proto */
1650 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1651 
1652 /* ListAppend.proto */
1653 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1654 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1655  PyListObject* L = (PyListObject*) list;
1656  Py_ssize_t len = Py_SIZE(list);
1657  if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1658  Py_INCREF(x);
1659  PyList_SET_ITEM(list, len, x);
1660  __Pyx_SET_SIZE(list, len + 1);
1661  return 0;
1662  }
1663  return PyList_Append(list, x);
1664 }
1665 #else
1666 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1667 #endif
1668 
1669 /* BufferFallbackError.proto */
1670 static void __Pyx_RaiseBufferFallbackError(void);
1671 
1672 /* SetItemInt.proto */
1673 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1674  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1675  __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1676  (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1677  __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1678 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1679 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1680  int is_list, int wraparound, int boundscheck);
1681 
1682 /* IncludeStringH.proto */
1683 #include <string.h>
1684 
1685 /* BytesEquals.proto */
1686 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1687 
1688 /* UnicodeEquals.proto */
1689 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1690 
1691 /* StrEquals.proto */
1692 #if PY_MAJOR_VERSION >= 3
1693 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1694 #else
1695 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1696 #endif
1697 
1698 /* PyIntCompare.proto */
1699 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1700 
1701 /* None.proto */
1702 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1703 
1704 /* GetTopmostException.proto */
1705 #if CYTHON_USE_EXC_INFO_STACK
1706 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1707 #endif
1708 
1709 /* SaveResetException.proto */
1710 #if CYTHON_FAST_THREAD_STATE
1711 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1712 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1713 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1714 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1715 #else
1716 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1717 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1718 #endif
1719 
1720 /* PyErrExceptionMatches.proto */
1721 #if CYTHON_FAST_THREAD_STATE
1722 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1723 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1724 #else
1725 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1726 #endif
1727 
1728 /* GetException.proto */
1729 #if CYTHON_FAST_THREAD_STATE
1730 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1731 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1732 #else
1733 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1734 #endif
1735 
1736 /* PyObject_GenericGetAttrNoDict.proto */
1737 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1738 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1739 #else
1740 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1741 #endif
1742 
1743 /* TypeImport.proto */
1744 #ifndef __PYX_HAVE_RT_ImportType_proto
1745 #define __PYX_HAVE_RT_ImportType_proto
1746 enum __Pyx_ImportType_CheckSize {
1747  __Pyx_ImportType_CheckSize_Error = 0,
1748  __Pyx_ImportType_CheckSize_Warn = 1,
1749  __Pyx_ImportType_CheckSize_Ignore = 2
1750 };
1751 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1752 #endif
1753 
1754 /* CalculateMetaclass.proto */
1755 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1756 
1757 /* FetchCommonType.proto */
1758 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1759 
1760 /* CythonFunctionShared.proto */
1761 #define __Pyx_CyFunction_USED 1
1762 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1763 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1764 #define __Pyx_CYFUNCTION_CCLASS 0x04
1765 #define __Pyx_CyFunction_GetClosure(f)\
1766  (((__pyx_CyFunctionObject *) (f))->func_closure)
1767 #define __Pyx_CyFunction_GetClassObj(f)\
1768  (((__pyx_CyFunctionObject *) (f))->func_classobj)
1769 #define __Pyx_CyFunction_Defaults(type, f)\
1770  ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1771 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1772  ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1773 typedef struct {
1774  PyCFunctionObject func;
1775 #if PY_VERSION_HEX < 0x030500A0
1776  PyObject *func_weakreflist;
1777 #endif
1778  PyObject *func_dict;
1779  PyObject *func_name;
1780  PyObject *func_qualname;
1781  PyObject *func_doc;
1782  PyObject *func_globals;
1783  PyObject *func_code;
1784  PyObject *func_closure;
1785  PyObject *func_classobj;
1786  void *defaults;
1787  int defaults_pyobjects;
1788  size_t defaults_size; // used by FusedFunction for copying defaults
1789  int flags;
1790  PyObject *defaults_tuple;
1791  PyObject *defaults_kwdict;
1792  PyObject *(*defaults_getter)(PyObject *);
1793  PyObject *func_annotations;
1794 } __pyx_CyFunctionObject;
1795 static PyTypeObject *__pyx_CyFunctionType = 0;
1796 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
1797 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
1798  int flags, PyObject* qualname,
1799  PyObject *self,
1800  PyObject *module, PyObject *globals,
1801  PyObject* code);
1802 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1803  size_t size,
1804  int pyobjects);
1805 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1806  PyObject *tuple);
1807 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1808  PyObject *dict);
1809 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1810  PyObject *dict);
1811 static int __pyx_CyFunction_init(void);
1812 
1813 /* CythonFunction.proto */
1814 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1815  int flags, PyObject* qualname,
1816  PyObject *closure,
1817  PyObject *module, PyObject *globals,
1818  PyObject* code);
1819 
1820 /* SetNameInClass.proto */
1821 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1822 #define __Pyx_SetNameInClass(ns, name, value)\
1823  (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1824 #elif CYTHON_COMPILING_IN_CPYTHON
1825 #define __Pyx_SetNameInClass(ns, name, value)\
1826  (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1827 #else
1828 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1829 #endif
1830 
1831 /* Py3ClassCreate.proto */
1832 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1833  PyObject *mkw, PyObject *modname, PyObject *doc);
1834 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1835  PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1836 
1837 /* CLineInTraceback.proto */
1838 #ifdef CYTHON_CLINE_IN_TRACEBACK
1839 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1840 #else
1841 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1842 #endif
1843 
1844 /* CodeObjectCache.proto */
1845 typedef struct {
1846  PyCodeObject* code_object;
1847  int code_line;
1848 } __Pyx_CodeObjectCacheEntry;
1849 struct __Pyx_CodeObjectCache {
1850  int count;
1851  int max_count;
1852  __Pyx_CodeObjectCacheEntry* entries;
1853 };
1854 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1855 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1856 static PyCodeObject *__pyx_find_code_object(int code_line);
1857 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1858 
1859 /* AddTraceback.proto */
1860 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1861  int py_line, const char *filename);
1862 
1863 /* BufferStructDeclare.proto */
1864 typedef struct {
1865  Py_ssize_t shape, strides, suboffsets;
1866 } __Pyx_Buf_DimInfo;
1867 typedef struct {
1868  size_t refcount;
1869  Py_buffer pybuffer;
1870 } __Pyx_Buffer;
1871 typedef struct {
1872  __Pyx_Buffer *rcbuffer;
1873  char *data;
1874  __Pyx_Buf_DimInfo diminfo[8];
1875 } __Pyx_LocalBuf_ND;
1876 
1877 #if PY_MAJOR_VERSION < 3
1878  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1879  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1880 #else
1881  #define __Pyx_GetBuffer PyObject_GetBuffer
1882  #define __Pyx_ReleaseBuffer PyBuffer_Release
1883 #endif
1884 
1885 
1886 /* GCCDiagnostics.proto */
1887 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1888 #define __Pyx_HAS_GCC_DIAGNOSTIC
1889 #endif
1890 
1891 /* Print.proto */
1892 static int __Pyx_Print(PyObject*, PyObject *, int);
1893 #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
1894 static PyObject* __pyx_print = 0;
1895 static PyObject* __pyx_print_kwargs = 0;
1896 #endif
1897 
1898 /* RealImag.proto */
1899 #if CYTHON_CCOMPLEX
1900  #ifdef __cplusplus
1901  #define __Pyx_CREAL(z) ((z).real())
1902  #define __Pyx_CIMAG(z) ((z).imag())
1903  #else
1904  #define __Pyx_CREAL(z) (__real__(z))
1905  #define __Pyx_CIMAG(z) (__imag__(z))
1906  #endif
1907 #else
1908  #define __Pyx_CREAL(z) ((z).real)
1909  #define __Pyx_CIMAG(z) ((z).imag)
1910 #endif
1911 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1912  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1913  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1914  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1915 #else
1916  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1917  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1918 #endif
1919 
1920 /* Arithmetic.proto */
1921 #if CYTHON_CCOMPLEX
1922  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1923  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1924  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1925  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1926  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1927  #define __Pyx_c_neg_float(a) (-(a))
1928  #ifdef __cplusplus
1929  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1930  #define __Pyx_c_conj_float(z) (::std::conj(z))
1931  #if 1
1932  #define __Pyx_c_abs_float(z) (::std::abs(z))
1933  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1934  #endif
1935  #else
1936  #define __Pyx_c_is_zero_float(z) ((z)==0)
1937  #define __Pyx_c_conj_float(z) (conjf(z))
1938  #if 1
1939  #define __Pyx_c_abs_float(z) (cabsf(z))
1940  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1941  #endif
1942  #endif
1943 #else
1944  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1945  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1946  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1947  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1948  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1949  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1950  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1951  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1952  #if 1
1953  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1954  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1955  #endif
1956 #endif
1957 
1958 /* Arithmetic.proto */
1959 #if CYTHON_CCOMPLEX
1960  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1961  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1962  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1963  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1964  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1965  #define __Pyx_c_neg_double(a) (-(a))
1966  #ifdef __cplusplus
1967  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1968  #define __Pyx_c_conj_double(z) (::std::conj(z))
1969  #if 1
1970  #define __Pyx_c_abs_double(z) (::std::abs(z))
1971  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1972  #endif
1973  #else
1974  #define __Pyx_c_is_zero_double(z) ((z)==0)
1975  #define __Pyx_c_conj_double(z) (conj(z))
1976  #if 1
1977  #define __Pyx_c_abs_double(z) (cabs(z))
1978  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1979  #endif
1980  #endif
1981 #else
1982  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1983  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1984  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1985  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1986  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1987  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1988  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1989  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1990  #if 1
1991  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1992  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1993  #endif
1994 #endif
1995 
1996 /* CIntToPy.proto */
1997 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1998 
1999 /* PrintOne.proto */
2000 static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
2001 
2002 /* CIntFromPy.proto */
2003 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2004 
2005 /* CIntToPy.proto */
2006 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2007 
2008 /* CIntFromPy.proto */
2009 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2010 
2011 /* FastTypeChecks.proto */
2012 #if CYTHON_COMPILING_IN_CPYTHON
2013 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2014 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2015 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2016 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2017 #else
2018 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2019 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2020 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2021 #endif
2022 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2023 
2024 /* SwapException.proto */
2025 #if CYTHON_FAST_THREAD_STATE
2026 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2027 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2028 #else
2029 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2030 #endif
2031 
2032 /* PyObjectGetMethod.proto */
2033 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
2034 
2035 /* PyObjectCallMethod1.proto */
2036 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
2037 
2038 /* CoroutineBase.proto */
2039 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
2040 #if CYTHON_USE_EXC_INFO_STACK
2041 #define __Pyx_ExcInfoStruct _PyErr_StackItem
2042 #else
2043 typedef struct {
2044  PyObject *exc_type;
2045  PyObject *exc_value;
2046  PyObject *exc_traceback;
2047 } __Pyx_ExcInfoStruct;
2048 #endif
2049 typedef struct {
2050  PyObject_HEAD
2051  __pyx_coroutine_body_t body;
2052  PyObject *closure;
2053  __Pyx_ExcInfoStruct gi_exc_state;
2054  PyObject *gi_weakreflist;
2055  PyObject *classobj;
2056  PyObject *yieldfrom;
2057  PyObject *gi_name;
2058  PyObject *gi_qualname;
2059  PyObject *gi_modulename;
2060  PyObject *gi_code;
2061  PyObject *gi_frame;
2062  int resume_label;
2063  char is_running;
2064 } __pyx_CoroutineObject;
2065 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
2066  PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2067  PyObject *name, PyObject *qualname, PyObject *module_name);
2068 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
2069  __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2070  PyObject *name, PyObject *qualname, PyObject *module_name);
2071 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
2072 static int __Pyx_Coroutine_clear(PyObject *self);
2073 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
2074 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
2075 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
2076 #if CYTHON_USE_EXC_INFO_STACK
2077 #define __Pyx_Coroutine_SwapException(self)
2078 #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
2079 #else
2080 #define __Pyx_Coroutine_SwapException(self) {\
2081  __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
2082  __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
2083  }
2084 #define __Pyx_Coroutine_ResetAndClearException(self) {\
2085  __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
2086  (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
2087  }
2088 #endif
2089 #if CYTHON_FAST_THREAD_STATE
2090 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2091  __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
2092 #else
2093 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2094  __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
2095 #endif
2096 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
2097 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
2098 
2099 /* PatchModuleWithCoroutine.proto */
2100 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
2101 
2102 /* PatchGeneratorABC.proto */
2103 static int __Pyx_patch_abc(void);
2104 
2105 /* Generator.proto */
2106 #define __Pyx_Generator_USED
2107 static PyTypeObject *__pyx_GeneratorType = 0;
2108 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
2109 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
2110  __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
2111 static PyObject *__Pyx_Generator_Next(PyObject *self);
2112 static int __pyx_Generator_init(void);
2113 
2114 /* CheckBinaryVersion.proto */
2115 static int __Pyx_check_binary_version(void);
2116 
2117 /* InitStrings.proto */
2118 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2119 
2120 
2121 /* Module declarations from 'cpython.buffer' */
2122 
2123 /* Module declarations from 'libc.string' */
2124 
2125 /* Module declarations from 'libc.stdio' */
2126 
2127 /* Module declarations from '__builtin__' */
2128 
2129 /* Module declarations from 'cpython.type' */
2130 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2131 
2132 /* Module declarations from 'cpython' */
2133 
2134 /* Module declarations from 'cpython.object' */
2135 
2136 /* Module declarations from 'cpython.ref' */
2137 
2138 /* Module declarations from 'cpython.mem' */
2139 
2140 /* Module declarations from 'numpy' */
2141 
2142 /* Module declarations from 'numpy' */
2143 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2144 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2145 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2146 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2147 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2148 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2149 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2150 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2151 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2152 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2153 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2154 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2155 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2156 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2157 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2158 
2159 /* Module declarations from 'libc.math' */
2160 
2161 /* Module declarations from 'Isosurface' */
2162 static PyTypeObject *__pyx_ptype_10Isosurface___pyx_scope_struct__attachModel = 0;
2163 static PyTypeObject *__pyx_ptype_10Isosurface___pyx_scope_struct_1_genexpr = 0;
2164 static PyArrayObject *__pyx_f_10Isosurface_EVec(struct __pyx_opt_args_10Isosurface_EVec *__pyx_optional_args); /*proto*/
2165 static double __pyx_f_10Isosurface_enorm(PyArrayObject *); /*proto*/
2166 static double __pyx_f_10Isosurface_edot(PyArrayObject *, PyArrayObject *); /*proto*/
2167 static PyArrayObject *__pyx_f_10Isosurface_ecross(PyArrayObject *, PyArrayObject *); /*proto*/
2168 static double __pyx_f_10Isosurface_etriple(PyArrayObject *, PyArrayObject *, PyArrayObject *); /*proto*/
2169 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 };
2170 #define __Pyx_MODULE_NAME "Isosurface"
2171 extern int __pyx_module_is_main_Isosurface;
2172 int __pyx_module_is_main_Isosurface = 0;
2173 
2174 /* Implementation of 'Isosurface' */
2175 static PyObject *__pyx_builtin_enumerate;
2176 static PyObject *__pyx_builtin_NotImplementedError;
2177 static PyObject *__pyx_builtin_range;
2178 static PyObject *__pyx_builtin_open;
2179 static PyObject *__pyx_builtin_zip;
2180 static PyObject *__pyx_builtin_ImportError;
2181 static const char __pyx_k_I[] = "I";
2182 static const char __pyx_k_J[] = "J";
2183 static const char __pyx_k_L[] = "L";
2184 static const char __pyx_k_a[] = "a";
2185 static const char __pyx_k_d[] = "d";
2186 static const char __pyx_k_e[] = "e";
2187 static const char __pyx_k_f[] = "f";
2188 static const char __pyx_k_i[] = "i";
2189 static const char __pyx_k_j[] = "j";
2190 static const char __pyx_k_n[] = "n";
2191 static const char __pyx_k_s[] = "s";
2192 static const char __pyx_k_u[] = "u";
2193 static const char __pyx_k_v[] = "v";
2194 static const char __pyx_k_w[] = "w";
2195 static const char __pyx_k_x[] = "x";
2196 static const char __pyx_k__4[] = "/";
2197 static const char __pyx_k__6[] = "}\n";
2198 static const char __pyx_k_ar[] = "ar";
2199 static const char __pyx_k_dx[] = "dx";
2200 static const char __pyx_k_eN[] = "eN";
2201 static const char __pyx_k_h5[] = "h5";
2202 static const char __pyx_k_ni[] = "ni";
2203 static const char __pyx_k_np[] = "np";
2204 static const char __pyx_k_os[] = "os";
2205 static const char __pyx_k_0_d[] = "{0:d},\n";
2206 static const char __pyx_k_MPI[] = "MPI";
2207 static const char __pyx_k__10[] = "";
2208 static const char __pyx_k_bnt[] = "bnt";
2209 static const char __pyx_k_cam[] = "cam";
2210 static const char __pyx_k_doc[] = "__doc__";
2211 static const char __pyx_k_dof[] = "dof";
2212 static const char __pyx_k_ebN[] = "ebN";
2213 static const char __pyx_k_end[] = "end";
2214 static const char __pyx_k_eps[] = "eps";
2215 static const char __pyx_k_fur[] = "fur";
2216 static const char __pyx_k_g2b[] = "g2b";
2217 static const char __pyx_k_get[] = "get";
2218 static const char __pyx_k_log[] = "log";
2219 static const char __pyx_k_nll[] = "nll";
2220 static const char __pyx_k_phi[] = "phi";
2221 static const char __pyx_k_pov[] = "pov";
2222 static const char __pyx_k_zip[] = "zip";
2223 static const char __pyx_k_Comm[] = "Comm";
2224 static const char __pyx_k_File[] = "File";
2225 static const char __pyx_k_args[] = "args";
2226 static const char __pyx_k_comm[] = "comm";
2227 static const char __pyx_k_data[] = "data";
2228 static const char __pyx_k_dset[] = "dset";
2229 static const char __pyx_k_file[] = "file";
2230 static const char __pyx_k_h5_2[] = ".h5";
2231 static const char __pyx_k_h5py[] = "h5py";
2232 static const char __pyx_k_init[] = "__init__";
2233 static const char __pyx_k_join[] = "join";
2234 static const char __pyx_k_main[] = "__main__";
2235 static const char __pyx_k_mesh[] = "mesh";
2236 static const char __pyx_k_name[] = "__name__";
2237 static const char __pyx_k_norm[] = "norm";
2238 static const char __pyx_k_open[] = "open";
2239 static const char __pyx_k_path[] = "path";
2240 static const char __pyx_k_plus[] = "plus";
2241 static const char __pyx_k_rank[] = "rank";
2242 static const char __pyx_k_self[] = "self";
2243 static const char __pyx_k_send[] = "send";
2244 static const char __pyx_k_step[] = "step";
2245 static const char __pyx_k_test[] = "__test__";
2246 static const char __pyx_k_time[] = "time";
2247 static const char __pyx_k_PETSc[] = "PETSc";
2248 static const char __pyx_k_array[] = "array";
2249 static const char __pyx_k_cam_x[] = "cam_x";
2250 static const char __pyx_k_cam_y[] = "cam_y";
2251 static const char __pyx_k_cam_z[] = "cam_z";
2252 static const char __pyx_k_close[] = "close";
2253 static const char __pyx_k_elems[] = "elems";
2254 static const char __pyx_k_field[] = "field";
2255 static const char __pyx_k_flush[] = "flush";
2256 static const char __pyx_k_frame[] = "frame";
2257 static const char __pyx_k_fur_x[] = "fur_x";
2258 static const char __pyx_k_fur_y[] = "fur_y";
2259 static const char __pyx_k_fur_z[] = "fur_z";
2260 static const char __pyx_k_index[] = "index";
2261 static const char __pyx_k_light[] = "light";
2262 static const char __pyx_k_minus[] = "minus";
2263 static const char __pyx_k_model[] = "model";
2264 static const char __pyx_k_nPlus[] = "nPlus";
2265 static const char __pyx_k_nll_x[] = "nll_x";
2266 static const char __pyx_k_nll_y[] = "nll_y";
2267 static const char __pyx_k_nll_z[] = "nll_z";
2268 static const char __pyx_k_nodes[] = "nodes";
2269 static const char __pyx_k_numpy[] = "numpy";
2270 static const char __pyx_k_print[] = "print";
2271 static const char __pyx_k_range[] = "range";
2272 static const char __pyx_k_shape[] = "shape";
2273 static const char __pyx_k_sky_z[] = "sky_z";
2274 static const char __pyx_k_tLast[] = "tLast";
2275 static const char __pyx_k_throw[] = "throw";
2276 static const char __pyx_k_value[] = "value";
2277 static const char __pyx_k_write[] = "write";
2278 static const char __pyx_k_zeros[] = "zeros";
2279 static const char __pyx_k_domain[] = "domain";
2280 static const char __pyx_k_format[] = "format";
2281 static const char __pyx_k_import[] = "__import__";
2282 static const char __pyx_k_logDir[] = "logDir";
2283 static const char __pyx_k_module[] = "__module__";
2284 static const char __pyx_k_mpi4py[] = "mpi4py";
2285 static const char __pyx_k_nMinus[] = "nMinus";
2286 static const char __pyx_k_nZeros[] = "nZeros";
2287 static const char __pyx_k_normal[] = "normal";
2288 static const char __pyx_k_string[] = "string";
2289 static const char __pyx_k_values[] = "values";
2290 static const char __pyx_k_wall_y[] = "wall_y";
2291 static const char __pyx_k_AV_base[] = "AV_base";
2292 static const char __pyx_k_barrier[] = "barrier";
2293 static const char __pyx_k_field_i[] = "field_i";
2294 static const char __pyx_k_flatten[] = "flatten";
2295 static const char __pyx_k_floor_z[] = "floor_z";
2296 static const char __pyx_k_genexpr[] = "genexpr";
2297 static const char __pyx_k_light_x[] = "light_x";
2298 static const char __pyx_k_light_y[] = "light_y";
2299 static const char __pyx_k_light_z[] = "light_z";
2300 static const char __pyx_k_look_at[] = "look_at";
2301 static const char __pyx_k_nFrames[] = "nFrames";
2302 static const char __pyx_k_normals[] = "normals";
2303 static const char __pyx_k_prepare[] = "__prepare__";
2304 static const char __pyx_k_product[] = "product";
2305 static const char __pyx_k_proteus[] = "proteus";
2306 static const char __pyx_k_FemField[] = "FemField";
2307 static const char __pyx_k_Template[] = "Template";
2308 static const char __pyx_k_elements[] = "elements";
2309 static const char __pyx_k_filename[] = "filename";
2310 static const char __pyx_k_get_node[] = "get_node";
2311 static const char __pyx_k_isMaster[] = "isMaster";
2312 static const char __pyx_k_light_dx[] = "light_dx";
2313 static const char __pyx_k_light_dy[] = "light_dy";
2314 static const char __pyx_k_logEvent[] = "logEvent";
2315 static const char __pyx_k_nN_start[] = "nN_start";
2316 static const char __pyx_k_petsc4py[] = "petsc4py";
2317 static const char __pyx_k_povScene[] = "povScene";
2318 static const char __pyx_k_qualname[] = "__qualname__";
2319 static const char __pyx_k_Profiling[] = "Profiling";
2320 static const char __pyx_k_calculate[] = "calculate";
2321 static const char __pyx_k_checkTime[] = "checkTime";
2322 static const char __pyx_k_enumerate[] = "enumerate";
2323 static const char __pyx_k_fine_grid[] = "fine_grid";
2324 static const char __pyx_k_itertools[] = "itertools";
2325 static const char __pyx_k_look_at_x[] = "look_at_x";
2326 static const char __pyx_k_look_at_y[] = "look_at_y";
2327 static const char __pyx_k_look_at_z[] = "look_at_z";
2328 static const char __pyx_k_metaclass[] = "__metaclass__";
2329 static const char __pyx_k_nodeArray[] = "nodeArray";
2330 static const char __pyx_k_Isosurface[] = "Isosurface";
2331 static const char __pyx_k_activeTime[] = "activeTime";
2332 static const char __pyx_k_attachHDF5[] = "attachHDF5";
2333 static const char __pyx_k_fieldNames[] = "fieldNames";
2334 static const char __pyx_k_fileprefix[] = "fileprefix";
2335 static const char __pyx_k_isosurface[] = "isosurface";
2336 static const char __pyx_k_namedtuple[] = "namedtuple";
2337 static const char __pyx_k_sampleRate[] = "sampleRate";
2338 static const char __pyx_k_substitute[] = "substitute";
2339 static const char __pyx_k_0_d_1_d_2_d[] = "<{0:d},{1:d},{2:d}>,\n";
2340 static const char __pyx_k_0_f_1_f_2_f[] = "<{0:f}, {1:f}, {2:f}>,\n";
2341 static const char __pyx_k_ImportError[] = "ImportError";
2342 static const char __pyx_k_OrderedDict[] = "OrderedDict";
2343 static const char __pyx_k_attachModel[] = "attachModel";
2344 static const char __pyx_k_collections[] = "collections";
2345 static const char __pyx_k_defaultdict[] = "defaultdict";
2346 static const char __pyx_k_isosurfaces[] = "isosurfaces";
2347 static const char __pyx_k_next_output[] = "next_output";
2348 static const char __pyx_k_proteus_inc[] = "proteus.inc";
2349 static const char __pyx_k_coefficients[] = "coefficients";
2350 static const char __pyx_k_domain_fur_x[] = "domain_fur_x";
2351 static const char __pyx_k_domain_fur_y[] = "domain_fur_y";
2352 static const char __pyx_k_domain_fur_z[] = "domain_fur_z";
2353 static const char __pyx_k_domain_nll_x[] = "domain_nll_x";
2354 static const char __pyx_k_domain_nll_y[] = "domain_nll_y";
2355 static const char __pyx_k_domain_nll_z[] = "domain_nll_z";
2356 static const char __pyx_k_face_indices[] = "face_indices {\n ";
2357 static const char __pyx_k_numpy_linalg[] = "numpy.linalg";
2358 static const char __pyx_k_pov_filename[] = "pov_filename";
2359 static const char __pyx_k_0_d_1_d_2_d_2[] = "<{0:d}, {1:d}, {2:d}>,\n";
2360 static const char __pyx_k_boundaryNodes[] = "boundaryNodes";
2361 static const char __pyx_k_count_nonzero[] = "count_nonzero";
2362 static const char __pyx_k_endSequential[] = "endSequential";
2363 static const char __pyx_k_variableNames[] = "variableNames";
2364 static const char __pyx_k_writeBoundary[] = "writeBoundary";
2365 static const char __pyx_k_create_dataset[] = "create_dataset";
2366 static const char __pyx_k_face_indices_2[] = " }\n face_indices {\n ";
2367 static const char __pyx_k_levelModelList[] = "levelModelList";
2368 static const char __pyx_k_normal_indices[] = "normal_indices";
2369 static const char __pyx_k_normal_vectors[] = " }\n normal_vectors {\n ";
2370 static const char __pyx_k_beginSequential[] = "beginSequential";
2371 static const char __pyx_k_timeIntegration[] = "timeIntegration";
2372 static const char __pyx_k_nElements_global[] = "nElements_global";
2373 static const char __pyx_k_normal_indices_2[] = " }\n normal_indices {\n ";
2374 static const char __pyx_k_povSceneTemplate[] = "povSceneTemplate";
2375 static const char __pyx_k_writeSceneHeader[] = "writeSceneHeader";
2376 static const char __pyx_k_ATTACHING_TO_HDF5[] = "ATTACHING TO HDF5 !!";
2377 static const char __pyx_k_Isosurface___init[] = "Isosurface.__init__";
2378 static const char __pyx_k_Writing_pov_frame[] = "Writing pov frame ";
2379 static const char __pyx_k_elementNodesArray[] = "elementNodesArray";
2380 static const char __pyx_k_AuxiliaryVariables[] = "AuxiliaryVariables";
2381 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2382 static const char __pyx_k_num_owned_elements[] = "num_owned_elements";
2383 static const char __pyx_k_Extract_isosurfaces[] = "Extract isosurfaces";
2384 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
2385 static const char __pyx_k_nodesSpatial_Domain[] = "/nodesSpatial_Domain";
2386 static const char __pyx_k_writeIsosurfaceMesh[] = "writeIsosurfaceMesh";
2387 static const char __pyx_k_Isosurface_calculate[] = "Isosurface.calculate";
2388 static const char __pyx_k_mesh2_vertex_vectors[] = "mesh2 {\nvertex_vectors {";
2389  static const char __pyx_k_Isosurface_attachHDF5[] = "Isosurface.attachHDF5";
2390  static const char __pyx_k_inside_vector_on_mesh[] = "//inside_vector on\n}//mesh\n";
2391  static const char __pyx_k_triangulateIsosurface[] = "triangulateIsosurface";
2392  static const char __pyx_k_Isosurface_attachModel[] = "Isosurface.attachModel";
2393  static const char __pyx_k_elementsSpatial_Domain[] = "/elementsSpatial_Domain";
2394  static const char __pyx_k_proteus_Isosurface_pyx[] = "proteus/Isosurface.pyx";
2395  static const char __pyx_k_writeIsosurfaceMesh_h5[] = "writeIsosurfaceMesh_h5";
2396  static const char __pyx_k_Calculate_called_at_time[] = "Calculate called at time ";
2397  static const char __pyx_k_elementBoundaryNodesArray[] = "elementBoundaryNodesArray";
2398  static const char __pyx_k_writeIsosurfaceMesh_povray[] = "writeIsosurfaceMesh_povray";
2399  static const char __pyx_k_Isosurface_writeSceneHeader[] = "Isosurface.writeSceneHeader";
2400  static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
2401  static const char __pyx_k_Isosurface_writeIsosurfaceMesh[] = "Isosurface.writeIsosurfaceMesh";
2402  static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
2403  static const char __pyx_k_AuxiliaryVariables_subclasses_f[] = "\nAuxiliaryVariables subclasses for extracting isosurfaces and contours\n";
2404  static const char __pyx_k_Only_zero_isocontour_extraction[] = "Only zero isocontour extraction";
2405  static const char __pyx_k_field_s___value_f___frame_04d_p[] = "{field:s}_{value:f}_{frame:04d}.pov";
2406  static const char __pyx_k_include_colors_inc_include_text[] = "#include \"colors.inc\"\n#include \"textures.inc\"\n#include \"glass.inc\"\n#include \"metals.inc\"\n#include \"golds.inc\"\n#include \"stones.inc\"\n#include \"woods.inc\"\n#include \"shapes.inc\"\n#include \"shapes2.inc\"\n#include \"functions.inc\"\n#include \"math.inc\"\n#include \"transforms.inc\"\n\nglobal_settings {\n ambient_light color rgb <1.0, 1.0, 1.0>\n assumed_gamma 2\n}\n\nbackground { color rgb <0.319997, 0.340002, 0.429999>}\n\ncamera {\n perspective\n location <$cam_x,$cam_y,$cam_z>\n sky <0.0, 0.0, 5.0>\n up <0, 0, 1>\n right <1.33, 0, 0>\n angle 45.000000\n look_at <$look_at_x,$look_at_y,$look_at_z>\n}\n\nlight_source {<$light_x,$light_y,$light_z> color White}\n\nlight_source {\n <$light_x+$light_dx,$light_y+$light_dy,$light_z>\n color <0.99980, 0.999800, 0.999800>*2.250000\n spotlight\n point_at <0.5,0.5,0.0>\n}\n\nlight_source {\n <$light_x+$light_dx,$light_y-$light_dy,$light_z>\n color <0.99980, 0.999800, 0.999800>*2.250000\n spotlight\n point_at <0.5,0.5,0.0>\n}\n\nlight_source {\n <$light_x-$light_dx,$light_y-$light_dy,$light_z>\n color <0.99980, 0.999800, 0.999800>*2.250000\n spotlight\n point_at <0.5,0.5,0.0>\n}\n\nlight_source {\n <$light_x-$light_dx,+$light_y,$light_z>\n color <0.99980, 0.999800, 0.999800>*2.250000\n spotlight\n point_at <0.5,0.5,0.0>\n}\n\n// ground -----------------------------------------------------------------\n//---------------------------------<<< settings of squared plane dimensions\n#declare RasterScale = 0.10;\n#declare RasterHalfLine = 0.0125;\n#declare RasterHalfLineZ = 0.0125;\n//-------------------------------------------------------------------------\n#macro Raster(RScale, HLine)\n pigment{ gradient x scale RScale\n color_map{[0.000 color rgbt<1,1,1,0>*0.8]\n [0+HLine color rgbt<1,1,1,0"">*0.8]\n [0+HLine color rgbt<1,1,1,1>]\n [1-HLine color rgbt<1,1,1,1>]\n [1-HLine color rgbt<1,1,1,0>*0.8]\n [1.000 color rgbt<1,1,1,0>*0.8]} }\n #end// of Raster(RScale, HLine)-macro\n//-------------------------------------------------------------------------\n\n// squared plane XY\nplane { <0,0,1>, $floor_z // plane with layered textures\n texture { pigment{checker color White, color Black}\n scale $light_dy*0.5}\n }\nplane { <0,-1,0>, $wall_y // plane with layered textures\n texture { pigment{color White}\n }\n rotate<0,0,0>\n }\nplane { <0,0,-1>, $sky_z // plane with layered textures\n texture { pigment{color Blue}\n }\n rotate<0,0,0>\n }\n//------------------------------------------------ end of squared plane XZ\n#macro tank_material()\nmaterial{\n texture{\n pigment{ rgbf<.98,.98,.98,0.85>*1}\n finish { ambient 0.0\n diffuse 0.15\n reflection 0.2\n specular 0.6\n roughness 0.005\n // phong 1\n // phong_size 400\n reflection { 0.03, 1.0 fresnel on }\n // conserve_energy\n }\n } // end of texture\n\n interior{ ior 1.5\n fade_power 1001\n fade_distance 0.5\n fade_color <0.8,0.8,0.8>\n } // end of interior\n\n\n} // end of material\n#end\n\n#macro isosurface_material()\nmaterial{\n texture{\n pigment{ rgbf<.98,.98,.98,0.9>*0.95}\n finish { ambient 0.0\n diffuse 0.15\n specular 0.6\n roughness 0.005\n //phong 1\n //phong_size 400\n reflection { 0.2, 1.0 fresnel on }\n conserve_energy\n }\n } // end of texture\n\n interior{ ior 1.33\n fade_power 1001\n fade_distance 0.5\n fade_color <0.8,0.8,0.8>\n } // end of inte""rior\n} // end of material\n#end\n";
2407 static const char __pyx_k_matrix_1_000000_0_000000_0_0000[] = " }\n matrix < 1.000000, 0.000000, 0.000000,\n 0.000000, 1.000000, 0.000000,\n 0.000000, 0.000000, 1.000000,\n 0.000000, 0.000000, 0.000000 >\n isosurface_material()\n }\n";
2408 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2409 static const char __pyx_k_object_difference_box_nll_x_nll[] = "\nobject\n{\ndifference\n{\nbox {\n <$nll_x,$nll_y,$nll_z>, // Near lower left corner\n <$fur_x,$fur_y,$fur_z> // Far upper right corner\n }\nbox {\n <$domain_nll_x,$domain_nll_y,$domain_nll_z>, // Near lower left corner\n <$domain_fur_x,$domain_fur_y,$domain_fur_z> // Far upper right corner\n }\n}//difference of perturbed bounding box and boundary\n matrix < 1.000000, 0.000000, 0.000000,\n 0.000000, 1.000000, 0.000000,\n 0.000000, 0.000000, 1.000000,\n 0.000000, 0.000000, 0.000000 >\n tank_material()\n}//object\n";
2410 static const char __pyx_k_union_of_meshes_difference_of_p[] = "}//union of meshes\n//}//difference of perturbed bounding box and boundary\n matrix < 1.000000, 0.000000, 0.000000,\n 0.000000, 1.000000, 0.000000,\n 0.000000, 0.000000, 1.000000,\n 0.000000, 0.000000, 0.000000 >\n tank_material()\n}//object\n";
2411 static const char __pyx_k_version_3_7_include_proteus_inc[] = "#version 3.7;\n#include \"proteus.inc\"\n";
2412 static const char __pyx_k_Elements_have_0_d_vertices_but_a[] = "Elements have {0:d} vertices but algorithm is for tets";
2413 static const char __pyx_k_Isosurface_attachModel_locals_ge[] = "Isosurface.attachModel.<locals>.genexpr";
2414 static const char __pyx_k_Isosurface_file_format_not_recog[] = "Isosurface file format not recognized";
2415 static const char __pyx_k_Isosurface_triangulateIsosurface[] = "Isosurface.triangulateIsosurface";
2416 static const char __pyx_k_Isosurface_writeIsosurfaceMesh_h[] = "Isosurface.writeIsosurfaceMesh_h5";
2417 static const char __pyx_k_Isosurface_writeIsosurfaceMesh_p[] = "Isosurface.writeIsosurfaceMesh_povray";
2418 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2419 static const char __pyx_k_only_implemented_for_0_isosurfac[] = "only implemented for 0 isosurface in 3D for now";
2420 static const char __pyx_k_object_difference_box_nll_x_nll_2[] = "\nobject\n{\n//difference\n//{\n// box {\n// <$nll_x,$nll_y,$nll_z>, // Near lower left corner\n// <$fur_x,$fur_y,$fur_z> // Far upper right corner\n// }\nunion\n{\n";
2421 static PyObject *__pyx_kp_s_0_d;
2422 static PyObject *__pyx_kp_s_0_d_1_d_2_d;
2423 static PyObject *__pyx_kp_s_0_d_1_d_2_d_2;
2424 static PyObject *__pyx_kp_s_0_f_1_f_2_f;
2425 static PyObject *__pyx_kp_s_ATTACHING_TO_HDF5;
2426 static PyObject *__pyx_n_s_AV_base;
2427 static PyObject *__pyx_n_s_AuxiliaryVariables;
2428 static PyObject *__pyx_kp_s_Calculate_called_at_time;
2429 static PyObject *__pyx_n_s_Comm;
2430 static PyObject *__pyx_kp_s_Elements_have_0_d_vertices_but_a;
2431 static PyObject *__pyx_kp_s_Extract_isosurfaces;
2432 static PyObject *__pyx_n_s_FemField;
2433 static PyObject *__pyx_n_s_File;
2434 static PyObject *__pyx_n_s_I;
2435 static PyObject *__pyx_n_s_ImportError;
2436 static PyObject *__pyx_n_s_Isosurface;
2437 static PyObject *__pyx_n_s_Isosurface___init;
2438 static PyObject *__pyx_n_s_Isosurface_attachHDF5;
2439 static PyObject *__pyx_n_s_Isosurface_attachModel;
2440 static PyObject *__pyx_n_s_Isosurface_attachModel_locals_ge;
2441 static PyObject *__pyx_n_s_Isosurface_calculate;
2442 static PyObject *__pyx_kp_s_Isosurface_file_format_not_recog;
2443 static PyObject *__pyx_n_s_Isosurface_triangulateIsosurface;
2444 static PyObject *__pyx_n_s_Isosurface_writeIsosurfaceMesh;
2445 static PyObject *__pyx_n_s_Isosurface_writeIsosurfaceMesh_h;
2446 static PyObject *__pyx_n_s_Isosurface_writeIsosurfaceMesh_p;
2447 static PyObject *__pyx_n_s_Isosurface_writeSceneHeader;
2448 static PyObject *__pyx_n_s_J;
2449 static PyObject *__pyx_n_s_L;
2450 static PyObject *__pyx_n_s_MPI;
2451 static PyObject *__pyx_n_s_NotImplementedError;
2452 static PyObject *__pyx_kp_s_Only_zero_isocontour_extraction;
2453 static PyObject *__pyx_n_s_OrderedDict;
2454 static PyObject *__pyx_n_s_PETSc;
2455 static PyObject *__pyx_n_s_Profiling;
2456 static PyObject *__pyx_n_s_Template;
2457 static PyObject *__pyx_kp_s_Writing_pov_frame;
2458 static PyObject *__pyx_n_s__10;
2459 static PyObject *__pyx_kp_s__4;
2460 static PyObject *__pyx_kp_s__6;
2461 static PyObject *__pyx_n_s_a;
2462 static PyObject *__pyx_n_s_activeTime;
2463 static PyObject *__pyx_n_s_ar;
2464 static PyObject *__pyx_n_s_args;
2465 static PyObject *__pyx_n_s_array;
2466 static PyObject *__pyx_n_s_attachHDF5;
2467 static PyObject *__pyx_n_s_attachModel;
2468 static PyObject *__pyx_n_s_barrier;
2469 static PyObject *__pyx_n_s_beginSequential;
2470 static PyObject *__pyx_n_s_bnt;
2471 static PyObject *__pyx_n_s_boundaryNodes;
2472 static PyObject *__pyx_n_s_calculate;
2473 static PyObject *__pyx_n_s_cam;
2474 static PyObject *__pyx_n_s_cam_x;
2475 static PyObject *__pyx_n_s_cam_y;
2476 static PyObject *__pyx_n_s_cam_z;
2477 static PyObject *__pyx_n_s_checkTime;
2478 static PyObject *__pyx_n_s_cline_in_traceback;
2479 static PyObject *__pyx_n_s_close;
2480 static PyObject *__pyx_n_s_coefficients;
2481 static PyObject *__pyx_n_s_collections;
2482 static PyObject *__pyx_n_s_comm;
2483 static PyObject *__pyx_n_s_count_nonzero;
2484 static PyObject *__pyx_n_s_create_dataset;
2485 static PyObject *__pyx_n_s_d;
2486 static PyObject *__pyx_n_s_data;
2487 static PyObject *__pyx_n_s_defaultdict;
2488 static PyObject *__pyx_n_s_doc;
2489 static PyObject *__pyx_n_s_dof;
2490 static PyObject *__pyx_n_s_domain;
2491 static PyObject *__pyx_n_s_domain_fur_x;
2492 static PyObject *__pyx_n_s_domain_fur_y;
2493 static PyObject *__pyx_n_s_domain_fur_z;
2494 static PyObject *__pyx_n_s_domain_nll_x;
2495 static PyObject *__pyx_n_s_domain_nll_y;
2496 static PyObject *__pyx_n_s_domain_nll_z;
2497 static PyObject *__pyx_n_s_dset;
2498 static PyObject *__pyx_n_s_dx;
2499 static PyObject *__pyx_n_s_e;
2500 static PyObject *__pyx_n_s_eN;
2501 static PyObject *__pyx_n_s_ebN;
2502 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
2503 static PyObject *__pyx_n_s_elementBoundaryNodesArray;
2504 static PyObject *__pyx_n_s_elementNodesArray;
2505 static PyObject *__pyx_n_s_elements;
2506 static PyObject *__pyx_kp_s_elementsSpatial_Domain;
2507 static PyObject *__pyx_n_s_elems;
2508 static PyObject *__pyx_n_s_end;
2509 static PyObject *__pyx_n_s_endSequential;
2510 static PyObject *__pyx_n_s_enumerate;
2511 static PyObject *__pyx_n_s_eps;
2512 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
2513 static PyObject *__pyx_n_s_f;
2514 static PyObject *__pyx_kp_s_face_indices;
2515 static PyObject *__pyx_kp_s_face_indices_2;
2516 static PyObject *__pyx_n_s_field;
2517 static PyObject *__pyx_n_s_fieldNames;
2518 static PyObject *__pyx_n_s_field_i;
2519 static PyObject *__pyx_kp_s_field_s___value_f___frame_04d_p;
2520 static PyObject *__pyx_n_s_file;
2521 static PyObject *__pyx_n_s_filename;
2522 static PyObject *__pyx_n_s_fileprefix;
2523 static PyObject *__pyx_n_s_fine_grid;
2524 static PyObject *__pyx_n_s_flatten;
2525 static PyObject *__pyx_n_s_floor_z;
2526 static PyObject *__pyx_n_s_flush;
2527 static PyObject *__pyx_n_s_format;
2528 static PyObject *__pyx_n_s_frame;
2529 static PyObject *__pyx_n_s_fur;
2530 static PyObject *__pyx_n_s_fur_x;
2531 static PyObject *__pyx_n_s_fur_y;
2532 static PyObject *__pyx_n_s_fur_z;
2533 static PyObject *__pyx_n_s_g2b;
2534 static PyObject *__pyx_n_s_genexpr;
2535 static PyObject *__pyx_n_s_get;
2536 static PyObject *__pyx_n_s_get_node;
2537 static PyObject *__pyx_n_s_h5;
2538 static PyObject *__pyx_kp_s_h5_2;
2539 static PyObject *__pyx_n_s_h5py;
2540 static PyObject *__pyx_n_s_i;
2541 static PyObject *__pyx_n_s_import;
2542 static PyObject *__pyx_kp_s_include_colors_inc_include_text;
2543 static PyObject *__pyx_n_s_index;
2544 static PyObject *__pyx_n_s_init;
2545 static PyObject *__pyx_kp_s_inside_vector_on_mesh;
2546 static PyObject *__pyx_n_s_isMaster;
2547 static PyObject *__pyx_n_s_isosurface;
2548 static PyObject *__pyx_n_s_isosurfaces;
2549 static PyObject *__pyx_n_s_itertools;
2550 static PyObject *__pyx_n_s_j;
2551 static PyObject *__pyx_n_s_join;
2552 static PyObject *__pyx_n_s_levelModelList;
2553 static PyObject *__pyx_n_s_light;
2554 static PyObject *__pyx_n_s_light_dx;
2555 static PyObject *__pyx_n_s_light_dy;
2556 static PyObject *__pyx_n_s_light_x;
2557 static PyObject *__pyx_n_s_light_y;
2558 static PyObject *__pyx_n_s_light_z;
2559 static PyObject *__pyx_n_s_log;
2560 static PyObject *__pyx_n_s_logDir;
2561 static PyObject *__pyx_n_s_logEvent;
2562 static PyObject *__pyx_n_s_look_at;
2563 static PyObject *__pyx_n_s_look_at_x;
2564 static PyObject *__pyx_n_s_look_at_y;
2565 static PyObject *__pyx_n_s_look_at_z;
2566 static PyObject *__pyx_n_s_main;
2567 static PyObject *__pyx_kp_s_matrix_1_000000_0_000000_0_0000;
2568 static PyObject *__pyx_n_s_mesh;
2569 static PyObject *__pyx_kp_s_mesh2_vertex_vectors;
2570 static PyObject *__pyx_n_s_metaclass;
2571 static PyObject *__pyx_n_s_minus;
2572 static PyObject *__pyx_n_s_model;
2573 static PyObject *__pyx_n_s_module;
2574 static PyObject *__pyx_n_s_mpi4py;
2575 static PyObject *__pyx_n_s_n;
2576 static PyObject *__pyx_n_s_nElements_global;
2577 static PyObject *__pyx_n_s_nFrames;
2578 static PyObject *__pyx_n_s_nMinus;
2579 static PyObject *__pyx_n_s_nN_start;
2580 static PyObject *__pyx_n_s_nPlus;
2581 static PyObject *__pyx_n_s_nZeros;
2582 static PyObject *__pyx_n_s_name;
2583 static PyObject *__pyx_n_s_namedtuple;
2584 static PyObject *__pyx_n_s_next_output;
2585 static PyObject *__pyx_n_s_ni;
2586 static PyObject *__pyx_n_s_nll;
2587 static PyObject *__pyx_n_s_nll_x;
2588 static PyObject *__pyx_n_s_nll_y;
2589 static PyObject *__pyx_n_s_nll_z;
2590 static PyObject *__pyx_n_s_nodeArray;
2591 static PyObject *__pyx_n_s_nodes;
2592 static PyObject *__pyx_kp_s_nodesSpatial_Domain;
2593 static PyObject *__pyx_n_s_norm;
2594 static PyObject *__pyx_n_s_normal;
2595 static PyObject *__pyx_n_s_normal_indices;
2596 static PyObject *__pyx_kp_s_normal_indices_2;
2597 static PyObject *__pyx_kp_s_normal_vectors;
2598 static PyObject *__pyx_n_s_normals;
2599 static PyObject *__pyx_n_s_np;
2600 static PyObject *__pyx_n_s_num_owned_elements;
2601 static PyObject *__pyx_n_s_numpy;
2602 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2603 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2604 static PyObject *__pyx_n_s_numpy_linalg;
2605 static PyObject *__pyx_kp_s_object_difference_box_nll_x_nll;
2606 static PyObject *__pyx_kp_s_object_difference_box_nll_x_nll_2;
2607 static PyObject *__pyx_kp_s_only_implemented_for_0_isosurfac;
2608 static PyObject *__pyx_n_s_open;
2609 static PyObject *__pyx_n_s_os;
2610 static PyObject *__pyx_n_s_path;
2611 static PyObject *__pyx_n_s_petsc4py;
2612 static PyObject *__pyx_n_s_phi;
2613 static PyObject *__pyx_n_s_plus;
2614 static PyObject *__pyx_n_s_pov;
2615 static PyObject *__pyx_n_s_povScene;
2616 static PyObject *__pyx_n_s_povSceneTemplate;
2617 static PyObject *__pyx_n_s_pov_filename;
2618 static PyObject *__pyx_n_s_prepare;
2619 static PyObject *__pyx_n_s_print;
2620 static PyObject *__pyx_n_s_product;
2621 static PyObject *__pyx_n_s_proteus;
2622 static PyObject *__pyx_kp_s_proteus_Isosurface_pyx;
2623 static PyObject *__pyx_kp_s_proteus_inc;
2624 static PyObject *__pyx_n_s_qualname;
2625 static PyObject *__pyx_n_s_range;
2626 static PyObject *__pyx_n_s_rank;
2627 static PyObject *__pyx_n_s_s;
2628 static PyObject *__pyx_n_s_sampleRate;
2629 static PyObject *__pyx_n_s_self;
2630 static PyObject *__pyx_n_s_send;
2631 static PyObject *__pyx_n_s_shape;
2632 static PyObject *__pyx_n_s_sky_z;
2633 static PyObject *__pyx_n_s_step;
2634 static PyObject *__pyx_n_s_string;
2635 static PyObject *__pyx_n_s_substitute;
2636 static PyObject *__pyx_n_s_tLast;
2637 static PyObject *__pyx_n_s_test;
2638 static PyObject *__pyx_n_s_throw;
2639 static PyObject *__pyx_n_s_time;
2640 static PyObject *__pyx_n_s_timeIntegration;
2641 static PyObject *__pyx_n_s_triangulateIsosurface;
2642 static PyObject *__pyx_n_s_u;
2643 static PyObject *__pyx_kp_s_union_of_meshes_difference_of_p;
2644 static PyObject *__pyx_n_s_v;
2645 static PyObject *__pyx_n_s_value;
2646 static PyObject *__pyx_n_s_values;
2647 static PyObject *__pyx_n_s_variableNames;
2648 static PyObject *__pyx_kp_s_version_3_7_include_proteus_inc;
2649 static PyObject *__pyx_n_s_w;
2650 static PyObject *__pyx_n_s_wall_y;
2651 static PyObject *__pyx_n_s_write;
2652 static PyObject *__pyx_n_s_writeBoundary;
2653 static PyObject *__pyx_n_s_writeIsosurfaceMesh;
2654 static PyObject *__pyx_n_s_writeIsosurfaceMesh_h5;
2655 static PyObject *__pyx_n_s_writeIsosurfaceMesh_povray;
2656 static PyObject *__pyx_n_s_writeSceneHeader;
2657 static PyObject *__pyx_n_s_x;
2658 static PyObject *__pyx_n_s_zeros;
2659 static PyObject *__pyx_n_s_zip;
2660 static PyObject *__pyx_pf_10Isosurface_10Isosurface___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_isosurfaces, PyObject *__pyx_v_domain, PyObject *__pyx_v_activeTime, PyObject *__pyx_v_sampleRate, PyObject *__pyx_v_format, PyObject *__pyx_v_writeBoundary); /* proto */
2661 static PyObject *__pyx_pf_10Isosurface_10Isosurface_11attachModel_genexpr(PyObject *__pyx_self); /* proto */
2662 static PyObject *__pyx_pf_10Isosurface_10Isosurface_2attachModel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_model, CYTHON_UNUSED PyObject *__pyx_v_ar); /* proto */
2663 static PyObject *__pyx_pf_10Isosurface_10Isosurface_4attachHDF5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_h5, PyObject *__pyx_v_step, PyObject *__pyx_v_cam); /* proto */
2664 static PyObject *__pyx_pf_10Isosurface_10Isosurface_6triangulateIsosurface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value); /* proto */
2665 static PyObject *__pyx_pf_10Isosurface_10Isosurface_8writeIsosurfaceMesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value, PyObject *__pyx_v_frame); /* proto */
2666 static PyObject *__pyx_pf_10Isosurface_10Isosurface_10writeIsosurfaceMesh_h5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_frame); /* proto */
2667 static PyObject *__pyx_pf_10Isosurface_10Isosurface_12writeIsosurfaceMesh_povray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_frame); /* proto */
2668 static PyObject *__pyx_pf_10Isosurface_10Isosurface_14calculate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_checkTime); /* proto */
2669 static PyObject *__pyx_pf_10Isosurface_10Isosurface_16writeSceneHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cam); /* proto */
2670 static PyObject *__pyx_tp_new_10Isosurface___pyx_scope_struct__attachModel(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2671 static PyObject *__pyx_tp_new_10Isosurface___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2672 static PyObject *__pyx_float_0_0;
2673 static PyObject *__pyx_float_0_5;
2674 static PyObject *__pyx_float_2_0;
2675 static PyObject *__pyx_float_0_01;
2676 static PyObject *__pyx_float_0_02;
2677 static PyObject *__pyx_float_0_85;
2678 static PyObject *__pyx_int_0;
2679 static PyObject *__pyx_int_1;
2680 static PyObject *__pyx_int_2;
2681 static PyObject *__pyx_int_3;
2682 static PyObject *__pyx_int_4;
2683 static PyObject *__pyx_int_5;
2684 static PyObject *__pyx_int_10;
2685 static PyObject *__pyx_tuple_;
2686 static PyObject *__pyx_slice__3;
2687 static PyObject *__pyx_tuple__2;
2688 static PyObject *__pyx_tuple__5;
2689 static PyObject *__pyx_tuple__7;
2690 static PyObject *__pyx_tuple__8;
2691 static PyObject *__pyx_tuple__9;
2692 static PyObject *__pyx_tuple__11;
2693 static PyObject *__pyx_tuple__13;
2694 static PyObject *__pyx_tuple__14;
2695 static PyObject *__pyx_tuple__16;
2696 static PyObject *__pyx_tuple__18;
2697 static PyObject *__pyx_tuple__19;
2698 static PyObject *__pyx_tuple__21;
2699 static PyObject *__pyx_tuple__23;
2700 static PyObject *__pyx_tuple__25;
2701 static PyObject *__pyx_tuple__27;
2702 static PyObject *__pyx_tuple__29;
2703 static PyObject *__pyx_tuple__30;
2704 static PyObject *__pyx_tuple__32;
2705 static PyObject *__pyx_codeobj__12;
2706 static PyObject *__pyx_codeobj__15;
2707 static PyObject *__pyx_codeobj__17;
2708 static PyObject *__pyx_codeobj__20;
2709 static PyObject *__pyx_codeobj__22;
2710 static PyObject *__pyx_codeobj__24;
2711 static PyObject *__pyx_codeobj__26;
2712 static PyObject *__pyx_codeobj__28;
2713 static PyObject *__pyx_codeobj__31;
2714 /* Late includes */
2715 
2716 /* "Isosurface.pyx":28
2717  * DEF Z=2
2718  *
2719  * cdef np.ndarray[np.float64_t,ndim=1] EVec(double x=0.0, double y=0.0, double z=0.0): # <<<<<<<<<<<<<<
2720  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d')
2721  * v[X] = x
2722  */
2723 
2724 static PyArrayObject *__pyx_f_10Isosurface_EVec(struct __pyx_opt_args_10Isosurface_EVec *__pyx_optional_args) {
2725  double __pyx_v_x = ((double)0.0);
2726  double __pyx_v_y = ((double)0.0);
2727  double __pyx_v_z = ((double)0.0);
2728  PyArrayObject *__pyx_v_v = 0;
2729  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
2730  __Pyx_Buffer __pyx_pybuffer_v;
2731  PyArrayObject *__pyx_r = NULL;
2732  __Pyx_RefNannyDeclarations
2733  PyObject *__pyx_t_1 = NULL;
2734  PyObject *__pyx_t_2 = NULL;
2735  PyArrayObject *__pyx_t_3 = NULL;
2736  Py_ssize_t __pyx_t_4;
2737  int __pyx_t_5;
2738  int __pyx_lineno = 0;
2739  const char *__pyx_filename = NULL;
2740  int __pyx_clineno = 0;
2741  __Pyx_RefNannySetupContext("EVec", 0);
2742  if (__pyx_optional_args) {
2743  if (__pyx_optional_args->__pyx_n > 0) {
2744  __pyx_v_x = __pyx_optional_args->x;
2745  if (__pyx_optional_args->__pyx_n > 1) {
2746  __pyx_v_y = __pyx_optional_args->y;
2747  if (__pyx_optional_args->__pyx_n > 2) {
2748  __pyx_v_z = __pyx_optional_args->z;
2749  }
2750  }
2751  }
2752  }
2753  __pyx_pybuffer_v.pybuffer.buf = NULL;
2754  __pyx_pybuffer_v.refcount = 0;
2755  __pyx_pybuffernd_v.data = NULL;
2756  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
2757 
2758  /* "Isosurface.pyx":29
2759  *
2760  * cdef np.ndarray[np.float64_t,ndim=1] EVec(double x=0.0, double y=0.0, double z=0.0):
2761  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d') # <<<<<<<<<<<<<<
2762  * v[X] = x
2763  * v[Y] = y
2764  */
2765  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
2766  __Pyx_GOTREF(__pyx_t_1);
2767  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
2768  __Pyx_GOTREF(__pyx_t_2);
2769  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2770  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
2771  __Pyx_GOTREF(__pyx_t_1);
2772  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2773  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 29, __pyx_L1_error)
2774  __pyx_t_3 = ((PyArrayObject *)__pyx_t_1);
2775  {
2776  __Pyx_BufFmt_StackElem __pyx_stack[1];
2777  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
2778  __pyx_v_v = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_v.rcbuffer->pybuffer.buf = NULL;
2779  __PYX_ERR(0, 29, __pyx_L1_error)
2780  } else {__pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0];
2781  }
2782  }
2783  __pyx_t_3 = 0;
2784  __pyx_v_v = ((PyArrayObject *)__pyx_t_1);
2785  __pyx_t_1 = 0;
2786 
2787  /* "Isosurface.pyx":30
2788  * cdef np.ndarray[np.float64_t,ndim=1] EVec(double x=0.0, double y=0.0, double z=0.0):
2789  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d')
2790  * v[X] = x # <<<<<<<<<<<<<<
2791  * v[Y] = y
2792  * v[Z] = z
2793  */
2794  __pyx_t_4 = 0;
2795  __pyx_t_5 = -1;
2796  if (__pyx_t_4 < 0) {
2797  __pyx_t_4 += __pyx_pybuffernd_v.diminfo[0].shape;
2798  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2799  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_5 = 0;
2800  if (unlikely(__pyx_t_5 != -1)) {
2801  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2802  __PYX_ERR(0, 30, __pyx_L1_error)
2803  }
2804  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_v.diminfo[0].strides) = __pyx_v_x;
2805 
2806  /* "Isosurface.pyx":31
2807  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d')
2808  * v[X] = x
2809  * v[Y] = y # <<<<<<<<<<<<<<
2810  * v[Z] = z
2811  * return v
2812  */
2813  __pyx_t_4 = 1;
2814  __pyx_t_5 = -1;
2815  if (__pyx_t_4 < 0) {
2816  __pyx_t_4 += __pyx_pybuffernd_v.diminfo[0].shape;
2817  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2818  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_5 = 0;
2819  if (unlikely(__pyx_t_5 != -1)) {
2820  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2821  __PYX_ERR(0, 31, __pyx_L1_error)
2822  }
2823  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_v.diminfo[0].strides) = __pyx_v_y;
2824 
2825  /* "Isosurface.pyx":32
2826  * v[X] = x
2827  * v[Y] = y
2828  * v[Z] = z # <<<<<<<<<<<<<<
2829  * return v
2830  *
2831  */
2832  __pyx_t_4 = 2;
2833  __pyx_t_5 = -1;
2834  if (__pyx_t_4 < 0) {
2835  __pyx_t_4 += __pyx_pybuffernd_v.diminfo[0].shape;
2836  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2837  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_5 = 0;
2838  if (unlikely(__pyx_t_5 != -1)) {
2839  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2840  __PYX_ERR(0, 32, __pyx_L1_error)
2841  }
2842  *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_v.diminfo[0].strides) = __pyx_v_z;
2843 
2844  /* "Isosurface.pyx":33
2845  * v[Y] = y
2846  * v[Z] = z
2847  * return v # <<<<<<<<<<<<<<
2848  *
2849  * cdef double enorm(np.ndarray[np.float64_t, ndim=1] v):
2850  */
2851  __Pyx_XDECREF(((PyObject *)__pyx_r));
2852  __Pyx_INCREF(((PyObject *)__pyx_v_v));
2853  __pyx_r = ((PyArrayObject *)__pyx_v_v);
2854  goto __pyx_L0;
2855 
2856  /* "Isosurface.pyx":28
2857  * DEF Z=2
2858  *
2859  * cdef np.ndarray[np.float64_t,ndim=1] EVec(double x=0.0, double y=0.0, double z=0.0): # <<<<<<<<<<<<<<
2860  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d')
2861  * v[X] = x
2862  */
2863 
2864  /* function exit code */
2865  __pyx_L1_error:;
2866  __Pyx_XDECREF(__pyx_t_1);
2867  __Pyx_XDECREF(__pyx_t_2);
2868  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2869  __Pyx_PyThreadState_declare
2870  __Pyx_PyThreadState_assign
2871  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2872  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
2873  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2874  __Pyx_AddTraceback("Isosurface.EVec", __pyx_clineno, __pyx_lineno, __pyx_filename);
2875  __pyx_r = 0;
2876  goto __pyx_L2;
2877  __pyx_L0:;
2878  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
2879  __pyx_L2:;
2880  __Pyx_XDECREF((PyObject *)__pyx_v_v);
2881  __Pyx_XGIVEREF((PyObject *)__pyx_r);
2882  __Pyx_RefNannyFinishContext();
2883  return __pyx_r;
2884 }
2885 
2886 /* "Isosurface.pyx":35
2887  * return v
2888  *
2889  * cdef double enorm(np.ndarray[np.float64_t, ndim=1] v): # <<<<<<<<<<<<<<
2890  * return sqrt(v[X]**2 + v[Y]**2 + v[Z]**2)
2891  *
2892  */
2893 
2894 static double __pyx_f_10Isosurface_enorm(PyArrayObject *__pyx_v_v) {
2895  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
2896  __Pyx_Buffer __pyx_pybuffer_v;
2897  double __pyx_r;
2898  __Pyx_RefNannyDeclarations
2899  Py_ssize_t __pyx_t_1;
2900  int __pyx_t_2;
2901  Py_ssize_t __pyx_t_3;
2902  Py_ssize_t __pyx_t_4;
2903  int __pyx_lineno = 0;
2904  const char *__pyx_filename = NULL;
2905  int __pyx_clineno = 0;
2906  __Pyx_RefNannySetupContext("enorm", 0);
2907  __pyx_pybuffer_v.pybuffer.buf = NULL;
2908  __pyx_pybuffer_v.refcount = 0;
2909  __pyx_pybuffernd_v.data = NULL;
2910  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
2911  {
2912  __Pyx_BufFmt_StackElem __pyx_stack[1];
2913  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 35, __pyx_L1_error)
2914  }
2915  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0];
2916 
2917  /* "Isosurface.pyx":36
2918  *
2919  * cdef double enorm(np.ndarray[np.float64_t, ndim=1] v):
2920  * return sqrt(v[X]**2 + v[Y]**2 + v[Z]**2) # <<<<<<<<<<<<<<
2921  *
2922  * cdef double edot(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1):
2923  */
2924  __pyx_t_1 = 0;
2925  __pyx_t_2 = -1;
2926  if (__pyx_t_1 < 0) {
2927  __pyx_t_1 += __pyx_pybuffernd_v.diminfo[0].shape;
2928  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
2929  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_2 = 0;
2930  if (unlikely(__pyx_t_2 != -1)) {
2931  __Pyx_RaiseBufferIndexError(__pyx_t_2);
2932  __PYX_ERR(0, 36, __pyx_L1_error)
2933  }
2934  __pyx_t_3 = 1;
2935  __pyx_t_2 = -1;
2936  if (__pyx_t_3 < 0) {
2937  __pyx_t_3 += __pyx_pybuffernd_v.diminfo[0].shape;
2938  if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
2939  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_2 = 0;
2940  if (unlikely(__pyx_t_2 != -1)) {
2941  __Pyx_RaiseBufferIndexError(__pyx_t_2);
2942  __PYX_ERR(0, 36, __pyx_L1_error)
2943  }
2944  __pyx_t_4 = 2;
2945  __pyx_t_2 = -1;
2946  if (__pyx_t_4 < 0) {
2947  __pyx_t_4 += __pyx_pybuffernd_v.diminfo[0].shape;
2948  if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
2949  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_2 = 0;
2950  if (unlikely(__pyx_t_2 != -1)) {
2951  __Pyx_RaiseBufferIndexError(__pyx_t_2);
2952  __PYX_ERR(0, 36, __pyx_L1_error)
2953  }
2954  __pyx_r = sqrt(((pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_v.diminfo[0].strides)), 2.0) + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_v.diminfo[0].strides)), 2.0)) + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_v.diminfo[0].strides)), 2.0)));
2955  goto __pyx_L0;
2956 
2957  /* "Isosurface.pyx":35
2958  * return v
2959  *
2960  * cdef double enorm(np.ndarray[np.float64_t, ndim=1] v): # <<<<<<<<<<<<<<
2961  * return sqrt(v[X]**2 + v[Y]**2 + v[Z]**2)
2962  *
2963  */
2964 
2965  /* function exit code */
2966  __pyx_L1_error:;
2967  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2968  __Pyx_PyThreadState_declare
2969  __Pyx_PyThreadState_assign
2970  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2971  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
2972  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2973  __Pyx_WriteUnraisable("Isosurface.enorm", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
2974  __pyx_r = 0;
2975  goto __pyx_L2;
2976  __pyx_L0:;
2977  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
2978  __pyx_L2:;
2979  __Pyx_RefNannyFinishContext();
2980  return __pyx_r;
2981 }
2982 
2983 /* "Isosurface.pyx":38
2984  * return sqrt(v[X]**2 + v[Y]**2 + v[Z]**2)
2985  *
2986  * cdef double edot(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1): # <<<<<<<<<<<<<<
2987  * return v0[X]*v1[X] + v0[Y]*v1[Y] + v0[Z]*v1[Z]
2988  *
2989  */
2990 
2991 static double __pyx_f_10Isosurface_edot(PyArrayObject *__pyx_v_v0, PyArrayObject *__pyx_v_v1) {
2992  __Pyx_LocalBuf_ND __pyx_pybuffernd_v0;
2993  __Pyx_Buffer __pyx_pybuffer_v0;
2994  __Pyx_LocalBuf_ND __pyx_pybuffernd_v1;
2995  __Pyx_Buffer __pyx_pybuffer_v1;
2996  double __pyx_r;
2997  __Pyx_RefNannyDeclarations
2998  Py_ssize_t __pyx_t_1;
2999  int __pyx_t_2;
3000  Py_ssize_t __pyx_t_3;
3001  Py_ssize_t __pyx_t_4;
3002  Py_ssize_t __pyx_t_5;
3003  Py_ssize_t __pyx_t_6;
3004  Py_ssize_t __pyx_t_7;
3005  int __pyx_lineno = 0;
3006  const char *__pyx_filename = NULL;
3007  int __pyx_clineno = 0;
3008  __Pyx_RefNannySetupContext("edot", 0);
3009  __pyx_pybuffer_v0.pybuffer.buf = NULL;
3010  __pyx_pybuffer_v0.refcount = 0;
3011  __pyx_pybuffernd_v0.data = NULL;
3012  __pyx_pybuffernd_v0.rcbuffer = &__pyx_pybuffer_v0;
3013  __pyx_pybuffer_v1.pybuffer.buf = NULL;
3014  __pyx_pybuffer_v1.refcount = 0;
3015  __pyx_pybuffernd_v1.data = NULL;
3016  __pyx_pybuffernd_v1.rcbuffer = &__pyx_pybuffer_v1;
3017  {
3018  __Pyx_BufFmt_StackElem __pyx_stack[1];
3019  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v0.rcbuffer->pybuffer, (PyObject*)__pyx_v_v0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 38, __pyx_L1_error)
3020  }
3021  __pyx_pybuffernd_v0.diminfo[0].strides = __pyx_pybuffernd_v0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v0.diminfo[0].shape = __pyx_pybuffernd_v0.rcbuffer->pybuffer.shape[0];
3022  {
3023  __Pyx_BufFmt_StackElem __pyx_stack[1];
3024  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v1.rcbuffer->pybuffer, (PyObject*)__pyx_v_v1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 38, __pyx_L1_error)
3025  }
3026  __pyx_pybuffernd_v1.diminfo[0].strides = __pyx_pybuffernd_v1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v1.diminfo[0].shape = __pyx_pybuffernd_v1.rcbuffer->pybuffer.shape[0];
3027 
3028  /* "Isosurface.pyx":39
3029  *
3030  * cdef double edot(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1):
3031  * return v0[X]*v1[X] + v0[Y]*v1[Y] + v0[Z]*v1[Z] # <<<<<<<<<<<<<<
3032  *
3033  * cdef np.ndarray[np.float64_t, ndim=1] ecross(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1):
3034  */
3035  __pyx_t_1 = 0;
3036  __pyx_t_2 = -1;
3037  if (__pyx_t_1 < 0) {
3038  __pyx_t_1 += __pyx_pybuffernd_v0.diminfo[0].shape;
3039  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
3040  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3041  if (unlikely(__pyx_t_2 != -1)) {
3042  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3043  __PYX_ERR(0, 39, __pyx_L1_error)
3044  }
3045  __pyx_t_3 = 0;
3046  __pyx_t_2 = -1;
3047  if (__pyx_t_3 < 0) {
3048  __pyx_t_3 += __pyx_pybuffernd_v1.diminfo[0].shape;
3049  if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
3050  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3051  if (unlikely(__pyx_t_2 != -1)) {
3052  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3053  __PYX_ERR(0, 39, __pyx_L1_error)
3054  }
3055  __pyx_t_4 = 1;
3056  __pyx_t_2 = -1;
3057  if (__pyx_t_4 < 0) {
3058  __pyx_t_4 += __pyx_pybuffernd_v0.diminfo[0].shape;
3059  if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
3060  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3061  if (unlikely(__pyx_t_2 != -1)) {
3062  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3063  __PYX_ERR(0, 39, __pyx_L1_error)
3064  }
3065  __pyx_t_5 = 1;
3066  __pyx_t_2 = -1;
3067  if (__pyx_t_5 < 0) {
3068  __pyx_t_5 += __pyx_pybuffernd_v1.diminfo[0].shape;
3069  if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
3070  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3071  if (unlikely(__pyx_t_2 != -1)) {
3072  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3073  __PYX_ERR(0, 39, __pyx_L1_error)
3074  }
3075  __pyx_t_6 = 2;
3076  __pyx_t_2 = -1;
3077  if (__pyx_t_6 < 0) {
3078  __pyx_t_6 += __pyx_pybuffernd_v0.diminfo[0].shape;
3079  if (unlikely(__pyx_t_6 < 0)) __pyx_t_2 = 0;
3080  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3081  if (unlikely(__pyx_t_2 != -1)) {
3082  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3083  __PYX_ERR(0, 39, __pyx_L1_error)
3084  }
3085  __pyx_t_7 = 2;
3086  __pyx_t_2 = -1;
3087  if (__pyx_t_7 < 0) {
3088  __pyx_t_7 += __pyx_pybuffernd_v1.diminfo[0].shape;
3089  if (unlikely(__pyx_t_7 < 0)) __pyx_t_2 = 0;
3090  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3091  if (unlikely(__pyx_t_2 != -1)) {
3092  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3093  __PYX_ERR(0, 39, __pyx_L1_error)
3094  }
3095  __pyx_r = ((((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_v1.diminfo[0].strides))) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_v1.diminfo[0].strides)))) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_v1.diminfo[0].strides))));
3096  goto __pyx_L0;
3097 
3098  /* "Isosurface.pyx":38
3099  * return sqrt(v[X]**2 + v[Y]**2 + v[Z]**2)
3100  *
3101  * cdef double edot(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1): # <<<<<<<<<<<<<<
3102  * return v0[X]*v1[X] + v0[Y]*v1[Y] + v0[Z]*v1[Z]
3103  *
3104  */
3105 
3106  /* function exit code */
3107  __pyx_L1_error:;
3108  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3109  __Pyx_PyThreadState_declare
3110  __Pyx_PyThreadState_assign
3111  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3112  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v0.rcbuffer->pybuffer);
3113  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v1.rcbuffer->pybuffer);
3114  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3115  __Pyx_WriteUnraisable("Isosurface.edot", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3116  __pyx_r = 0;
3117  goto __pyx_L2;
3118  __pyx_L0:;
3119  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v0.rcbuffer->pybuffer);
3120  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v1.rcbuffer->pybuffer);
3121  __pyx_L2:;
3122  __Pyx_RefNannyFinishContext();
3123  return __pyx_r;
3124 }
3125 
3126 /* "Isosurface.pyx":41
3127  * return v0[X]*v1[X] + v0[Y]*v1[Y] + v0[Z]*v1[Z]
3128  *
3129  * cdef np.ndarray[np.float64_t, ndim=1] ecross(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1): # <<<<<<<<<<<<<<
3130  * return EVec(v0[Y]*v1[Z] - v0[Z]*v1[Y],
3131  * v0[Z]*v1[X] - v0[X]*v1[Z],
3132  */
3133 
3134 static PyArrayObject *__pyx_f_10Isosurface_ecross(PyArrayObject *__pyx_v_v0, PyArrayObject *__pyx_v_v1) {
3135  __Pyx_LocalBuf_ND __pyx_pybuffernd_v0;
3136  __Pyx_Buffer __pyx_pybuffer_v0;
3137  __Pyx_LocalBuf_ND __pyx_pybuffernd_v1;
3138  __Pyx_Buffer __pyx_pybuffer_v1;
3139  PyArrayObject *__pyx_r = NULL;
3140  __Pyx_RefNannyDeclarations
3141  Py_ssize_t __pyx_t_1;
3142  int __pyx_t_2;
3143  Py_ssize_t __pyx_t_3;
3144  Py_ssize_t __pyx_t_4;
3145  Py_ssize_t __pyx_t_5;
3146  Py_ssize_t __pyx_t_6;
3147  Py_ssize_t __pyx_t_7;
3148  Py_ssize_t __pyx_t_8;
3149  Py_ssize_t __pyx_t_9;
3150  Py_ssize_t __pyx_t_10;
3151  Py_ssize_t __pyx_t_11;
3152  Py_ssize_t __pyx_t_12;
3153  Py_ssize_t __pyx_t_13;
3154  PyObject *__pyx_t_14 = NULL;
3155  struct __pyx_opt_args_10Isosurface_EVec __pyx_t_15;
3156  int __pyx_lineno = 0;
3157  const char *__pyx_filename = NULL;
3158  int __pyx_clineno = 0;
3159  __Pyx_RefNannySetupContext("ecross", 0);
3160  __pyx_pybuffer_v0.pybuffer.buf = NULL;
3161  __pyx_pybuffer_v0.refcount = 0;
3162  __pyx_pybuffernd_v0.data = NULL;
3163  __pyx_pybuffernd_v0.rcbuffer = &__pyx_pybuffer_v0;
3164  __pyx_pybuffer_v1.pybuffer.buf = NULL;
3165  __pyx_pybuffer_v1.refcount = 0;
3166  __pyx_pybuffernd_v1.data = NULL;
3167  __pyx_pybuffernd_v1.rcbuffer = &__pyx_pybuffer_v1;
3168  {
3169  __Pyx_BufFmt_StackElem __pyx_stack[1];
3170  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v0.rcbuffer->pybuffer, (PyObject*)__pyx_v_v0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 41, __pyx_L1_error)
3171  }
3172  __pyx_pybuffernd_v0.diminfo[0].strides = __pyx_pybuffernd_v0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v0.diminfo[0].shape = __pyx_pybuffernd_v0.rcbuffer->pybuffer.shape[0];
3173  {
3174  __Pyx_BufFmt_StackElem __pyx_stack[1];
3175  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v1.rcbuffer->pybuffer, (PyObject*)__pyx_v_v1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 41, __pyx_L1_error)
3176  }
3177  __pyx_pybuffernd_v1.diminfo[0].strides = __pyx_pybuffernd_v1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v1.diminfo[0].shape = __pyx_pybuffernd_v1.rcbuffer->pybuffer.shape[0];
3178 
3179  /* "Isosurface.pyx":42
3180  *
3181  * cdef np.ndarray[np.float64_t, ndim=1] ecross(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1):
3182  * return EVec(v0[Y]*v1[Z] - v0[Z]*v1[Y], # <<<<<<<<<<<<<<
3183  * v0[Z]*v1[X] - v0[X]*v1[Z],
3184  * v0[X]*v1[Y] - v0[Y]*v1[X])
3185  */
3186  __Pyx_XDECREF(((PyObject *)__pyx_r));
3187  __pyx_t_1 = 1;
3188  __pyx_t_2 = -1;
3189  if (__pyx_t_1 < 0) {
3190  __pyx_t_1 += __pyx_pybuffernd_v0.diminfo[0].shape;
3191  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
3192  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3193  if (unlikely(__pyx_t_2 != -1)) {
3194  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3195  __PYX_ERR(0, 42, __pyx_L1_error)
3196  }
3197  __pyx_t_3 = 2;
3198  __pyx_t_2 = -1;
3199  if (__pyx_t_3 < 0) {
3200  __pyx_t_3 += __pyx_pybuffernd_v1.diminfo[0].shape;
3201  if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
3202  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3203  if (unlikely(__pyx_t_2 != -1)) {
3204  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3205  __PYX_ERR(0, 42, __pyx_L1_error)
3206  }
3207  __pyx_t_4 = 2;
3208  __pyx_t_2 = -1;
3209  if (__pyx_t_4 < 0) {
3210  __pyx_t_4 += __pyx_pybuffernd_v0.diminfo[0].shape;
3211  if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
3212  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3213  if (unlikely(__pyx_t_2 != -1)) {
3214  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3215  __PYX_ERR(0, 42, __pyx_L1_error)
3216  }
3217  __pyx_t_5 = 1;
3218  __pyx_t_2 = -1;
3219  if (__pyx_t_5 < 0) {
3220  __pyx_t_5 += __pyx_pybuffernd_v1.diminfo[0].shape;
3221  if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
3222  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3223  if (unlikely(__pyx_t_2 != -1)) {
3224  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3225  __PYX_ERR(0, 42, __pyx_L1_error)
3226  }
3227 
3228  /* "Isosurface.pyx":43
3229  * cdef np.ndarray[np.float64_t, ndim=1] ecross(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1):
3230  * return EVec(v0[Y]*v1[Z] - v0[Z]*v1[Y],
3231  * v0[Z]*v1[X] - v0[X]*v1[Z], # <<<<<<<<<<<<<<
3232  * v0[X]*v1[Y] - v0[Y]*v1[X])
3233  *
3234  */
3235  __pyx_t_6 = 2;
3236  __pyx_t_2 = -1;
3237  if (__pyx_t_6 < 0) {
3238  __pyx_t_6 += __pyx_pybuffernd_v0.diminfo[0].shape;
3239  if (unlikely(__pyx_t_6 < 0)) __pyx_t_2 = 0;
3240  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3241  if (unlikely(__pyx_t_2 != -1)) {
3242  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3243  __PYX_ERR(0, 43, __pyx_L1_error)
3244  }
3245  __pyx_t_7 = 0;
3246  __pyx_t_2 = -1;
3247  if (__pyx_t_7 < 0) {
3248  __pyx_t_7 += __pyx_pybuffernd_v1.diminfo[0].shape;
3249  if (unlikely(__pyx_t_7 < 0)) __pyx_t_2 = 0;
3250  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3251  if (unlikely(__pyx_t_2 != -1)) {
3252  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3253  __PYX_ERR(0, 43, __pyx_L1_error)
3254  }
3255  __pyx_t_8 = 0;
3256  __pyx_t_2 = -1;
3257  if (__pyx_t_8 < 0) {
3258  __pyx_t_8 += __pyx_pybuffernd_v0.diminfo[0].shape;
3259  if (unlikely(__pyx_t_8 < 0)) __pyx_t_2 = 0;
3260  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3261  if (unlikely(__pyx_t_2 != -1)) {
3262  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3263  __PYX_ERR(0, 43, __pyx_L1_error)
3264  }
3265  __pyx_t_9 = 2;
3266  __pyx_t_2 = -1;
3267  if (__pyx_t_9 < 0) {
3268  __pyx_t_9 += __pyx_pybuffernd_v1.diminfo[0].shape;
3269  if (unlikely(__pyx_t_9 < 0)) __pyx_t_2 = 0;
3270  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3271  if (unlikely(__pyx_t_2 != -1)) {
3272  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3273  __PYX_ERR(0, 43, __pyx_L1_error)
3274  }
3275 
3276  /* "Isosurface.pyx":44
3277  * return EVec(v0[Y]*v1[Z] - v0[Z]*v1[Y],
3278  * v0[Z]*v1[X] - v0[X]*v1[Z],
3279  * v0[X]*v1[Y] - v0[Y]*v1[X]) # <<<<<<<<<<<<<<
3280  *
3281  * cdef double etriple(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1, np.ndarray[np.float64_t, ndim=1] v2):
3282  */
3283  __pyx_t_10 = 0;
3284  __pyx_t_2 = -1;
3285  if (__pyx_t_10 < 0) {
3286  __pyx_t_10 += __pyx_pybuffernd_v0.diminfo[0].shape;
3287  if (unlikely(__pyx_t_10 < 0)) __pyx_t_2 = 0;
3288  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3289  if (unlikely(__pyx_t_2 != -1)) {
3290  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3291  __PYX_ERR(0, 44, __pyx_L1_error)
3292  }
3293  __pyx_t_11 = 1;
3294  __pyx_t_2 = -1;
3295  if (__pyx_t_11 < 0) {
3296  __pyx_t_11 += __pyx_pybuffernd_v1.diminfo[0].shape;
3297  if (unlikely(__pyx_t_11 < 0)) __pyx_t_2 = 0;
3298  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3299  if (unlikely(__pyx_t_2 != -1)) {
3300  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3301  __PYX_ERR(0, 44, __pyx_L1_error)
3302  }
3303  __pyx_t_12 = 1;
3304  __pyx_t_2 = -1;
3305  if (__pyx_t_12 < 0) {
3306  __pyx_t_12 += __pyx_pybuffernd_v0.diminfo[0].shape;
3307  if (unlikely(__pyx_t_12 < 0)) __pyx_t_2 = 0;
3308  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v0.diminfo[0].shape)) __pyx_t_2 = 0;
3309  if (unlikely(__pyx_t_2 != -1)) {
3310  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3311  __PYX_ERR(0, 44, __pyx_L1_error)
3312  }
3313  __pyx_t_13 = 0;
3314  __pyx_t_2 = -1;
3315  if (__pyx_t_13 < 0) {
3316  __pyx_t_13 += __pyx_pybuffernd_v1.diminfo[0].shape;
3317  if (unlikely(__pyx_t_13 < 0)) __pyx_t_2 = 0;
3318  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v1.diminfo[0].shape)) __pyx_t_2 = 0;
3319  if (unlikely(__pyx_t_2 != -1)) {
3320  __Pyx_RaiseBufferIndexError(__pyx_t_2);
3321  __PYX_ERR(0, 44, __pyx_L1_error)
3322  }
3323 
3324  /* "Isosurface.pyx":42
3325  *
3326  * cdef np.ndarray[np.float64_t, ndim=1] ecross(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1):
3327  * return EVec(v0[Y]*v1[Z] - v0[Z]*v1[Y], # <<<<<<<<<<<<<<
3328  * v0[Z]*v1[X] - v0[X]*v1[Z],
3329  * v0[X]*v1[Y] - v0[Y]*v1[X])
3330  */
3331  __pyx_t_15.__pyx_n = 3;
3332  __pyx_t_15.x = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_v1.diminfo[0].strides))) - ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_v1.diminfo[0].strides))));
3333  __pyx_t_15.y = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_v1.diminfo[0].strides))) - ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_v1.diminfo[0].strides))));
3334  __pyx_t_15.z = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v1.diminfo[0].strides))) - ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v0.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v0.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_v1.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v1.diminfo[0].strides))));
3335  __pyx_t_14 = ((PyObject *)__pyx_f_10Isosurface_EVec(&__pyx_t_15)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 42, __pyx_L1_error)
3336  __Pyx_GOTREF(__pyx_t_14);
3337  __pyx_r = ((PyArrayObject *)__pyx_t_14);
3338  __pyx_t_14 = 0;
3339  goto __pyx_L0;
3340 
3341  /* "Isosurface.pyx":41
3342  * return v0[X]*v1[X] + v0[Y]*v1[Y] + v0[Z]*v1[Z]
3343  *
3344  * cdef np.ndarray[np.float64_t, ndim=1] ecross(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1): # <<<<<<<<<<<<<<
3345  * return EVec(v0[Y]*v1[Z] - v0[Z]*v1[Y],
3346  * v0[Z]*v1[X] - v0[X]*v1[Z],
3347  */
3348 
3349  /* function exit code */
3350  __pyx_L1_error:;
3351  __Pyx_XDECREF(__pyx_t_14);
3352  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3353  __Pyx_PyThreadState_declare
3354  __Pyx_PyThreadState_assign
3355  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3356  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v0.rcbuffer->pybuffer);
3357  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v1.rcbuffer->pybuffer);
3358  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3359  __Pyx_AddTraceback("Isosurface.ecross", __pyx_clineno, __pyx_lineno, __pyx_filename);
3360  __pyx_r = 0;
3361  goto __pyx_L2;
3362  __pyx_L0:;
3363  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v0.rcbuffer->pybuffer);
3364  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v1.rcbuffer->pybuffer);
3365  __pyx_L2:;
3366  __Pyx_XGIVEREF((PyObject *)__pyx_r);
3367  __Pyx_RefNannyFinishContext();
3368  return __pyx_r;
3369 }
3370 
3371 /* "Isosurface.pyx":46
3372  * v0[X]*v1[Y] - v0[Y]*v1[X])
3373  *
3374  * cdef double etriple(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1, np.ndarray[np.float64_t, ndim=1] v2): # <<<<<<<<<<<<<<
3375  * return edot(v0,ecross(v1,v2))
3376  *
3377  */
3378 
3379 static double __pyx_f_10Isosurface_etriple(PyArrayObject *__pyx_v_v0, PyArrayObject *__pyx_v_v1, PyArrayObject *__pyx_v_v2) {
3380  __Pyx_LocalBuf_ND __pyx_pybuffernd_v0;
3381  __Pyx_Buffer __pyx_pybuffer_v0;
3382  __Pyx_LocalBuf_ND __pyx_pybuffernd_v1;
3383  __Pyx_Buffer __pyx_pybuffer_v1;
3384  __Pyx_LocalBuf_ND __pyx_pybuffernd_v2;
3385  __Pyx_Buffer __pyx_pybuffer_v2;
3386  double __pyx_r;
3387  __Pyx_RefNannyDeclarations
3388  PyObject *__pyx_t_1 = NULL;
3389  int __pyx_lineno = 0;
3390  const char *__pyx_filename = NULL;
3391  int __pyx_clineno = 0;
3392  __Pyx_RefNannySetupContext("etriple", 0);
3393  __pyx_pybuffer_v0.pybuffer.buf = NULL;
3394  __pyx_pybuffer_v0.refcount = 0;
3395  __pyx_pybuffernd_v0.data = NULL;
3396  __pyx_pybuffernd_v0.rcbuffer = &__pyx_pybuffer_v0;
3397  __pyx_pybuffer_v1.pybuffer.buf = NULL;
3398  __pyx_pybuffer_v1.refcount = 0;
3399  __pyx_pybuffernd_v1.data = NULL;
3400  __pyx_pybuffernd_v1.rcbuffer = &__pyx_pybuffer_v1;
3401  __pyx_pybuffer_v2.pybuffer.buf = NULL;
3402  __pyx_pybuffer_v2.refcount = 0;
3403  __pyx_pybuffernd_v2.data = NULL;
3404  __pyx_pybuffernd_v2.rcbuffer = &__pyx_pybuffer_v2;
3405  {
3406  __Pyx_BufFmt_StackElem __pyx_stack[1];
3407  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v0.rcbuffer->pybuffer, (PyObject*)__pyx_v_v0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 46, __pyx_L1_error)
3408  }
3409  __pyx_pybuffernd_v0.diminfo[0].strides = __pyx_pybuffernd_v0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v0.diminfo[0].shape = __pyx_pybuffernd_v0.rcbuffer->pybuffer.shape[0];
3410  {
3411  __Pyx_BufFmt_StackElem __pyx_stack[1];
3412  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v1.rcbuffer->pybuffer, (PyObject*)__pyx_v_v1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 46, __pyx_L1_error)
3413  }
3414  __pyx_pybuffernd_v1.diminfo[0].strides = __pyx_pybuffernd_v1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v1.diminfo[0].shape = __pyx_pybuffernd_v1.rcbuffer->pybuffer.shape[0];
3415  {
3416  __Pyx_BufFmt_StackElem __pyx_stack[1];
3417  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v2.rcbuffer->pybuffer, (PyObject*)__pyx_v_v2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 46, __pyx_L1_error)
3418  }
3419  __pyx_pybuffernd_v2.diminfo[0].strides = __pyx_pybuffernd_v2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v2.diminfo[0].shape = __pyx_pybuffernd_v2.rcbuffer->pybuffer.shape[0];
3420 
3421  /* "Isosurface.pyx":47
3422  *
3423  * cdef double etriple(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1, np.ndarray[np.float64_t, ndim=1] v2):
3424  * return edot(v0,ecross(v1,v2)) # <<<<<<<<<<<<<<
3425  *
3426  *
3427  */
3428  __pyx_t_1 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_v_v1), ((PyArrayObject *)__pyx_v_v2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
3429  __Pyx_GOTREF(__pyx_t_1);
3430  __pyx_r = __pyx_f_10Isosurface_edot(((PyArrayObject *)__pyx_v_v0), ((PyArrayObject *)__pyx_t_1));
3431  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3432  goto __pyx_L0;
3433 
3434  /* "Isosurface.pyx":46
3435  * v0[X]*v1[Y] - v0[Y]*v1[X])
3436  *
3437  * cdef double etriple(np.ndarray[np.float64_t, ndim=1] v0, np.ndarray[np.float64_t, ndim=1] v1, np.ndarray[np.float64_t, ndim=1] v2): # <<<<<<<<<<<<<<
3438  * return edot(v0,ecross(v1,v2))
3439  *
3440  */
3441 
3442  /* function exit code */
3443  __pyx_L1_error:;
3444  __Pyx_XDECREF(__pyx_t_1);
3445  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3446  __Pyx_PyThreadState_declare
3447  __Pyx_PyThreadState_assign
3448  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3449  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v0.rcbuffer->pybuffer);
3450  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v1.rcbuffer->pybuffer);
3451  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v2.rcbuffer->pybuffer);
3452  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3453  __Pyx_WriteUnraisable("Isosurface.etriple", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
3454  __pyx_r = 0;
3455  goto __pyx_L2;
3456  __pyx_L0:;
3457  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v0.rcbuffer->pybuffer);
3458  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v1.rcbuffer->pybuffer);
3459  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v2.rcbuffer->pybuffer);
3460  __pyx_L2:;
3461  __Pyx_RefNannyFinishContext();
3462  return __pyx_r;
3463 }
3464 
3465 /* "Isosurface.pyx":54
3466  * """Extract isosurfaces"""
3467  *
3468  * def __init__(self, isosurfaces, domain, activeTime=None, # <<<<<<<<<<<<<<
3469  * sampleRate=0, format='pov', writeBoundary=True):
3470  * """Create a set of isosurfaces that will be extracted and serialized
3471  */
3472 
3473 /* Python wrapper */
3474 static PyObject *__pyx_pw_10Isosurface_10Isosurface_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3475 static char __pyx_doc_10Isosurface_10Isosurface___init__[] = "Isosurface.__init__(self, isosurfaces, domain, activeTime=None, sampleRate=0, format='pov', writeBoundary=True)\nCreate a set of isosurfaces that will be extracted and serialized\n\n :param isosurfaces: An iterable of \"isosurfaces\". Each isosurface is\n specified by a 2-tuple, with the first element in the tuple is a field\n from which to extract isosurfaces, and the second element is an n-tuple\n of isosurface values to extract.\n\n :param domain: a Domain object\n\n :param activeTime: If not None, a 2-tuple of start time and end time\n for which the point gauge is active.\n\n :param sampleRate: The intervals at which samples should be measured.\n Note that this is a rough lower bound, and that the gauge values could\n be computed less frequently depending on the time integrator. The\n default value of zero computes the gauge values at every time step.\n\n :param format: the file format for the isosurfaces ('pov', None).\n\n :param writeBoundary: whether to write the boundary mesh to or the\n domain bounding box\n\n Example:\n\n phi0 = (isosurfaces=('phi', (0.0,)),\n activeTime=(0, 2.5),\n sampleRate=0.2,\n fileName='water.pov')\n\n This creates an Isosurfaces object that will extract phi(x,y,z,t) = 0\n at simulation time between = 0 and 2.5 with samples taken no more\n frequently than every 0.2 seconds. Results will be saved to:\n water.pov.\n\n ";
3476 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface___init__};
3477 static PyObject *__pyx_pw_10Isosurface_10Isosurface_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3478  PyObject *__pyx_v_self = 0;
3479  PyObject *__pyx_v_isosurfaces = 0;
3480  PyObject *__pyx_v_domain = 0;
3481  PyObject *__pyx_v_activeTime = 0;
3482  PyObject *__pyx_v_sampleRate = 0;
3483  PyObject *__pyx_v_format = 0;
3484  PyObject *__pyx_v_writeBoundary = 0;
3485  int __pyx_lineno = 0;
3486  const char *__pyx_filename = NULL;
3487  int __pyx_clineno = 0;
3488  PyObject *__pyx_r = 0;
3489  __Pyx_RefNannyDeclarations
3490  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
3491  {
3492  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_isosurfaces,&__pyx_n_s_domain,&__pyx_n_s_activeTime,&__pyx_n_s_sampleRate,&__pyx_n_s_format,&__pyx_n_s_writeBoundary,0};
3493  PyObject* values[7] = {0,0,0,0,0,0,0};
3494  values[3] = ((PyObject *)((PyObject *)Py_None));
3495  values[4] = ((PyObject *)((PyObject *)__pyx_int_0));
3496  values[5] = ((PyObject *)((PyObject*)__pyx_n_s_pov));
3497 
3498  /* "Isosurface.pyx":55
3499  *
3500  * def __init__(self, isosurfaces, domain, activeTime=None,
3501  * sampleRate=0, format='pov', writeBoundary=True): # <<<<<<<<<<<<<<
3502  * """Create a set of isosurfaces that will be extracted and serialized
3503  *
3504  */
3505  values[6] = ((PyObject *)((PyObject *)Py_True));
3506  if (unlikely(__pyx_kwds)) {
3507  Py_ssize_t kw_args;
3508  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3509  switch (pos_args) {
3510  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3511  CYTHON_FALLTHROUGH;
3512  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3513  CYTHON_FALLTHROUGH;
3514  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3515  CYTHON_FALLTHROUGH;
3516  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3517  CYTHON_FALLTHROUGH;
3518  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3519  CYTHON_FALLTHROUGH;
3520  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3521  CYTHON_FALLTHROUGH;
3522  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3523  CYTHON_FALLTHROUGH;
3524  case 0: break;
3525  default: goto __pyx_L5_argtuple_error;
3526  }
3527  kw_args = PyDict_Size(__pyx_kwds);
3528  switch (pos_args) {
3529  case 0:
3530  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3531  else goto __pyx_L5_argtuple_error;
3532  CYTHON_FALLTHROUGH;
3533  case 1:
3534  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isosurfaces)) != 0)) kw_args--;
3535  else {
3536  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, 1); __PYX_ERR(0, 54, __pyx_L3_error)
3537  }
3538  CYTHON_FALLTHROUGH;
3539  case 2:
3540  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_domain)) != 0)) kw_args--;
3541  else {
3542  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, 2); __PYX_ERR(0, 54, __pyx_L3_error)
3543  }
3544  CYTHON_FALLTHROUGH;
3545  case 3:
3546  if (kw_args > 0) {
3547  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_activeTime);
3548  if (value) { values[3] = value; kw_args--; }
3549  }
3550  CYTHON_FALLTHROUGH;
3551  case 4:
3552  if (kw_args > 0) {
3553  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sampleRate);
3554  if (value) { values[4] = value; kw_args--; }
3555  }
3556  CYTHON_FALLTHROUGH;
3557  case 5:
3558  if (kw_args > 0) {
3559  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format);
3560  if (value) { values[5] = value; kw_args--; }
3561  }
3562  CYTHON_FALLTHROUGH;
3563  case 6:
3564  if (kw_args > 0) {
3565  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_writeBoundary);
3566  if (value) { values[6] = value; kw_args--; }
3567  }
3568  }
3569  if (unlikely(kw_args > 0)) {
3570  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 54, __pyx_L3_error)
3571  }
3572  } else {
3573  switch (PyTuple_GET_SIZE(__pyx_args)) {
3574  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3575  CYTHON_FALLTHROUGH;
3576  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3577  CYTHON_FALLTHROUGH;
3578  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3579  CYTHON_FALLTHROUGH;
3580  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3581  CYTHON_FALLTHROUGH;
3582  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3583  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3584  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3585  break;
3586  default: goto __pyx_L5_argtuple_error;
3587  }
3588  }
3589  __pyx_v_self = values[0];
3590  __pyx_v_isosurfaces = values[1];
3591  __pyx_v_domain = values[2];
3592  __pyx_v_activeTime = values[3];
3593  __pyx_v_sampleRate = values[4];
3594  __pyx_v_format = values[5];
3595  __pyx_v_writeBoundary = values[6];
3596  }
3597  goto __pyx_L4_argument_unpacking_done;
3598  __pyx_L5_argtuple_error:;
3599  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error)
3600  __pyx_L3_error:;
3601  __Pyx_AddTraceback("Isosurface.Isosurface.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3602  __Pyx_RefNannyFinishContext();
3603  return NULL;
3604  __pyx_L4_argument_unpacking_done:;
3605  __pyx_r = __pyx_pf_10Isosurface_10Isosurface___init__(__pyx_self, __pyx_v_self, __pyx_v_isosurfaces, __pyx_v_domain, __pyx_v_activeTime, __pyx_v_sampleRate, __pyx_v_format, __pyx_v_writeBoundary);
3606 
3607  /* "Isosurface.pyx":54
3608  * """Extract isosurfaces"""
3609  *
3610  * def __init__(self, isosurfaces, domain, activeTime=None, # <<<<<<<<<<<<<<
3611  * sampleRate=0, format='pov', writeBoundary=True):
3612  * """Create a set of isosurfaces that will be extracted and serialized
3613  */
3614 
3615  /* function exit code */
3616  __Pyx_RefNannyFinishContext();
3617  return __pyx_r;
3618 }
3619 
3620 static PyObject *__pyx_pf_10Isosurface_10Isosurface___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_isosurfaces, PyObject *__pyx_v_domain, PyObject *__pyx_v_activeTime, PyObject *__pyx_v_sampleRate, PyObject *__pyx_v_format, PyObject *__pyx_v_writeBoundary) {
3621  CYTHON_UNUSED PyObject *__pyx_v_f = NULL;
3622  PyObject *__pyx_v_values = NULL;
3623  PyObject *__pyx_v_v = NULL;
3624  PyObject *__pyx_r = NULL;
3625  __Pyx_RefNannyDeclarations
3626  PyObject *__pyx_t_1 = NULL;
3627  PyObject *__pyx_t_2 = NULL;
3628  Py_ssize_t __pyx_t_3;
3629  PyObject *(*__pyx_t_4)(PyObject *);
3630  PyObject *__pyx_t_5 = NULL;
3631  PyObject *__pyx_t_6 = NULL;
3632  PyObject *__pyx_t_7 = NULL;
3633  PyObject *(*__pyx_t_8)(PyObject *);
3634  Py_ssize_t __pyx_t_9;
3635  PyObject *(*__pyx_t_10)(PyObject *);
3636  int __pyx_t_11;
3637  int __pyx_lineno = 0;
3638  const char *__pyx_filename = NULL;
3639  int __pyx_clineno = 0;
3640  __Pyx_RefNannySetupContext("__init__", 0);
3641 
3642  /* "Isosurface.pyx":91
3643  *
3644  * """
3645  * self.isosurfaces = isosurfaces # <<<<<<<<<<<<<<
3646  * self.domain = domain
3647  * self.nodes = {}
3648  */
3649  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_isosurfaces, __pyx_v_isosurfaces) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
3650 
3651  /* "Isosurface.pyx":92
3652  * """
3653  * self.isosurfaces = isosurfaces
3654  * self.domain = domain # <<<<<<<<<<<<<<
3655  * self.nodes = {}
3656  * self.elements = {}
3657  */
3658  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_domain, __pyx_v_domain) < 0) __PYX_ERR(0, 92, __pyx_L1_error)
3659 
3660  /* "Isosurface.pyx":93
3661  * self.isosurfaces = isosurfaces
3662  * self.domain = domain
3663  * self.nodes = {} # <<<<<<<<<<<<<<
3664  * self.elements = {}
3665  * self.normals = {}
3666  */
3667  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
3668  __Pyx_GOTREF(__pyx_t_1);
3669  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nodes, __pyx_t_1) < 0) __PYX_ERR(0, 93, __pyx_L1_error)
3670  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3671 
3672  /* "Isosurface.pyx":94
3673  * self.domain = domain
3674  * self.nodes = {}
3675  * self.elements = {} # <<<<<<<<<<<<<<
3676  * self.normals = {}
3677  * self.normal_indices = {}
3678  */
3679  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
3680  __Pyx_GOTREF(__pyx_t_1);
3681  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_elements, __pyx_t_1) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
3682  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3683 
3684  /* "Isosurface.pyx":95
3685  * self.nodes = {}
3686  * self.elements = {}
3687  * self.normals = {} # <<<<<<<<<<<<<<
3688  * self.normal_indices = {}
3689  * for f, values in self.isosurfaces:
3690  */
3691  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
3692  __Pyx_GOTREF(__pyx_t_1);
3693  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_normals, __pyx_t_1) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
3694  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3695 
3696  /* "Isosurface.pyx":96
3697  * self.elements = {}
3698  * self.normals = {}
3699  * self.normal_indices = {} # <<<<<<<<<<<<<<
3700  * for f, values in self.isosurfaces:
3701  * for v in values:
3702  */
3703  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
3704  __Pyx_GOTREF(__pyx_t_1);
3705  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_normal_indices, __pyx_t_1) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
3706  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3707 
3708  /* "Isosurface.pyx":97
3709  * self.normals = {}
3710  * self.normal_indices = {}
3711  * for f, values in self.isosurfaces: # <<<<<<<<<<<<<<
3712  * for v in values:
3713  * assert v == 0.0, \
3714  */
3715  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_isosurfaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
3716  __Pyx_GOTREF(__pyx_t_1);
3717  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
3718  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
3719  __pyx_t_4 = NULL;
3720  } else {
3721  __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
3722  __Pyx_GOTREF(__pyx_t_2);
3723  __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
3724  }
3725  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3726  for (;;) {
3727  if (likely(!__pyx_t_4)) {
3728  if (likely(PyList_CheckExact(__pyx_t_2))) {
3729  if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
3730  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3731  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
3732  #else
3733  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
3734  __Pyx_GOTREF(__pyx_t_1);
3735  #endif
3736  } else {
3737  if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3738  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3739  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
3740  #else
3741  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
3742  __Pyx_GOTREF(__pyx_t_1);
3743  #endif
3744  }
3745  } else {
3746  __pyx_t_1 = __pyx_t_4(__pyx_t_2);
3747  if (unlikely(!__pyx_t_1)) {
3748  PyObject* exc_type = PyErr_Occurred();
3749  if (exc_type) {
3750  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3751  else __PYX_ERR(0, 97, __pyx_L1_error)
3752  }
3753  break;
3754  }
3755  __Pyx_GOTREF(__pyx_t_1);
3756  }
3757  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3758  PyObject* sequence = __pyx_t_1;
3759  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3760  if (unlikely(size != 2)) {
3761  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3762  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3763  __PYX_ERR(0, 97, __pyx_L1_error)
3764  }
3765  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3766  if (likely(PyTuple_CheckExact(sequence))) {
3767  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
3768  __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
3769  } else {
3770  __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
3771  __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
3772  }
3773  __Pyx_INCREF(__pyx_t_5);
3774  __Pyx_INCREF(__pyx_t_6);
3775  #else
3776  __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
3777  __Pyx_GOTREF(__pyx_t_5);
3778  __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
3779  __Pyx_GOTREF(__pyx_t_6);
3780  #endif
3781  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3782  } else {
3783  Py_ssize_t index = -1;
3784  __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
3785  __Pyx_GOTREF(__pyx_t_7);
3786  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3787  __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
3788  index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
3789  __Pyx_GOTREF(__pyx_t_5);
3790  index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
3791  __Pyx_GOTREF(__pyx_t_6);
3792  if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
3793  __pyx_t_8 = NULL;
3794  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3795  goto __pyx_L6_unpacking_done;
3796  __pyx_L5_unpacking_failed:;
3797  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3798  __pyx_t_8 = NULL;
3799  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3800  __PYX_ERR(0, 97, __pyx_L1_error)
3801  __pyx_L6_unpacking_done:;
3802  }
3803  __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_5);
3804  __pyx_t_5 = 0;
3805  __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_6);
3806  __pyx_t_6 = 0;
3807 
3808  /* "Isosurface.pyx":98
3809  * self.normal_indices = {}
3810  * for f, values in self.isosurfaces:
3811  * for v in values: # <<<<<<<<<<<<<<
3812  * assert v == 0.0, \
3813  * "only implemented for 0 isosurface in 3D for now"
3814  */
3815  if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
3816  __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
3817  __pyx_t_10 = NULL;
3818  } else {
3819  __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
3820  __Pyx_GOTREF(__pyx_t_1);
3821  __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 98, __pyx_L1_error)
3822  }
3823  for (;;) {
3824  if (likely(!__pyx_t_10)) {
3825  if (likely(PyList_CheckExact(__pyx_t_1))) {
3826  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
3827  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3828  __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
3829  #else
3830  __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
3831  __Pyx_GOTREF(__pyx_t_6);
3832  #endif
3833  } else {
3834  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3835  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3836  __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
3837  #else
3838  __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
3839  __Pyx_GOTREF(__pyx_t_6);
3840  #endif
3841  }
3842  } else {
3843  __pyx_t_6 = __pyx_t_10(__pyx_t_1);
3844  if (unlikely(!__pyx_t_6)) {
3845  PyObject* exc_type = PyErr_Occurred();
3846  if (exc_type) {
3847  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3848  else __PYX_ERR(0, 98, __pyx_L1_error)
3849  }
3850  break;
3851  }
3852  __Pyx_GOTREF(__pyx_t_6);
3853  }
3854  __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
3855  __pyx_t_6 = 0;
3856 
3857  /* "Isosurface.pyx":99
3858  * for f, values in self.isosurfaces:
3859  * for v in values:
3860  * assert v == 0.0, \ # <<<<<<<<<<<<<<
3861  * "only implemented for 0 isosurface in 3D for now"
3862  * self.activeTime = activeTime
3863  */
3864  #ifndef CYTHON_WITHOUT_ASSERTIONS
3865  if (unlikely(!Py_OptimizeFlag)) {
3866  __pyx_t_6 = __Pyx_PyFloat_EqObjC(__pyx_v_v, __pyx_float_0_0, 0.0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
3867  __Pyx_GOTREF(__pyx_t_6);
3868  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
3869  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3870  if (unlikely(!__pyx_t_11)) {
3871  PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_only_implemented_for_0_isosurfac);
3872  __PYX_ERR(0, 99, __pyx_L1_error)
3873  }
3874  }
3875  #endif
3876 
3877  /* "Isosurface.pyx":98
3878  * self.normal_indices = {}
3879  * for f, values in self.isosurfaces:
3880  * for v in values: # <<<<<<<<<<<<<<
3881  * assert v == 0.0, \
3882  * "only implemented for 0 isosurface in 3D for now"
3883  */
3884  }
3885  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3886 
3887  /* "Isosurface.pyx":97
3888  * self.normals = {}
3889  * self.normal_indices = {}
3890  * for f, values in self.isosurfaces: # <<<<<<<<<<<<<<
3891  * for v in values:
3892  * assert v == 0.0, \
3893  */
3894  }
3895  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3896 
3897  /* "Isosurface.pyx":101
3898  * assert v == 0.0, \
3899  * "only implemented for 0 isosurface in 3D for now"
3900  * self.activeTime = activeTime # <<<<<<<<<<<<<<
3901  * self.sampleRate = sampleRate
3902  * self.format = format
3903  */
3904  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_activeTime, __pyx_v_activeTime) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
3905 
3906  /* "Isosurface.pyx":102
3907  * "only implemented for 0 isosurface in 3D for now"
3908  * self.activeTime = activeTime
3909  * self.sampleRate = sampleRate # <<<<<<<<<<<<<<
3910  * self.format = format
3911  * self.comm = Comm.get()
3912  */
3913  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sampleRate, __pyx_v_sampleRate) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
3914 
3915  /* "Isosurface.pyx":103
3916  * self.activeTime = activeTime
3917  * self.sampleRate = sampleRate
3918  * self.format = format # <<<<<<<<<<<<<<
3919  * self.comm = Comm.get()
3920  * self.writeBoundary = writeBoundary
3921  */
3922  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_format, __pyx_v_format) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
3923 
3924  /* "Isosurface.pyx":104
3925  * self.sampleRate = sampleRate
3926  * self.format = format
3927  * self.comm = Comm.get() # <<<<<<<<<<<<<<
3928  * self.writeBoundary = writeBoundary
3929  * self.fileprefix = 'isosurface'
3930  */
3931  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Comm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
3932  __Pyx_GOTREF(__pyx_t_1);
3933  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L1_error)
3934  __Pyx_GOTREF(__pyx_t_6);
3935  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3936  __pyx_t_1 = NULL;
3937  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
3938  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
3939  if (likely(__pyx_t_1)) {
3940  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
3941  __Pyx_INCREF(__pyx_t_1);
3942  __Pyx_INCREF(function);
3943  __Pyx_DECREF_SET(__pyx_t_6, function);
3944  }
3945  }
3946  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
3947  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3948  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
3949  __Pyx_GOTREF(__pyx_t_2);
3950  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3951  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_comm, __pyx_t_2) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
3952  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3953 
3954  /* "Isosurface.pyx":105
3955  * self.format = format
3956  * self.comm = Comm.get()
3957  * self.writeBoundary = writeBoundary # <<<<<<<<<<<<<<
3958  * self.fileprefix = 'isosurface'
3959  *
3960  */
3961  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_writeBoundary, __pyx_v_writeBoundary) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
3962 
3963  /* "Isosurface.pyx":106
3964  * self.comm = Comm.get()
3965  * self.writeBoundary = writeBoundary
3966  * self.fileprefix = 'isosurface' # <<<<<<<<<<<<<<
3967  *
3968  * def attachModel(self, model, ar):
3969  */
3970  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fileprefix, __pyx_n_s_isosurface) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
3971 
3972  /* "Isosurface.pyx":54
3973  * """Extract isosurfaces"""
3974  *
3975  * def __init__(self, isosurfaces, domain, activeTime=None, # <<<<<<<<<<<<<<
3976  * sampleRate=0, format='pov', writeBoundary=True):
3977  * """Create a set of isosurfaces that will be extracted and serialized
3978  */
3979 
3980  /* function exit code */
3981  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3982  goto __pyx_L0;
3983  __pyx_L1_error:;
3984  __Pyx_XDECREF(__pyx_t_1);
3985  __Pyx_XDECREF(__pyx_t_2);
3986  __Pyx_XDECREF(__pyx_t_5);
3987  __Pyx_XDECREF(__pyx_t_6);
3988  __Pyx_XDECREF(__pyx_t_7);
3989  __Pyx_AddTraceback("Isosurface.Isosurface.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3990  __pyx_r = NULL;
3991  __pyx_L0:;
3992  __Pyx_XDECREF(__pyx_v_f);
3993  __Pyx_XDECREF(__pyx_v_values);
3994  __Pyx_XDECREF(__pyx_v_v);
3995  __Pyx_XGIVEREF(__pyx_r);
3996  __Pyx_RefNannyFinishContext();
3997  return __pyx_r;
3998 }
3999 
4000 /* "Isosurface.pyx":108
4001  * self.fileprefix = 'isosurface'
4002  *
4003  * def attachModel(self, model, ar): # <<<<<<<<<<<<<<
4004  * """ Attach this isosurface to the given simulation model.
4005  * """
4006  */
4007 
4008 /* Python wrapper */
4009 static PyObject *__pyx_pw_10Isosurface_10Isosurface_3attachModel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4010 static char __pyx_doc_10Isosurface_10Isosurface_2attachModel[] = "Isosurface.attachModel(self, model, ar)\n Attach this isosurface to the given simulation model.\n ";
4011 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_3attachModel = {"attachModel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_3attachModel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_2attachModel};
4012 static PyObject *__pyx_pw_10Isosurface_10Isosurface_3attachModel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4013  PyObject *__pyx_v_self = 0;
4014  PyObject *__pyx_v_model = 0;
4015  CYTHON_UNUSED PyObject *__pyx_v_ar = 0;
4016  int __pyx_lineno = 0;
4017  const char *__pyx_filename = NULL;
4018  int __pyx_clineno = 0;
4019  PyObject *__pyx_r = 0;
4020  __Pyx_RefNannyDeclarations
4021  __Pyx_RefNannySetupContext("attachModel (wrapper)", 0);
4022  {
4023  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_model,&__pyx_n_s_ar,0};
4024  PyObject* values[3] = {0,0,0};
4025  if (unlikely(__pyx_kwds)) {
4026  Py_ssize_t kw_args;
4027  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4028  switch (pos_args) {
4029  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4030  CYTHON_FALLTHROUGH;
4031  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4032  CYTHON_FALLTHROUGH;
4033  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4034  CYTHON_FALLTHROUGH;
4035  case 0: break;
4036  default: goto __pyx_L5_argtuple_error;
4037  }
4038  kw_args = PyDict_Size(__pyx_kwds);
4039  switch (pos_args) {
4040  case 0:
4041  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4042  else goto __pyx_L5_argtuple_error;
4043  CYTHON_FALLTHROUGH;
4044  case 1:
4045  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--;
4046  else {
4047  __Pyx_RaiseArgtupleInvalid("attachModel", 1, 3, 3, 1); __PYX_ERR(0, 108, __pyx_L3_error)
4048  }
4049  CYTHON_FALLTHROUGH;
4050  case 2:
4051  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ar)) != 0)) kw_args--;
4052  else {
4053  __Pyx_RaiseArgtupleInvalid("attachModel", 1, 3, 3, 2); __PYX_ERR(0, 108, __pyx_L3_error)
4054  }
4055  }
4056  if (unlikely(kw_args > 0)) {
4057  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "attachModel") < 0)) __PYX_ERR(0, 108, __pyx_L3_error)
4058  }
4059  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4060  goto __pyx_L5_argtuple_error;
4061  } else {
4062  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4063  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4064  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4065  }
4066  __pyx_v_self = values[0];
4067  __pyx_v_model = values[1];
4068  __pyx_v_ar = values[2];
4069  }
4070  goto __pyx_L4_argument_unpacking_done;
4071  __pyx_L5_argtuple_error:;
4072  __Pyx_RaiseArgtupleInvalid("attachModel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 108, __pyx_L3_error)
4073  __pyx_L3_error:;
4074  __Pyx_AddTraceback("Isosurface.Isosurface.attachModel", __pyx_clineno, __pyx_lineno, __pyx_filename);
4075  __Pyx_RefNannyFinishContext();
4076  return NULL;
4077  __pyx_L4_argument_unpacking_done:;
4078  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_2attachModel(__pyx_self, __pyx_v_self, __pyx_v_model, __pyx_v_ar);
4079 
4080  /* function exit code */
4081  __Pyx_RefNannyFinishContext();
4082  return __pyx_r;
4083 }
4084 static PyObject *__pyx_gb_10Isosurface_10Isosurface_11attachModel_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
4085 
4086 /* "Isosurface.pyx":125
4087  * self.exteriorElementBoundariesArray
4088  * ].flatten())
4089  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes)) # <<<<<<<<<<<<<<
4090  * self.nodeArray = fine_grid.mesh.nodeArray
4091  * self.num_owned_elements = fine_grid.mesh.nElements_global
4092  */
4093 
4094 static PyObject *__pyx_pf_10Isosurface_10Isosurface_11attachModel_genexpr(PyObject *__pyx_self) {
4095  struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
4096  PyObject *__pyx_r = NULL;
4097  __Pyx_RefNannyDeclarations
4098  int __pyx_lineno = 0;
4099  const char *__pyx_filename = NULL;
4100  int __pyx_clineno = 0;
4101  __Pyx_RefNannySetupContext("genexpr", 0);
4102  __pyx_cur_scope = (struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *)__pyx_tp_new_10Isosurface___pyx_scope_struct_1_genexpr(__pyx_ptype_10Isosurface___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
4103  if (unlikely(!__pyx_cur_scope)) {
4104  __pyx_cur_scope = ((struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *)Py_None);
4105  __Pyx_INCREF(Py_None);
4106  __PYX_ERR(0, 125, __pyx_L1_error)
4107  } else {
4108  __Pyx_GOTREF(__pyx_cur_scope);
4109  }
4110  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *) __pyx_self;
4111  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
4112  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
4113  {
4114  __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10Isosurface_10Isosurface_11attachModel_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Isosurface_attachModel_locals_ge, __pyx_n_s_Isosurface); if (unlikely(!gen)) __PYX_ERR(0, 125, __pyx_L1_error)
4115  __Pyx_DECREF(__pyx_cur_scope);
4116  __Pyx_RefNannyFinishContext();
4117  return (PyObject *) gen;
4118  }
4119 
4120  /* function exit code */
4121  __pyx_L1_error:;
4122  __Pyx_AddTraceback("Isosurface.Isosurface.attachModel.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
4123  __pyx_r = NULL;
4124  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4125  __Pyx_XGIVEREF(__pyx_r);
4126  __Pyx_RefNannyFinishContext();
4127  return __pyx_r;
4128 }
4129 
4130 static PyObject *__pyx_gb_10Isosurface_10Isosurface_11attachModel_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
4131 {
4132  struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
4133  PyObject *__pyx_r = NULL;
4134  PyObject *__pyx_t_1 = NULL;
4135  PyObject *__pyx_t_2 = NULL;
4136  PyObject *__pyx_t_3 = NULL;
4137  Py_ssize_t __pyx_t_4;
4138  PyObject *(*__pyx_t_5)(PyObject *);
4139  int __pyx_lineno = 0;
4140  const char *__pyx_filename = NULL;
4141  int __pyx_clineno = 0;
4142  __Pyx_RefNannyDeclarations
4143  __Pyx_RefNannySetupContext("genexpr", 0);
4144  switch (__pyx_generator->resume_label) {
4145  case 0: goto __pyx_L3_first_run;
4146  default: /* CPython raises the right error here */
4147  __Pyx_RefNannyFinishContext();
4148  return NULL;
4149  }
4150  __pyx_L3_first_run:;
4151  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 125, __pyx_L1_error)
4152  __pyx_r = PyDict_New(); if (unlikely(!__pyx_r)) __PYX_ERR(0, 125, __pyx_L1_error)
4153  __Pyx_GOTREF(__pyx_r);
4154  __Pyx_INCREF(__pyx_int_0);
4155  __pyx_t_1 = __pyx_int_0;
4156  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 125, __pyx_L1_error) }
4157  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_boundaryNodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error)
4158  __Pyx_GOTREF(__pyx_t_2);
4159  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
4160  __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
4161  __pyx_t_5 = NULL;
4162  } else {
4163  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error)
4164  __Pyx_GOTREF(__pyx_t_3);
4165  __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error)
4166  }
4167  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4168  for (;;) {
4169  if (likely(!__pyx_t_5)) {
4170  if (likely(PyList_CheckExact(__pyx_t_3))) {
4171  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
4172  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4173  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 125, __pyx_L1_error)
4174  #else
4175  __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error)
4176  __Pyx_GOTREF(__pyx_t_2);
4177  #endif
4178  } else {
4179  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
4180  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4181  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 125, __pyx_L1_error)
4182  #else
4183  __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error)
4184  __Pyx_GOTREF(__pyx_t_2);
4185  #endif
4186  }
4187  } else {
4188  __pyx_t_2 = __pyx_t_5(__pyx_t_3);
4189  if (unlikely(!__pyx_t_2)) {
4190  PyObject* exc_type = PyErr_Occurred();
4191  if (exc_type) {
4192  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4193  else __PYX_ERR(0, 125, __pyx_L1_error)
4194  }
4195  break;
4196  }
4197  __Pyx_GOTREF(__pyx_t_2);
4198  }
4199  __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_gn);
4200  __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_gn, __pyx_t_2);
4201  __Pyx_GIVEREF(__pyx_t_2);
4202  __pyx_t_2 = 0;
4203  __Pyx_INCREF(__pyx_t_1);
4204  __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bn);
4205  __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_bn, __pyx_t_1);
4206  __Pyx_GIVEREF(__pyx_t_1);
4207  __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error)
4208  __Pyx_GOTREF(__pyx_t_2);
4209  __Pyx_DECREF(__pyx_t_1);
4210  __pyx_t_1 = __pyx_t_2;
4211  __pyx_t_2 = 0;
4212  if (unlikely(PyDict_SetItem(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_gn, (PyObject*)__pyx_cur_scope->__pyx_v_bn))) __PYX_ERR(0, 125, __pyx_L1_error)
4213  }
4214  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4215  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4216  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
4217 
4218  /* function exit code */
4219  goto __pyx_L0;
4220  __pyx_L1_error:;
4221  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
4222  __Pyx_XDECREF(__pyx_t_1);
4223  __Pyx_XDECREF(__pyx_t_2);
4224  __Pyx_XDECREF(__pyx_t_3);
4225  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
4226  __pyx_L0:;
4227  __Pyx_XGIVEREF(__pyx_r);
4228  #if !CYTHON_USE_EXC_INFO_STACK
4229  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4230  #endif
4231  __pyx_generator->resume_label = -1;
4232  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
4233  __Pyx_RefNannyFinishContext();
4234  return __pyx_r;
4235 }
4236 
4237 /* "Isosurface.pyx":108
4238  * self.fileprefix = 'isosurface'
4239  *
4240  * def attachModel(self, model, ar): # <<<<<<<<<<<<<<
4241  * """ Attach this isosurface to the given simulation model.
4242  * """
4243  */
4244 
4245 static PyObject *__pyx_pf_10Isosurface_10Isosurface_2attachModel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_model, CYTHON_UNUSED PyObject *__pyx_v_ar) {
4246  struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *__pyx_cur_scope;
4247  PyObject *__pyx_v_fine_grid = NULL;
4248  PyObject *__pyx_gb_10Isosurface_10Isosurface_11attachModel_2generator = 0;
4249  PyObject *__pyx_r = NULL;
4250  __Pyx_RefNannyDeclarations
4251  PyObject *__pyx_t_1 = NULL;
4252  PyObject *__pyx_t_2 = NULL;
4253  PyObject *__pyx_t_3 = NULL;
4254  PyObject *__pyx_t_4 = NULL;
4255  int __pyx_lineno = 0;
4256  const char *__pyx_filename = NULL;
4257  int __pyx_clineno = 0;
4258  __Pyx_RefNannySetupContext("attachModel", 0);
4259  __pyx_cur_scope = (struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *)__pyx_tp_new_10Isosurface___pyx_scope_struct__attachModel(__pyx_ptype_10Isosurface___pyx_scope_struct__attachModel, __pyx_empty_tuple, NULL);
4260  if (unlikely(!__pyx_cur_scope)) {
4261  __pyx_cur_scope = ((struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *)Py_None);
4262  __Pyx_INCREF(Py_None);
4263  __PYX_ERR(0, 108, __pyx_L1_error)
4264  } else {
4265  __Pyx_GOTREF(__pyx_cur_scope);
4266  }
4267  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
4268  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
4269  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
4270 
4271  /* "Isosurface.pyx":111
4272  * """ Attach this isosurface to the given simulation model.
4273  * """
4274  * self.model = model # <<<<<<<<<<<<<<
4275  * fine_grid = model.levelModelList[-1]
4276  * self.fieldNames = fine_grid.coefficients.variableNames
4277  */
4278  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_model, __pyx_v_model) < 0) __PYX_ERR(0, 111, __pyx_L1_error)
4279 
4280  /* "Isosurface.pyx":112
4281  * """
4282  * self.model = model
4283  * fine_grid = model.levelModelList[-1] # <<<<<<<<<<<<<<
4284  * self.fieldNames = fine_grid.coefficients.variableNames
4285  * self.elementNodesArray = fine_grid.mesh.elementNodesArray
4286  */
4287  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_levelModelList); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
4288  __Pyx_GOTREF(__pyx_t_1);
4289  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
4290  __Pyx_GOTREF(__pyx_t_2);
4291  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4292  __pyx_v_fine_grid = __pyx_t_2;
4293  __pyx_t_2 = 0;
4294 
4295  /* "Isosurface.pyx":113
4296  * self.model = model
4297  * fine_grid = model.levelModelList[-1]
4298  * self.fieldNames = fine_grid.coefficients.variableNames # <<<<<<<<<<<<<<
4299  * self.elementNodesArray = fine_grid.mesh.elementNodesArray
4300  * self.exteriorElementBoundariesArray \
4301  */
4302  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_coefficients); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
4303  __Pyx_GOTREF(__pyx_t_2);
4304  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_variableNames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
4305  __Pyx_GOTREF(__pyx_t_1);
4306  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4307  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_fieldNames, __pyx_t_1) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
4308  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4309 
4310  /* "Isosurface.pyx":114
4311  * fine_grid = model.levelModelList[-1]
4312  * self.fieldNames = fine_grid.coefficients.variableNames
4313  * self.elementNodesArray = fine_grid.mesh.elementNodesArray # <<<<<<<<<<<<<<
4314  * self.exteriorElementBoundariesArray \
4315  * = fine_grid.mesh.exteriorElementBoundariesArray
4316  */
4317  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_mesh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
4318  __Pyx_GOTREF(__pyx_t_1);
4319  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
4320  __Pyx_GOTREF(__pyx_t_2);
4321  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4322  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_elementNodesArray, __pyx_t_2) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
4323  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4324 
4325  /* "Isosurface.pyx":116
4326  * self.elementNodesArray = fine_grid.mesh.elementNodesArray
4327  * self.exteriorElementBoundariesArray \
4328  * = fine_grid.mesh.exteriorElementBoundariesArray # <<<<<<<<<<<<<<
4329  * self.elementBoundaryNodesArray \
4330  * = fine_grid.mesh.elementBoundaryNodesArray
4331  */
4332  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_mesh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
4333  __Pyx_GOTREF(__pyx_t_2);
4334  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_exteriorElementBoundariesArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
4335  __Pyx_GOTREF(__pyx_t_1);
4336  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4337 
4338  /* "Isosurface.pyx":115
4339  * self.fieldNames = fine_grid.coefficients.variableNames
4340  * self.elementNodesArray = fine_grid.mesh.elementNodesArray
4341  * self.exteriorElementBoundariesArray \ # <<<<<<<<<<<<<<
4342  * = fine_grid.mesh.exteriorElementBoundariesArray
4343  * self.elementBoundaryNodesArray \
4344  */
4345  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_exteriorElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 115, __pyx_L1_error)
4346  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4347 
4348  /* "Isosurface.pyx":118
4349  * = fine_grid.mesh.exteriorElementBoundariesArray
4350  * self.elementBoundaryNodesArray \
4351  * = fine_grid.mesh.elementBoundaryNodesArray # <<<<<<<<<<<<<<
4352  * self.elementBoundaryMaterialTypes \
4353  * = fine_grid.mesh.elementBoundaryMaterialTypes
4354  */
4355  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_mesh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
4356  __Pyx_GOTREF(__pyx_t_1);
4357  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_elementBoundaryNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
4358  __Pyx_GOTREF(__pyx_t_2);
4359  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4360 
4361  /* "Isosurface.pyx":117
4362  * self.exteriorElementBoundariesArray \
4363  * = fine_grid.mesh.exteriorElementBoundariesArray
4364  * self.elementBoundaryNodesArray \ # <<<<<<<<<<<<<<
4365  * = fine_grid.mesh.elementBoundaryNodesArray
4366  * self.elementBoundaryMaterialTypes \
4367  */
4368  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_elementBoundaryNodesArray, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
4369  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4370 
4371  /* "Isosurface.pyx":120
4372  * = fine_grid.mesh.elementBoundaryNodesArray
4373  * self.elementBoundaryMaterialTypes \
4374  * = fine_grid.mesh.elementBoundaryMaterialTypes # <<<<<<<<<<<<<<
4375  * self.boundaryNodes = set(
4376  * self.elementBoundaryNodesArray[
4377  */
4378  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_mesh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
4379  __Pyx_GOTREF(__pyx_t_2);
4380  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_elementBoundaryMaterialTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
4381  __Pyx_GOTREF(__pyx_t_1);
4382  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4383 
4384  /* "Isosurface.pyx":119
4385  * self.elementBoundaryNodesArray \
4386  * = fine_grid.mesh.elementBoundaryNodesArray
4387  * self.elementBoundaryMaterialTypes \ # <<<<<<<<<<<<<<
4388  * = fine_grid.mesh.elementBoundaryMaterialTypes
4389  * self.boundaryNodes = set(
4390  */
4391  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
4392  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4393 
4394  /* "Isosurface.pyx":122
4395  * = fine_grid.mesh.elementBoundaryMaterialTypes
4396  * self.boundaryNodes = set(
4397  * self.elementBoundaryNodesArray[ # <<<<<<<<<<<<<<
4398  * self.exteriorElementBoundariesArray
4399  * ].flatten())
4400  */
4401  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_elementBoundaryNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
4402  __Pyx_GOTREF(__pyx_t_2);
4403 
4404  /* "Isosurface.pyx":123
4405  * self.boundaryNodes = set(
4406  * self.elementBoundaryNodesArray[
4407  * self.exteriorElementBoundariesArray # <<<<<<<<<<<<<<
4408  * ].flatten())
4409  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes))
4410  */
4411  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_exteriorElementBoundariesArray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
4412  __Pyx_GOTREF(__pyx_t_3);
4413 
4414  /* "Isosurface.pyx":122
4415  * = fine_grid.mesh.elementBoundaryMaterialTypes
4416  * self.boundaryNodes = set(
4417  * self.elementBoundaryNodesArray[ # <<<<<<<<<<<<<<
4418  * self.exteriorElementBoundariesArray
4419  * ].flatten())
4420  */
4421  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
4422  __Pyx_GOTREF(__pyx_t_4);
4423  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4424  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4425 
4426  /* "Isosurface.pyx":124
4427  * self.elementBoundaryNodesArray[
4428  * self.exteriorElementBoundariesArray
4429  * ].flatten()) # <<<<<<<<<<<<<<
4430  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes))
4431  * self.nodeArray = fine_grid.mesh.nodeArray
4432  */
4433  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_flatten); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)
4434  __Pyx_GOTREF(__pyx_t_3);
4435  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4436  __pyx_t_4 = NULL;
4437  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4438  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4439  if (likely(__pyx_t_4)) {
4440  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4441  __Pyx_INCREF(__pyx_t_4);
4442  __Pyx_INCREF(function);
4443  __Pyx_DECREF_SET(__pyx_t_3, function);
4444  }
4445  }
4446  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
4447  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4448  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
4449  __Pyx_GOTREF(__pyx_t_1);
4450  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4451 
4452  /* "Isosurface.pyx":121
4453  * self.elementBoundaryMaterialTypes \
4454  * = fine_grid.mesh.elementBoundaryMaterialTypes
4455  * self.boundaryNodes = set( # <<<<<<<<<<<<<<
4456  * self.elementBoundaryNodesArray[
4457  * self.exteriorElementBoundariesArray
4458  */
4459  __pyx_t_3 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
4460  __Pyx_GOTREF(__pyx_t_3);
4461  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4462  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_boundaryNodes, __pyx_t_3) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
4463  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4464 
4465  /* "Isosurface.pyx":125
4466  * self.exteriorElementBoundariesArray
4467  * ].flatten())
4468  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes)) # <<<<<<<<<<<<<<
4469  * self.nodeArray = fine_grid.mesh.nodeArray
4470  * self.num_owned_elements = fine_grid.mesh.nElements_global
4471  */
4472  __pyx_t_3 = __pyx_pf_10Isosurface_10Isosurface_11attachModel_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error)
4473  __Pyx_GOTREF(__pyx_t_3);
4474  __pyx_t_1 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
4475  __Pyx_GOTREF(__pyx_t_1);
4476  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4477  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_g2b, __pyx_t_1) < 0) __PYX_ERR(0, 125, __pyx_L1_error)
4478  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4479 
4480  /* "Isosurface.pyx":126
4481  * ].flatten())
4482  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes))
4483  * self.nodeArray = fine_grid.mesh.nodeArray # <<<<<<<<<<<<<<
4484  * self.num_owned_elements = fine_grid.mesh.nElements_global
4485  * self.u = fine_grid.u
4486  */
4487  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_mesh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4488  __Pyx_GOTREF(__pyx_t_1);
4489  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
4490  __Pyx_GOTREF(__pyx_t_3);
4491  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4492  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_nodeArray, __pyx_t_3) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
4493  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4494 
4495  /* "Isosurface.pyx":127
4496  * self.g2b = dict((gn, bn) for bn, gn in enumerate(self.boundaryNodes))
4497  * self.nodeArray = fine_grid.mesh.nodeArray
4498  * self.num_owned_elements = fine_grid.mesh.nElements_global # <<<<<<<<<<<<<<
4499  * self.u = fine_grid.u
4500  * self.timeIntegration = fine_grid.timeIntegration
4501  */
4502  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_mesh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error)
4503  __Pyx_GOTREF(__pyx_t_3);
4504  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nElements_global); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
4505  __Pyx_GOTREF(__pyx_t_1);
4506  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4507  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_num_owned_elements, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
4508  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4509 
4510  /* "Isosurface.pyx":128
4511  * self.nodeArray = fine_grid.mesh.nodeArray
4512  * self.num_owned_elements = fine_grid.mesh.nElements_global
4513  * self.u = fine_grid.u # <<<<<<<<<<<<<<
4514  * self.timeIntegration = fine_grid.timeIntegration
4515  * self.nFrames = 0
4516  */
4517  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_u); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
4518  __Pyx_GOTREF(__pyx_t_1);
4519  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_u, __pyx_t_1) < 0) __PYX_ERR(0, 128, __pyx_L1_error)
4520  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4521 
4522  /* "Isosurface.pyx":129
4523  * self.num_owned_elements = fine_grid.mesh.nElements_global
4524  * self.u = fine_grid.u
4525  * self.timeIntegration = fine_grid.timeIntegration # <<<<<<<<<<<<<<
4526  * self.nFrames = 0
4527  * self.next_output = 0
4528  */
4529  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fine_grid, __pyx_n_s_timeIntegration); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
4530  __Pyx_GOTREF(__pyx_t_1);
4531  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_timeIntegration, __pyx_t_1) < 0) __PYX_ERR(0, 129, __pyx_L1_error)
4532  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4533 
4534  /* "Isosurface.pyx":130
4535  * self.u = fine_grid.u
4536  * self.timeIntegration = fine_grid.timeIntegration
4537  * self.nFrames = 0 # <<<<<<<<<<<<<<
4538  * self.next_output = 0
4539  * self.writeSceneHeader()
4540  */
4541  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_nFrames, __pyx_int_0) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
4542 
4543  /* "Isosurface.pyx":131
4544  * self.timeIntegration = fine_grid.timeIntegration
4545  * self.nFrames = 0
4546  * self.next_output = 0 # <<<<<<<<<<<<<<
4547  * self.writeSceneHeader()
4548  * return self
4549  */
4550  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_next_output, __pyx_int_0) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
4551 
4552  /* "Isosurface.pyx":132
4553  * self.nFrames = 0
4554  * self.next_output = 0
4555  * self.writeSceneHeader() # <<<<<<<<<<<<<<
4556  * return self
4557  *
4558  */
4559  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_writeSceneHeader); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error)
4560  __Pyx_GOTREF(__pyx_t_3);
4561  __pyx_t_4 = NULL;
4562  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4563  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4564  if (likely(__pyx_t_4)) {
4565  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4566  __Pyx_INCREF(__pyx_t_4);
4567  __Pyx_INCREF(function);
4568  __Pyx_DECREF_SET(__pyx_t_3, function);
4569  }
4570  }
4571  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
4572  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4573  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
4574  __Pyx_GOTREF(__pyx_t_1);
4575  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4576  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4577 
4578  /* "Isosurface.pyx":133
4579  * self.next_output = 0
4580  * self.writeSceneHeader()
4581  * return self # <<<<<<<<<<<<<<
4582  *
4583  * def attachHDF5(self, h5, step, cam=None):
4584  */
4585  __Pyx_XDECREF(__pyx_r);
4586  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
4587  __pyx_r = __pyx_cur_scope->__pyx_v_self;
4588  goto __pyx_L0;
4589 
4590  /* "Isosurface.pyx":108
4591  * self.fileprefix = 'isosurface'
4592  *
4593  * def attachModel(self, model, ar): # <<<<<<<<<<<<<<
4594  * """ Attach this isosurface to the given simulation model.
4595  * """
4596  */
4597 
4598  /* function exit code */
4599  __pyx_L1_error:;
4600  __Pyx_XDECREF(__pyx_t_1);
4601  __Pyx_XDECREF(__pyx_t_2);
4602  __Pyx_XDECREF(__pyx_t_3);
4603  __Pyx_XDECREF(__pyx_t_4);
4604  __Pyx_AddTraceback("Isosurface.Isosurface.attachModel", __pyx_clineno, __pyx_lineno, __pyx_filename);
4605  __pyx_r = NULL;
4606  __pyx_L0:;
4607  __Pyx_XDECREF(__pyx_v_fine_grid);
4608  __Pyx_XDECREF(__pyx_gb_10Isosurface_10Isosurface_11attachModel_2generator);
4609  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4610  __Pyx_XGIVEREF(__pyx_r);
4611  __Pyx_RefNannyFinishContext();
4612  return __pyx_r;
4613 }
4614 
4615 /* "Isosurface.pyx":135
4616  * return self
4617  *
4618  * def attachHDF5(self, h5, step, cam=None): # <<<<<<<<<<<<<<
4619  * """
4620  * Attach this isosurface to and HDF5 archive
4621  */
4622 
4623 /* Python wrapper */
4624 static PyObject *__pyx_pw_10Isosurface_10Isosurface_5attachHDF5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4625 static char __pyx_doc_10Isosurface_10Isosurface_4attachHDF5[] = "Isosurface.attachHDF5(self, h5, step, cam=None)\n\n Attach this isosurface to and HDF5 archive\n ";
4626 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_5attachHDF5 = {"attachHDF5", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_5attachHDF5, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_4attachHDF5};
4627 static PyObject *__pyx_pw_10Isosurface_10Isosurface_5attachHDF5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4628  PyObject *__pyx_v_self = 0;
4629  PyObject *__pyx_v_h5 = 0;
4630  PyObject *__pyx_v_step = 0;
4631  PyObject *__pyx_v_cam = 0;
4632  int __pyx_lineno = 0;
4633  const char *__pyx_filename = NULL;
4634  int __pyx_clineno = 0;
4635  PyObject *__pyx_r = 0;
4636  __Pyx_RefNannyDeclarations
4637  __Pyx_RefNannySetupContext("attachHDF5 (wrapper)", 0);
4638  {
4639  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_h5,&__pyx_n_s_step,&__pyx_n_s_cam,0};
4640  PyObject* values[4] = {0,0,0,0};
4641  values[3] = ((PyObject *)((PyObject *)Py_None));
4642  if (unlikely(__pyx_kwds)) {
4643  Py_ssize_t kw_args;
4644  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4645  switch (pos_args) {
4646  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4647  CYTHON_FALLTHROUGH;
4648  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4649  CYTHON_FALLTHROUGH;
4650  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4651  CYTHON_FALLTHROUGH;
4652  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4653  CYTHON_FALLTHROUGH;
4654  case 0: break;
4655  default: goto __pyx_L5_argtuple_error;
4656  }
4657  kw_args = PyDict_Size(__pyx_kwds);
4658  switch (pos_args) {
4659  case 0:
4660  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
4661  else goto __pyx_L5_argtuple_error;
4662  CYTHON_FALLTHROUGH;
4663  case 1:
4664  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h5)) != 0)) kw_args--;
4665  else {
4666  __Pyx_RaiseArgtupleInvalid("attachHDF5", 0, 3, 4, 1); __PYX_ERR(0, 135, __pyx_L3_error)
4667  }
4668  CYTHON_FALLTHROUGH;
4669  case 2:
4670  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_step)) != 0)) kw_args--;
4671  else {
4672  __Pyx_RaiseArgtupleInvalid("attachHDF5", 0, 3, 4, 2); __PYX_ERR(0, 135, __pyx_L3_error)
4673  }
4674  CYTHON_FALLTHROUGH;
4675  case 3:
4676  if (kw_args > 0) {
4677  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cam);
4678  if (value) { values[3] = value; kw_args--; }
4679  }
4680  }
4681  if (unlikely(kw_args > 0)) {
4682  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "attachHDF5") < 0)) __PYX_ERR(0, 135, __pyx_L3_error)
4683  }
4684  } else {
4685  switch (PyTuple_GET_SIZE(__pyx_args)) {
4686  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4687  CYTHON_FALLTHROUGH;
4688  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4689  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4690  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4691  break;
4692  default: goto __pyx_L5_argtuple_error;
4693  }
4694  }
4695  __pyx_v_self = values[0];
4696  __pyx_v_h5 = values[1];
4697  __pyx_v_step = values[2];
4698  __pyx_v_cam = values[3];
4699  }
4700  goto __pyx_L4_argument_unpacking_done;
4701  __pyx_L5_argtuple_error:;
4702  __Pyx_RaiseArgtupleInvalid("attachHDF5", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 135, __pyx_L3_error)
4703  __pyx_L3_error:;
4704  __Pyx_AddTraceback("Isosurface.Isosurface.attachHDF5", __pyx_clineno, __pyx_lineno, __pyx_filename);
4705  __Pyx_RefNannyFinishContext();
4706  return NULL;
4707  __pyx_L4_argument_unpacking_done:;
4708  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_4attachHDF5(__pyx_self, __pyx_v_self, __pyx_v_h5, __pyx_v_step, __pyx_v_cam);
4709 
4710  /* function exit code */
4711  __Pyx_RefNannyFinishContext();
4712  return __pyx_r;
4713 }
4714 
4715 static PyObject *__pyx_pf_10Isosurface_10Isosurface_4attachHDF5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_h5, PyObject *__pyx_v_step, PyObject *__pyx_v_cam) {
4716  PyObject *__pyx_v_namedtuple = NULL;
4717  PyObject *__pyx_v_FemField = NULL;
4718  PyObject *__pyx_v_field_i = NULL;
4719  CYTHON_UNUSED PyObject *__pyx_v_field = NULL;
4720  PyObject *__pyx_v_isosurface = NULL;
4721  PyObject *__pyx_r = NULL;
4722  __Pyx_RefNannyDeclarations
4723  PyObject *__pyx_t_1 = NULL;
4724  PyObject *__pyx_t_2 = NULL;
4725  PyObject *__pyx_t_3 = NULL;
4726  Py_ssize_t __pyx_t_4;
4727  PyObject *(*__pyx_t_5)(PyObject *);
4728  PyObject *__pyx_t_6 = NULL;
4729  int __pyx_t_7;
4730  PyObject *__pyx_t_8 = NULL;
4731  PyObject *__pyx_t_9 = NULL;
4732  PyObject *__pyx_t_10 = NULL;
4733  PyObject *__pyx_t_11 = NULL;
4734  int __pyx_t_12;
4735  int __pyx_lineno = 0;
4736  const char *__pyx_filename = NULL;
4737  int __pyx_clineno = 0;
4738  __Pyx_RefNannySetupContext("attachHDF5", 0);
4739 
4740  /* "Isosurface.pyx":139
4741  * Attach this isosurface to and HDF5 archive
4742  * """
4743  * from collections import namedtuple # <<<<<<<<<<<<<<
4744  * self.fieldNames = [isosurface[0] for isosurface in self.isosurfaces]
4745  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4746  */
4747  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
4748  __Pyx_GOTREF(__pyx_t_1);
4749  __Pyx_INCREF(__pyx_n_s_namedtuple);
4750  __Pyx_GIVEREF(__pyx_n_s_namedtuple);
4751  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_namedtuple);
4752  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
4753  __Pyx_GOTREF(__pyx_t_2);
4754  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4755  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
4756  __Pyx_GOTREF(__pyx_t_1);
4757  __Pyx_INCREF(__pyx_t_1);
4758  __pyx_v_namedtuple = __pyx_t_1;
4759  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4760  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4761 
4762  /* "Isosurface.pyx":140
4763  * """
4764  * from collections import namedtuple
4765  * self.fieldNames = [isosurface[0] for isosurface in self.isosurfaces] # <<<<<<<<<<<<<<
4766  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4767  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" +
4768  */
4769  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
4770  __Pyx_GOTREF(__pyx_t_2);
4771  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_isosurfaces); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
4772  __Pyx_GOTREF(__pyx_t_1);
4773  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
4774  __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
4775  __pyx_t_5 = NULL;
4776  } else {
4777  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error)
4778  __Pyx_GOTREF(__pyx_t_3);
4779  __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error)
4780  }
4781  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4782  for (;;) {
4783  if (likely(!__pyx_t_5)) {
4784  if (likely(PyList_CheckExact(__pyx_t_3))) {
4785  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
4786  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4787  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 140, __pyx_L1_error)
4788  #else
4789  __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
4790  __Pyx_GOTREF(__pyx_t_1);
4791  #endif
4792  } else {
4793  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
4794  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4795  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 140, __pyx_L1_error)
4796  #else
4797  __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
4798  __Pyx_GOTREF(__pyx_t_1);
4799  #endif
4800  }
4801  } else {
4802  __pyx_t_1 = __pyx_t_5(__pyx_t_3);
4803  if (unlikely(!__pyx_t_1)) {
4804  PyObject* exc_type = PyErr_Occurred();
4805  if (exc_type) {
4806  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4807  else __PYX_ERR(0, 140, __pyx_L1_error)
4808  }
4809  break;
4810  }
4811  __Pyx_GOTREF(__pyx_t_1);
4812  }
4813  __Pyx_XDECREF_SET(__pyx_v_isosurface, __pyx_t_1);
4814  __pyx_t_1 = 0;
4815  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_isosurface, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
4816  __Pyx_GOTREF(__pyx_t_1);
4817  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 140, __pyx_L1_error)
4818  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4819  }
4820  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4821  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fieldNames, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
4822  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4823 
4824  /* "Isosurface.pyx":141
4825  * from collections import namedtuple
4826  * self.fieldNames = [isosurface[0] for isosurface in self.isosurfaces]
4827  * print("ATTACHING TO HDF5 !!", self.fieldNames) # <<<<<<<<<<<<<<
4828  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" +
4829  * repr(step))[:]
4830  */
4831  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fieldNames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
4832  __Pyx_GOTREF(__pyx_t_2);
4833  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
4834  __Pyx_GOTREF(__pyx_t_3);
4835  __Pyx_INCREF(__pyx_kp_s_ATTACHING_TO_HDF5);
4836  __Pyx_GIVEREF(__pyx_kp_s_ATTACHING_TO_HDF5);
4837  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_ATTACHING_TO_HDF5);
4838  __Pyx_GIVEREF(__pyx_t_2);
4839  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
4840  __pyx_t_2 = 0;
4841  if (__Pyx_PrintOne(0, __pyx_t_3) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
4842  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4843 
4844  /* "Isosurface.pyx":142
4845  * self.fieldNames = [isosurface[0] for isosurface in self.isosurfaces]
4846  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4847  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" + # <<<<<<<<<<<<<<
4848  * repr(step))[:]
4849  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4850  */
4851  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_h5, __pyx_n_s_get_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
4852  __Pyx_GOTREF(__pyx_t_2);
4853 
4854  /* "Isosurface.pyx":143
4855  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4856  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" +
4857  * repr(step))[:] # <<<<<<<<<<<<<<
4858  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4859  * self.num_owned_elements = len(self.elementNodesArray)
4860  */
4861  __pyx_t_1 = PyObject_Repr(__pyx_v_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
4862  __Pyx_GOTREF(__pyx_t_1);
4863 
4864  /* "Isosurface.pyx":142
4865  * self.fieldNames = [isosurface[0] for isosurface in self.isosurfaces]
4866  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4867  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" + # <<<<<<<<<<<<<<
4868  * repr(step))[:]
4869  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4870  */
4871  __pyx_t_6 = PyNumber_Add(__pyx_kp_s_elementsSpatial_Domain, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error)
4872  __Pyx_GOTREF(__pyx_t_6);
4873  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4874  __pyx_t_1 = NULL;
4875  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4876  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
4877  if (likely(__pyx_t_1)) {
4878  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4879  __Pyx_INCREF(__pyx_t_1);
4880  __Pyx_INCREF(function);
4881  __Pyx_DECREF_SET(__pyx_t_2, function);
4882  }
4883  }
4884  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6);
4885  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4886  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4887  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
4888  __Pyx_GOTREF(__pyx_t_3);
4889  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4890 
4891  /* "Isosurface.pyx":143
4892  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4893  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" +
4894  * repr(step))[:] # <<<<<<<<<<<<<<
4895  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4896  * self.num_owned_elements = len(self.elementNodesArray)
4897  */
4898  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0, NULL, NULL, &__pyx_slice__3, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
4899  __Pyx_GOTREF(__pyx_t_2);
4900  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4901 
4902  /* "Isosurface.pyx":142
4903  * self.fieldNames = [isosurface[0] for isosurface in self.isosurfaces]
4904  * print("ATTACHING TO HDF5 !!", self.fieldNames)
4905  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" + # <<<<<<<<<<<<<<
4906  * repr(step))[:]
4907  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4908  */
4909  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_elementNodesArray, __pyx_t_2) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
4910  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4911 
4912  /* "Isosurface.pyx":144
4913  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" +
4914  * repr(step))[:]
4915  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:] # <<<<<<<<<<<<<<
4916  * self.num_owned_elements = len(self.elementNodesArray)
4917  * self.u = {}
4918  */
4919  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_h5, __pyx_n_s_get_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
4920  __Pyx_GOTREF(__pyx_t_3);
4921  __pyx_t_6 = PyObject_Repr(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error)
4922  __Pyx_GOTREF(__pyx_t_6);
4923  __pyx_t_1 = PyNumber_Add(__pyx_kp_s_nodesSpatial_Domain, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
4924  __Pyx_GOTREF(__pyx_t_1);
4925  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4926  __pyx_t_6 = NULL;
4927  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4928  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4929  if (likely(__pyx_t_6)) {
4930  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4931  __Pyx_INCREF(__pyx_t_6);
4932  __Pyx_INCREF(function);
4933  __Pyx_DECREF_SET(__pyx_t_3, function);
4934  }
4935  }
4936  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
4937  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4938  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4939  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
4940  __Pyx_GOTREF(__pyx_t_2);
4941  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4942  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, NULL, NULL, &__pyx_slice__3, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
4943  __Pyx_GOTREF(__pyx_t_3);
4944  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4945  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray, __pyx_t_3) < 0) __PYX_ERR(0, 144, __pyx_L1_error)
4946  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4947 
4948  /* "Isosurface.pyx":145
4949  * repr(step))[:]
4950  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4951  * self.num_owned_elements = len(self.elementNodesArray) # <<<<<<<<<<<<<<
4952  * self.u = {}
4953  * FemField = namedtuple('FemField', ['dof'])
4954  */
4955  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
4956  __Pyx_GOTREF(__pyx_t_3);
4957  __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 145, __pyx_L1_error)
4958  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4959  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
4960  __Pyx_GOTREF(__pyx_t_3);
4961  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_num_owned_elements, __pyx_t_3) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
4962  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4963 
4964  /* "Isosurface.pyx":146
4965  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
4966  * self.num_owned_elements = len(self.elementNodesArray)
4967  * self.u = {} # <<<<<<<<<<<<<<
4968  * FemField = namedtuple('FemField', ['dof'])
4969  * for field_i, field in enumerate(self.fieldNames):
4970  */
4971  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error)
4972  __Pyx_GOTREF(__pyx_t_3);
4973  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_u, __pyx_t_3) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
4974  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4975 
4976  /* "Isosurface.pyx":147
4977  * self.num_owned_elements = len(self.elementNodesArray)
4978  * self.u = {}
4979  * FemField = namedtuple('FemField', ['dof']) # <<<<<<<<<<<<<<
4980  * for field_i, field in enumerate(self.fieldNames):
4981  * self.u[field_i] = FemField(dof=h5.get_node("/" +
4982  */
4983  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
4984  __Pyx_GOTREF(__pyx_t_2);
4985  __Pyx_INCREF(__pyx_n_s_dof);
4986  __Pyx_GIVEREF(__pyx_n_s_dof);
4987  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_dof);
4988  __Pyx_INCREF(__pyx_v_namedtuple);
4989  __pyx_t_1 = __pyx_v_namedtuple; __pyx_t_6 = NULL;
4990  __pyx_t_7 = 0;
4991  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
4992  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
4993  if (likely(__pyx_t_6)) {
4994  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4995  __Pyx_INCREF(__pyx_t_6);
4996  __Pyx_INCREF(function);
4997  __Pyx_DECREF_SET(__pyx_t_1, function);
4998  __pyx_t_7 = 1;
4999  }
5000  }
5001  #if CYTHON_FAST_PYCALL
5002  if (PyFunction_Check(__pyx_t_1)) {
5003  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_s_FemField, __pyx_t_2};
5004  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
5005  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5006  __Pyx_GOTREF(__pyx_t_3);
5007  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5008  } else
5009  #endif
5010  #if CYTHON_FAST_PYCCALL
5011  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
5012  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_s_FemField, __pyx_t_2};
5013  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
5014  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5015  __Pyx_GOTREF(__pyx_t_3);
5016  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5017  } else
5018  #endif
5019  {
5020  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 147, __pyx_L1_error)
5021  __Pyx_GOTREF(__pyx_t_8);
5022  if (__pyx_t_6) {
5023  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
5024  }
5025  __Pyx_INCREF(__pyx_n_s_FemField);
5026  __Pyx_GIVEREF(__pyx_n_s_FemField);
5027  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_s_FemField);
5028  __Pyx_GIVEREF(__pyx_t_2);
5029  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_2);
5030  __pyx_t_2 = 0;
5031  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
5032  __Pyx_GOTREF(__pyx_t_3);
5033  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5034  }
5035  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5036  __pyx_v_FemField = __pyx_t_3;
5037  __pyx_t_3 = 0;
5038 
5039  /* "Isosurface.pyx":148
5040  * self.u = {}
5041  * FemField = namedtuple('FemField', ['dof'])
5042  * for field_i, field in enumerate(self.fieldNames): # <<<<<<<<<<<<<<
5043  * self.u[field_i] = FemField(dof=h5.get_node("/" +
5044  * self.isosurfaces[0][0] +
5045  */
5046  __Pyx_INCREF(__pyx_int_0);
5047  __pyx_t_3 = __pyx_int_0;
5048  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fieldNames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
5049  __Pyx_GOTREF(__pyx_t_1);
5050  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
5051  __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
5052  __pyx_t_5 = NULL;
5053  } else {
5054  __pyx_t_4 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
5055  __Pyx_GOTREF(__pyx_t_8);
5056  __pyx_t_5 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
5057  }
5058  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5059  for (;;) {
5060  if (likely(!__pyx_t_5)) {
5061  if (likely(PyList_CheckExact(__pyx_t_8))) {
5062  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
5063  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5064  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 148, __pyx_L1_error)
5065  #else
5066  __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
5067  __Pyx_GOTREF(__pyx_t_1);
5068  #endif
5069  } else {
5070  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
5071  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5072  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 148, __pyx_L1_error)
5073  #else
5074  __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
5075  __Pyx_GOTREF(__pyx_t_1);
5076  #endif
5077  }
5078  } else {
5079  __pyx_t_1 = __pyx_t_5(__pyx_t_8);
5080  if (unlikely(!__pyx_t_1)) {
5081  PyObject* exc_type = PyErr_Occurred();
5082  if (exc_type) {
5083  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5084  else __PYX_ERR(0, 148, __pyx_L1_error)
5085  }
5086  break;
5087  }
5088  __Pyx_GOTREF(__pyx_t_1);
5089  }
5090  __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_1);
5091  __pyx_t_1 = 0;
5092  __Pyx_INCREF(__pyx_t_3);
5093  __Pyx_XDECREF_SET(__pyx_v_field_i, __pyx_t_3);
5094  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
5095  __Pyx_GOTREF(__pyx_t_1);
5096  __Pyx_DECREF(__pyx_t_3);
5097  __pyx_t_3 = __pyx_t_1;
5098  __pyx_t_1 = 0;
5099 
5100  /* "Isosurface.pyx":149
5101  * FemField = namedtuple('FemField', ['dof'])
5102  * for field_i, field in enumerate(self.fieldNames):
5103  * self.u[field_i] = FemField(dof=h5.get_node("/" + # <<<<<<<<<<<<<<
5104  * self.isosurfaces[0][0] +
5105  * repr(step))[:])
5106  */
5107  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
5108  __Pyx_GOTREF(__pyx_t_1);
5109  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_h5, __pyx_n_s_get_node); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error)
5110  __Pyx_GOTREF(__pyx_t_6);
5111 
5112  /* "Isosurface.pyx":150
5113  * for field_i, field in enumerate(self.fieldNames):
5114  * self.u[field_i] = FemField(dof=h5.get_node("/" +
5115  * self.isosurfaces[0][0] + # <<<<<<<<<<<<<<
5116  * repr(step))[:])
5117  * self.nFrames = step
5118  */
5119  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_isosurfaces); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error)
5120  __Pyx_GOTREF(__pyx_t_9);
5121  __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 150, __pyx_L1_error)
5122  __Pyx_GOTREF(__pyx_t_10);
5123  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5124  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 150, __pyx_L1_error)
5125  __Pyx_GOTREF(__pyx_t_9);
5126  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5127 
5128  /* "Isosurface.pyx":149
5129  * FemField = namedtuple('FemField', ['dof'])
5130  * for field_i, field in enumerate(self.fieldNames):
5131  * self.u[field_i] = FemField(dof=h5.get_node("/" + # <<<<<<<<<<<<<<
5132  * self.isosurfaces[0][0] +
5133  * repr(step))[:])
5134  */
5135  __pyx_t_10 = PyNumber_Add(__pyx_kp_s__4, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 149, __pyx_L1_error)
5136  __Pyx_GOTREF(__pyx_t_10);
5137  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5138 
5139  /* "Isosurface.pyx":151
5140  * self.u[field_i] = FemField(dof=h5.get_node("/" +
5141  * self.isosurfaces[0][0] +
5142  * repr(step))[:]) # <<<<<<<<<<<<<<
5143  * self.nFrames = step
5144  * self.next_output = 0
5145  */
5146  __pyx_t_9 = PyObject_Repr(__pyx_v_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
5147  __Pyx_GOTREF(__pyx_t_9);
5148 
5149  /* "Isosurface.pyx":150
5150  * for field_i, field in enumerate(self.fieldNames):
5151  * self.u[field_i] = FemField(dof=h5.get_node("/" +
5152  * self.isosurfaces[0][0] + # <<<<<<<<<<<<<<
5153  * repr(step))[:])
5154  * self.nFrames = step
5155  */
5156  __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 150, __pyx_L1_error)
5157  __Pyx_GOTREF(__pyx_t_11);
5158  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5159  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5160  __pyx_t_9 = NULL;
5161  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
5162  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
5163  if (likely(__pyx_t_9)) {
5164  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5165  __Pyx_INCREF(__pyx_t_9);
5166  __Pyx_INCREF(function);
5167  __Pyx_DECREF_SET(__pyx_t_6, function);
5168  }
5169  }
5170  __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_11);
5171  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5172  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5173  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
5174  __Pyx_GOTREF(__pyx_t_2);
5175  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5176 
5177  /* "Isosurface.pyx":151
5178  * self.u[field_i] = FemField(dof=h5.get_node("/" +
5179  * self.isosurfaces[0][0] +
5180  * repr(step))[:]) # <<<<<<<<<<<<<<
5181  * self.nFrames = step
5182  * self.next_output = 0
5183  */
5184  __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, NULL, NULL, &__pyx_slice__3, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error)
5185  __Pyx_GOTREF(__pyx_t_6);
5186  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5187  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dof, __pyx_t_6) < 0) __PYX_ERR(0, 149, __pyx_L1_error)
5188  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5189 
5190  /* "Isosurface.pyx":149
5191  * FemField = namedtuple('FemField', ['dof'])
5192  * for field_i, field in enumerate(self.fieldNames):
5193  * self.u[field_i] = FemField(dof=h5.get_node("/" + # <<<<<<<<<<<<<<
5194  * self.isosurfaces[0][0] +
5195  * repr(step))[:])
5196  */
5197  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_FemField, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error)
5198  __Pyx_GOTREF(__pyx_t_6);
5199  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5200  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_u); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
5201  __Pyx_GOTREF(__pyx_t_1);
5202  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_field_i, __pyx_t_6) < 0)) __PYX_ERR(0, 149, __pyx_L1_error)
5203  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5204  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5205 
5206  /* "Isosurface.pyx":148
5207  * self.u = {}
5208  * FemField = namedtuple('FemField', ['dof'])
5209  * for field_i, field in enumerate(self.fieldNames): # <<<<<<<<<<<<<<
5210  * self.u[field_i] = FemField(dof=h5.get_node("/" +
5211  * self.isosurfaces[0][0] +
5212  */
5213  }
5214  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5215  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5216 
5217  /* "Isosurface.pyx":152
5218  * self.isosurfaces[0][0] +
5219  * repr(step))[:])
5220  * self.nFrames = step # <<<<<<<<<<<<<<
5221  * self.next_output = 0
5222  * if step == 0:
5223  */
5224  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nFrames, __pyx_v_step) < 0) __PYX_ERR(0, 152, __pyx_L1_error)
5225 
5226  /* "Isosurface.pyx":153
5227  * repr(step))[:])
5228  * self.nFrames = step
5229  * self.next_output = 0 # <<<<<<<<<<<<<<
5230  * if step == 0:
5231  * self.writeSceneHeader(cam)
5232  */
5233  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_next_output, __pyx_int_0) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
5234 
5235  /* "Isosurface.pyx":154
5236  * self.nFrames = step
5237  * self.next_output = 0
5238  * if step == 0: # <<<<<<<<<<<<<<
5239  * self.writeSceneHeader(cam)
5240  * return self
5241  */
5242  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_step, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
5243  __Pyx_GOTREF(__pyx_t_3);
5244  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
5245  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5246  if (__pyx_t_12) {
5247 
5248  /* "Isosurface.pyx":155
5249  * self.next_output = 0
5250  * if step == 0:
5251  * self.writeSceneHeader(cam) # <<<<<<<<<<<<<<
5252  * return self
5253  *
5254  */
5255  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeSceneHeader); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error)
5256  __Pyx_GOTREF(__pyx_t_8);
5257  __pyx_t_6 = NULL;
5258  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
5259  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
5260  if (likely(__pyx_t_6)) {
5261  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5262  __Pyx_INCREF(__pyx_t_6);
5263  __Pyx_INCREF(function);
5264  __Pyx_DECREF_SET(__pyx_t_8, function);
5265  }
5266  }
5267  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_cam) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_cam);
5268  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5269  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error)
5270  __Pyx_GOTREF(__pyx_t_3);
5271  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5272  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5273 
5274  /* "Isosurface.pyx":154
5275  * self.nFrames = step
5276  * self.next_output = 0
5277  * if step == 0: # <<<<<<<<<<<<<<
5278  * self.writeSceneHeader(cam)
5279  * return self
5280  */
5281  }
5282 
5283  /* "Isosurface.pyx":156
5284  * if step == 0:
5285  * self.writeSceneHeader(cam)
5286  * return self # <<<<<<<<<<<<<<
5287  *
5288  * def triangulateIsosurface(self, field, value):
5289  */
5290  __Pyx_XDECREF(__pyx_r);
5291  __Pyx_INCREF(__pyx_v_self);
5292  __pyx_r = __pyx_v_self;
5293  goto __pyx_L0;
5294 
5295  /* "Isosurface.pyx":135
5296  * return self
5297  *
5298  * def attachHDF5(self, h5, step, cam=None): # <<<<<<<<<<<<<<
5299  * """
5300  * Attach this isosurface to and HDF5 archive
5301  */
5302 
5303  /* function exit code */
5304  __pyx_L1_error:;
5305  __Pyx_XDECREF(__pyx_t_1);
5306  __Pyx_XDECREF(__pyx_t_2);
5307  __Pyx_XDECREF(__pyx_t_3);
5308  __Pyx_XDECREF(__pyx_t_6);
5309  __Pyx_XDECREF(__pyx_t_8);
5310  __Pyx_XDECREF(__pyx_t_9);
5311  __Pyx_XDECREF(__pyx_t_10);
5312  __Pyx_XDECREF(__pyx_t_11);
5313  __Pyx_AddTraceback("Isosurface.Isosurface.attachHDF5", __pyx_clineno, __pyx_lineno, __pyx_filename);
5314  __pyx_r = NULL;
5315  __pyx_L0:;
5316  __Pyx_XDECREF(__pyx_v_namedtuple);
5317  __Pyx_XDECREF(__pyx_v_FemField);
5318  __Pyx_XDECREF(__pyx_v_field_i);
5319  __Pyx_XDECREF(__pyx_v_field);
5320  __Pyx_XDECREF(__pyx_v_isosurface);
5321  __Pyx_XGIVEREF(__pyx_r);
5322  __Pyx_RefNannyFinishContext();
5323  return __pyx_r;
5324 }
5325 
5326 /* "Isosurface.pyx":158
5327  * return self
5328  *
5329  * def triangulateIsosurface(self, field, value): # <<<<<<<<<<<<<<
5330  * """
5331  * Build a triangular mesh of the isosurface
5332  */
5333 
5334 /* Python wrapper */
5335 static PyObject *__pyx_pw_10Isosurface_10Isosurface_7triangulateIsosurface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5336 static char __pyx_doc_10Isosurface_10Isosurface_6triangulateIsosurface[] = "Isosurface.triangulateIsosurface(self, field, value)\n\n Build a triangular mesh of the isosurface\n ";
5337 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_7triangulateIsosurface = {"triangulateIsosurface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_7triangulateIsosurface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_6triangulateIsosurface};
5338 static PyObject *__pyx_pw_10Isosurface_10Isosurface_7triangulateIsosurface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5339  PyObject *__pyx_v_self = 0;
5340  PyObject *__pyx_v_field = 0;
5341  PyObject *__pyx_v_value = 0;
5342  int __pyx_lineno = 0;
5343  const char *__pyx_filename = NULL;
5344  int __pyx_clineno = 0;
5345  PyObject *__pyx_r = 0;
5346  __Pyx_RefNannyDeclarations
5347  __Pyx_RefNannySetupContext("triangulateIsosurface (wrapper)", 0);
5348  {
5349  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_field,&__pyx_n_s_value,0};
5350  PyObject* values[3] = {0,0,0};
5351  if (unlikely(__pyx_kwds)) {
5352  Py_ssize_t kw_args;
5353  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5354  switch (pos_args) {
5355  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5356  CYTHON_FALLTHROUGH;
5357  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5358  CYTHON_FALLTHROUGH;
5359  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5360  CYTHON_FALLTHROUGH;
5361  case 0: break;
5362  default: goto __pyx_L5_argtuple_error;
5363  }
5364  kw_args = PyDict_Size(__pyx_kwds);
5365  switch (pos_args) {
5366  case 0:
5367  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
5368  else goto __pyx_L5_argtuple_error;
5369  CYTHON_FALLTHROUGH;
5370  case 1:
5371  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
5372  else {
5373  __Pyx_RaiseArgtupleInvalid("triangulateIsosurface", 1, 3, 3, 1); __PYX_ERR(0, 158, __pyx_L3_error)
5374  }
5375  CYTHON_FALLTHROUGH;
5376  case 2:
5377  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
5378  else {
5379  __Pyx_RaiseArgtupleInvalid("triangulateIsosurface", 1, 3, 3, 2); __PYX_ERR(0, 158, __pyx_L3_error)
5380  }
5381  }
5382  if (unlikely(kw_args > 0)) {
5383  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "triangulateIsosurface") < 0)) __PYX_ERR(0, 158, __pyx_L3_error)
5384  }
5385  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5386  goto __pyx_L5_argtuple_error;
5387  } else {
5388  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5389  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5390  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5391  }
5392  __pyx_v_self = values[0];
5393  __pyx_v_field = values[1];
5394  __pyx_v_value = values[2];
5395  }
5396  goto __pyx_L4_argument_unpacking_done;
5397  __pyx_L5_argtuple_error:;
5398  __Pyx_RaiseArgtupleInvalid("triangulateIsosurface", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 158, __pyx_L3_error)
5399  __pyx_L3_error:;
5400  __Pyx_AddTraceback("Isosurface.Isosurface.triangulateIsosurface", __pyx_clineno, __pyx_lineno, __pyx_filename);
5401  __Pyx_RefNannyFinishContext();
5402  return NULL;
5403  __pyx_L4_argument_unpacking_done:;
5404  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_6triangulateIsosurface(__pyx_self, __pyx_v_self, __pyx_v_field, __pyx_v_value);
5405 
5406  /* function exit code */
5407  __Pyx_RefNannyFinishContext();
5408  return __pyx_r;
5409 }
5410 
5411 static PyObject *__pyx_pf_10Isosurface_10Isosurface_6triangulateIsosurface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value) {
5412  int __pyx_v_eN;
5413  int __pyx_v_i;
5414  int __pyx_v_J;
5415  int __pyx_v_I;
5416  int __pyx_v_nMinus;
5417  int __pyx_v_nPlus;
5418  int __pyx_v_nZeros;
5419  int __pyx_v_nN_start;
5420  double __pyx_v_eps;
5421  double __pyx_v_s;
5422  PyArrayObject *__pyx_v_x = 0;
5423  PyArrayObject *__pyx_v_normal = 0;
5424  PyObject *__pyx_v_nodes = NULL;
5425  PyObject *__pyx_v_elements = NULL;
5426  PyObject *__pyx_v_normals = NULL;
5427  PyObject *__pyx_v_normal_indices = NULL;
5428  PyObject *__pyx_v_phi = NULL;
5429  PyObject *__pyx_v_plus = NULL;
5430  PyObject *__pyx_v_minus = NULL;
5431  PyObject *__pyx_v_zeros = NULL;
5432  PyObject *__pyx_v_j = NULL;
5433  __Pyx_LocalBuf_ND __pyx_pybuffernd_normal;
5434  __Pyx_Buffer __pyx_pybuffer_normal;
5435  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5436  __Pyx_Buffer __pyx_pybuffer_x;
5437  PyObject *__pyx_r = NULL;
5438  __Pyx_RefNannyDeclarations
5439  PyObject *__pyx_t_1 = NULL;
5440  PyObject *__pyx_t_2 = NULL;
5441  PyObject *__pyx_t_3 = NULL;
5442  int __pyx_t_4;
5443  PyObject *__pyx_t_5 = NULL;
5444  long __pyx_t_6;
5445  long __pyx_t_7;
5446  int __pyx_t_8;
5447  int __pyx_t_9;
5448  int __pyx_t_10;
5449  int __pyx_t_11;
5450  Py_ssize_t __pyx_t_12;
5451  int __pyx_t_13;
5452  Py_ssize_t __pyx_t_14;
5453  PyObject *__pyx_t_15 = NULL;
5454  PyObject *__pyx_t_16 = NULL;
5455  double __pyx_t_17;
5456  PyArrayObject *__pyx_t_18 = NULL;
5457  PyObject *__pyx_t_19 = NULL;
5458  PyObject *__pyx_t_20 = NULL;
5459  PyObject *__pyx_t_21 = NULL;
5460  long __pyx_t_22;
5461  int __pyx_lineno = 0;
5462  const char *__pyx_filename = NULL;
5463  int __pyx_clineno = 0;
5464  __Pyx_RefNannySetupContext("triangulateIsosurface", 0);
5465  __pyx_pybuffer_x.pybuffer.buf = NULL;
5466  __pyx_pybuffer_x.refcount = 0;
5467  __pyx_pybuffernd_x.data = NULL;
5468  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5469  __pyx_pybuffer_normal.pybuffer.buf = NULL;
5470  __pyx_pybuffer_normal.refcount = 0;
5471  __pyx_pybuffernd_normal.data = NULL;
5472  __pyx_pybuffernd_normal.rcbuffer = &__pyx_pybuffer_normal;
5473 
5474  /* "Isosurface.pyx":165
5475  * cdef double eps, s
5476  * cdef np.ndarray[np.float64_t, ndim=1] x, normal
5477  * self.nodes[(field, value)] = nodes = [] # <<<<<<<<<<<<<<
5478  * self.elements[(field, value)] = elements = []
5479  * self.normals[(field, value)] = normals = []
5480  */
5481  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
5482  __Pyx_GOTREF(__pyx_t_1);
5483  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
5484  __Pyx_GOTREF(__pyx_t_2);
5485  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error)
5486  __Pyx_GOTREF(__pyx_t_3);
5487  __Pyx_INCREF(__pyx_v_field);
5488  __Pyx_GIVEREF(__pyx_v_field);
5489  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_field);
5490  __Pyx_INCREF(__pyx_v_value);
5491  __Pyx_GIVEREF(__pyx_v_value);
5492  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
5493  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(0, 165, __pyx_L1_error)
5494  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5495  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5496  __Pyx_INCREF(__pyx_t_1);
5497  __pyx_v_nodes = __pyx_t_1;
5498  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5499 
5500  /* "Isosurface.pyx":166
5501  * cdef np.ndarray[np.float64_t, ndim=1] x, normal
5502  * self.nodes[(field, value)] = nodes = []
5503  * self.elements[(field, value)] = elements = [] # <<<<<<<<<<<<<<
5504  * self.normals[(field, value)] = normals = []
5505  * self.normal_indices[(field, value)] = normal_indices = []
5506  */
5507  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
5508  __Pyx_GOTREF(__pyx_t_1);
5509  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error)
5510  __Pyx_GOTREF(__pyx_t_3);
5511  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error)
5512  __Pyx_GOTREF(__pyx_t_2);
5513  __Pyx_INCREF(__pyx_v_field);
5514  __Pyx_GIVEREF(__pyx_v_field);
5515  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_field);
5516  __Pyx_INCREF(__pyx_v_value);
5517  __Pyx_GIVEREF(__pyx_v_value);
5518  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
5519  if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 166, __pyx_L1_error)
5520  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5521  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5522  __Pyx_INCREF(__pyx_t_1);
5523  __pyx_v_elements = __pyx_t_1;
5524  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5525 
5526  /* "Isosurface.pyx":167
5527  * self.nodes[(field, value)] = nodes = []
5528  * self.elements[(field, value)] = elements = []
5529  * self.normals[(field, value)] = normals = [] # <<<<<<<<<<<<<<
5530  * self.normal_indices[(field, value)] = normal_indices = []
5531  * if value != 0.0:
5532  */
5533  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
5534  __Pyx_GOTREF(__pyx_t_1);
5535  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
5536  __Pyx_GOTREF(__pyx_t_2);
5537  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
5538  __Pyx_GOTREF(__pyx_t_3);
5539  __Pyx_INCREF(__pyx_v_field);
5540  __Pyx_GIVEREF(__pyx_v_field);
5541  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_field);
5542  __Pyx_INCREF(__pyx_v_value);
5543  __Pyx_GIVEREF(__pyx_v_value);
5544  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
5545  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(0, 167, __pyx_L1_error)
5546  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5547  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5548  __Pyx_INCREF(__pyx_t_1);
5549  __pyx_v_normals = __pyx_t_1;
5550  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5551 
5552  /* "Isosurface.pyx":168
5553  * self.elements[(field, value)] = elements = []
5554  * self.normals[(field, value)] = normals = []
5555  * self.normal_indices[(field, value)] = normal_indices = [] # <<<<<<<<<<<<<<
5556  * if value != 0.0:
5557  * raise NotImplementedError("Only zero isocontour extraction")
5558  */
5559  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error)
5560  __Pyx_GOTREF(__pyx_t_1);
5561  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normal_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error)
5562  __Pyx_GOTREF(__pyx_t_3);
5563  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error)
5564  __Pyx_GOTREF(__pyx_t_2);
5565  __Pyx_INCREF(__pyx_v_field);
5566  __Pyx_GIVEREF(__pyx_v_field);
5567  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_field);
5568  __Pyx_INCREF(__pyx_v_value);
5569  __Pyx_GIVEREF(__pyx_v_value);
5570  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
5571  if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_1) < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
5572  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5573  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5574  __Pyx_INCREF(__pyx_t_1);
5575  __pyx_v_normal_indices = __pyx_t_1;
5576  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5577 
5578  /* "Isosurface.pyx":169
5579  * self.normals[(field, value)] = normals = []
5580  * self.normal_indices[(field, value)] = normal_indices = []
5581  * if value != 0.0: # <<<<<<<<<<<<<<
5582  * raise NotImplementedError("Only zero isocontour extraction")
5583  * phi = self.u[self.fieldNames.index(field)].dof
5584  */
5585  __pyx_t_1 = __Pyx_PyFloat_NeObjC(__pyx_v_value, __pyx_float_0_0, 0.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
5586  __Pyx_GOTREF(__pyx_t_1);
5587  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 169, __pyx_L1_error)
5588  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5589  if (unlikely(__pyx_t_4)) {
5590 
5591  /* "Isosurface.pyx":170
5592  * self.normal_indices[(field, value)] = normal_indices = []
5593  * if value != 0.0:
5594  * raise NotImplementedError("Only zero isocontour extraction") # <<<<<<<<<<<<<<
5595  * phi = self.u[self.fieldNames.index(field)].dof
5596  * for eN in range(self.num_owned_elements):
5597  */
5598  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
5599  __Pyx_GOTREF(__pyx_t_1);
5600  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5601  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5602  __PYX_ERR(0, 170, __pyx_L1_error)
5603 
5604  /* "Isosurface.pyx":169
5605  * self.normals[(field, value)] = normals = []
5606  * self.normal_indices[(field, value)] = normal_indices = []
5607  * if value != 0.0: # <<<<<<<<<<<<<<
5608  * raise NotImplementedError("Only zero isocontour extraction")
5609  * phi = self.u[self.fieldNames.index(field)].dof
5610  */
5611  }
5612 
5613  /* "Isosurface.pyx":171
5614  * if value != 0.0:
5615  * raise NotImplementedError("Only zero isocontour extraction")
5616  * phi = self.u[self.fieldNames.index(field)].dof # <<<<<<<<<<<<<<
5617  * for eN in range(self.num_owned_elements):
5618  * plus = []
5619  */
5620  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_u); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
5621  __Pyx_GOTREF(__pyx_t_1);
5622  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fieldNames); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
5623  __Pyx_GOTREF(__pyx_t_3);
5624  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5625  __Pyx_GOTREF(__pyx_t_5);
5626  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5627  __pyx_t_3 = NULL;
5628  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
5629  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
5630  if (likely(__pyx_t_3)) {
5631  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
5632  __Pyx_INCREF(__pyx_t_3);
5633  __Pyx_INCREF(function);
5634  __Pyx_DECREF_SET(__pyx_t_5, function);
5635  }
5636  }
5637  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_field) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_field);
5638  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5639  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
5640  __Pyx_GOTREF(__pyx_t_2);
5641  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5642  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
5643  __Pyx_GOTREF(__pyx_t_5);
5644  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5645  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5646  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dof); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
5647  __Pyx_GOTREF(__pyx_t_2);
5648  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5649  __pyx_v_phi = __pyx_t_2;
5650  __pyx_t_2 = 0;
5651 
5652  /* "Isosurface.pyx":172
5653  * raise NotImplementedError("Only zero isocontour extraction")
5654  * phi = self.u[self.fieldNames.index(field)].dof
5655  * for eN in range(self.num_owned_elements): # <<<<<<<<<<<<<<
5656  * plus = []
5657  * minus = []
5658  */
5659  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_owned_elements); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
5660  __Pyx_GOTREF(__pyx_t_2);
5661  __pyx_t_6 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error)
5662  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5663  __pyx_t_7 = __pyx_t_6;
5664  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
5665  __pyx_v_eN = __pyx_t_8;
5666 
5667  /* "Isosurface.pyx":173
5668  * phi = self.u[self.fieldNames.index(field)].dof
5669  * for eN in range(self.num_owned_elements):
5670  * plus = [] # <<<<<<<<<<<<<<
5671  * minus = []
5672  * zeros = []
5673  */
5674  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
5675  __Pyx_GOTREF(__pyx_t_2);
5676  __Pyx_XDECREF_SET(__pyx_v_plus, ((PyObject*)__pyx_t_2));
5677  __pyx_t_2 = 0;
5678 
5679  /* "Isosurface.pyx":174
5680  * for eN in range(self.num_owned_elements):
5681  * plus = []
5682  * minus = [] # <<<<<<<<<<<<<<
5683  * zeros = []
5684  * eps = 1.0e-8
5685  */
5686  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
5687  __Pyx_GOTREF(__pyx_t_2);
5688  __Pyx_XDECREF_SET(__pyx_v_minus, ((PyObject*)__pyx_t_2));
5689  __pyx_t_2 = 0;
5690 
5691  /* "Isosurface.pyx":175
5692  * plus = []
5693  * minus = []
5694  * zeros = [] # <<<<<<<<<<<<<<
5695  * eps = 1.0e-8
5696  * for i in range(4):
5697  */
5698  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
5699  __Pyx_GOTREF(__pyx_t_2);
5700  __Pyx_XDECREF_SET(__pyx_v_zeros, ((PyObject*)__pyx_t_2));
5701  __pyx_t_2 = 0;
5702 
5703  /* "Isosurface.pyx":176
5704  * minus = []
5705  * zeros = []
5706  * eps = 1.0e-8 # <<<<<<<<<<<<<<
5707  * for i in range(4):
5708  * I = self.elementNodesArray[eN, i]
5709  */
5710  __pyx_v_eps = 1.0e-8;
5711 
5712  /* "Isosurface.pyx":177
5713  * zeros = []
5714  * eps = 1.0e-8
5715  * for i in range(4): # <<<<<<<<<<<<<<
5716  * I = self.elementNodesArray[eN, i]
5717  * if phi[I] > eps:
5718  */
5719  for (__pyx_t_9 = 0; __pyx_t_9 < 4; __pyx_t_9+=1) {
5720  __pyx_v_i = __pyx_t_9;
5721 
5722  /* "Isosurface.pyx":178
5723  * eps = 1.0e-8
5724  * for i in range(4):
5725  * I = self.elementNodesArray[eN, i] # <<<<<<<<<<<<<<
5726  * if phi[I] > eps:
5727  * plus.append(I)
5728  */
5729  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
5730  __Pyx_GOTREF(__pyx_t_2);
5731  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
5732  __Pyx_GOTREF(__pyx_t_5);
5733  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
5734  __Pyx_GOTREF(__pyx_t_1);
5735  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
5736  __Pyx_GOTREF(__pyx_t_3);
5737  __Pyx_GIVEREF(__pyx_t_5);
5738  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
5739  __Pyx_GIVEREF(__pyx_t_1);
5740  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
5741  __pyx_t_5 = 0;
5742  __pyx_t_1 = 0;
5743  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
5744  __Pyx_GOTREF(__pyx_t_1);
5745  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5746  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5747  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5748  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5749  __pyx_v_I = __pyx_t_10;
5750 
5751  /* "Isosurface.pyx":179
5752  * for i in range(4):
5753  * I = self.elementNodesArray[eN, i]
5754  * if phi[I] > eps: # <<<<<<<<<<<<<<
5755  * plus.append(I)
5756  * elif phi[I] < -eps:
5757  */
5758  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
5759  __Pyx_GOTREF(__pyx_t_1);
5760  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_eps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
5761  __Pyx_GOTREF(__pyx_t_3);
5762  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
5763  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5764  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5765  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 179, __pyx_L1_error)
5766  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5767  if (__pyx_t_4) {
5768 
5769  /* "Isosurface.pyx":180
5770  * I = self.elementNodesArray[eN, i]
5771  * if phi[I] > eps:
5772  * plus.append(I) # <<<<<<<<<<<<<<
5773  * elif phi[I] < -eps:
5774  * minus.append(I)
5775  */
5776  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
5777  __Pyx_GOTREF(__pyx_t_2);
5778  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_plus, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 180, __pyx_L1_error)
5779  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5780 
5781  /* "Isosurface.pyx":179
5782  * for i in range(4):
5783  * I = self.elementNodesArray[eN, i]
5784  * if phi[I] > eps: # <<<<<<<<<<<<<<
5785  * plus.append(I)
5786  * elif phi[I] < -eps:
5787  */
5788  goto __pyx_L8;
5789  }
5790 
5791  /* "Isosurface.pyx":181
5792  * if phi[I] > eps:
5793  * plus.append(I)
5794  * elif phi[I] < -eps: # <<<<<<<<<<<<<<
5795  * minus.append(I)
5796  * else:
5797  */
5798  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
5799  __Pyx_GOTREF(__pyx_t_2);
5800  __pyx_t_3 = PyFloat_FromDouble((-__pyx_v_eps)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
5801  __Pyx_GOTREF(__pyx_t_3);
5802  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
5803  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5804  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5805  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
5806  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5807  if (__pyx_t_4) {
5808 
5809  /* "Isosurface.pyx":182
5810  * plus.append(I)
5811  * elif phi[I] < -eps:
5812  * minus.append(I) # <<<<<<<<<<<<<<
5813  * else:
5814  * zeros.append(I)
5815  */
5816  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
5817  __Pyx_GOTREF(__pyx_t_1);
5818  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_minus, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 182, __pyx_L1_error)
5819  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5820 
5821  /* "Isosurface.pyx":181
5822  * if phi[I] > eps:
5823  * plus.append(I)
5824  * elif phi[I] < -eps: # <<<<<<<<<<<<<<
5825  * minus.append(I)
5826  * else:
5827  */
5828  goto __pyx_L8;
5829  }
5830 
5831  /* "Isosurface.pyx":184
5832  * minus.append(I)
5833  * else:
5834  * zeros.append(I) # <<<<<<<<<<<<<<
5835  * nZeros = len(zeros)
5836  * nMinus = len(minus)
5837  */
5838  /*else*/ {
5839  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
5840  __Pyx_GOTREF(__pyx_t_1);
5841  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_zeros, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 184, __pyx_L1_error)
5842  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5843  }
5844  __pyx_L8:;
5845  }
5846 
5847  /* "Isosurface.pyx":185
5848  * else:
5849  * zeros.append(I)
5850  * nZeros = len(zeros) # <<<<<<<<<<<<<<
5851  * nMinus = len(minus)
5852  * nPlus = len(plus)
5853  */
5854  __pyx_t_12 = PyList_GET_SIZE(__pyx_v_zeros); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 185, __pyx_L1_error)
5855  __pyx_v_nZeros = __pyx_t_12;
5856 
5857  /* "Isosurface.pyx":186
5858  * zeros.append(I)
5859  * nZeros = len(zeros)
5860  * nMinus = len(minus) # <<<<<<<<<<<<<<
5861  * nPlus = len(plus)
5862  * assert(nZeros + nMinus + nPlus == 4)
5863  */
5864  __pyx_t_12 = PyList_GET_SIZE(__pyx_v_minus); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 186, __pyx_L1_error)
5865  __pyx_v_nMinus = __pyx_t_12;
5866 
5867  /* "Isosurface.pyx":187
5868  * nZeros = len(zeros)
5869  * nMinus = len(minus)
5870  * nPlus = len(plus) # <<<<<<<<<<<<<<
5871  * assert(nZeros + nMinus + nPlus == 4)
5872  * nN_start = len(nodes)
5873  */
5874  __pyx_t_12 = PyList_GET_SIZE(__pyx_v_plus); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 187, __pyx_L1_error)
5875  __pyx_v_nPlus = __pyx_t_12;
5876 
5877  /* "Isosurface.pyx":188
5878  * nMinus = len(minus)
5879  * nPlus = len(plus)
5880  * assert(nZeros + nMinus + nPlus == 4) # <<<<<<<<<<<<<<
5881  * nN_start = len(nodes)
5882  * if nMinus == 2 and nPlus == 2: # 4 cut edges
5883  */
5884  #ifndef CYTHON_WITHOUT_ASSERTIONS
5885  if (unlikely(!Py_OptimizeFlag)) {
5886  if (unlikely(!((((__pyx_v_nZeros + __pyx_v_nMinus) + __pyx_v_nPlus) == 4) != 0))) {
5887  PyErr_SetNone(PyExc_AssertionError);
5888  __PYX_ERR(0, 188, __pyx_L1_error)
5889  }
5890  }
5891  #endif
5892 
5893  /* "Isosurface.pyx":189
5894  * nPlus = len(plus)
5895  * assert(nZeros + nMinus + nPlus == 4)
5896  * nN_start = len(nodes) # <<<<<<<<<<<<<<
5897  * if nMinus == 2 and nPlus == 2: # 4 cut edges
5898  * for J in minus:
5899  */
5900  __pyx_t_12 = PyList_GET_SIZE(__pyx_v_nodes); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 189, __pyx_L1_error)
5901  __pyx_v_nN_start = __pyx_t_12;
5902 
5903  /* "Isosurface.pyx":190
5904  * assert(nZeros + nMinus + nPlus == 4)
5905  * nN_start = len(nodes)
5906  * if nMinus == 2 and nPlus == 2: # 4 cut edges # <<<<<<<<<<<<<<
5907  * for J in minus:
5908  * for I in plus:
5909  */
5910  __pyx_t_13 = ((__pyx_v_nMinus == 2) != 0);
5911  if (__pyx_t_13) {
5912  } else {
5913  __pyx_t_4 = __pyx_t_13;
5914  goto __pyx_L10_bool_binop_done;
5915  }
5916  __pyx_t_13 = ((__pyx_v_nPlus == 2) != 0);
5917  __pyx_t_4 = __pyx_t_13;
5918  __pyx_L10_bool_binop_done:;
5919  if (__pyx_t_4) {
5920 
5921  /* "Isosurface.pyx":191
5922  * nN_start = len(nodes)
5923  * if nMinus == 2 and nPlus == 2: # 4 cut edges
5924  * for J in minus: # <<<<<<<<<<<<<<
5925  * for I in plus:
5926  * s = -phi[I] / (phi[J] - phi[I])
5927  */
5928  __pyx_t_1 = __pyx_v_minus; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
5929  for (;;) {
5930  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
5931  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5932  __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L1_error)
5933  #else
5934  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error)
5935  __Pyx_GOTREF(__pyx_t_3);
5936  #endif
5937  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error)
5938  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5939  __pyx_v_J = __pyx_t_9;
5940 
5941  /* "Isosurface.pyx":192
5942  * if nMinus == 2 and nPlus == 2: # 4 cut edges
5943  * for J in minus:
5944  * for I in plus: # <<<<<<<<<<<<<<
5945  * s = -phi[I] / (phi[J] - phi[I])
5946  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
5947  */
5948  __pyx_t_3 = __pyx_v_plus; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0;
5949  for (;;) {
5950  if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break;
5951  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5952  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
5953  #else
5954  __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
5955  __Pyx_GOTREF(__pyx_t_2);
5956  #endif
5957  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L1_error)
5958  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5959  __pyx_v_I = __pyx_t_9;
5960 
5961  /* "Isosurface.pyx":193
5962  * for J in minus:
5963  * for I in plus:
5964  * s = -phi[I] / (phi[J] - phi[I]) # <<<<<<<<<<<<<<
5965  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
5966  * + self.nodeArray[I]
5967  */
5968  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
5969  __Pyx_GOTREF(__pyx_t_2);
5970  __pyx_t_5 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
5971  __Pyx_GOTREF(__pyx_t_5);
5972  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5973  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
5974  __Pyx_GOTREF(__pyx_t_2);
5975  __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 193, __pyx_L1_error)
5976  __Pyx_GOTREF(__pyx_t_15);
5977  __pyx_t_16 = PyNumber_Subtract(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 193, __pyx_L1_error)
5978  __Pyx_GOTREF(__pyx_t_16);
5979  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5980  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5981  __pyx_t_15 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 193, __pyx_L1_error)
5982  __Pyx_GOTREF(__pyx_t_15);
5983  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5984  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5985  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error)
5986  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5987  __pyx_v_s = __pyx_t_17;
5988 
5989  /* "Isosurface.pyx":194
5990  * for I in plus:
5991  * s = -phi[I] / (phi[J] - phi[I])
5992  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \ # <<<<<<<<<<<<<<
5993  * + self.nodeArray[I]
5994  * nodes.append(x)
5995  */
5996  __pyx_t_15 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 194, __pyx_L1_error)
5997  __Pyx_GOTREF(__pyx_t_15);
5998  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 194, __pyx_L1_error)
5999  __Pyx_GOTREF(__pyx_t_16);
6000  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error)
6001  __Pyx_GOTREF(__pyx_t_5);
6002  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6003  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 194, __pyx_L1_error)
6004  __Pyx_GOTREF(__pyx_t_16);
6005  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
6006  __Pyx_GOTREF(__pyx_t_2);
6007  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6008  __pyx_t_16 = PyNumber_Subtract(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 194, __pyx_L1_error)
6009  __Pyx_GOTREF(__pyx_t_16);
6010  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6011  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6012  __pyx_t_2 = PyNumber_Multiply(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error)
6013  __Pyx_GOTREF(__pyx_t_2);
6014  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6015  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6016 
6017  /* "Isosurface.pyx":195
6018  * s = -phi[I] / (phi[J] - phi[I])
6019  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
6020  * + self.nodeArray[I] # <<<<<<<<<<<<<<
6021  * nodes.append(x)
6022  * elements.append([nN_start + j for j in range(3)])
6023  */
6024  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 195, __pyx_L1_error)
6025  __Pyx_GOTREF(__pyx_t_16);
6026  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 195, __pyx_L1_error)
6027  __Pyx_GOTREF(__pyx_t_15);
6028  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6029  __pyx_t_16 = PyNumber_Add(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 195, __pyx_L1_error)
6030  __Pyx_GOTREF(__pyx_t_16);
6031  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6032  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6033  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 195, __pyx_L1_error)
6034  __pyx_t_18 = ((PyArrayObject *)__pyx_t_16);
6035  {
6036  __Pyx_BufFmt_StackElem __pyx_stack[1];
6037  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6038  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6039  if (unlikely(__pyx_t_9 < 0)) {
6040  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
6041  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6042  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
6043  __Pyx_RaiseBufferFallbackError();
6044  } else {
6045  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
6046  }
6047  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
6048  }
6049  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
6050  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 194, __pyx_L1_error)
6051  }
6052  __pyx_t_18 = 0;
6053  __Pyx_XDECREF_SET(__pyx_v_x, ((PyArrayObject *)__pyx_t_16));
6054  __pyx_t_16 = 0;
6055 
6056  /* "Isosurface.pyx":196
6057  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
6058  * + self.nodeArray[I]
6059  * nodes.append(x) # <<<<<<<<<<<<<<
6060  * elements.append([nN_start + j for j in range(3)])
6061  * elements.append([nN_start + j + 1 for j in range(3)])
6062  */
6063  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, ((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 196, __pyx_L1_error)
6064 
6065  /* "Isosurface.pyx":192
6066  * if nMinus == 2 and nPlus == 2: # 4 cut edges
6067  * for J in minus:
6068  * for I in plus: # <<<<<<<<<<<<<<
6069  * s = -phi[I] / (phi[J] - phi[I])
6070  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
6071  */
6072  }
6073  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6074 
6075  /* "Isosurface.pyx":191
6076  * nN_start = len(nodes)
6077  * if nMinus == 2 and nPlus == 2: # 4 cut edges
6078  * for J in minus: # <<<<<<<<<<<<<<
6079  * for I in plus:
6080  * s = -phi[I] / (phi[J] - phi[I])
6081  */
6082  }
6083  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6084 
6085  /* "Isosurface.pyx":197
6086  * + self.nodeArray[I]
6087  * nodes.append(x)
6088  * elements.append([nN_start + j for j in range(3)]) # <<<<<<<<<<<<<<
6089  * elements.append([nN_start + j + 1 for j in range(3)])
6090  * if etriple(self.nodeArray[plus[0]] - nodes[-4],
6091  */
6092  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
6093  __Pyx_GOTREF(__pyx_t_1);
6094  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
6095  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
6096  __Pyx_GOTREF(__pyx_t_3);
6097  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
6098  __pyx_t_3 = 0;
6099  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
6100  __Pyx_GOTREF(__pyx_t_3);
6101  __pyx_t_16 = PyNumber_Add(__pyx_t_3, __pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 197, __pyx_L1_error)
6102  __Pyx_GOTREF(__pyx_t_16);
6103  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6104  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 197, __pyx_L1_error)
6105  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6106  }
6107  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 197, __pyx_L1_error)
6108  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6109 
6110  /* "Isosurface.pyx":198
6111  * nodes.append(x)
6112  * elements.append([nN_start + j for j in range(3)])
6113  * elements.append([nN_start + j + 1 for j in range(3)]) # <<<<<<<<<<<<<<
6114  * if etriple(self.nodeArray[plus[0]] - nodes[-4],
6115  * nodes[-3] - nodes[-4],
6116  */
6117  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
6118  __Pyx_GOTREF(__pyx_t_1);
6119  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
6120  __pyx_t_16 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 198, __pyx_L1_error)
6121  __Pyx_GOTREF(__pyx_t_16);
6122  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_16);
6123  __pyx_t_16 = 0;
6124  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 198, __pyx_L1_error)
6125  __Pyx_GOTREF(__pyx_t_16);
6126  __pyx_t_3 = PyNumber_Add(__pyx_t_16, __pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
6127  __Pyx_GOTREF(__pyx_t_3);
6128  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6129  __pyx_t_16 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 198, __pyx_L1_error)
6130  __Pyx_GOTREF(__pyx_t_16);
6131  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6132  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 198, __pyx_L1_error)
6133  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6134  }
6135  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 198, __pyx_L1_error)
6136  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6137 
6138  /* "Isosurface.pyx":199
6139  * elements.append([nN_start + j for j in range(3)])
6140  * elements.append([nN_start + j + 1 for j in range(3)])
6141  * if etriple(self.nodeArray[plus[0]] - nodes[-4], # <<<<<<<<<<<<<<
6142  * nodes[-3] - nodes[-4],
6143  * nodes[-2] - nodes[-4]) < 0.0:
6144  */
6145  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6146  __Pyx_GOTREF(__pyx_t_1);
6147  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 199, __pyx_L1_error)
6148  __Pyx_GOTREF(__pyx_t_16);
6149  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
6150  __Pyx_GOTREF(__pyx_t_3);
6151  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6152  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6153  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -4L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 199, __pyx_L1_error)
6154  __Pyx_GOTREF(__pyx_t_16);
6155  __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
6156  __Pyx_GOTREF(__pyx_t_1);
6157  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6158  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6159  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
6160 
6161  /* "Isosurface.pyx":200
6162  * elements.append([nN_start + j + 1 for j in range(3)])
6163  * if etriple(self.nodeArray[plus[0]] - nodes[-4],
6164  * nodes[-3] - nodes[-4], # <<<<<<<<<<<<<<
6165  * nodes[-2] - nodes[-4]) < 0.0:
6166  * elements[-2] = [elements[-2][0],
6167  */
6168  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 200, __pyx_L1_error)
6169  __Pyx_GOTREF(__pyx_t_16);
6170  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -4L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
6171  __Pyx_GOTREF(__pyx_t_3);
6172  __pyx_t_15 = PyNumber_Subtract(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 200, __pyx_L1_error)
6173  __Pyx_GOTREF(__pyx_t_15);
6174  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6175  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6176  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 200, __pyx_L1_error)
6177 
6178  /* "Isosurface.pyx":201
6179  * if etriple(self.nodeArray[plus[0]] - nodes[-4],
6180  * nodes[-3] - nodes[-4],
6181  * nodes[-2] - nodes[-4]) < 0.0: # <<<<<<<<<<<<<<
6182  * elements[-2] = [elements[-2][0],
6183  * elements[-2][2],
6184  */
6185  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
6186  __Pyx_GOTREF(__pyx_t_3);
6187  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -4L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 201, __pyx_L1_error)
6188  __Pyx_GOTREF(__pyx_t_16);
6189  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
6190  __Pyx_GOTREF(__pyx_t_2);
6191  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6192  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6193  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 201, __pyx_L1_error)
6194 
6195  /* "Isosurface.pyx":199
6196  * elements.append([nN_start + j for j in range(3)])
6197  * elements.append([nN_start + j + 1 for j in range(3)])
6198  * if etriple(self.nodeArray[plus[0]] - nodes[-4], # <<<<<<<<<<<<<<
6199  * nodes[-3] - nodes[-4],
6200  * nodes[-2] - nodes[-4]) < 0.0:
6201  */
6202  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_2)) < 0.0) != 0);
6203  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6204  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6205  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6206  if (__pyx_t_4) {
6207 
6208  /* "Isosurface.pyx":202
6209  * nodes[-3] - nodes[-4],
6210  * nodes[-2] - nodes[-4]) < 0.0:
6211  * elements[-2] = [elements[-2][0], # <<<<<<<<<<<<<<
6212  * elements[-2][2],
6213  * elements[-2][1]]
6214  */
6215  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
6216  __Pyx_GOTREF(__pyx_t_2);
6217  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 202, __pyx_L1_error)
6218  __Pyx_GOTREF(__pyx_t_15);
6219  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6220 
6221  /* "Isosurface.pyx":203
6222  * nodes[-2] - nodes[-4]) < 0.0:
6223  * elements[-2] = [elements[-2][0],
6224  * elements[-2][2], # <<<<<<<<<<<<<<
6225  * elements[-2][1]]
6226  * if etriple(self.nodeArray[plus[1]] - nodes[-3],
6227  */
6228  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
6229  __Pyx_GOTREF(__pyx_t_2);
6230  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
6231  __Pyx_GOTREF(__pyx_t_1);
6232  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6233 
6234  /* "Isosurface.pyx":204
6235  * elements[-2] = [elements[-2][0],
6236  * elements[-2][2],
6237  * elements[-2][1]] # <<<<<<<<<<<<<<
6238  * if etriple(self.nodeArray[plus[1]] - nodes[-3],
6239  * nodes[-2] - nodes[-3],
6240  */
6241  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
6242  __Pyx_GOTREF(__pyx_t_2);
6243  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 204, __pyx_L1_error)
6244  __Pyx_GOTREF(__pyx_t_16);
6245  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6246 
6247  /* "Isosurface.pyx":202
6248  * nodes[-3] - nodes[-4],
6249  * nodes[-2] - nodes[-4]) < 0.0:
6250  * elements[-2] = [elements[-2][0], # <<<<<<<<<<<<<<
6251  * elements[-2][2],
6252  * elements[-2][1]]
6253  */
6254  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
6255  __Pyx_GOTREF(__pyx_t_2);
6256  __Pyx_GIVEREF(__pyx_t_15);
6257  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
6258  __Pyx_GIVEREF(__pyx_t_1);
6259  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
6260  __Pyx_GIVEREF(__pyx_t_16);
6261  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_16);
6262  __pyx_t_15 = 0;
6263  __pyx_t_1 = 0;
6264  __pyx_t_16 = 0;
6265  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -2L, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 202, __pyx_L1_error)
6266  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6267 
6268  /* "Isosurface.pyx":199
6269  * elements.append([nN_start + j for j in range(3)])
6270  * elements.append([nN_start + j + 1 for j in range(3)])
6271  * if etriple(self.nodeArray[plus[0]] - nodes[-4], # <<<<<<<<<<<<<<
6272  * nodes[-3] - nodes[-4],
6273  * nodes[-2] - nodes[-4]) < 0.0:
6274  */
6275  }
6276 
6277  /* "Isosurface.pyx":205
6278  * elements[-2][2],
6279  * elements[-2][1]]
6280  * if etriple(self.nodeArray[plus[1]] - nodes[-3], # <<<<<<<<<<<<<<
6281  * nodes[-2] - nodes[-3],
6282  * nodes[-1] - nodes[-3]) < 0.0:
6283  */
6284  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
6285  __Pyx_GOTREF(__pyx_t_2);
6286  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_plus, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 205, __pyx_L1_error)
6287  __Pyx_GOTREF(__pyx_t_16);
6288  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
6289  __Pyx_GOTREF(__pyx_t_1);
6290  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6291  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6292  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 205, __pyx_L1_error)
6293  __Pyx_GOTREF(__pyx_t_16);
6294  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
6295  __Pyx_GOTREF(__pyx_t_2);
6296  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6297  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6298  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 205, __pyx_L1_error)
6299 
6300  /* "Isosurface.pyx":206
6301  * elements[-2][1]]
6302  * if etriple(self.nodeArray[plus[1]] - nodes[-3],
6303  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
6304  * nodes[-1] - nodes[-3]) < 0.0:
6305  * elements[-1] = [elements[-1][0],
6306  */
6307  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 206, __pyx_L1_error)
6308  __Pyx_GOTREF(__pyx_t_16);
6309  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
6310  __Pyx_GOTREF(__pyx_t_1);
6311  __pyx_t_15 = PyNumber_Subtract(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 206, __pyx_L1_error)
6312  __Pyx_GOTREF(__pyx_t_15);
6313  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6314  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6315  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 206, __pyx_L1_error)
6316 
6317  /* "Isosurface.pyx":207
6318  * if etriple(self.nodeArray[plus[1]] - nodes[-3],
6319  * nodes[-2] - nodes[-3],
6320  * nodes[-1] - nodes[-3]) < 0.0: # <<<<<<<<<<<<<<
6321  * elements[-1] = [elements[-1][0],
6322  * elements[-1][2],
6323  */
6324  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
6325  __Pyx_GOTREF(__pyx_t_1);
6326  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 207, __pyx_L1_error)
6327  __Pyx_GOTREF(__pyx_t_16);
6328  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error)
6329  __Pyx_GOTREF(__pyx_t_3);
6330  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6331  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6332  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 207, __pyx_L1_error)
6333 
6334  /* "Isosurface.pyx":205
6335  * elements[-2][2],
6336  * elements[-2][1]]
6337  * if etriple(self.nodeArray[plus[1]] - nodes[-3], # <<<<<<<<<<<<<<
6338  * nodes[-2] - nodes[-3],
6339  * nodes[-1] - nodes[-3]) < 0.0:
6340  */
6341  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_3)) < 0.0) != 0);
6342  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6343  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6344  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6345  if (__pyx_t_4) {
6346 
6347  /* "Isosurface.pyx":208
6348  * nodes[-2] - nodes[-3],
6349  * nodes[-1] - nodes[-3]) < 0.0:
6350  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
6351  * elements[-1][2],
6352  * elements[-1][1]]
6353  */
6354  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error)
6355  __Pyx_GOTREF(__pyx_t_3);
6356  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 208, __pyx_L1_error)
6357  __Pyx_GOTREF(__pyx_t_15);
6358  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6359 
6360  /* "Isosurface.pyx":209
6361  * nodes[-1] - nodes[-3]) < 0.0:
6362  * elements[-1] = [elements[-1][0],
6363  * elements[-1][2], # <<<<<<<<<<<<<<
6364  * elements[-1][1]]
6365  * normal = ecross(
6366  */
6367  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
6368  __Pyx_GOTREF(__pyx_t_3);
6369  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
6370  __Pyx_GOTREF(__pyx_t_2);
6371  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6372 
6373  /* "Isosurface.pyx":210
6374  * elements[-1] = [elements[-1][0],
6375  * elements[-1][2],
6376  * elements[-1][1]] # <<<<<<<<<<<<<<
6377  * normal = ecross(
6378  * nodes[elements[-2][1]] - nodes[elements[-2][0]],
6379  */
6380  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
6381  __Pyx_GOTREF(__pyx_t_3);
6382  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 210, __pyx_L1_error)
6383  __Pyx_GOTREF(__pyx_t_16);
6384  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6385 
6386  /* "Isosurface.pyx":208
6387  * nodes[-2] - nodes[-3],
6388  * nodes[-1] - nodes[-3]) < 0.0:
6389  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
6390  * elements[-1][2],
6391  * elements[-1][1]]
6392  */
6393  __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 208, __pyx_L1_error)
6394  __Pyx_GOTREF(__pyx_t_3);
6395  __Pyx_GIVEREF(__pyx_t_15);
6396  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
6397  __Pyx_GIVEREF(__pyx_t_2);
6398  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
6399  __Pyx_GIVEREF(__pyx_t_16);
6400  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_16);
6401  __pyx_t_15 = 0;
6402  __pyx_t_2 = 0;
6403  __pyx_t_16 = 0;
6404  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
6405  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6406 
6407  /* "Isosurface.pyx":205
6408  * elements[-2][2],
6409  * elements[-2][1]]
6410  * if etriple(self.nodeArray[plus[1]] - nodes[-3], # <<<<<<<<<<<<<<
6411  * nodes[-2] - nodes[-3],
6412  * nodes[-1] - nodes[-3]) < 0.0:
6413  */
6414  }
6415 
6416  /* "Isosurface.pyx":212
6417  * elements[-1][1]]
6418  * normal = ecross(
6419  * nodes[elements[-2][1]] - nodes[elements[-2][0]], # <<<<<<<<<<<<<<
6420  * nodes[elements[-2][2]] - nodes[elements[-2][0]])
6421  * normal /= enorm(normal)
6422  */
6423  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
6424  __Pyx_GOTREF(__pyx_t_3);
6425  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 212, __pyx_L1_error)
6426  __Pyx_GOTREF(__pyx_t_16);
6427  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6428  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
6429  __Pyx_GOTREF(__pyx_t_3);
6430  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6431  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 212, __pyx_L1_error)
6432  __Pyx_GOTREF(__pyx_t_16);
6433  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
6434  __Pyx_GOTREF(__pyx_t_2);
6435  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6436  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 212, __pyx_L1_error)
6437  __Pyx_GOTREF(__pyx_t_16);
6438  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6439  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
6440  __Pyx_GOTREF(__pyx_t_2);
6441  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6442  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6443  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 212, __pyx_L1_error)
6444 
6445  /* "Isosurface.pyx":213
6446  * normal = ecross(
6447  * nodes[elements[-2][1]] - nodes[elements[-2][0]],
6448  * nodes[elements[-2][2]] - nodes[elements[-2][0]]) # <<<<<<<<<<<<<<
6449  * normal /= enorm(normal)
6450  * normals.append(normal)
6451  */
6452  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 213, __pyx_L1_error)
6453  __Pyx_GOTREF(__pyx_t_16);
6454  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_16, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
6455  __Pyx_GOTREF(__pyx_t_3);
6456  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6457  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 213, __pyx_L1_error)
6458  __Pyx_GOTREF(__pyx_t_16);
6459  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6460  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
6461  __Pyx_GOTREF(__pyx_t_3);
6462  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 213, __pyx_L1_error)
6463  __Pyx_GOTREF(__pyx_t_15);
6464  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6465  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error)
6466  __Pyx_GOTREF(__pyx_t_3);
6467  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6468  __pyx_t_15 = PyNumber_Subtract(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 213, __pyx_L1_error)
6469  __Pyx_GOTREF(__pyx_t_15);
6470  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6471  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6472  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 213, __pyx_L1_error)
6473 
6474  /* "Isosurface.pyx":211
6475  * elements[-1][2],
6476  * elements[-1][1]]
6477  * normal = ecross( # <<<<<<<<<<<<<<
6478  * nodes[elements[-2][1]] - nodes[elements[-2][0]],
6479  * nodes[elements[-2][2]] - nodes[elements[-2][0]])
6480  */
6481  __pyx_t_3 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_15))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
6482  __Pyx_GOTREF(__pyx_t_3);
6483  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6484  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6485  {
6486  __Pyx_BufFmt_StackElem __pyx_stack[1];
6487  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
6488  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6489  if (unlikely(__pyx_t_9 < 0)) {
6490  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
6491  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6492  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
6493  __Pyx_RaiseBufferFallbackError();
6494  } else {
6495  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
6496  }
6497  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
6498  }
6499  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
6500  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
6501  }
6502  __Pyx_XDECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_3));
6503  __pyx_t_3 = 0;
6504 
6505  /* "Isosurface.pyx":214
6506  * nodes[elements[-2][1]] - nodes[elements[-2][0]],
6507  * nodes[elements[-2][2]] - nodes[elements[-2][0]])
6508  * normal /= enorm(normal) # <<<<<<<<<<<<<<
6509  * normals.append(normal)
6510  * normals.append(normal)
6511  */
6512  __pyx_t_3 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error)
6513  __Pyx_GOTREF(__pyx_t_3);
6514  __pyx_t_15 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 214, __pyx_L1_error)
6515  __Pyx_GOTREF(__pyx_t_15);
6516  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6517  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 214, __pyx_L1_error)
6518  __pyx_t_18 = ((PyArrayObject *)__pyx_t_15);
6519  {
6520  __Pyx_BufFmt_StackElem __pyx_stack[1];
6521  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
6522  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6523  if (unlikely(__pyx_t_9 < 0)) {
6524  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
6525  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6526  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
6527  __Pyx_RaiseBufferFallbackError();
6528  } else {
6529  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
6530  }
6531  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
6532  }
6533  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
6534  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 214, __pyx_L1_error)
6535  }
6536  __pyx_t_18 = 0;
6537  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_15));
6538  __pyx_t_15 = 0;
6539 
6540  /* "Isosurface.pyx":215
6541  * nodes[elements[-2][2]] - nodes[elements[-2][0]])
6542  * normal /= enorm(normal)
6543  * normals.append(normal) # <<<<<<<<<<<<<<
6544  * normals.append(normal)
6545  * normals.append(normal)
6546  */
6547  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 215, __pyx_L1_error)
6548 
6549  /* "Isosurface.pyx":216
6550  * normal /= enorm(normal)
6551  * normals.append(normal)
6552  * normals.append(normal) # <<<<<<<<<<<<<<
6553  * normals.append(normal)
6554  * normal_indices.append(elements[-2])
6555  */
6556  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 216, __pyx_L1_error)
6557 
6558  /* "Isosurface.pyx":217
6559  * normals.append(normal)
6560  * normals.append(normal)
6561  * normals.append(normal) # <<<<<<<<<<<<<<
6562  * normal_indices.append(elements[-2])
6563  * normal = ecross(
6564  */
6565  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 217, __pyx_L1_error)
6566 
6567  /* "Isosurface.pyx":218
6568  * normals.append(normal)
6569  * normals.append(normal)
6570  * normal_indices.append(elements[-2]) # <<<<<<<<<<<<<<
6571  * normal = ecross(
6572  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
6573  */
6574  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_elements, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 218, __pyx_L1_error)
6575  __Pyx_GOTREF(__pyx_t_15);
6576  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 218, __pyx_L1_error)
6577  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6578 
6579  /* "Isosurface.pyx":220
6580  * normal_indices.append(elements[-2])
6581  * normal = ecross(
6582  * nodes[elements[-1][1]] - nodes[elements[-1][0]], # <<<<<<<<<<<<<<
6583  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
6584  * normal /= enorm(normal)
6585  */
6586  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 220, __pyx_L1_error)
6587  __Pyx_GOTREF(__pyx_t_15);
6588  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_15, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
6589  __Pyx_GOTREF(__pyx_t_3);
6590  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6591  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 220, __pyx_L1_error)
6592  __Pyx_GOTREF(__pyx_t_15);
6593  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6594  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
6595  __Pyx_GOTREF(__pyx_t_3);
6596  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
6597  __Pyx_GOTREF(__pyx_t_2);
6598  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6599  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
6600  __Pyx_GOTREF(__pyx_t_3);
6601  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6602  __pyx_t_2 = PyNumber_Subtract(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
6603  __Pyx_GOTREF(__pyx_t_2);
6604  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6605  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6606  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 220, __pyx_L1_error)
6607 
6608  /* "Isosurface.pyx":221
6609  * normal = ecross(
6610  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
6611  * nodes[elements[-1][2]] - nodes[elements[-1][0]]) # <<<<<<<<<<<<<<
6612  * normal /= enorm(normal)
6613  * normals.append(normal)
6614  */
6615  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
6616  __Pyx_GOTREF(__pyx_t_3);
6617  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 221, __pyx_L1_error)
6618  __Pyx_GOTREF(__pyx_t_15);
6619  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6620  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
6621  __Pyx_GOTREF(__pyx_t_3);
6622  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6623  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 221, __pyx_L1_error)
6624  __Pyx_GOTREF(__pyx_t_15);
6625  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_15, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 221, __pyx_L1_error)
6626  __Pyx_GOTREF(__pyx_t_16);
6627  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6628  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 221, __pyx_L1_error)
6629  __Pyx_GOTREF(__pyx_t_15);
6630  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6631  __pyx_t_16 = PyNumber_Subtract(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 221, __pyx_L1_error)
6632  __Pyx_GOTREF(__pyx_t_16);
6633  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6634  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6635  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 221, __pyx_L1_error)
6636 
6637  /* "Isosurface.pyx":219
6638  * normals.append(normal)
6639  * normal_indices.append(elements[-2])
6640  * normal = ecross( # <<<<<<<<<<<<<<
6641  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
6642  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
6643  */
6644  __pyx_t_15 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_16))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 219, __pyx_L1_error)
6645  __Pyx_GOTREF(__pyx_t_15);
6646  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6647  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6648  {
6649  __Pyx_BufFmt_StackElem __pyx_stack[1];
6650  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
6651  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_15), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6652  if (unlikely(__pyx_t_9 < 0)) {
6653  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
6654  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6655  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
6656  __Pyx_RaiseBufferFallbackError();
6657  } else {
6658  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
6659  }
6660  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
6661  }
6662  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
6663  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 219, __pyx_L1_error)
6664  }
6665  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_15));
6666  __pyx_t_15 = 0;
6667 
6668  /* "Isosurface.pyx":222
6669  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
6670  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
6671  * normal /= enorm(normal) # <<<<<<<<<<<<<<
6672  * normals.append(normal)
6673  * normals.append(normal)
6674  */
6675  __pyx_t_15 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 222, __pyx_L1_error)
6676  __Pyx_GOTREF(__pyx_t_15);
6677  __pyx_t_16 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 222, __pyx_L1_error)
6678  __Pyx_GOTREF(__pyx_t_16);
6679  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6680  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 222, __pyx_L1_error)
6681  __pyx_t_18 = ((PyArrayObject *)__pyx_t_16);
6682  {
6683  __Pyx_BufFmt_StackElem __pyx_stack[1];
6684  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
6685  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6686  if (unlikely(__pyx_t_9 < 0)) {
6687  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
6688  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6689  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
6690  __Pyx_RaiseBufferFallbackError();
6691  } else {
6692  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
6693  }
6694  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
6695  }
6696  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
6697  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 222, __pyx_L1_error)
6698  }
6699  __pyx_t_18 = 0;
6700  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_16));
6701  __pyx_t_16 = 0;
6702 
6703  /* "Isosurface.pyx":223
6704  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
6705  * normal /= enorm(normal)
6706  * normals.append(normal) # <<<<<<<<<<<<<<
6707  * normals.append(normal)
6708  * normals.append(normal)
6709  */
6710  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 223, __pyx_L1_error)
6711 
6712  /* "Isosurface.pyx":224
6713  * normal /= enorm(normal)
6714  * normals.append(normal)
6715  * normals.append(normal) # <<<<<<<<<<<<<<
6716  * normals.append(normal)
6717  * normal_indices.append(elements[-1])
6718  */
6719  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
6720 
6721  /* "Isosurface.pyx":225
6722  * normals.append(normal)
6723  * normals.append(normal)
6724  * normals.append(normal) # <<<<<<<<<<<<<<
6725  * normal_indices.append(elements[-1])
6726  * elif nPlus == 3 and nMinus == 1: # 3 cut edges
6727  */
6728  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 225, __pyx_L1_error)
6729 
6730  /* "Isosurface.pyx":226
6731  * normals.append(normal)
6732  * normals.append(normal)
6733  * normal_indices.append(elements[-1]) # <<<<<<<<<<<<<<
6734  * elif nPlus == 3 and nMinus == 1: # 3 cut edges
6735  * I = minus[0]
6736  */
6737  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 226, __pyx_L1_error)
6738  __Pyx_GOTREF(__pyx_t_16);
6739  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_16); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 226, __pyx_L1_error)
6740  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6741 
6742  /* "Isosurface.pyx":190
6743  * assert(nZeros + nMinus + nPlus == 4)
6744  * nN_start = len(nodes)
6745  * if nMinus == 2 and nPlus == 2: # 4 cut edges # <<<<<<<<<<<<<<
6746  * for J in minus:
6747  * for I in plus:
6748  */
6749  goto __pyx_L9;
6750  }
6751 
6752  /* "Isosurface.pyx":227
6753  * normals.append(normal)
6754  * normal_indices.append(elements[-1])
6755  * elif nPlus == 3 and nMinus == 1: # 3 cut edges # <<<<<<<<<<<<<<
6756  * I = minus[0]
6757  * for J in plus:
6758  */
6759  __pyx_t_13 = ((__pyx_v_nPlus == 3) != 0);
6760  if (__pyx_t_13) {
6761  } else {
6762  __pyx_t_4 = __pyx_t_13;
6763  goto __pyx_L22_bool_binop_done;
6764  }
6765  __pyx_t_13 = ((__pyx_v_nMinus == 1) != 0);
6766  __pyx_t_4 = __pyx_t_13;
6767  __pyx_L22_bool_binop_done:;
6768  if (__pyx_t_4) {
6769 
6770  /* "Isosurface.pyx":228
6771  * normal_indices.append(elements[-1])
6772  * elif nPlus == 3 and nMinus == 1: # 3 cut edges
6773  * I = minus[0] # <<<<<<<<<<<<<<
6774  * for J in plus:
6775  * s = -phi[I] / (phi[J] - phi[I])
6776  */
6777  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_minus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 228, __pyx_L1_error)
6778  __Pyx_GOTREF(__pyx_t_16);
6779  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L1_error)
6780  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6781  __pyx_v_I = __pyx_t_9;
6782 
6783  /* "Isosurface.pyx":229
6784  * elif nPlus == 3 and nMinus == 1: # 3 cut edges
6785  * I = minus[0]
6786  * for J in plus: # <<<<<<<<<<<<<<
6787  * s = -phi[I] / (phi[J] - phi[I])
6788  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
6789  */
6790  __pyx_t_16 = __pyx_v_plus; __Pyx_INCREF(__pyx_t_16); __pyx_t_12 = 0;
6791  for (;;) {
6792  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_16)) break;
6793  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6794  __pyx_t_15 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_12); __Pyx_INCREF(__pyx_t_15); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
6795  #else
6796  __pyx_t_15 = PySequence_ITEM(__pyx_t_16, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 229, __pyx_L1_error)
6797  __Pyx_GOTREF(__pyx_t_15);
6798  #endif
6799  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error)
6800  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6801  __pyx_v_J = __pyx_t_9;
6802 
6803  /* "Isosurface.pyx":230
6804  * I = minus[0]
6805  * for J in plus:
6806  * s = -phi[I] / (phi[J] - phi[I]) # <<<<<<<<<<<<<<
6807  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
6808  * self.nodeArray[I]
6809  */
6810  __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 230, __pyx_L1_error)
6811  __Pyx_GOTREF(__pyx_t_15);
6812  __pyx_t_2 = PyNumber_Negative(__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
6813  __Pyx_GOTREF(__pyx_t_2);
6814  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6815  __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 230, __pyx_L1_error)
6816  __Pyx_GOTREF(__pyx_t_15);
6817  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
6818  __Pyx_GOTREF(__pyx_t_3);
6819  __pyx_t_1 = PyNumber_Subtract(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
6820  __Pyx_GOTREF(__pyx_t_1);
6821  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6822  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6823  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
6824  __Pyx_GOTREF(__pyx_t_3);
6825  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6826  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6827  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error)
6828  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6829  __pyx_v_s = __pyx_t_17;
6830 
6831  /* "Isosurface.pyx":231
6832  * for J in plus:
6833  * s = -phi[I] / (phi[J] - phi[I])
6834  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \ # <<<<<<<<<<<<<<
6835  * self.nodeArray[I]
6836  * nodes.append(x)
6837  */
6838  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
6839  __Pyx_GOTREF(__pyx_t_3);
6840  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
6841  __Pyx_GOTREF(__pyx_t_1);
6842  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
6843  __Pyx_GOTREF(__pyx_t_2);
6844  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6845  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
6846  __Pyx_GOTREF(__pyx_t_1);
6847  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 231, __pyx_L1_error)
6848  __Pyx_GOTREF(__pyx_t_15);
6849  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6850  __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
6851  __Pyx_GOTREF(__pyx_t_1);
6852  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6853  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6854  __pyx_t_15 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 231, __pyx_L1_error)
6855  __Pyx_GOTREF(__pyx_t_15);
6856  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6857  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6858 
6859  /* "Isosurface.pyx":232
6860  * s = -phi[I] / (phi[J] - phi[I])
6861  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
6862  * self.nodeArray[I] # <<<<<<<<<<<<<<
6863  * nodes.append(x)
6864  * elements.append([nN_start + j for j in range(3)])
6865  */
6866  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
6867  __Pyx_GOTREF(__pyx_t_1);
6868  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 232, __pyx_L1_error)
6869  __Pyx_GOTREF(__pyx_t_3);
6870  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6871 
6872  /* "Isosurface.pyx":231
6873  * for J in plus:
6874  * s = -phi[I] / (phi[J] - phi[I])
6875  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \ # <<<<<<<<<<<<<<
6876  * self.nodeArray[I]
6877  * nodes.append(x)
6878  */
6879  __pyx_t_1 = PyNumber_Add(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
6880  __Pyx_GOTREF(__pyx_t_1);
6881  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6882  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6883  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 231, __pyx_L1_error)
6884  __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
6885  {
6886  __Pyx_BufFmt_StackElem __pyx_stack[1];
6887  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6888  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6889  if (unlikely(__pyx_t_9 < 0)) {
6890  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
6891  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6892  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
6893  __Pyx_RaiseBufferFallbackError();
6894  } else {
6895  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
6896  }
6897  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
6898  }
6899  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
6900  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 231, __pyx_L1_error)
6901  }
6902  __pyx_t_18 = 0;
6903  __Pyx_XDECREF_SET(__pyx_v_x, ((PyArrayObject *)__pyx_t_1));
6904  __pyx_t_1 = 0;
6905 
6906  /* "Isosurface.pyx":233
6907  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
6908  * self.nodeArray[I]
6909  * nodes.append(x) # <<<<<<<<<<<<<<
6910  * elements.append([nN_start + j for j in range(3)])
6911  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
6912  */
6913  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, ((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 233, __pyx_L1_error)
6914 
6915  /* "Isosurface.pyx":229
6916  * elif nPlus == 3 and nMinus == 1: # 3 cut edges
6917  * I = minus[0]
6918  * for J in plus: # <<<<<<<<<<<<<<
6919  * s = -phi[I] / (phi[J] - phi[I])
6920  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
6921  */
6922  }
6923  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6924 
6925  /* "Isosurface.pyx":234
6926  * self.nodeArray[I]
6927  * nodes.append(x)
6928  * elements.append([nN_start + j for j in range(3)]) # <<<<<<<<<<<<<<
6929  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
6930  * nodes[-2] - nodes[-3],
6931  */
6932  __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 234, __pyx_L1_error)
6933  __Pyx_GOTREF(__pyx_t_16);
6934  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
6935  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
6936  __Pyx_GOTREF(__pyx_t_1);
6937  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_1);
6938  __pyx_t_1 = 0;
6939  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
6940  __Pyx_GOTREF(__pyx_t_1);
6941  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
6942  __Pyx_GOTREF(__pyx_t_3);
6943  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6944  if (unlikely(__Pyx_ListComp_Append(__pyx_t_16, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 234, __pyx_L1_error)
6945  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6946  }
6947  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_16); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 234, __pyx_L1_error)
6948  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6949 
6950  /* "Isosurface.pyx":235
6951  * nodes.append(x)
6952  * elements.append([nN_start + j for j in range(3)])
6953  * if etriple(self.nodeArray[minus[0]] - nodes[-3], # <<<<<<<<<<<<<<
6954  * nodes[-2] - nodes[-3],
6955  * nodes[-1] - nodes[-3]) > 0.0:
6956  */
6957  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 235, __pyx_L1_error)
6958  __Pyx_GOTREF(__pyx_t_16);
6959  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_minus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
6960  __Pyx_GOTREF(__pyx_t_3);
6961  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
6962  __Pyx_GOTREF(__pyx_t_1);
6963  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6964  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6965  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
6966  __Pyx_GOTREF(__pyx_t_3);
6967  __pyx_t_16 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 235, __pyx_L1_error)
6968  __Pyx_GOTREF(__pyx_t_16);
6969  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6970  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6971  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 235, __pyx_L1_error)
6972 
6973  /* "Isosurface.pyx":236
6974  * elements.append([nN_start + j for j in range(3)])
6975  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
6976  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
6977  * nodes[-1] - nodes[-3]) > 0.0:
6978  * elements[-1] = [elements[-1][0],
6979  */
6980  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error)
6981  __Pyx_GOTREF(__pyx_t_3);
6982  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error)
6983  __Pyx_GOTREF(__pyx_t_1);
6984  __pyx_t_15 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 236, __pyx_L1_error)
6985  __Pyx_GOTREF(__pyx_t_15);
6986  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6987  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6988  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 236, __pyx_L1_error)
6989 
6990  /* "Isosurface.pyx":237
6991  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
6992  * nodes[-2] - nodes[-3],
6993  * nodes[-1] - nodes[-3]) > 0.0: # <<<<<<<<<<<<<<
6994  * elements[-1] = [elements[-1][0],
6995  * elements[-1][2],
6996  */
6997  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
6998  __Pyx_GOTREF(__pyx_t_1);
6999  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
7000  __Pyx_GOTREF(__pyx_t_3);
7001  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
7002  __Pyx_GOTREF(__pyx_t_2);
7003  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7004  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7005  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 237, __pyx_L1_error)
7006 
7007  /* "Isosurface.pyx":235
7008  * nodes.append(x)
7009  * elements.append([nN_start + j for j in range(3)])
7010  * if etriple(self.nodeArray[minus[0]] - nodes[-3], # <<<<<<<<<<<<<<
7011  * nodes[-2] - nodes[-3],
7012  * nodes[-1] - nodes[-3]) > 0.0:
7013  */
7014  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_16), ((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_2)) > 0.0) != 0);
7015  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7016  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7017  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7018  if (__pyx_t_4) {
7019 
7020  /* "Isosurface.pyx":238
7021  * nodes[-2] - nodes[-3],
7022  * nodes[-1] - nodes[-3]) > 0.0:
7023  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
7024  * elements[-1][2],
7025  * elements[-1][1]]
7026  */
7027  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
7028  __Pyx_GOTREF(__pyx_t_2);
7029  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 238, __pyx_L1_error)
7030  __Pyx_GOTREF(__pyx_t_15);
7031  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7032 
7033  /* "Isosurface.pyx":239
7034  * nodes[-1] - nodes[-3]) > 0.0:
7035  * elements[-1] = [elements[-1][0],
7036  * elements[-1][2], # <<<<<<<<<<<<<<
7037  * elements[-1][1]]
7038  * normal = ecross(
7039  */
7040  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
7041  __Pyx_GOTREF(__pyx_t_2);
7042  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 239, __pyx_L1_error)
7043  __Pyx_GOTREF(__pyx_t_16);
7044  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7045 
7046  /* "Isosurface.pyx":240
7047  * elements[-1] = [elements[-1][0],
7048  * elements[-1][2],
7049  * elements[-1][1]] # <<<<<<<<<<<<<<
7050  * normal = ecross(
7051  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7052  */
7053  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
7054  __Pyx_GOTREF(__pyx_t_2);
7055  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
7056  __Pyx_GOTREF(__pyx_t_3);
7057  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7058 
7059  /* "Isosurface.pyx":238
7060  * nodes[-2] - nodes[-3],
7061  * nodes[-1] - nodes[-3]) > 0.0:
7062  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
7063  * elements[-1][2],
7064  * elements[-1][1]]
7065  */
7066  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
7067  __Pyx_GOTREF(__pyx_t_2);
7068  __Pyx_GIVEREF(__pyx_t_15);
7069  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
7070  __Pyx_GIVEREF(__pyx_t_16);
7071  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_16);
7072  __Pyx_GIVEREF(__pyx_t_3);
7073  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
7074  __pyx_t_15 = 0;
7075  __pyx_t_16 = 0;
7076  __pyx_t_3 = 0;
7077  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 238, __pyx_L1_error)
7078  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7079 
7080  /* "Isosurface.pyx":235
7081  * nodes.append(x)
7082  * elements.append([nN_start + j for j in range(3)])
7083  * if etriple(self.nodeArray[minus[0]] - nodes[-3], # <<<<<<<<<<<<<<
7084  * nodes[-2] - nodes[-3],
7085  * nodes[-1] - nodes[-3]) > 0.0:
7086  */
7087  }
7088 
7089  /* "Isosurface.pyx":242
7090  * elements[-1][1]]
7091  * normal = ecross(
7092  * nodes[elements[-1][1]] - nodes[elements[-1][0]], # <<<<<<<<<<<<<<
7093  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7094  * normal /= enorm(normal)
7095  */
7096  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
7097  __Pyx_GOTREF(__pyx_t_2);
7098  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
7099  __Pyx_GOTREF(__pyx_t_3);
7100  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7101  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
7102  __Pyx_GOTREF(__pyx_t_2);
7103  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7104  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
7105  __Pyx_GOTREF(__pyx_t_3);
7106  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 242, __pyx_L1_error)
7107  __Pyx_GOTREF(__pyx_t_16);
7108  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7109  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
7110  __Pyx_GOTREF(__pyx_t_3);
7111  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7112  __pyx_t_16 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 242, __pyx_L1_error)
7113  __Pyx_GOTREF(__pyx_t_16);
7114  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7115  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7116  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 242, __pyx_L1_error)
7117 
7118  /* "Isosurface.pyx":243
7119  * normal = ecross(
7120  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7121  * nodes[elements[-1][2]] - nodes[elements[-1][0]]) # <<<<<<<<<<<<<<
7122  * normal /= enorm(normal)
7123  * normals.append(normal)
7124  */
7125  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error)
7126  __Pyx_GOTREF(__pyx_t_3);
7127  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
7128  __Pyx_GOTREF(__pyx_t_2);
7129  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7130  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error)
7131  __Pyx_GOTREF(__pyx_t_3);
7132  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7133  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
7134  __Pyx_GOTREF(__pyx_t_2);
7135  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 243, __pyx_L1_error)
7136  __Pyx_GOTREF(__pyx_t_15);
7137  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7138  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
7139  __Pyx_GOTREF(__pyx_t_2);
7140  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7141  __pyx_t_15 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 243, __pyx_L1_error)
7142  __Pyx_GOTREF(__pyx_t_15);
7143  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7144  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7145  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 243, __pyx_L1_error)
7146 
7147  /* "Isosurface.pyx":241
7148  * elements[-1][2],
7149  * elements[-1][1]]
7150  * normal = ecross( # <<<<<<<<<<<<<<
7151  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7152  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7153  */
7154  __pyx_t_2 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_16), ((PyArrayObject *)__pyx_t_15))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error)
7155  __Pyx_GOTREF(__pyx_t_2);
7156  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7157  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7158  {
7159  __Pyx_BufFmt_StackElem __pyx_stack[1];
7160  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
7161  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7162  if (unlikely(__pyx_t_9 < 0)) {
7163  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
7164  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7165  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
7166  __Pyx_RaiseBufferFallbackError();
7167  } else {
7168  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
7169  }
7170  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
7171  }
7172  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
7173  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 241, __pyx_L1_error)
7174  }
7175  __Pyx_XDECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_2));
7176  __pyx_t_2 = 0;
7177 
7178  /* "Isosurface.pyx":244
7179  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7180  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7181  * normal /= enorm(normal) # <<<<<<<<<<<<<<
7182  * normals.append(normal)
7183  * normals.append(normal)
7184  */
7185  __pyx_t_2 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
7186  __Pyx_GOTREF(__pyx_t_2);
7187  __pyx_t_15 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 244, __pyx_L1_error)
7188  __Pyx_GOTREF(__pyx_t_15);
7189  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7190  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 244, __pyx_L1_error)
7191  __pyx_t_18 = ((PyArrayObject *)__pyx_t_15);
7192  {
7193  __Pyx_BufFmt_StackElem __pyx_stack[1];
7194  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
7195  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7196  if (unlikely(__pyx_t_9 < 0)) {
7197  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
7198  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7199  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
7200  __Pyx_RaiseBufferFallbackError();
7201  } else {
7202  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
7203  }
7204  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
7205  }
7206  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
7207  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
7208  }
7209  __pyx_t_18 = 0;
7210  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_15));
7211  __pyx_t_15 = 0;
7212 
7213  /* "Isosurface.pyx":245
7214  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7215  * normal /= enorm(normal)
7216  * normals.append(normal) # <<<<<<<<<<<<<<
7217  * normals.append(normal)
7218  * normals.append(normal)
7219  */
7220  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 245, __pyx_L1_error)
7221 
7222  /* "Isosurface.pyx":246
7223  * normal /= enorm(normal)
7224  * normals.append(normal)
7225  * normals.append(normal) # <<<<<<<<<<<<<<
7226  * normals.append(normal)
7227  * normal_indices.append(elements[-1])
7228  */
7229  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 246, __pyx_L1_error)
7230 
7231  /* "Isosurface.pyx":247
7232  * normals.append(normal)
7233  * normals.append(normal)
7234  * normals.append(normal) # <<<<<<<<<<<<<<
7235  * normal_indices.append(elements[-1])
7236  * elif nMinus == 3 and nPlus == 1: # 3 cut edges
7237  */
7238  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 247, __pyx_L1_error)
7239 
7240  /* "Isosurface.pyx":248
7241  * normals.append(normal)
7242  * normals.append(normal)
7243  * normal_indices.append(elements[-1]) # <<<<<<<<<<<<<<
7244  * elif nMinus == 3 and nPlus == 1: # 3 cut edges
7245  * I = plus[0]
7246  */
7247  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 248, __pyx_L1_error)
7248  __Pyx_GOTREF(__pyx_t_15);
7249  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 248, __pyx_L1_error)
7250  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7251 
7252  /* "Isosurface.pyx":227
7253  * normals.append(normal)
7254  * normal_indices.append(elements[-1])
7255  * elif nPlus == 3 and nMinus == 1: # 3 cut edges # <<<<<<<<<<<<<<
7256  * I = minus[0]
7257  * for J in plus:
7258  */
7259  goto __pyx_L9;
7260  }
7261 
7262  /* "Isosurface.pyx":249
7263  * normals.append(normal)
7264  * normal_indices.append(elements[-1])
7265  * elif nMinus == 3 and nPlus == 1: # 3 cut edges # <<<<<<<<<<<<<<
7266  * I = plus[0]
7267  * for J in minus:
7268  */
7269  __pyx_t_13 = ((__pyx_v_nMinus == 3) != 0);
7270  if (__pyx_t_13) {
7271  } else {
7272  __pyx_t_4 = __pyx_t_13;
7273  goto __pyx_L29_bool_binop_done;
7274  }
7275  __pyx_t_13 = ((__pyx_v_nPlus == 1) != 0);
7276  __pyx_t_4 = __pyx_t_13;
7277  __pyx_L29_bool_binop_done:;
7278  if (__pyx_t_4) {
7279 
7280  /* "Isosurface.pyx":250
7281  * normal_indices.append(elements[-1])
7282  * elif nMinus == 3 and nPlus == 1: # 3 cut edges
7283  * I = plus[0] # <<<<<<<<<<<<<<
7284  * for J in minus:
7285  * s = -phi[I] / (phi[J] - phi[I])
7286  */
7287  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 250, __pyx_L1_error)
7288  __Pyx_GOTREF(__pyx_t_15);
7289  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
7290  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7291  __pyx_v_I = __pyx_t_9;
7292 
7293  /* "Isosurface.pyx":251
7294  * elif nMinus == 3 and nPlus == 1: # 3 cut edges
7295  * I = plus[0]
7296  * for J in minus: # <<<<<<<<<<<<<<
7297  * s = -phi[I] / (phi[J] - phi[I])
7298  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
7299  */
7300  __pyx_t_15 = __pyx_v_minus; __Pyx_INCREF(__pyx_t_15); __pyx_t_12 = 0;
7301  for (;;) {
7302  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_15)) break;
7303  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7304  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
7305  #else
7306  __pyx_t_2 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
7307  __Pyx_GOTREF(__pyx_t_2);
7308  #endif
7309  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error)
7310  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7311  __pyx_v_J = __pyx_t_9;
7312 
7313  /* "Isosurface.pyx":252
7314  * I = plus[0]
7315  * for J in minus:
7316  * s = -phi[I] / (phi[J] - phi[I]) # <<<<<<<<<<<<<<
7317  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
7318  * self.nodeArray[I]
7319  */
7320  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error)
7321  __Pyx_GOTREF(__pyx_t_2);
7322  __pyx_t_16 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 252, __pyx_L1_error)
7323  __Pyx_GOTREF(__pyx_t_16);
7324  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7325  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error)
7326  __Pyx_GOTREF(__pyx_t_2);
7327  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
7328  __Pyx_GOTREF(__pyx_t_3);
7329  __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
7330  __Pyx_GOTREF(__pyx_t_1);
7331  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7332  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7333  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
7334  __Pyx_GOTREF(__pyx_t_3);
7335  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7336  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7337  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error)
7338  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7339  __pyx_v_s = __pyx_t_17;
7340 
7341  /* "Isosurface.pyx":253
7342  * for J in minus:
7343  * s = -phi[I] / (phi[J] - phi[I])
7344  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \ # <<<<<<<<<<<<<<
7345  * self.nodeArray[I]
7346  * nodes.append(x)
7347  */
7348  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error)
7349  __Pyx_GOTREF(__pyx_t_3);
7350  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
7351  __Pyx_GOTREF(__pyx_t_1);
7352  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 253, __pyx_L1_error)
7353  __Pyx_GOTREF(__pyx_t_16);
7354  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7355  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
7356  __Pyx_GOTREF(__pyx_t_1);
7357  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
7358  __Pyx_GOTREF(__pyx_t_2);
7359  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7360  __pyx_t_1 = PyNumber_Subtract(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
7361  __Pyx_GOTREF(__pyx_t_1);
7362  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7363  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7364  __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
7365  __Pyx_GOTREF(__pyx_t_2);
7366  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7367  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7368 
7369  /* "Isosurface.pyx":254
7370  * s = -phi[I] / (phi[J] - phi[I])
7371  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
7372  * self.nodeArray[I] # <<<<<<<<<<<<<<
7373  * nodes.append(x)
7374  * elements.append([nN_start + j for j in range(3)])
7375  */
7376  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
7377  __Pyx_GOTREF(__pyx_t_1);
7378  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error)
7379  __Pyx_GOTREF(__pyx_t_3);
7380  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7381 
7382  /* "Isosurface.pyx":253
7383  * for J in minus:
7384  * s = -phi[I] / (phi[J] - phi[I])
7385  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \ # <<<<<<<<<<<<<<
7386  * self.nodeArray[I]
7387  * nodes.append(x)
7388  */
7389  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
7390  __Pyx_GOTREF(__pyx_t_1);
7391  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7392  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7393  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 253, __pyx_L1_error)
7394  __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
7395  {
7396  __Pyx_BufFmt_StackElem __pyx_stack[1];
7397  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7398  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7399  if (unlikely(__pyx_t_9 < 0)) {
7400  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
7401  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7402  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
7403  __Pyx_RaiseBufferFallbackError();
7404  } else {
7405  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
7406  }
7407  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
7408  }
7409  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
7410  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 253, __pyx_L1_error)
7411  }
7412  __pyx_t_18 = 0;
7413  __Pyx_XDECREF_SET(__pyx_v_x, ((PyArrayObject *)__pyx_t_1));
7414  __pyx_t_1 = 0;
7415 
7416  /* "Isosurface.pyx":255
7417  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
7418  * self.nodeArray[I]
7419  * nodes.append(x) # <<<<<<<<<<<<<<
7420  * elements.append([nN_start + j for j in range(3)])
7421  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
7422  */
7423  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, ((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 255, __pyx_L1_error)
7424 
7425  /* "Isosurface.pyx":251
7426  * elif nMinus == 3 and nPlus == 1: # 3 cut edges
7427  * I = plus[0]
7428  * for J in minus: # <<<<<<<<<<<<<<
7429  * s = -phi[I] / (phi[J] - phi[I])
7430  * x = s * (self.nodeArray[J] - self.nodeArray[I]) + \
7431  */
7432  }
7433  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7434 
7435  /* "Isosurface.pyx":256
7436  * self.nodeArray[I]
7437  * nodes.append(x)
7438  * elements.append([nN_start + j for j in range(3)]) # <<<<<<<<<<<<<<
7439  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
7440  * nodes[-2] - nodes[-3],
7441  */
7442  __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 256, __pyx_L1_error)
7443  __Pyx_GOTREF(__pyx_t_15);
7444  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
7445  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
7446  __Pyx_GOTREF(__pyx_t_1);
7447  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_1);
7448  __pyx_t_1 = 0;
7449  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error)
7450  __Pyx_GOTREF(__pyx_t_1);
7451  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
7452  __Pyx_GOTREF(__pyx_t_3);
7453  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7454  if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 256, __pyx_L1_error)
7455  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7456  }
7457  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 256, __pyx_L1_error)
7458  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7459 
7460  /* "Isosurface.pyx":257
7461  * nodes.append(x)
7462  * elements.append([nN_start + j for j in range(3)])
7463  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
7464  * nodes[-2] - nodes[-3],
7465  * nodes[-1] - nodes[-3]) < 0.0:
7466  */
7467  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 257, __pyx_L1_error)
7468  __Pyx_GOTREF(__pyx_t_15);
7469  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
7470  __Pyx_GOTREF(__pyx_t_3);
7471  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
7472  __Pyx_GOTREF(__pyx_t_1);
7473  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7474  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7475  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
7476  __Pyx_GOTREF(__pyx_t_3);
7477  __pyx_t_15 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 257, __pyx_L1_error)
7478  __Pyx_GOTREF(__pyx_t_15);
7479  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7480  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7481  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 257, __pyx_L1_error)
7482 
7483  /* "Isosurface.pyx":258
7484  * elements.append([nN_start + j for j in range(3)])
7485  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
7486  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
7487  * nodes[-1] - nodes[-3]) < 0.0:
7488  * elements[-1] = [elements[-1][0],
7489  */
7490  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L1_error)
7491  __Pyx_GOTREF(__pyx_t_3);
7492  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error)
7493  __Pyx_GOTREF(__pyx_t_1);
7494  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
7495  __Pyx_GOTREF(__pyx_t_2);
7496  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7497  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7498  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 258, __pyx_L1_error)
7499 
7500  /* "Isosurface.pyx":259
7501  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
7502  * nodes[-2] - nodes[-3],
7503  * nodes[-1] - nodes[-3]) < 0.0: # <<<<<<<<<<<<<<
7504  * elements[-1] = [elements[-1][0],
7505  * elements[-1][2],
7506  */
7507  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
7508  __Pyx_GOTREF(__pyx_t_1);
7509  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
7510  __Pyx_GOTREF(__pyx_t_3);
7511  __pyx_t_16 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 259, __pyx_L1_error)
7512  __Pyx_GOTREF(__pyx_t_16);
7513  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7514  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7515  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 259, __pyx_L1_error)
7516 
7517  /* "Isosurface.pyx":257
7518  * nodes.append(x)
7519  * elements.append([nN_start + j for j in range(3)])
7520  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
7521  * nodes[-2] - nodes[-3],
7522  * nodes[-1] - nodes[-3]) < 0.0:
7523  */
7524  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_16)) < 0.0) != 0);
7525  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7526  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7527  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7528  if (__pyx_t_4) {
7529 
7530  /* "Isosurface.pyx":260
7531  * nodes[-2] - nodes[-3],
7532  * nodes[-1] - nodes[-3]) < 0.0:
7533  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
7534  * elements[-1][2],
7535  * elements[-1][1]]
7536  */
7537  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 260, __pyx_L1_error)
7538  __Pyx_GOTREF(__pyx_t_16);
7539  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
7540  __Pyx_GOTREF(__pyx_t_2);
7541  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7542 
7543  /* "Isosurface.pyx":261
7544  * nodes[-1] - nodes[-3]) < 0.0:
7545  * elements[-1] = [elements[-1][0],
7546  * elements[-1][2], # <<<<<<<<<<<<<<
7547  * elements[-1][1]]
7548  * normal = ecross(
7549  */
7550  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 261, __pyx_L1_error)
7551  __Pyx_GOTREF(__pyx_t_16);
7552  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_16, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 261, __pyx_L1_error)
7553  __Pyx_GOTREF(__pyx_t_15);
7554  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7555 
7556  /* "Isosurface.pyx":262
7557  * elements[-1] = [elements[-1][0],
7558  * elements[-1][2],
7559  * elements[-1][1]] # <<<<<<<<<<<<<<
7560  * normal = ecross(
7561  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7562  */
7563  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 262, __pyx_L1_error)
7564  __Pyx_GOTREF(__pyx_t_16);
7565  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_16, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error)
7566  __Pyx_GOTREF(__pyx_t_3);
7567  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7568 
7569  /* "Isosurface.pyx":260
7570  * nodes[-2] - nodes[-3],
7571  * nodes[-1] - nodes[-3]) < 0.0:
7572  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
7573  * elements[-1][2],
7574  * elements[-1][1]]
7575  */
7576  __pyx_t_16 = PyList_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 260, __pyx_L1_error)
7577  __Pyx_GOTREF(__pyx_t_16);
7578  __Pyx_GIVEREF(__pyx_t_2);
7579  PyList_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
7580  __Pyx_GIVEREF(__pyx_t_15);
7581  PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
7582  __Pyx_GIVEREF(__pyx_t_3);
7583  PyList_SET_ITEM(__pyx_t_16, 2, __pyx_t_3);
7584  __pyx_t_2 = 0;
7585  __pyx_t_15 = 0;
7586  __pyx_t_3 = 0;
7587  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_16, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
7588  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7589 
7590  /* "Isosurface.pyx":257
7591  * nodes.append(x)
7592  * elements.append([nN_start + j for j in range(3)])
7593  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
7594  * nodes[-2] - nodes[-3],
7595  * nodes[-1] - nodes[-3]) < 0.0:
7596  */
7597  }
7598 
7599  /* "Isosurface.pyx":264
7600  * elements[-1][1]]
7601  * normal = ecross(
7602  * nodes[elements[-1][1]] - nodes[elements[-1][0]], # <<<<<<<<<<<<<<
7603  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7604  * normal /= enorm(normal)
7605  */
7606  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 264, __pyx_L1_error)
7607  __Pyx_GOTREF(__pyx_t_16);
7608  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_16, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
7609  __Pyx_GOTREF(__pyx_t_3);
7610  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7611  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 264, __pyx_L1_error)
7612  __Pyx_GOTREF(__pyx_t_16);
7613  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7614  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
7615  __Pyx_GOTREF(__pyx_t_3);
7616  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 264, __pyx_L1_error)
7617  __Pyx_GOTREF(__pyx_t_15);
7618  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7619  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
7620  __Pyx_GOTREF(__pyx_t_3);
7621  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7622  __pyx_t_15 = PyNumber_Subtract(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 264, __pyx_L1_error)
7623  __Pyx_GOTREF(__pyx_t_15);
7624  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7625  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7626  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 264, __pyx_L1_error)
7627 
7628  /* "Isosurface.pyx":265
7629  * normal = ecross(
7630  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7631  * nodes[elements[-1][2]] - nodes[elements[-1][0]]) # <<<<<<<<<<<<<<
7632  * normal /= enorm(normal)
7633  * normals.append(normal)
7634  */
7635  __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error)
7636  __Pyx_GOTREF(__pyx_t_3);
7637  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 265, __pyx_L1_error)
7638  __Pyx_GOTREF(__pyx_t_16);
7639  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7640  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error)
7641  __Pyx_GOTREF(__pyx_t_3);
7642  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7643  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 265, __pyx_L1_error)
7644  __Pyx_GOTREF(__pyx_t_16);
7645  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
7646  __Pyx_GOTREF(__pyx_t_2);
7647  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7648  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 265, __pyx_L1_error)
7649  __Pyx_GOTREF(__pyx_t_16);
7650  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7651  __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error)
7652  __Pyx_GOTREF(__pyx_t_2);
7653  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7654  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7655  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 265, __pyx_L1_error)
7656 
7657  /* "Isosurface.pyx":263
7658  * elements[-1][2],
7659  * elements[-1][1]]
7660  * normal = ecross( # <<<<<<<<<<<<<<
7661  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7662  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7663  */
7664  __pyx_t_16 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_2))); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 263, __pyx_L1_error)
7665  __Pyx_GOTREF(__pyx_t_16);
7666  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7667  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7668  {
7669  __Pyx_BufFmt_StackElem __pyx_stack[1];
7670  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
7671  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_16), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7672  if (unlikely(__pyx_t_9 < 0)) {
7673  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
7674  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7675  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
7676  __Pyx_RaiseBufferFallbackError();
7677  } else {
7678  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
7679  }
7680  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
7681  }
7682  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
7683  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
7684  }
7685  __Pyx_XDECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_16));
7686  __pyx_t_16 = 0;
7687 
7688  /* "Isosurface.pyx":266
7689  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
7690  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7691  * normal /= enorm(normal) # <<<<<<<<<<<<<<
7692  * normals.append(normal)
7693  * normals.append(normal)
7694  */
7695  __pyx_t_16 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 266, __pyx_L1_error)
7696  __Pyx_GOTREF(__pyx_t_16);
7697  __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error)
7698  __Pyx_GOTREF(__pyx_t_2);
7699  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7700  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 266, __pyx_L1_error)
7701  __pyx_t_18 = ((PyArrayObject *)__pyx_t_2);
7702  {
7703  __Pyx_BufFmt_StackElem __pyx_stack[1];
7704  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
7705  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7706  if (unlikely(__pyx_t_9 < 0)) {
7707  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
7708  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7709  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
7710  __Pyx_RaiseBufferFallbackError();
7711  } else {
7712  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
7713  }
7714  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
7715  }
7716  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
7717  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
7718  }
7719  __pyx_t_18 = 0;
7720  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_2));
7721  __pyx_t_2 = 0;
7722 
7723  /* "Isosurface.pyx":267
7724  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
7725  * normal /= enorm(normal)
7726  * normals.append(normal) # <<<<<<<<<<<<<<
7727  * normals.append(normal)
7728  * normals.append(normal)
7729  */
7730  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 267, __pyx_L1_error)
7731 
7732  /* "Isosurface.pyx":268
7733  * normal /= enorm(normal)
7734  * normals.append(normal)
7735  * normals.append(normal) # <<<<<<<<<<<<<<
7736  * normals.append(normal)
7737  * normal_indices.append(elements[-1])
7738  */
7739  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 268, __pyx_L1_error)
7740 
7741  /* "Isosurface.pyx":269
7742  * normals.append(normal)
7743  * normals.append(normal)
7744  * normals.append(normal) # <<<<<<<<<<<<<<
7745  * normal_indices.append(elements[-1])
7746  * elif nZeros == 1 and ((nPlus == 2 and nMinus == 1) or
7747  */
7748  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 269, __pyx_L1_error)
7749 
7750  /* "Isosurface.pyx":270
7751  * normals.append(normal)
7752  * normals.append(normal)
7753  * normal_indices.append(elements[-1]) # <<<<<<<<<<<<<<
7754  * elif nZeros == 1 and ((nPlus == 2 and nMinus == 1) or
7755  * (nPlus == 1 and nMinus == 2)):
7756  */
7757  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
7758  __Pyx_GOTREF(__pyx_t_2);
7759  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_2); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 270, __pyx_L1_error)
7760  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7761 
7762  /* "Isosurface.pyx":249
7763  * normals.append(normal)
7764  * normal_indices.append(elements[-1])
7765  * elif nMinus == 3 and nPlus == 1: # 3 cut edges # <<<<<<<<<<<<<<
7766  * I = plus[0]
7767  * for J in minus:
7768  */
7769  goto __pyx_L9;
7770  }
7771 
7772  /* "Isosurface.pyx":271
7773  * normals.append(normal)
7774  * normal_indices.append(elements[-1])
7775  * elif nZeros == 1 and ((nPlus == 2 and nMinus == 1) or # <<<<<<<<<<<<<<
7776  * (nPlus == 1 and nMinus == 2)):
7777  * # 2 cut edges, 1 vertex lies in plane
7778  */
7779  __pyx_t_13 = ((__pyx_v_nZeros == 1) != 0);
7780  if (__pyx_t_13) {
7781  } else {
7782  __pyx_t_4 = __pyx_t_13;
7783  goto __pyx_L36_bool_binop_done;
7784  }
7785  __pyx_t_13 = ((__pyx_v_nPlus == 2) != 0);
7786  if (!__pyx_t_13) {
7787  goto __pyx_L38_next_or;
7788  } else {
7789  }
7790  __pyx_t_13 = ((__pyx_v_nMinus == 1) != 0);
7791  if (!__pyx_t_13) {
7792  } else {
7793  __pyx_t_4 = __pyx_t_13;
7794  goto __pyx_L36_bool_binop_done;
7795  }
7796  __pyx_L38_next_or:;
7797 
7798  /* "Isosurface.pyx":272
7799  * normal_indices.append(elements[-1])
7800  * elif nZeros == 1 and ((nPlus == 2 and nMinus == 1) or
7801  * (nPlus == 1 and nMinus == 2)): # <<<<<<<<<<<<<<
7802  * # 2 cut edges, 1 vertex lies in plane
7803  * nodes.append(self.nodeArray[zeros[0]])
7804  */
7805  __pyx_t_13 = ((__pyx_v_nPlus == 1) != 0);
7806  if (__pyx_t_13) {
7807  } else {
7808  __pyx_t_4 = __pyx_t_13;
7809  goto __pyx_L36_bool_binop_done;
7810  }
7811  __pyx_t_13 = ((__pyx_v_nMinus == 2) != 0);
7812  __pyx_t_4 = __pyx_t_13;
7813  __pyx_L36_bool_binop_done:;
7814 
7815  /* "Isosurface.pyx":271
7816  * normals.append(normal)
7817  * normal_indices.append(elements[-1])
7818  * elif nZeros == 1 and ((nPlus == 2 and nMinus == 1) or # <<<<<<<<<<<<<<
7819  * (nPlus == 1 and nMinus == 2)):
7820  * # 2 cut edges, 1 vertex lies in plane
7821  */
7822  if (__pyx_t_4) {
7823 
7824  /* "Isosurface.pyx":274
7825  * (nPlus == 1 and nMinus == 2)):
7826  * # 2 cut edges, 1 vertex lies in plane
7827  * nodes.append(self.nodeArray[zeros[0]]) # <<<<<<<<<<<<<<
7828  * for J in minus:
7829  * for I in plus:
7830  */
7831  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
7832  __Pyx_GOTREF(__pyx_t_2);
7833  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_zeros, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 274, __pyx_L1_error)
7834  __Pyx_GOTREF(__pyx_t_16);
7835  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 274, __pyx_L1_error)
7836  __Pyx_GOTREF(__pyx_t_15);
7837  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7838  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7839  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 274, __pyx_L1_error)
7840  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7841 
7842  /* "Isosurface.pyx":275
7843  * # 2 cut edges, 1 vertex lies in plane
7844  * nodes.append(self.nodeArray[zeros[0]])
7845  * for J in minus: # <<<<<<<<<<<<<<
7846  * for I in plus:
7847  * s = -phi[I] / (phi[J] - phi[I])
7848  */
7849  __pyx_t_15 = __pyx_v_minus; __Pyx_INCREF(__pyx_t_15); __pyx_t_12 = 0;
7850  for (;;) {
7851  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_15)) break;
7852  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7853  __pyx_t_16 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_16); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 275, __pyx_L1_error)
7854  #else
7855  __pyx_t_16 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 275, __pyx_L1_error)
7856  __Pyx_GOTREF(__pyx_t_16);
7857  #endif
7858  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error)
7859  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7860  __pyx_v_J = __pyx_t_9;
7861 
7862  /* "Isosurface.pyx":276
7863  * nodes.append(self.nodeArray[zeros[0]])
7864  * for J in minus:
7865  * for I in plus: # <<<<<<<<<<<<<<
7866  * s = -phi[I] / (phi[J] - phi[I])
7867  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
7868  */
7869  __pyx_t_16 = __pyx_v_plus; __Pyx_INCREF(__pyx_t_16); __pyx_t_14 = 0;
7870  for (;;) {
7871  if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_16)) break;
7872  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7873  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 276, __pyx_L1_error)
7874  #else
7875  __pyx_t_2 = PySequence_ITEM(__pyx_t_16, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error)
7876  __Pyx_GOTREF(__pyx_t_2);
7877  #endif
7878  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L1_error)
7879  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7880  __pyx_v_I = __pyx_t_9;
7881 
7882  /* "Isosurface.pyx":277
7883  * for J in minus:
7884  * for I in plus:
7885  * s = -phi[I] / (phi[J] - phi[I]) # <<<<<<<<<<<<<<
7886  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
7887  * + self.nodeArray[I]
7888  */
7889  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
7890  __Pyx_GOTREF(__pyx_t_2);
7891  __pyx_t_3 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error)
7892  __Pyx_GOTREF(__pyx_t_3);
7893  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7894  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
7895  __Pyx_GOTREF(__pyx_t_2);
7896  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
7897  __Pyx_GOTREF(__pyx_t_1);
7898  __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 277, __pyx_L1_error)
7899  __Pyx_GOTREF(__pyx_t_5);
7900  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7901  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7902  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
7903  __Pyx_GOTREF(__pyx_t_1);
7904  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7905  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7906  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 277, __pyx_L1_error)
7907  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7908  __pyx_v_s = __pyx_t_17;
7909 
7910  /* "Isosurface.pyx":278
7911  * for I in plus:
7912  * s = -phi[I] / (phi[J] - phi[I])
7913  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \ # <<<<<<<<<<<<<<
7914  * + self.nodeArray[I]
7915  * nodes.append(x)
7916  */
7917  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
7918  __Pyx_GOTREF(__pyx_t_1);
7919  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
7920  __Pyx_GOTREF(__pyx_t_5);
7921  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error)
7922  __Pyx_GOTREF(__pyx_t_3);
7923  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7924  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
7925  __Pyx_GOTREF(__pyx_t_5);
7926  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
7927  __Pyx_GOTREF(__pyx_t_2);
7928  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7929  __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
7930  __Pyx_GOTREF(__pyx_t_5);
7931  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7932  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7933  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
7934  __Pyx_GOTREF(__pyx_t_2);
7935  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7936  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7937 
7938  /* "Isosurface.pyx":279
7939  * s = -phi[I] / (phi[J] - phi[I])
7940  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
7941  * + self.nodeArray[I] # <<<<<<<<<<<<<<
7942  * nodes.append(x)
7943  * elements.append([nN_start + j for j in range(3)])
7944  */
7945  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error)
7946  __Pyx_GOTREF(__pyx_t_5);
7947  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
7948  __Pyx_GOTREF(__pyx_t_1);
7949  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7950  __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error)
7951  __Pyx_GOTREF(__pyx_t_5);
7952  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7953  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7954  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 279, __pyx_L1_error)
7955  __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
7956  {
7957  __Pyx_BufFmt_StackElem __pyx_stack[1];
7958  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7959  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7960  if (unlikely(__pyx_t_9 < 0)) {
7961  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
7962  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7963  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
7964  __Pyx_RaiseBufferFallbackError();
7965  } else {
7966  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
7967  }
7968  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
7969  }
7970  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
7971  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 278, __pyx_L1_error)
7972  }
7973  __pyx_t_18 = 0;
7974  __Pyx_XDECREF_SET(__pyx_v_x, ((PyArrayObject *)__pyx_t_5));
7975  __pyx_t_5 = 0;
7976 
7977  /* "Isosurface.pyx":280
7978  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
7979  * + self.nodeArray[I]
7980  * nodes.append(x) # <<<<<<<<<<<<<<
7981  * elements.append([nN_start + j for j in range(3)])
7982  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
7983  */
7984  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, ((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 280, __pyx_L1_error)
7985 
7986  /* "Isosurface.pyx":276
7987  * nodes.append(self.nodeArray[zeros[0]])
7988  * for J in minus:
7989  * for I in plus: # <<<<<<<<<<<<<<
7990  * s = -phi[I] / (phi[J] - phi[I])
7991  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
7992  */
7993  }
7994  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7995 
7996  /* "Isosurface.pyx":275
7997  * # 2 cut edges, 1 vertex lies in plane
7998  * nodes.append(self.nodeArray[zeros[0]])
7999  * for J in minus: # <<<<<<<<<<<<<<
8000  * for I in plus:
8001  * s = -phi[I] / (phi[J] - phi[I])
8002  */
8003  }
8004  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8005 
8006  /* "Isosurface.pyx":281
8007  * + self.nodeArray[I]
8008  * nodes.append(x)
8009  * elements.append([nN_start + j for j in range(3)]) # <<<<<<<<<<<<<<
8010  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8011  * nodes[-2] - nodes[-3],
8012  */
8013  __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 281, __pyx_L1_error)
8014  __Pyx_GOTREF(__pyx_t_15);
8015  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
8016  __pyx_t_16 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 281, __pyx_L1_error)
8017  __Pyx_GOTREF(__pyx_t_16);
8018  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_16);
8019  __pyx_t_16 = 0;
8020  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 281, __pyx_L1_error)
8021  __Pyx_GOTREF(__pyx_t_16);
8022  __pyx_t_5 = PyNumber_Add(__pyx_t_16, __pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 281, __pyx_L1_error)
8023  __Pyx_GOTREF(__pyx_t_5);
8024  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8025  if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 281, __pyx_L1_error)
8026  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8027  }
8028  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 281, __pyx_L1_error)
8029  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8030 
8031  /* "Isosurface.pyx":282
8032  * nodes.append(x)
8033  * elements.append([nN_start + j for j in range(3)])
8034  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8035  * nodes[-2] - nodes[-3],
8036  * nodes[-1] - nodes[-3]) < 0.0:
8037  */
8038  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L1_error)
8039  __Pyx_GOTREF(__pyx_t_15);
8040  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
8041  __Pyx_GOTREF(__pyx_t_5);
8042  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 282, __pyx_L1_error)
8043  __Pyx_GOTREF(__pyx_t_16);
8044  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8045  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8046  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
8047  __Pyx_GOTREF(__pyx_t_5);
8048  __pyx_t_15 = PyNumber_Subtract(__pyx_t_16, __pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 282, __pyx_L1_error)
8049  __Pyx_GOTREF(__pyx_t_15);
8050  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8051  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8052  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 282, __pyx_L1_error)
8053 
8054  /* "Isosurface.pyx":283
8055  * elements.append([nN_start + j for j in range(3)])
8056  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8057  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
8058  * nodes[-1] - nodes[-3]) < 0.0:
8059  * elements[-1] = [elements[-1][0],
8060  */
8061  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
8062  __Pyx_GOTREF(__pyx_t_5);
8063  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 283, __pyx_L1_error)
8064  __Pyx_GOTREF(__pyx_t_16);
8065  __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
8066  __Pyx_GOTREF(__pyx_t_1);
8067  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8068  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8069  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 283, __pyx_L1_error)
8070 
8071  /* "Isosurface.pyx":284
8072  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8073  * nodes[-2] - nodes[-3],
8074  * nodes[-1] - nodes[-3]) < 0.0: # <<<<<<<<<<<<<<
8075  * elements[-1] = [elements[-1][0],
8076  * elements[-1][2],
8077  */
8078  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 284, __pyx_L1_error)
8079  __Pyx_GOTREF(__pyx_t_16);
8080  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
8081  __Pyx_GOTREF(__pyx_t_5);
8082  __pyx_t_2 = PyNumber_Subtract(__pyx_t_16, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
8083  __Pyx_GOTREF(__pyx_t_2);
8084  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8085  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8086  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 284, __pyx_L1_error)
8087 
8088  /* "Isosurface.pyx":282
8089  * nodes.append(x)
8090  * elements.append([nN_start + j for j in range(3)])
8091  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8092  * nodes[-2] - nodes[-3],
8093  * nodes[-1] - nodes[-3]) < 0.0:
8094  */
8095  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_2)) < 0.0) != 0);
8096  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8097  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8098  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8099  if (__pyx_t_4) {
8100 
8101  /* "Isosurface.pyx":285
8102  * nodes[-2] - nodes[-3],
8103  * nodes[-1] - nodes[-3]) < 0.0:
8104  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
8105  * elements[-1][2],
8106  * elements[-1][1]]
8107  */
8108  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
8109  __Pyx_GOTREF(__pyx_t_2);
8110  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
8111  __Pyx_GOTREF(__pyx_t_1);
8112  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8113 
8114  /* "Isosurface.pyx":286
8115  * nodes[-1] - nodes[-3]) < 0.0:
8116  * elements[-1] = [elements[-1][0],
8117  * elements[-1][2], # <<<<<<<<<<<<<<
8118  * elements[-1][1]]
8119  * normal = ecross(
8120  */
8121  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
8122  __Pyx_GOTREF(__pyx_t_2);
8123  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 286, __pyx_L1_error)
8124  __Pyx_GOTREF(__pyx_t_15);
8125  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8126 
8127  /* "Isosurface.pyx":287
8128  * elements[-1] = [elements[-1][0],
8129  * elements[-1][2],
8130  * elements[-1][1]] # <<<<<<<<<<<<<<
8131  * normal = ecross(
8132  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8133  */
8134  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
8135  __Pyx_GOTREF(__pyx_t_2);
8136  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error)
8137  __Pyx_GOTREF(__pyx_t_5);
8138  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8139 
8140  /* "Isosurface.pyx":285
8141  * nodes[-2] - nodes[-3],
8142  * nodes[-1] - nodes[-3]) < 0.0:
8143  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
8144  * elements[-1][2],
8145  * elements[-1][1]]
8146  */
8147  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
8148  __Pyx_GOTREF(__pyx_t_2);
8149  __Pyx_GIVEREF(__pyx_t_1);
8150  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
8151  __Pyx_GIVEREF(__pyx_t_15);
8152  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_15);
8153  __Pyx_GIVEREF(__pyx_t_5);
8154  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
8155  __pyx_t_1 = 0;
8156  __pyx_t_15 = 0;
8157  __pyx_t_5 = 0;
8158  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 285, __pyx_L1_error)
8159  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8160 
8161  /* "Isosurface.pyx":282
8162  * nodes.append(x)
8163  * elements.append([nN_start + j for j in range(3)])
8164  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8165  * nodes[-2] - nodes[-3],
8166  * nodes[-1] - nodes[-3]) < 0.0:
8167  */
8168  }
8169 
8170  /* "Isosurface.pyx":289
8171  * elements[-1][1]]
8172  * normal = ecross(
8173  * nodes[elements[-1][1]] - nodes[elements[-1][0]], # <<<<<<<<<<<<<<
8174  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8175  * normal /= enorm(normal)
8176  */
8177  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
8178  __Pyx_GOTREF(__pyx_t_2);
8179  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
8180  __Pyx_GOTREF(__pyx_t_5);
8181  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8182  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
8183  __Pyx_GOTREF(__pyx_t_2);
8184  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8185  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
8186  __Pyx_GOTREF(__pyx_t_5);
8187  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 289, __pyx_L1_error)
8188  __Pyx_GOTREF(__pyx_t_15);
8189  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8190  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
8191  __Pyx_GOTREF(__pyx_t_5);
8192  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8193  __pyx_t_15 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 289, __pyx_L1_error)
8194  __Pyx_GOTREF(__pyx_t_15);
8195  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8196  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8197  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 289, __pyx_L1_error)
8198 
8199  /* "Isosurface.pyx":290
8200  * normal = ecross(
8201  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8202  * nodes[elements[-1][2]] - nodes[elements[-1][0]]) # <<<<<<<<<<<<<<
8203  * normal /= enorm(normal)
8204  * normals.append(normal)
8205  */
8206  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error)
8207  __Pyx_GOTREF(__pyx_t_5);
8208  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error)
8209  __Pyx_GOTREF(__pyx_t_2);
8210  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8211  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error)
8212  __Pyx_GOTREF(__pyx_t_5);
8213  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8214  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error)
8215  __Pyx_GOTREF(__pyx_t_2);
8216  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
8217  __Pyx_GOTREF(__pyx_t_1);
8218  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8219  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error)
8220  __Pyx_GOTREF(__pyx_t_2);
8221  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8222  __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
8223  __Pyx_GOTREF(__pyx_t_1);
8224  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8225  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8226  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 290, __pyx_L1_error)
8227 
8228  /* "Isosurface.pyx":288
8229  * elements[-1][2],
8230  * elements[-1][1]]
8231  * normal = ecross( # <<<<<<<<<<<<<<
8232  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8233  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8234  */
8235  __pyx_t_2 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
8236  __Pyx_GOTREF(__pyx_t_2);
8237  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8238  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8239  {
8240  __Pyx_BufFmt_StackElem __pyx_stack[1];
8241  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
8242  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
8243  if (unlikely(__pyx_t_9 < 0)) {
8244  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
8245  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
8246  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
8247  __Pyx_RaiseBufferFallbackError();
8248  } else {
8249  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
8250  }
8251  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
8252  }
8253  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
8254  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
8255  }
8256  __Pyx_XDECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_2));
8257  __pyx_t_2 = 0;
8258 
8259  /* "Isosurface.pyx":291
8260  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8261  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8262  * normal /= enorm(normal) # <<<<<<<<<<<<<<
8263  * normals.append(normal)
8264  * normals.append(normal)
8265  */
8266  __pyx_t_2 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
8267  __Pyx_GOTREF(__pyx_t_2);
8268  __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
8269  __Pyx_GOTREF(__pyx_t_1);
8270  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8271  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 291, __pyx_L1_error)
8272  __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
8273  {
8274  __Pyx_BufFmt_StackElem __pyx_stack[1];
8275  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
8276  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
8277  if (unlikely(__pyx_t_9 < 0)) {
8278  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
8279  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
8280  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
8281  __Pyx_RaiseBufferFallbackError();
8282  } else {
8283  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
8284  }
8285  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
8286  }
8287  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
8288  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 291, __pyx_L1_error)
8289  }
8290  __pyx_t_18 = 0;
8291  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_1));
8292  __pyx_t_1 = 0;
8293 
8294  /* "Isosurface.pyx":292
8295  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8296  * normal /= enorm(normal)
8297  * normals.append(normal) # <<<<<<<<<<<<<<
8298  * normals.append(normal)
8299  * normals.append(normal)
8300  */
8301  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 292, __pyx_L1_error)
8302 
8303  /* "Isosurface.pyx":293
8304  * normal /= enorm(normal)
8305  * normals.append(normal)
8306  * normals.append(normal) # <<<<<<<<<<<<<<
8307  * normals.append(normal)
8308  * normal_indices.append(elements[-1])
8309  */
8310  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 293, __pyx_L1_error)
8311 
8312  /* "Isosurface.pyx":294
8313  * normals.append(normal)
8314  * normals.append(normal)
8315  * normals.append(normal) # <<<<<<<<<<<<<<
8316  * normal_indices.append(elements[-1])
8317  * elif nZeros == 2 and nPlus == 1 and nMinus == 1:
8318  */
8319  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 294, __pyx_L1_error)
8320 
8321  /* "Isosurface.pyx":295
8322  * normals.append(normal)
8323  * normals.append(normal)
8324  * normal_indices.append(elements[-1]) # <<<<<<<<<<<<<<
8325  * elif nZeros == 2 and nPlus == 1 and nMinus == 1:
8326  * # 1 cut edge, 2 vertices lie in plane
8327  */
8328  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
8329  __Pyx_GOTREF(__pyx_t_1);
8330  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L1_error)
8331  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8332 
8333  /* "Isosurface.pyx":271
8334  * normals.append(normal)
8335  * normal_indices.append(elements[-1])
8336  * elif nZeros == 1 and ((nPlus == 2 and nMinus == 1) or # <<<<<<<<<<<<<<
8337  * (nPlus == 1 and nMinus == 2)):
8338  * # 2 cut edges, 1 vertex lies in plane
8339  */
8340  goto __pyx_L9;
8341  }
8342 
8343  /* "Isosurface.pyx":296
8344  * normals.append(normal)
8345  * normal_indices.append(elements[-1])
8346  * elif nZeros == 2 and nPlus == 1 and nMinus == 1: # <<<<<<<<<<<<<<
8347  * # 1 cut edge, 2 vertices lie in plane
8348  * for I in zeros:
8349  */
8350  __pyx_t_13 = ((__pyx_v_nZeros == 2) != 0);
8351  if (__pyx_t_13) {
8352  } else {
8353  __pyx_t_4 = __pyx_t_13;
8354  goto __pyx_L48_bool_binop_done;
8355  }
8356  __pyx_t_13 = ((__pyx_v_nPlus == 1) != 0);
8357  if (__pyx_t_13) {
8358  } else {
8359  __pyx_t_4 = __pyx_t_13;
8360  goto __pyx_L48_bool_binop_done;
8361  }
8362  __pyx_t_13 = ((__pyx_v_nMinus == 1) != 0);
8363  __pyx_t_4 = __pyx_t_13;
8364  __pyx_L48_bool_binop_done:;
8365  if (__pyx_t_4) {
8366 
8367  /* "Isosurface.pyx":298
8368  * elif nZeros == 2 and nPlus == 1 and nMinus == 1:
8369  * # 1 cut edge, 2 vertices lie in plane
8370  * for I in zeros: # <<<<<<<<<<<<<<
8371  * nodes.append(self.nodeArray[I])
8372  * I = plus[0]
8373  */
8374  __pyx_t_1 = __pyx_v_zeros; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
8375  for (;;) {
8376  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
8377  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8378  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 298, __pyx_L1_error)
8379  #else
8380  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
8381  __Pyx_GOTREF(__pyx_t_2);
8382  #endif
8383  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error)
8384  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8385  __pyx_v_I = __pyx_t_9;
8386 
8387  /* "Isosurface.pyx":299
8388  * # 1 cut edge, 2 vertices lie in plane
8389  * for I in zeros:
8390  * nodes.append(self.nodeArray[I]) # <<<<<<<<<<<<<<
8391  * I = plus[0]
8392  * J = minus[0]
8393  */
8394  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
8395  __Pyx_GOTREF(__pyx_t_2);
8396  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 299, __pyx_L1_error)
8397  __Pyx_GOTREF(__pyx_t_15);
8398  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8399  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 299, __pyx_L1_error)
8400  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8401 
8402  /* "Isosurface.pyx":298
8403  * elif nZeros == 2 and nPlus == 1 and nMinus == 1:
8404  * # 1 cut edge, 2 vertices lie in plane
8405  * for I in zeros: # <<<<<<<<<<<<<<
8406  * nodes.append(self.nodeArray[I])
8407  * I = plus[0]
8408  */
8409  }
8410  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8411 
8412  /* "Isosurface.pyx":300
8413  * for I in zeros:
8414  * nodes.append(self.nodeArray[I])
8415  * I = plus[0] # <<<<<<<<<<<<<<
8416  * J = minus[0]
8417  * s = -phi[I] / (phi[J] - phi[I])
8418  */
8419  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
8420  __Pyx_GOTREF(__pyx_t_1);
8421  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error)
8422  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8423  __pyx_v_I = __pyx_t_9;
8424 
8425  /* "Isosurface.pyx":301
8426  * nodes.append(self.nodeArray[I])
8427  * I = plus[0]
8428  * J = minus[0] # <<<<<<<<<<<<<<
8429  * s = -phi[I] / (phi[J] - phi[I])
8430  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
8431  */
8432  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_minus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
8433  __Pyx_GOTREF(__pyx_t_1);
8434  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L1_error)
8435  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8436  __pyx_v_J = __pyx_t_9;
8437 
8438  /* "Isosurface.pyx":302
8439  * I = plus[0]
8440  * J = minus[0]
8441  * s = -phi[I] / (phi[J] - phi[I]) # <<<<<<<<<<<<<<
8442  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
8443  * + self.nodeArray[I]
8444  */
8445  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
8446  __Pyx_GOTREF(__pyx_t_1);
8447  __pyx_t_15 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 302, __pyx_L1_error)
8448  __Pyx_GOTREF(__pyx_t_15);
8449  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8450  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
8451  __Pyx_GOTREF(__pyx_t_1);
8452  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_phi, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
8453  __Pyx_GOTREF(__pyx_t_2);
8454  __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 302, __pyx_L1_error)
8455  __Pyx_GOTREF(__pyx_t_5);
8456  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8457  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8458  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
8459  __Pyx_GOTREF(__pyx_t_2);
8460  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8461  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8462  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
8463  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8464  __pyx_v_s = __pyx_t_17;
8465 
8466  /* "Isosurface.pyx":303
8467  * J = minus[0]
8468  * s = -phi[I] / (phi[J] - phi[I])
8469  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \ # <<<<<<<<<<<<<<
8470  * + self.nodeArray[I]
8471  * nodes.append(x)
8472  */
8473  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error)
8474  __Pyx_GOTREF(__pyx_t_2);
8475  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error)
8476  __Pyx_GOTREF(__pyx_t_5);
8477  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_J, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 303, __pyx_L1_error)
8478  __Pyx_GOTREF(__pyx_t_15);
8479  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8480  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error)
8481  __Pyx_GOTREF(__pyx_t_5);
8482  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
8483  __Pyx_GOTREF(__pyx_t_1);
8484  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8485  __pyx_t_5 = PyNumber_Subtract(__pyx_t_15, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error)
8486  __Pyx_GOTREF(__pyx_t_5);
8487  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8488  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8489  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
8490  __Pyx_GOTREF(__pyx_t_1);
8491  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8492  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8493 
8494  /* "Isosurface.pyx":304
8495  * s = -phi[I] / (phi[J] - phi[I])
8496  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
8497  * + self.nodeArray[I] # <<<<<<<<<<<<<<
8498  * nodes.append(x)
8499  * elements.append([nN_start + j for j in range(3)])
8500  */
8501  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 304, __pyx_L1_error)
8502  __Pyx_GOTREF(__pyx_t_5);
8503  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
8504  __Pyx_GOTREF(__pyx_t_2);
8505  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8506  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 304, __pyx_L1_error)
8507  __Pyx_GOTREF(__pyx_t_5);
8508  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8509  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8510  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 304, __pyx_L1_error)
8511  __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
8512  {
8513  __Pyx_BufFmt_StackElem __pyx_stack[1];
8514  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8515  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
8516  if (unlikely(__pyx_t_9 < 0)) {
8517  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
8518  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
8519  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
8520  __Pyx_RaiseBufferFallbackError();
8521  } else {
8522  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
8523  }
8524  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
8525  }
8526  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0];
8527  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 303, __pyx_L1_error)
8528  }
8529  __pyx_t_18 = 0;
8530  __Pyx_XDECREF_SET(__pyx_v_x, ((PyArrayObject *)__pyx_t_5));
8531  __pyx_t_5 = 0;
8532 
8533  /* "Isosurface.pyx":305
8534  * x = s * (self.nodeArray[J] - self.nodeArray[I]) \
8535  * + self.nodeArray[I]
8536  * nodes.append(x) # <<<<<<<<<<<<<<
8537  * elements.append([nN_start + j for j in range(3)])
8538  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8539  */
8540  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, ((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 305, __pyx_L1_error)
8541 
8542  /* "Isosurface.pyx":306
8543  * + self.nodeArray[I]
8544  * nodes.append(x)
8545  * elements.append([nN_start + j for j in range(3)]) # <<<<<<<<<<<<<<
8546  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8547  * nodes[-2] - nodes[-3],
8548  */
8549  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error)
8550  __Pyx_GOTREF(__pyx_t_5);
8551  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
8552  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
8553  __Pyx_GOTREF(__pyx_t_2);
8554  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2);
8555  __pyx_t_2 = 0;
8556  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
8557  __Pyx_GOTREF(__pyx_t_2);
8558  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
8559  __Pyx_GOTREF(__pyx_t_1);
8560  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8561  if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 306, __pyx_L1_error)
8562  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8563  }
8564  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_5); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 306, __pyx_L1_error)
8565  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8566 
8567  /* "Isosurface.pyx":307
8568  * nodes.append(x)
8569  * elements.append([nN_start + j for j in range(3)])
8570  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8571  * nodes[-2] - nodes[-3],
8572  * nodes[-1] - nodes[-3]) < 0.0:
8573  */
8574  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
8575  __Pyx_GOTREF(__pyx_t_5);
8576  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
8577  __Pyx_GOTREF(__pyx_t_1);
8578  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
8579  __Pyx_GOTREF(__pyx_t_2);
8580  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8581  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8582  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
8583  __Pyx_GOTREF(__pyx_t_1);
8584  __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
8585  __Pyx_GOTREF(__pyx_t_5);
8586  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8587  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8588  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 307, __pyx_L1_error)
8589 
8590  /* "Isosurface.pyx":308
8591  * elements.append([nN_start + j for j in range(3)])
8592  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8593  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
8594  * nodes[-1] - nodes[-3]) < 0.0:
8595  * elements[-1] = [elements[-1][0],
8596  */
8597  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error)
8598  __Pyx_GOTREF(__pyx_t_1);
8599  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error)
8600  __Pyx_GOTREF(__pyx_t_2);
8601  __pyx_t_15 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 308, __pyx_L1_error)
8602  __Pyx_GOTREF(__pyx_t_15);
8603  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8604  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8605  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 308, __pyx_L1_error)
8606 
8607  /* "Isosurface.pyx":309
8608  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8609  * nodes[-2] - nodes[-3],
8610  * nodes[-1] - nodes[-3]) < 0.0: # <<<<<<<<<<<<<<
8611  * elements[-1] = [elements[-1][0],
8612  * elements[-1][2],
8613  */
8614  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
8615  __Pyx_GOTREF(__pyx_t_2);
8616  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
8617  __Pyx_GOTREF(__pyx_t_1);
8618  __pyx_t_16 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 309, __pyx_L1_error)
8619  __Pyx_GOTREF(__pyx_t_16);
8620  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8621  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8622  if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 309, __pyx_L1_error)
8623 
8624  /* "Isosurface.pyx":307
8625  * nodes.append(x)
8626  * elements.append([nN_start + j for j in range(3)])
8627  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8628  * nodes[-2] - nodes[-3],
8629  * nodes[-1] - nodes[-3]) < 0.0:
8630  */
8631  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_5), ((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_16)) < 0.0) != 0);
8632  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8633  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8634  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8635  if (__pyx_t_4) {
8636 
8637  /* "Isosurface.pyx":310
8638  * nodes[-2] - nodes[-3],
8639  * nodes[-1] - nodes[-3]) < 0.0:
8640  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
8641  * elements[-1][2],
8642  * elements[-1][1]]
8643  */
8644  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 310, __pyx_L1_error)
8645  __Pyx_GOTREF(__pyx_t_16);
8646  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 310, __pyx_L1_error)
8647  __Pyx_GOTREF(__pyx_t_15);
8648  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8649 
8650  /* "Isosurface.pyx":311
8651  * nodes[-1] - nodes[-3]) < 0.0:
8652  * elements[-1] = [elements[-1][0],
8653  * elements[-1][2], # <<<<<<<<<<<<<<
8654  * elements[-1][1]]
8655  * normal = ecross(
8656  */
8657  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 311, __pyx_L1_error)
8658  __Pyx_GOTREF(__pyx_t_16);
8659  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_16, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 311, __pyx_L1_error)
8660  __Pyx_GOTREF(__pyx_t_5);
8661  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8662 
8663  /* "Isosurface.pyx":312
8664  * elements[-1] = [elements[-1][0],
8665  * elements[-1][2],
8666  * elements[-1][1]] # <<<<<<<<<<<<<<
8667  * normal = ecross(
8668  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8669  */
8670  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 312, __pyx_L1_error)
8671  __Pyx_GOTREF(__pyx_t_16);
8672  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_16, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
8673  __Pyx_GOTREF(__pyx_t_1);
8674  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8675 
8676  /* "Isosurface.pyx":310
8677  * nodes[-2] - nodes[-3],
8678  * nodes[-1] - nodes[-3]) < 0.0:
8679  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
8680  * elements[-1][2],
8681  * elements[-1][1]]
8682  */
8683  __pyx_t_16 = PyList_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 310, __pyx_L1_error)
8684  __Pyx_GOTREF(__pyx_t_16);
8685  __Pyx_GIVEREF(__pyx_t_15);
8686  PyList_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
8687  __Pyx_GIVEREF(__pyx_t_5);
8688  PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
8689  __Pyx_GIVEREF(__pyx_t_1);
8690  PyList_SET_ITEM(__pyx_t_16, 2, __pyx_t_1);
8691  __pyx_t_15 = 0;
8692  __pyx_t_5 = 0;
8693  __pyx_t_1 = 0;
8694  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_16, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 310, __pyx_L1_error)
8695  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8696 
8697  /* "Isosurface.pyx":307
8698  * nodes.append(x)
8699  * elements.append([nN_start + j for j in range(3)])
8700  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8701  * nodes[-2] - nodes[-3],
8702  * nodes[-1] - nodes[-3]) < 0.0:
8703  */
8704  }
8705 
8706  /* "Isosurface.pyx":314
8707  * elements[-1][1]]
8708  * normal = ecross(
8709  * nodes[elements[-1][1]] - nodes[elements[-1][0]], # <<<<<<<<<<<<<<
8710  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8711  * normal /= enorm(normal)
8712  */
8713  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 314, __pyx_L1_error)
8714  __Pyx_GOTREF(__pyx_t_16);
8715  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_16, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
8716  __Pyx_GOTREF(__pyx_t_1);
8717  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8718  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 314, __pyx_L1_error)
8719  __Pyx_GOTREF(__pyx_t_16);
8720  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8721  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
8722  __Pyx_GOTREF(__pyx_t_1);
8723  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 314, __pyx_L1_error)
8724  __Pyx_GOTREF(__pyx_t_5);
8725  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8726  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
8727  __Pyx_GOTREF(__pyx_t_1);
8728  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8729  __pyx_t_5 = PyNumber_Subtract(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 314, __pyx_L1_error)
8730  __Pyx_GOTREF(__pyx_t_5);
8731  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8732  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8733  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 314, __pyx_L1_error)
8734 
8735  /* "Isosurface.pyx":315
8736  * normal = ecross(
8737  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8738  * nodes[elements[-1][2]] - nodes[elements[-1][0]]) # <<<<<<<<<<<<<<
8739  * normal /= enorm(normal)
8740  * normals.append(normal)
8741  */
8742  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
8743  __Pyx_GOTREF(__pyx_t_1);
8744  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 315, __pyx_L1_error)
8745  __Pyx_GOTREF(__pyx_t_16);
8746  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8747  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
8748  __Pyx_GOTREF(__pyx_t_1);
8749  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8750  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 315, __pyx_L1_error)
8751  __Pyx_GOTREF(__pyx_t_16);
8752  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 315, __pyx_L1_error)
8753  __Pyx_GOTREF(__pyx_t_15);
8754  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8755  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 315, __pyx_L1_error)
8756  __Pyx_GOTREF(__pyx_t_16);
8757  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8758  __pyx_t_15 = PyNumber_Subtract(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 315, __pyx_L1_error)
8759  __Pyx_GOTREF(__pyx_t_15);
8760  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8761  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8762  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 315, __pyx_L1_error)
8763 
8764  /* "Isosurface.pyx":313
8765  * elements[-1][2],
8766  * elements[-1][1]]
8767  * normal = ecross( # <<<<<<<<<<<<<<
8768  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8769  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8770  */
8771  __pyx_t_16 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_5), ((PyArrayObject *)__pyx_t_15))); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 313, __pyx_L1_error)
8772  __Pyx_GOTREF(__pyx_t_16);
8773  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8774  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8775  {
8776  __Pyx_BufFmt_StackElem __pyx_stack[1];
8777  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
8778  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_16), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
8779  if (unlikely(__pyx_t_9 < 0)) {
8780  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
8781  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
8782  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
8783  __Pyx_RaiseBufferFallbackError();
8784  } else {
8785  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
8786  }
8787  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
8788  }
8789  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
8790  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 313, __pyx_L1_error)
8791  }
8792  __Pyx_XDECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_16));
8793  __pyx_t_16 = 0;
8794 
8795  /* "Isosurface.pyx":316
8796  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
8797  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8798  * normal /= enorm(normal) # <<<<<<<<<<<<<<
8799  * normals.append(normal)
8800  * normals.append(normal)
8801  */
8802  __pyx_t_16 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 316, __pyx_L1_error)
8803  __Pyx_GOTREF(__pyx_t_16);
8804  __pyx_t_15 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 316, __pyx_L1_error)
8805  __Pyx_GOTREF(__pyx_t_15);
8806  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8807  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 316, __pyx_L1_error)
8808  __pyx_t_18 = ((PyArrayObject *)__pyx_t_15);
8809  {
8810  __Pyx_BufFmt_StackElem __pyx_stack[1];
8811  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
8812  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
8813  if (unlikely(__pyx_t_9 < 0)) {
8814  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
8815  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
8816  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
8817  __Pyx_RaiseBufferFallbackError();
8818  } else {
8819  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
8820  }
8821  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
8822  }
8823  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
8824  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 316, __pyx_L1_error)
8825  }
8826  __pyx_t_18 = 0;
8827  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_15));
8828  __pyx_t_15 = 0;
8829 
8830  /* "Isosurface.pyx":317
8831  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
8832  * normal /= enorm(normal)
8833  * normals.append(normal) # <<<<<<<<<<<<<<
8834  * normals.append(normal)
8835  * normals.append(normal)
8836  */
8837  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 317, __pyx_L1_error)
8838 
8839  /* "Isosurface.pyx":318
8840  * normal /= enorm(normal)
8841  * normals.append(normal)
8842  * normals.append(normal) # <<<<<<<<<<<<<<
8843  * normals.append(normal)
8844  * normal_indices.append(elements[-1])
8845  */
8846  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 318, __pyx_L1_error)
8847 
8848  /* "Isosurface.pyx":319
8849  * normals.append(normal)
8850  * normals.append(normal)
8851  * normals.append(normal) # <<<<<<<<<<<<<<
8852  * normal_indices.append(elements[-1])
8853  * elif nZeros == 3: # 3 vertices lie in plane
8854  */
8855  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 319, __pyx_L1_error)
8856 
8857  /* "Isosurface.pyx":320
8858  * normals.append(normal)
8859  * normals.append(normal)
8860  * normal_indices.append(elements[-1]) # <<<<<<<<<<<<<<
8861  * elif nZeros == 3: # 3 vertices lie in plane
8862  * for I in zeros:
8863  */
8864  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 320, __pyx_L1_error)
8865  __Pyx_GOTREF(__pyx_t_15);
8866  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 320, __pyx_L1_error)
8867  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8868 
8869  /* "Isosurface.pyx":296
8870  * normals.append(normal)
8871  * normal_indices.append(elements[-1])
8872  * elif nZeros == 2 and nPlus == 1 and nMinus == 1: # <<<<<<<<<<<<<<
8873  * # 1 cut edge, 2 vertices lie in plane
8874  * for I in zeros:
8875  */
8876  goto __pyx_L9;
8877  }
8878 
8879  /* "Isosurface.pyx":321
8880  * normals.append(normal)
8881  * normal_indices.append(elements[-1])
8882  * elif nZeros == 3: # 3 vertices lie in plane # <<<<<<<<<<<<<<
8883  * for I in zeros:
8884  * nodes.append(self.nodeArray[I])
8885  */
8886  __pyx_t_4 = ((__pyx_v_nZeros == 3) != 0);
8887  if (__pyx_t_4) {
8888 
8889  /* "Isosurface.pyx":322
8890  * normal_indices.append(elements[-1])
8891  * elif nZeros == 3: # 3 vertices lie in plane
8892  * for I in zeros: # <<<<<<<<<<<<<<
8893  * nodes.append(self.nodeArray[I])
8894  * elements.append([nN_start + j for j in range(3)])
8895  */
8896  __pyx_t_15 = __pyx_v_zeros; __Pyx_INCREF(__pyx_t_15); __pyx_t_12 = 0;
8897  for (;;) {
8898  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_15)) break;
8899  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8900  __pyx_t_16 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_16); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 322, __pyx_L1_error)
8901  #else
8902  __pyx_t_16 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 322, __pyx_L1_error)
8903  __Pyx_GOTREF(__pyx_t_16);
8904  #endif
8905  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error)
8906  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8907  __pyx_v_I = __pyx_t_9;
8908 
8909  /* "Isosurface.pyx":323
8910  * elif nZeros == 3: # 3 vertices lie in plane
8911  * for I in zeros:
8912  * nodes.append(self.nodeArray[I]) # <<<<<<<<<<<<<<
8913  * elements.append([nN_start + j for j in range(3)])
8914  * if nPlus == 1:
8915  */
8916  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 323, __pyx_L1_error)
8917  __Pyx_GOTREF(__pyx_t_16);
8918  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_16, __pyx_v_I, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
8919  __Pyx_GOTREF(__pyx_t_5);
8920  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8921  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_5); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 323, __pyx_L1_error)
8922  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8923 
8924  /* "Isosurface.pyx":322
8925  * normal_indices.append(elements[-1])
8926  * elif nZeros == 3: # 3 vertices lie in plane
8927  * for I in zeros: # <<<<<<<<<<<<<<
8928  * nodes.append(self.nodeArray[I])
8929  * elements.append([nN_start + j for j in range(3)])
8930  */
8931  }
8932  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8933 
8934  /* "Isosurface.pyx":324
8935  * for I in zeros:
8936  * nodes.append(self.nodeArray[I])
8937  * elements.append([nN_start + j for j in range(3)]) # <<<<<<<<<<<<<<
8938  * if nPlus == 1:
8939  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8940  */
8941  __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 324, __pyx_L1_error)
8942  __Pyx_GOTREF(__pyx_t_15);
8943  for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
8944  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 324, __pyx_L1_error)
8945  __Pyx_GOTREF(__pyx_t_5);
8946  __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5);
8947  __pyx_t_5 = 0;
8948  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nN_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 324, __pyx_L1_error)
8949  __Pyx_GOTREF(__pyx_t_5);
8950  __pyx_t_16 = PyNumber_Add(__pyx_t_5, __pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 324, __pyx_L1_error)
8951  __Pyx_GOTREF(__pyx_t_16);
8952  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8953  if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 324, __pyx_L1_error)
8954  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8955  }
8956  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_elements, __pyx_t_15); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 324, __pyx_L1_error)
8957  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8958 
8959  /* "Isosurface.pyx":325
8960  * nodes.append(self.nodeArray[I])
8961  * elements.append([nN_start + j for j in range(3)])
8962  * if nPlus == 1: # <<<<<<<<<<<<<<
8963  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8964  * nodes[-2] - nodes[-3],
8965  */
8966  __pyx_t_4 = ((__pyx_v_nPlus == 1) != 0);
8967  if (__pyx_t_4) {
8968 
8969  /* "Isosurface.pyx":326
8970  * elements.append([nN_start + j for j in range(3)])
8971  * if nPlus == 1:
8972  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
8973  * nodes[-2] - nodes[-3],
8974  * nodes[-1] - nodes[-3]) < 0.0:
8975  */
8976  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 326, __pyx_L1_error)
8977  __Pyx_GOTREF(__pyx_t_15);
8978  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_plus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 326, __pyx_L1_error)
8979  __Pyx_GOTREF(__pyx_t_16);
8980  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error)
8981  __Pyx_GOTREF(__pyx_t_5);
8982  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8983  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8984  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 326, __pyx_L1_error)
8985  __Pyx_GOTREF(__pyx_t_16);
8986  __pyx_t_15 = PyNumber_Subtract(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 326, __pyx_L1_error)
8987  __Pyx_GOTREF(__pyx_t_15);
8988  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8989  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8990  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 326, __pyx_L1_error)
8991 
8992  /* "Isosurface.pyx":327
8993  * if nPlus == 1:
8994  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
8995  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
8996  * nodes[-1] - nodes[-3]) < 0.0:
8997  * elements[-1] = [elements[-1][0],
8998  */
8999  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 327, __pyx_L1_error)
9000  __Pyx_GOTREF(__pyx_t_16);
9001  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
9002  __Pyx_GOTREF(__pyx_t_5);
9003  __pyx_t_1 = PyNumber_Subtract(__pyx_t_16, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
9004  __Pyx_GOTREF(__pyx_t_1);
9005  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9006  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9007  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 327, __pyx_L1_error)
9008 
9009  /* "Isosurface.pyx":328
9010  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
9011  * nodes[-2] - nodes[-3],
9012  * nodes[-1] - nodes[-3]) < 0.0: # <<<<<<<<<<<<<<
9013  * elements[-1] = [elements[-1][0],
9014  * elements[-1][2],
9015  */
9016  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
9017  __Pyx_GOTREF(__pyx_t_5);
9018  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 328, __pyx_L1_error)
9019  __Pyx_GOTREF(__pyx_t_16);
9020  __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error)
9021  __Pyx_GOTREF(__pyx_t_2);
9022  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9023  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9024  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 328, __pyx_L1_error)
9025 
9026  /* "Isosurface.pyx":326
9027  * elements.append([nN_start + j for j in range(3)])
9028  * if nPlus == 1:
9029  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
9030  * nodes[-2] - nodes[-3],
9031  * nodes[-1] - nodes[-3]) < 0.0:
9032  */
9033  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_2)) < 0.0) != 0);
9034  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
9035  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9036  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9037  if (__pyx_t_4) {
9038 
9039  /* "Isosurface.pyx":329
9040  * nodes[-2] - nodes[-3],
9041  * nodes[-1] - nodes[-3]) < 0.0:
9042  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
9043  * elements[-1][2],
9044  * elements[-1][1]]
9045  */
9046  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
9047  __Pyx_GOTREF(__pyx_t_2);
9048  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
9049  __Pyx_GOTREF(__pyx_t_1);
9050  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9051 
9052  /* "Isosurface.pyx":330
9053  * nodes[-1] - nodes[-3]) < 0.0:
9054  * elements[-1] = [elements[-1][0],
9055  * elements[-1][2], # <<<<<<<<<<<<<<
9056  * elements[-1][1]]
9057  * else:
9058  */
9059  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
9060  __Pyx_GOTREF(__pyx_t_2);
9061  __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 330, __pyx_L1_error)
9062  __Pyx_GOTREF(__pyx_t_15);
9063  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9064 
9065  /* "Isosurface.pyx":331
9066  * elements[-1] = [elements[-1][0],
9067  * elements[-1][2],
9068  * elements[-1][1]] # <<<<<<<<<<<<<<
9069  * else:
9070  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
9071  */
9072  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
9073  __Pyx_GOTREF(__pyx_t_2);
9074  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 331, __pyx_L1_error)
9075  __Pyx_GOTREF(__pyx_t_16);
9076  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9077 
9078  /* "Isosurface.pyx":329
9079  * nodes[-2] - nodes[-3],
9080  * nodes[-1] - nodes[-3]) < 0.0:
9081  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
9082  * elements[-1][2],
9083  * elements[-1][1]]
9084  */
9085  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
9086  __Pyx_GOTREF(__pyx_t_2);
9087  __Pyx_GIVEREF(__pyx_t_1);
9088  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
9089  __Pyx_GIVEREF(__pyx_t_15);
9090  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_15);
9091  __Pyx_GIVEREF(__pyx_t_16);
9092  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_16);
9093  __pyx_t_1 = 0;
9094  __pyx_t_15 = 0;
9095  __pyx_t_16 = 0;
9096  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 329, __pyx_L1_error)
9097  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9098 
9099  /* "Isosurface.pyx":326
9100  * elements.append([nN_start + j for j in range(3)])
9101  * if nPlus == 1:
9102  * if etriple(self.nodeArray[plus[0]] - nodes[-3], # <<<<<<<<<<<<<<
9103  * nodes[-2] - nodes[-3],
9104  * nodes[-1] - nodes[-3]) < 0.0:
9105  */
9106  }
9107 
9108  /* "Isosurface.pyx":325
9109  * nodes.append(self.nodeArray[I])
9110  * elements.append([nN_start + j for j in range(3)])
9111  * if nPlus == 1: # <<<<<<<<<<<<<<
9112  * if etriple(self.nodeArray[plus[0]] - nodes[-3],
9113  * nodes[-2] - nodes[-3],
9114  */
9115  goto __pyx_L60;
9116  }
9117 
9118  /* "Isosurface.pyx":333
9119  * elements[-1][1]]
9120  * else:
9121  * if etriple(self.nodeArray[minus[0]] - nodes[-3], # <<<<<<<<<<<<<<
9122  * nodes[-2] - nodes[-3],
9123  * nodes[-1] - nodes[-3]) > 0.0:
9124  */
9125  /*else*/ {
9126  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
9127  __Pyx_GOTREF(__pyx_t_2);
9128  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_minus, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 333, __pyx_L1_error)
9129  __Pyx_GOTREF(__pyx_t_16);
9130  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 333, __pyx_L1_error)
9131  __Pyx_GOTREF(__pyx_t_15);
9132  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9133  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9134  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 333, __pyx_L1_error)
9135  __Pyx_GOTREF(__pyx_t_16);
9136  __pyx_t_2 = PyNumber_Subtract(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
9137  __Pyx_GOTREF(__pyx_t_2);
9138  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
9139  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9140  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
9141 
9142  /* "Isosurface.pyx":334
9143  * else:
9144  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
9145  * nodes[-2] - nodes[-3], # <<<<<<<<<<<<<<
9146  * nodes[-1] - nodes[-3]) > 0.0:
9147  * elements[-1] = [elements[-1][0],
9148  */
9149  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 334, __pyx_L1_error)
9150  __Pyx_GOTREF(__pyx_t_16);
9151  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 334, __pyx_L1_error)
9152  __Pyx_GOTREF(__pyx_t_15);
9153  __pyx_t_1 = PyNumber_Subtract(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
9154  __Pyx_GOTREF(__pyx_t_1);
9155  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9156  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
9157  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 334, __pyx_L1_error)
9158 
9159  /* "Isosurface.pyx":335
9160  * if etriple(self.nodeArray[minus[0]] - nodes[-3],
9161  * nodes[-2] - nodes[-3],
9162  * nodes[-1] - nodes[-3]) > 0.0: # <<<<<<<<<<<<<<
9163  * elements[-1] = [elements[-1][0],
9164  * elements[-1][2],
9165  */
9166  __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_nodes, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 335, __pyx_L1_error)
9167  __Pyx_GOTREF(__pyx_t_15);
9168  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_nodes, -3L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 335, __pyx_L1_error)
9169  __Pyx_GOTREF(__pyx_t_16);
9170  __pyx_t_5 = PyNumber_Subtract(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error)
9171  __Pyx_GOTREF(__pyx_t_5);
9172  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
9173  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9174  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 335, __pyx_L1_error)
9175 
9176  /* "Isosurface.pyx":333
9177  * elements[-1][1]]
9178  * else:
9179  * if etriple(self.nodeArray[minus[0]] - nodes[-3], # <<<<<<<<<<<<<<
9180  * nodes[-2] - nodes[-3],
9181  * nodes[-1] - nodes[-3]) > 0.0:
9182  */
9183  __pyx_t_4 = ((__pyx_f_10Isosurface_etriple(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_5)) > 0.0) != 0);
9184  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9185  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9186  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9187  if (__pyx_t_4) {
9188 
9189  /* "Isosurface.pyx":336
9190  * nodes[-2] - nodes[-3],
9191  * nodes[-1] - nodes[-3]) > 0.0:
9192  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
9193  * elements[-1][2],
9194  * elements[-1][1]]
9195  */
9196  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
9197  __Pyx_GOTREF(__pyx_t_5);
9198  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
9199  __Pyx_GOTREF(__pyx_t_1);
9200  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9201 
9202  /* "Isosurface.pyx":337
9203  * nodes[-1] - nodes[-3]) > 0.0:
9204  * elements[-1] = [elements[-1][0],
9205  * elements[-1][2], # <<<<<<<<<<<<<<
9206  * elements[-1][1]]
9207  * normal = ecross(
9208  */
9209  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error)
9210  __Pyx_GOTREF(__pyx_t_5);
9211  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error)
9212  __Pyx_GOTREF(__pyx_t_2);
9213  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9214 
9215  /* "Isosurface.pyx":338
9216  * elements[-1] = [elements[-1][0],
9217  * elements[-1][2],
9218  * elements[-1][1]] # <<<<<<<<<<<<<<
9219  * normal = ecross(
9220  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
9221  */
9222  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
9223  __Pyx_GOTREF(__pyx_t_5);
9224  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 338, __pyx_L1_error)
9225  __Pyx_GOTREF(__pyx_t_16);
9226  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9227 
9228  /* "Isosurface.pyx":336
9229  * nodes[-2] - nodes[-3],
9230  * nodes[-1] - nodes[-3]) > 0.0:
9231  * elements[-1] = [elements[-1][0], # <<<<<<<<<<<<<<
9232  * elements[-1][2],
9233  * elements[-1][1]]
9234  */
9235  __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
9236  __Pyx_GOTREF(__pyx_t_5);
9237  __Pyx_GIVEREF(__pyx_t_1);
9238  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
9239  __Pyx_GIVEREF(__pyx_t_2);
9240  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
9241  __Pyx_GIVEREF(__pyx_t_16);
9242  PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_16);
9243  __pyx_t_1 = 0;
9244  __pyx_t_2 = 0;
9245  __pyx_t_16 = 0;
9246  if (unlikely(__Pyx_SetItemInt(__pyx_v_elements, -1L, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 1, 1, 1) < 0)) __PYX_ERR(0, 336, __pyx_L1_error)
9247  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9248 
9249  /* "Isosurface.pyx":333
9250  * elements[-1][1]]
9251  * else:
9252  * if etriple(self.nodeArray[minus[0]] - nodes[-3], # <<<<<<<<<<<<<<
9253  * nodes[-2] - nodes[-3],
9254  * nodes[-1] - nodes[-3]) > 0.0:
9255  */
9256  }
9257  }
9258  __pyx_L60:;
9259 
9260  /* "Isosurface.pyx":340
9261  * elements[-1][1]]
9262  * normal = ecross(
9263  * nodes[elements[-1][1]] - nodes[elements[-1][0]], # <<<<<<<<<<<<<<
9264  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
9265  * normal /= enorm(normal)
9266  */
9267  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 340, __pyx_L1_error)
9268  __Pyx_GOTREF(__pyx_t_5);
9269  __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 340, __pyx_L1_error)
9270  __Pyx_GOTREF(__pyx_t_16);
9271  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9272  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 340, __pyx_L1_error)
9273  __Pyx_GOTREF(__pyx_t_5);
9274  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9275  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 340, __pyx_L1_error)
9276  __Pyx_GOTREF(__pyx_t_16);
9277  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_16, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
9278  __Pyx_GOTREF(__pyx_t_2);
9279  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9280  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 340, __pyx_L1_error)
9281  __Pyx_GOTREF(__pyx_t_16);
9282  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9283  __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
9284  __Pyx_GOTREF(__pyx_t_2);
9285  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9286  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9287  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 340, __pyx_L1_error)
9288 
9289  /* "Isosurface.pyx":341
9290  * normal = ecross(
9291  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
9292  * nodes[elements[-1][2]] - nodes[elements[-1][0]]) # <<<<<<<<<<<<<<
9293  * normal /= enorm(normal)
9294  * normals.append(normal)
9295  */
9296  __pyx_t_16 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 341, __pyx_L1_error)
9297  __Pyx_GOTREF(__pyx_t_16);
9298  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_16, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error)
9299  __Pyx_GOTREF(__pyx_t_5);
9300  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9301  __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 341, __pyx_L1_error)
9302  __Pyx_GOTREF(__pyx_t_16);
9303  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9304  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error)
9305  __Pyx_GOTREF(__pyx_t_5);
9306  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
9307  __Pyx_GOTREF(__pyx_t_1);
9308  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9309  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_nodes, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 341, __pyx_L1_error)
9310  __Pyx_GOTREF(__pyx_t_5);
9311  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9312  __pyx_t_1 = PyNumber_Subtract(__pyx_t_16, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
9313  __Pyx_GOTREF(__pyx_t_1);
9314  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
9315  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9316  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 341, __pyx_L1_error)
9317 
9318  /* "Isosurface.pyx":339
9319  * elements[-1][2],
9320  * elements[-1][1]]
9321  * normal = ecross( # <<<<<<<<<<<<<<
9322  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
9323  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
9324  */
9325  __pyx_t_5 = ((PyObject *)__pyx_f_10Isosurface_ecross(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 339, __pyx_L1_error)
9326  __Pyx_GOTREF(__pyx_t_5);
9327  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9328  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9329  {
9330  __Pyx_BufFmt_StackElem __pyx_stack[1];
9331  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
9332  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_5), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
9333  if (unlikely(__pyx_t_9 < 0)) {
9334  PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
9335  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
9336  Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
9337  __Pyx_RaiseBufferFallbackError();
9338  } else {
9339  PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
9340  }
9341  __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
9342  }
9343  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
9344  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 339, __pyx_L1_error)
9345  }
9346  __Pyx_XDECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_5));
9347  __pyx_t_5 = 0;
9348 
9349  /* "Isosurface.pyx":342
9350  * nodes[elements[-1][1]] - nodes[elements[-1][0]],
9351  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
9352  * normal /= enorm(normal) # <<<<<<<<<<<<<<
9353  * normals.append(normal)
9354  * normals.append(normal)
9355  */
9356  __pyx_t_5 = PyFloat_FromDouble(__pyx_f_10Isosurface_enorm(((PyArrayObject *)__pyx_v_normal))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 342, __pyx_L1_error)
9357  __Pyx_GOTREF(__pyx_t_5);
9358  __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_normal), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
9359  __Pyx_GOTREF(__pyx_t_1);
9360  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9361  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 342, __pyx_L1_error)
9362  __pyx_t_18 = ((PyArrayObject *)__pyx_t_1);
9363  {
9364  __Pyx_BufFmt_StackElem __pyx_stack[1];
9365  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
9366  __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
9367  if (unlikely(__pyx_t_9 < 0)) {
9368  PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
9369  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_normal.rcbuffer->pybuffer, (PyObject*)__pyx_v_normal, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
9370  Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
9371  __Pyx_RaiseBufferFallbackError();
9372  } else {
9373  PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
9374  }
9375  __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
9376  }
9377  __pyx_pybuffernd_normal.diminfo[0].strides = __pyx_pybuffernd_normal.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_normal.diminfo[0].shape = __pyx_pybuffernd_normal.rcbuffer->pybuffer.shape[0];
9378  if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 342, __pyx_L1_error)
9379  }
9380  __pyx_t_18 = 0;
9381  __Pyx_DECREF_SET(__pyx_v_normal, ((PyArrayObject *)__pyx_t_1));
9382  __pyx_t_1 = 0;
9383 
9384  /* "Isosurface.pyx":343
9385  * nodes[elements[-1][2]] - nodes[elements[-1][0]])
9386  * normal /= enorm(normal)
9387  * normals.append(normal) # <<<<<<<<<<<<<<
9388  * normals.append(normal)
9389  * normals.append(normal)
9390  */
9391  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 343, __pyx_L1_error)
9392 
9393  /* "Isosurface.pyx":344
9394  * normal /= enorm(normal)
9395  * normals.append(normal)
9396  * normals.append(normal) # <<<<<<<<<<<<<<
9397  * normals.append(normal)
9398  * normal_indices.append(elements[-1])
9399  */
9400  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 344, __pyx_L1_error)
9401 
9402  /* "Isosurface.pyx":345
9403  * normals.append(normal)
9404  * normals.append(normal)
9405  * normals.append(normal) # <<<<<<<<<<<<<<
9406  * normal_indices.append(elements[-1])
9407  *
9408  */
9409  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normals, ((PyObject *)__pyx_v_normal)); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 345, __pyx_L1_error)
9410 
9411  /* "Isosurface.pyx":346
9412  * normals.append(normal)
9413  * normals.append(normal)
9414  * normal_indices.append(elements[-1]) # <<<<<<<<<<<<<<
9415  *
9416  * def writeIsosurfaceMesh(self, field, value, frame):
9417  */
9418  __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_elements, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
9419  __Pyx_GOTREF(__pyx_t_1);
9420  __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_normal_indices, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 346, __pyx_L1_error)
9421  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9422 
9423  /* "Isosurface.pyx":321
9424  * normals.append(normal)
9425  * normal_indices.append(elements[-1])
9426  * elif nZeros == 3: # 3 vertices lie in plane # <<<<<<<<<<<<<<
9427  * for I in zeros:
9428  * nodes.append(self.nodeArray[I])
9429  */
9430  }
9431  __pyx_L9:;
9432  }
9433 
9434  /* "Isosurface.pyx":158
9435  * return self
9436  *
9437  * def triangulateIsosurface(self, field, value): # <<<<<<<<<<<<<<
9438  * """
9439  * Build a triangular mesh of the isosurface
9440  */
9441 
9442  /* function exit code */
9443  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9444  goto __pyx_L0;
9445  __pyx_L1_error:;
9446  __Pyx_XDECREF(__pyx_t_1);
9447  __Pyx_XDECREF(__pyx_t_2);
9448  __Pyx_XDECREF(__pyx_t_3);
9449  __Pyx_XDECREF(__pyx_t_5);
9450  __Pyx_XDECREF(__pyx_t_15);
9451  __Pyx_XDECREF(__pyx_t_16);
9452  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9453  __Pyx_PyThreadState_declare
9454  __Pyx_PyThreadState_assign
9455  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9456  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
9457  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
9458  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9459  __Pyx_AddTraceback("Isosurface.Isosurface.triangulateIsosurface", __pyx_clineno, __pyx_lineno, __pyx_filename);
9460  __pyx_r = NULL;
9461  goto __pyx_L2;
9462  __pyx_L0:;
9463  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_normal.rcbuffer->pybuffer);
9464  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
9465  __pyx_L2:;
9466  __Pyx_XDECREF((PyObject *)__pyx_v_x);
9467  __Pyx_XDECREF((PyObject *)__pyx_v_normal);
9468  __Pyx_XDECREF(__pyx_v_nodes);
9469  __Pyx_XDECREF(__pyx_v_elements);
9470  __Pyx_XDECREF(__pyx_v_normals);
9471  __Pyx_XDECREF(__pyx_v_normal_indices);
9472  __Pyx_XDECREF(__pyx_v_phi);
9473  __Pyx_XDECREF(__pyx_v_plus);
9474  __Pyx_XDECREF(__pyx_v_minus);
9475  __Pyx_XDECREF(__pyx_v_zeros);
9476  __Pyx_XDECREF(__pyx_v_j);
9477  __Pyx_XGIVEREF(__pyx_r);
9478  __Pyx_RefNannyFinishContext();
9479  return __pyx_r;
9480 }
9481 
9482 /* "Isosurface.pyx":348
9483  * normal_indices.append(elements[-1])
9484  *
9485  * def writeIsosurfaceMesh(self, field, value, frame): # <<<<<<<<<<<<<<
9486  * if self.format == 'pov':
9487  * log("Writing pov frame " + repr(frame))
9488  */
9489 
9490 /* Python wrapper */
9491 static PyObject *__pyx_pw_10Isosurface_10Isosurface_9writeIsosurfaceMesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9492 static char __pyx_doc_10Isosurface_10Isosurface_8writeIsosurfaceMesh[] = "Isosurface.writeIsosurfaceMesh(self, field, value, frame)";
9493 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_9writeIsosurfaceMesh = {"writeIsosurfaceMesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_9writeIsosurfaceMesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_8writeIsosurfaceMesh};
9494 static PyObject *__pyx_pw_10Isosurface_10Isosurface_9writeIsosurfaceMesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9495  PyObject *__pyx_v_self = 0;
9496  PyObject *__pyx_v_field = 0;
9497  PyObject *__pyx_v_value = 0;
9498  PyObject *__pyx_v_frame = 0;
9499  int __pyx_lineno = 0;
9500  const char *__pyx_filename = NULL;
9501  int __pyx_clineno = 0;
9502  PyObject *__pyx_r = 0;
9503  __Pyx_RefNannyDeclarations
9504  __Pyx_RefNannySetupContext("writeIsosurfaceMesh (wrapper)", 0);
9505  {
9506  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_field,&__pyx_n_s_value,&__pyx_n_s_frame,0};
9507  PyObject* values[4] = {0,0,0,0};
9508  if (unlikely(__pyx_kwds)) {
9509  Py_ssize_t kw_args;
9510  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9511  switch (pos_args) {
9512  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9513  CYTHON_FALLTHROUGH;
9514  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9515  CYTHON_FALLTHROUGH;
9516  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9517  CYTHON_FALLTHROUGH;
9518  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9519  CYTHON_FALLTHROUGH;
9520  case 0: break;
9521  default: goto __pyx_L5_argtuple_error;
9522  }
9523  kw_args = PyDict_Size(__pyx_kwds);
9524  switch (pos_args) {
9525  case 0:
9526  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
9527  else goto __pyx_L5_argtuple_error;
9528  CYTHON_FALLTHROUGH;
9529  case 1:
9530  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
9531  else {
9532  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh", 1, 4, 4, 1); __PYX_ERR(0, 348, __pyx_L3_error)
9533  }
9534  CYTHON_FALLTHROUGH;
9535  case 2:
9536  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
9537  else {
9538  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh", 1, 4, 4, 2); __PYX_ERR(0, 348, __pyx_L3_error)
9539  }
9540  CYTHON_FALLTHROUGH;
9541  case 3:
9542  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
9543  else {
9544  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh", 1, 4, 4, 3); __PYX_ERR(0, 348, __pyx_L3_error)
9545  }
9546  }
9547  if (unlikely(kw_args > 0)) {
9548  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeIsosurfaceMesh") < 0)) __PYX_ERR(0, 348, __pyx_L3_error)
9549  }
9550  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
9551  goto __pyx_L5_argtuple_error;
9552  } else {
9553  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9554  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9555  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9556  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9557  }
9558  __pyx_v_self = values[0];
9559  __pyx_v_field = values[1];
9560  __pyx_v_value = values[2];
9561  __pyx_v_frame = values[3];
9562  }
9563  goto __pyx_L4_argument_unpacking_done;
9564  __pyx_L5_argtuple_error:;
9565  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 348, __pyx_L3_error)
9566  __pyx_L3_error:;
9567  __Pyx_AddTraceback("Isosurface.Isosurface.writeIsosurfaceMesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
9568  __Pyx_RefNannyFinishContext();
9569  return NULL;
9570  __pyx_L4_argument_unpacking_done:;
9571  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_8writeIsosurfaceMesh(__pyx_self, __pyx_v_self, __pyx_v_field, __pyx_v_value, __pyx_v_frame);
9572 
9573  /* function exit code */
9574  __Pyx_RefNannyFinishContext();
9575  return __pyx_r;
9576 }
9577 
9578 static PyObject *__pyx_pf_10Isosurface_10Isosurface_8writeIsosurfaceMesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value, PyObject *__pyx_v_frame) {
9579  PyObject *__pyx_r = NULL;
9580  __Pyx_RefNannyDeclarations
9581  PyObject *__pyx_t_1 = NULL;
9582  int __pyx_t_2;
9583  PyObject *__pyx_t_3 = NULL;
9584  PyObject *__pyx_t_4 = NULL;
9585  PyObject *__pyx_t_5 = NULL;
9586  int __pyx_t_6;
9587  int __pyx_t_7;
9588  int __pyx_lineno = 0;
9589  const char *__pyx_filename = NULL;
9590  int __pyx_clineno = 0;
9591  __Pyx_RefNannySetupContext("writeIsosurfaceMesh", 0);
9592 
9593  /* "Isosurface.pyx":349
9594  *
9595  * def writeIsosurfaceMesh(self, field, value, frame):
9596  * if self.format == 'pov': # <<<<<<<<<<<<<<
9597  * log("Writing pov frame " + repr(frame))
9598  * self.writeIsosurfaceMesh_povray(field, value, frame)
9599  */
9600  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error)
9601  __Pyx_GOTREF(__pyx_t_1);
9602  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_pov, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 349, __pyx_L1_error)
9603  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9604  if (__pyx_t_2) {
9605 
9606  /* "Isosurface.pyx":350
9607  * def writeIsosurfaceMesh(self, field, value, frame):
9608  * if self.format == 'pov':
9609  * log("Writing pov frame " + repr(frame)) # <<<<<<<<<<<<<<
9610  * self.writeIsosurfaceMesh_povray(field, value, frame)
9611  * elif self.format == 'h5':
9612  */
9613  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error)
9614  __Pyx_GOTREF(__pyx_t_3);
9615  __pyx_t_4 = PyObject_Repr(__pyx_v_frame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error)
9616  __Pyx_GOTREF(__pyx_t_4);
9617  __pyx_t_5 = PyNumber_Add(__pyx_kp_s_Writing_pov_frame, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L1_error)
9618  __Pyx_GOTREF(__pyx_t_5);
9619  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9620  __pyx_t_4 = NULL;
9621  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9622  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9623  if (likely(__pyx_t_4)) {
9624  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9625  __Pyx_INCREF(__pyx_t_4);
9626  __Pyx_INCREF(function);
9627  __Pyx_DECREF_SET(__pyx_t_3, function);
9628  }
9629  }
9630  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
9631  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9632  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9633  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
9634  __Pyx_GOTREF(__pyx_t_1);
9635  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9636  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9637 
9638  /* "Isosurface.pyx":351
9639  * if self.format == 'pov':
9640  * log("Writing pov frame " + repr(frame))
9641  * self.writeIsosurfaceMesh_povray(field, value, frame) # <<<<<<<<<<<<<<
9642  * elif self.format == 'h5':
9643  * self.writeIsosurfaceMesh_h5(field, value, frame)
9644  */
9645  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeIsosurfaceMesh_povray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error)
9646  __Pyx_GOTREF(__pyx_t_3);
9647  __pyx_t_5 = NULL;
9648  __pyx_t_6 = 0;
9649  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9650  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
9651  if (likely(__pyx_t_5)) {
9652  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9653  __Pyx_INCREF(__pyx_t_5);
9654  __Pyx_INCREF(function);
9655  __Pyx_DECREF_SET(__pyx_t_3, function);
9656  __pyx_t_6 = 1;
9657  }
9658  }
9659  #if CYTHON_FAST_PYCALL
9660  if (PyFunction_Check(__pyx_t_3)) {
9661  PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_field, __pyx_v_value, __pyx_v_frame};
9662  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
9663  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9664  __Pyx_GOTREF(__pyx_t_1);
9665  } else
9666  #endif
9667  #if CYTHON_FAST_PYCCALL
9668  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
9669  PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_field, __pyx_v_value, __pyx_v_frame};
9670  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
9671  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9672  __Pyx_GOTREF(__pyx_t_1);
9673  } else
9674  #endif
9675  {
9676  __pyx_t_4 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error)
9677  __Pyx_GOTREF(__pyx_t_4);
9678  if (__pyx_t_5) {
9679  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
9680  }
9681  __Pyx_INCREF(__pyx_v_field);
9682  __Pyx_GIVEREF(__pyx_v_field);
9683  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_field);
9684  __Pyx_INCREF(__pyx_v_value);
9685  __Pyx_GIVEREF(__pyx_v_value);
9686  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_value);
9687  __Pyx_INCREF(__pyx_v_frame);
9688  __Pyx_GIVEREF(__pyx_v_frame);
9689  PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_frame);
9690  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
9691  __Pyx_GOTREF(__pyx_t_1);
9692  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9693  }
9694  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9695  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9696 
9697  /* "Isosurface.pyx":349
9698  *
9699  * def writeIsosurfaceMesh(self, field, value, frame):
9700  * if self.format == 'pov': # <<<<<<<<<<<<<<
9701  * log("Writing pov frame " + repr(frame))
9702  * self.writeIsosurfaceMesh_povray(field, value, frame)
9703  */
9704  goto __pyx_L3;
9705  }
9706 
9707  /* "Isosurface.pyx":352
9708  * log("Writing pov frame " + repr(frame))
9709  * self.writeIsosurfaceMesh_povray(field, value, frame)
9710  * elif self.format == 'h5': # <<<<<<<<<<<<<<
9711  * self.writeIsosurfaceMesh_h5(field, value, frame)
9712  * elif self.format is None:
9713  */
9714  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
9715  __Pyx_GOTREF(__pyx_t_1);
9716  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_h5, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 352, __pyx_L1_error)
9717  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9718  if (__pyx_t_2) {
9719 
9720  /* "Isosurface.pyx":353
9721  * self.writeIsosurfaceMesh_povray(field, value, frame)
9722  * elif self.format == 'h5':
9723  * self.writeIsosurfaceMesh_h5(field, value, frame) # <<<<<<<<<<<<<<
9724  * elif self.format is None:
9725  * pass
9726  */
9727  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeIsosurfaceMesh_h5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error)
9728  __Pyx_GOTREF(__pyx_t_3);
9729  __pyx_t_4 = NULL;
9730  __pyx_t_6 = 0;
9731  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9732  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9733  if (likely(__pyx_t_4)) {
9734  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9735  __Pyx_INCREF(__pyx_t_4);
9736  __Pyx_INCREF(function);
9737  __Pyx_DECREF_SET(__pyx_t_3, function);
9738  __pyx_t_6 = 1;
9739  }
9740  }
9741  #if CYTHON_FAST_PYCALL
9742  if (PyFunction_Check(__pyx_t_3)) {
9743  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_field, __pyx_v_value, __pyx_v_frame};
9744  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
9745  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9746  __Pyx_GOTREF(__pyx_t_1);
9747  } else
9748  #endif
9749  #if CYTHON_FAST_PYCCALL
9750  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
9751  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_field, __pyx_v_value, __pyx_v_frame};
9752  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
9753  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9754  __Pyx_GOTREF(__pyx_t_1);
9755  } else
9756  #endif
9757  {
9758  __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 353, __pyx_L1_error)
9759  __Pyx_GOTREF(__pyx_t_5);
9760  if (__pyx_t_4) {
9761  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
9762  }
9763  __Pyx_INCREF(__pyx_v_field);
9764  __Pyx_GIVEREF(__pyx_v_field);
9765  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_field);
9766  __Pyx_INCREF(__pyx_v_value);
9767  __Pyx_GIVEREF(__pyx_v_value);
9768  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_value);
9769  __Pyx_INCREF(__pyx_v_frame);
9770  __Pyx_GIVEREF(__pyx_v_frame);
9771  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_frame);
9772  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __pyx_L1_error)
9773  __Pyx_GOTREF(__pyx_t_1);
9774  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9775  }
9776  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9777  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9778 
9779  /* "Isosurface.pyx":352
9780  * log("Writing pov frame " + repr(frame))
9781  * self.writeIsosurfaceMesh_povray(field, value, frame)
9782  * elif self.format == 'h5': # <<<<<<<<<<<<<<
9783  * self.writeIsosurfaceMesh_h5(field, value, frame)
9784  * elif self.format is None:
9785  */
9786  goto __pyx_L3;
9787  }
9788 
9789  /* "Isosurface.pyx":354
9790  * elif self.format == 'h5':
9791  * self.writeIsosurfaceMesh_h5(field, value, frame)
9792  * elif self.format is None: # <<<<<<<<<<<<<<
9793  * pass
9794  * else:
9795  */
9796  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
9797  __Pyx_GOTREF(__pyx_t_1);
9798  __pyx_t_2 = (__pyx_t_1 == Py_None);
9799  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9800  __pyx_t_7 = (__pyx_t_2 != 0);
9801  if (__pyx_t_7) {
9802  goto __pyx_L3;
9803  }
9804 
9805  /* "Isosurface.pyx":357
9806  * pass
9807  * else:
9808  * log("Isosurface file format not recognized") # <<<<<<<<<<<<<<
9809  *
9810  * def writeIsosurfaceMesh_h5(self, field, value, frame):
9811  */
9812  /*else*/ {
9813  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
9814  __Pyx_GOTREF(__pyx_t_3);
9815  __pyx_t_5 = NULL;
9816  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9817  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
9818  if (likely(__pyx_t_5)) {
9819  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9820  __Pyx_INCREF(__pyx_t_5);
9821  __Pyx_INCREF(function);
9822  __Pyx_DECREF_SET(__pyx_t_3, function);
9823  }
9824  }
9825  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Isosurface_file_format_not_recog) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Isosurface_file_format_not_recog);
9826  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9827  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
9828  __Pyx_GOTREF(__pyx_t_1);
9829  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9830  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9831  }
9832  __pyx_L3:;
9833 
9834  /* "Isosurface.pyx":348
9835  * normal_indices.append(elements[-1])
9836  *
9837  * def writeIsosurfaceMesh(self, field, value, frame): # <<<<<<<<<<<<<<
9838  * if self.format == 'pov':
9839  * log("Writing pov frame " + repr(frame))
9840  */
9841 
9842  /* function exit code */
9843  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9844  goto __pyx_L0;
9845  __pyx_L1_error:;
9846  __Pyx_XDECREF(__pyx_t_1);
9847  __Pyx_XDECREF(__pyx_t_3);
9848  __Pyx_XDECREF(__pyx_t_4);
9849  __Pyx_XDECREF(__pyx_t_5);
9850  __Pyx_AddTraceback("Isosurface.Isosurface.writeIsosurfaceMesh", __pyx_clineno, __pyx_lineno, __pyx_filename);
9851  __pyx_r = NULL;
9852  __pyx_L0:;
9853  __Pyx_XGIVEREF(__pyx_r);
9854  __Pyx_RefNannyFinishContext();
9855  return __pyx_r;
9856 }
9857 
9858 /* "Isosurface.pyx":359
9859  * log("Isosurface file format not recognized")
9860  *
9861  * def writeIsosurfaceMesh_h5(self, field, value, frame): # <<<<<<<<<<<<<<
9862  * import h5py
9863  * nodes = self.nodes[(field, value)]
9864  */
9865 
9866 /* Python wrapper */
9867 static PyObject *__pyx_pw_10Isosurface_10Isosurface_11writeIsosurfaceMesh_h5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9868 static char __pyx_doc_10Isosurface_10Isosurface_10writeIsosurfaceMesh_h5[] = "Isosurface.writeIsosurfaceMesh_h5(self, field, value, frame)";
9869 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_11writeIsosurfaceMesh_h5 = {"writeIsosurfaceMesh_h5", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_11writeIsosurfaceMesh_h5, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_10writeIsosurfaceMesh_h5};
9870 static PyObject *__pyx_pw_10Isosurface_10Isosurface_11writeIsosurfaceMesh_h5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9871  PyObject *__pyx_v_self = 0;
9872  PyObject *__pyx_v_field = 0;
9873  PyObject *__pyx_v_value = 0;
9874  CYTHON_UNUSED PyObject *__pyx_v_frame = 0;
9875  int __pyx_lineno = 0;
9876  const char *__pyx_filename = NULL;
9877  int __pyx_clineno = 0;
9878  PyObject *__pyx_r = 0;
9879  __Pyx_RefNannyDeclarations
9880  __Pyx_RefNannySetupContext("writeIsosurfaceMesh_h5 (wrapper)", 0);
9881  {
9882  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_field,&__pyx_n_s_value,&__pyx_n_s_frame,0};
9883  PyObject* values[4] = {0,0,0,0};
9884  if (unlikely(__pyx_kwds)) {
9885  Py_ssize_t kw_args;
9886  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9887  switch (pos_args) {
9888  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9889  CYTHON_FALLTHROUGH;
9890  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9891  CYTHON_FALLTHROUGH;
9892  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9893  CYTHON_FALLTHROUGH;
9894  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9895  CYTHON_FALLTHROUGH;
9896  case 0: break;
9897  default: goto __pyx_L5_argtuple_error;
9898  }
9899  kw_args = PyDict_Size(__pyx_kwds);
9900  switch (pos_args) {
9901  case 0:
9902  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
9903  else goto __pyx_L5_argtuple_error;
9904  CYTHON_FALLTHROUGH;
9905  case 1:
9906  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
9907  else {
9908  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_h5", 1, 4, 4, 1); __PYX_ERR(0, 359, __pyx_L3_error)
9909  }
9910  CYTHON_FALLTHROUGH;
9911  case 2:
9912  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
9913  else {
9914  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_h5", 1, 4, 4, 2); __PYX_ERR(0, 359, __pyx_L3_error)
9915  }
9916  CYTHON_FALLTHROUGH;
9917  case 3:
9918  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
9919  else {
9920  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_h5", 1, 4, 4, 3); __PYX_ERR(0, 359, __pyx_L3_error)
9921  }
9922  }
9923  if (unlikely(kw_args > 0)) {
9924  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeIsosurfaceMesh_h5") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
9925  }
9926  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
9927  goto __pyx_L5_argtuple_error;
9928  } else {
9929  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9930  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9931  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9932  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9933  }
9934  __pyx_v_self = values[0];
9935  __pyx_v_field = values[1];
9936  __pyx_v_value = values[2];
9937  __pyx_v_frame = values[3];
9938  }
9939  goto __pyx_L4_argument_unpacking_done;
9940  __pyx_L5_argtuple_error:;
9941  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_h5", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
9942  __pyx_L3_error:;
9943  __Pyx_AddTraceback("Isosurface.Isosurface.writeIsosurfaceMesh_h5", __pyx_clineno, __pyx_lineno, __pyx_filename);
9944  __Pyx_RefNannyFinishContext();
9945  return NULL;
9946  __pyx_L4_argument_unpacking_done:;
9947  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_10writeIsosurfaceMesh_h5(__pyx_self, __pyx_v_self, __pyx_v_field, __pyx_v_value, __pyx_v_frame);
9948 
9949  /* function exit code */
9950  __Pyx_RefNannyFinishContext();
9951  return __pyx_r;
9952 }
9953 
9954 static PyObject *__pyx_pf_10Isosurface_10Isosurface_10writeIsosurfaceMesh_h5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_frame) {
9955  PyObject *__pyx_v_h5py = NULL;
9956  PyObject *__pyx_v_nodes = NULL;
9957  PyObject *__pyx_v_elements = NULL;
9958  PyObject *__pyx_v_normals = NULL;
9959  PyObject *__pyx_v_normal_indices = NULL;
9960  PyObject *__pyx_v_filename = NULL;
9961  PyObject *__pyx_v_f = NULL;
9962  CYTHON_UNUSED PyObject *__pyx_v_dset = NULL;
9963  PyObject *__pyx_r = NULL;
9964  __Pyx_RefNannyDeclarations
9965  PyObject *__pyx_t_1 = NULL;
9966  PyObject *__pyx_t_2 = NULL;
9967  PyObject *__pyx_t_3 = NULL;
9968  PyObject *__pyx_t_4 = NULL;
9969  PyObject *__pyx_t_5 = NULL;
9970  PyObject *__pyx_t_6 = NULL;
9971  PyObject *__pyx_t_7 = NULL;
9972  int __pyx_t_8;
9973  int __pyx_t_9;
9974  int __pyx_lineno = 0;
9975  const char *__pyx_filename = NULL;
9976  int __pyx_clineno = 0;
9977  __Pyx_RefNannySetupContext("writeIsosurfaceMesh_h5", 0);
9978 
9979  /* "Isosurface.pyx":360
9980  *
9981  * def writeIsosurfaceMesh_h5(self, field, value, frame):
9982  * import h5py # <<<<<<<<<<<<<<
9983  * nodes = self.nodes[(field, value)]
9984  * elements = self.elements[(field, value)]
9985  */
9986  __pyx_t_1 = __Pyx_Import(__pyx_n_s_h5py, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
9987  __Pyx_GOTREF(__pyx_t_1);
9988  __pyx_v_h5py = __pyx_t_1;
9989  __pyx_t_1 = 0;
9990 
9991  /* "Isosurface.pyx":361
9992  * def writeIsosurfaceMesh_h5(self, field, value, frame):
9993  * import h5py
9994  * nodes = self.nodes[(field, value)] # <<<<<<<<<<<<<<
9995  * elements = self.elements[(field, value)]
9996  * normals = self.normals[(field, value)]
9997  */
9998  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
9999  __Pyx_GOTREF(__pyx_t_1);
10000  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
10001  __Pyx_GOTREF(__pyx_t_2);
10002  __Pyx_INCREF(__pyx_v_field);
10003  __Pyx_GIVEREF(__pyx_v_field);
10004  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_field);
10005  __Pyx_INCREF(__pyx_v_value);
10006  __Pyx_GIVEREF(__pyx_v_value);
10007  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
10008  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
10009  __Pyx_GOTREF(__pyx_t_3);
10010  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10011  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10012  __pyx_v_nodes = __pyx_t_3;
10013  __pyx_t_3 = 0;
10014 
10015  /* "Isosurface.pyx":362
10016  * import h5py
10017  * nodes = self.nodes[(field, value)]
10018  * elements = self.elements[(field, value)] # <<<<<<<<<<<<<<
10019  * normals = self.normals[(field, value)]
10020  * normal_indices = self.normal_indices[(field, value)]
10021  */
10022  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
10023  __Pyx_GOTREF(__pyx_t_3);
10024  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
10025  __Pyx_GOTREF(__pyx_t_2);
10026  __Pyx_INCREF(__pyx_v_field);
10027  __Pyx_GIVEREF(__pyx_v_field);
10028  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_field);
10029  __Pyx_INCREF(__pyx_v_value);
10030  __Pyx_GIVEREF(__pyx_v_value);
10031  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
10032  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
10033  __Pyx_GOTREF(__pyx_t_1);
10034  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10035  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10036  __pyx_v_elements = __pyx_t_1;
10037  __pyx_t_1 = 0;
10038 
10039  /* "Isosurface.pyx":363
10040  * nodes = self.nodes[(field, value)]
10041  * elements = self.elements[(field, value)]
10042  * normals = self.normals[(field, value)] # <<<<<<<<<<<<<<
10043  * normal_indices = self.normal_indices[(field, value)]
10044  * filename = os.path.join(Profiling.logDir, self.fileprefix+str(self.comm.rank())+'.h5')
10045  */
10046  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
10047  __Pyx_GOTREF(__pyx_t_1);
10048  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
10049  __Pyx_GOTREF(__pyx_t_2);
10050  __Pyx_INCREF(__pyx_v_field);
10051  __Pyx_GIVEREF(__pyx_v_field);
10052  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_field);
10053  __Pyx_INCREF(__pyx_v_value);
10054  __Pyx_GIVEREF(__pyx_v_value);
10055  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
10056  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
10057  __Pyx_GOTREF(__pyx_t_3);
10058  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10059  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10060  __pyx_v_normals = __pyx_t_3;
10061  __pyx_t_3 = 0;
10062 
10063  /* "Isosurface.pyx":364
10064  * elements = self.elements[(field, value)]
10065  * normals = self.normals[(field, value)]
10066  * normal_indices = self.normal_indices[(field, value)] # <<<<<<<<<<<<<<
10067  * filename = os.path.join(Profiling.logDir, self.fileprefix+str(self.comm.rank())+'.h5')
10068  * if self.nFrames == 0:
10069  */
10070  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normal_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
10071  __Pyx_GOTREF(__pyx_t_3);
10072  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
10073  __Pyx_GOTREF(__pyx_t_2);
10074  __Pyx_INCREF(__pyx_v_field);
10075  __Pyx_GIVEREF(__pyx_v_field);
10076  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_field);
10077  __Pyx_INCREF(__pyx_v_value);
10078  __Pyx_GIVEREF(__pyx_v_value);
10079  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value);
10080  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
10081  __Pyx_GOTREF(__pyx_t_1);
10082  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10083  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10084  __pyx_v_normal_indices = __pyx_t_1;
10085  __pyx_t_1 = 0;
10086 
10087  /* "Isosurface.pyx":365
10088  * normals = self.normals[(field, value)]
10089  * normal_indices = self.normal_indices[(field, value)]
10090  * filename = os.path.join(Profiling.logDir, self.fileprefix+str(self.comm.rank())+'.h5') # <<<<<<<<<<<<<<
10091  * if self.nFrames == 0:
10092  * f = h5py.File(filename, "w")
10093  */
10094  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
10095  __Pyx_GOTREF(__pyx_t_2);
10096  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
10097  __Pyx_GOTREF(__pyx_t_3);
10098  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10099  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
10100  __Pyx_GOTREF(__pyx_t_2);
10101  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10102  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
10103  __Pyx_GOTREF(__pyx_t_3);
10104  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_logDir); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error)
10105  __Pyx_GOTREF(__pyx_t_4);
10106  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10107  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fileprefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
10108  __Pyx_GOTREF(__pyx_t_3);
10109  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 365, __pyx_L1_error)
10110  __Pyx_GOTREF(__pyx_t_6);
10111  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_rank); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 365, __pyx_L1_error)
10112  __Pyx_GOTREF(__pyx_t_7);
10113  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10114  __pyx_t_6 = NULL;
10115  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
10116  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
10117  if (likely(__pyx_t_6)) {
10118  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
10119  __Pyx_INCREF(__pyx_t_6);
10120  __Pyx_INCREF(function);
10121  __Pyx_DECREF_SET(__pyx_t_7, function);
10122  }
10123  }
10124  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
10125  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10126  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error)
10127  __Pyx_GOTREF(__pyx_t_5);
10128  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10129  __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 365, __pyx_L1_error)
10130  __Pyx_GOTREF(__pyx_t_7);
10131  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10132  __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 365, __pyx_L1_error)
10133  __Pyx_GOTREF(__pyx_t_5);
10134  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10135  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10136  __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_kp_s_h5_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 365, __pyx_L1_error)
10137  __Pyx_GOTREF(__pyx_t_7);
10138  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10139  __pyx_t_5 = NULL;
10140  __pyx_t_8 = 0;
10141  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10142  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
10143  if (likely(__pyx_t_5)) {
10144  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10145  __Pyx_INCREF(__pyx_t_5);
10146  __Pyx_INCREF(function);
10147  __Pyx_DECREF_SET(__pyx_t_2, function);
10148  __pyx_t_8 = 1;
10149  }
10150  }
10151  #if CYTHON_FAST_PYCALL
10152  if (PyFunction_Check(__pyx_t_2)) {
10153  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_7};
10154  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
10155  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10156  __Pyx_GOTREF(__pyx_t_1);
10157  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10158  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10159  } else
10160  #endif
10161  #if CYTHON_FAST_PYCCALL
10162  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
10163  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_7};
10164  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
10165  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10166  __Pyx_GOTREF(__pyx_t_1);
10167  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10168  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10169  } else
10170  #endif
10171  {
10172  __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
10173  __Pyx_GOTREF(__pyx_t_3);
10174  if (__pyx_t_5) {
10175  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
10176  }
10177  __Pyx_GIVEREF(__pyx_t_4);
10178  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_t_4);
10179  __Pyx_GIVEREF(__pyx_t_7);
10180  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_7);
10181  __pyx_t_4 = 0;
10182  __pyx_t_7 = 0;
10183  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
10184  __Pyx_GOTREF(__pyx_t_1);
10185  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10186  }
10187  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10188  __pyx_v_filename = __pyx_t_1;
10189  __pyx_t_1 = 0;
10190 
10191  /* "Isosurface.pyx":366
10192  * normal_indices = self.normal_indices[(field, value)]
10193  * filename = os.path.join(Profiling.logDir, self.fileprefix+str(self.comm.rank())+'.h5')
10194  * if self.nFrames == 0: # <<<<<<<<<<<<<<
10195  * f = h5py.File(filename, "w")
10196  * else:
10197  */
10198  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error)
10199  __Pyx_GOTREF(__pyx_t_1);
10200  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error)
10201  __Pyx_GOTREF(__pyx_t_2);
10202  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10203  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 366, __pyx_L1_error)
10204  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10205  if (__pyx_t_9) {
10206 
10207  /* "Isosurface.pyx":367
10208  * filename = os.path.join(Profiling.logDir, self.fileprefix+str(self.comm.rank())+'.h5')
10209  * if self.nFrames == 0:
10210  * f = h5py.File(filename, "w") # <<<<<<<<<<<<<<
10211  * else:
10212  * f = h5py.File(filename, "a")
10213  */
10214  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_h5py, __pyx_n_s_File); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
10215  __Pyx_GOTREF(__pyx_t_1);
10216  __pyx_t_3 = NULL;
10217  __pyx_t_8 = 0;
10218  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
10219  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
10220  if (likely(__pyx_t_3)) {
10221  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10222  __Pyx_INCREF(__pyx_t_3);
10223  __Pyx_INCREF(function);
10224  __Pyx_DECREF_SET(__pyx_t_1, function);
10225  __pyx_t_8 = 1;
10226  }
10227  }
10228  #if CYTHON_FAST_PYCALL
10229  if (PyFunction_Check(__pyx_t_1)) {
10230  PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, __pyx_n_s_w};
10231  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
10232  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10233  __Pyx_GOTREF(__pyx_t_2);
10234  } else
10235  #endif
10236  #if CYTHON_FAST_PYCCALL
10237  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
10238  PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_filename, __pyx_n_s_w};
10239  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
10240  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10241  __Pyx_GOTREF(__pyx_t_2);
10242  } else
10243  #endif
10244  {
10245  __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 367, __pyx_L1_error)
10246  __Pyx_GOTREF(__pyx_t_7);
10247  if (__pyx_t_3) {
10248  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
10249  }
10250  __Pyx_INCREF(__pyx_v_filename);
10251  __Pyx_GIVEREF(__pyx_v_filename);
10252  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_v_filename);
10253  __Pyx_INCREF(__pyx_n_s_w);
10254  __Pyx_GIVEREF(__pyx_n_s_w);
10255  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_n_s_w);
10256  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
10257  __Pyx_GOTREF(__pyx_t_2);
10258  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10259  }
10260  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10261  __pyx_v_f = __pyx_t_2;
10262  __pyx_t_2 = 0;
10263 
10264  /* "Isosurface.pyx":366
10265  * normal_indices = self.normal_indices[(field, value)]
10266  * filename = os.path.join(Profiling.logDir, self.fileprefix+str(self.comm.rank())+'.h5')
10267  * if self.nFrames == 0: # <<<<<<<<<<<<<<
10268  * f = h5py.File(filename, "w")
10269  * else:
10270  */
10271  goto __pyx_L3;
10272  }
10273 
10274  /* "Isosurface.pyx":369
10275  * f = h5py.File(filename, "w")
10276  * else:
10277  * f = h5py.File(filename, "a") # <<<<<<<<<<<<<<
10278  * dset = f.create_dataset('nodes'+str(self.nFrames), data=nodes)
10279  * dset = f.create_dataset('elems'+str(self.nFrames), data=elements)
10280  */
10281  /*else*/ {
10282  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_h5py, __pyx_n_s_File); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
10283  __Pyx_GOTREF(__pyx_t_1);
10284  __pyx_t_7 = NULL;
10285  __pyx_t_8 = 0;
10286  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
10287  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
10288  if (likely(__pyx_t_7)) {
10289  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10290  __Pyx_INCREF(__pyx_t_7);
10291  __Pyx_INCREF(function);
10292  __Pyx_DECREF_SET(__pyx_t_1, function);
10293  __pyx_t_8 = 1;
10294  }
10295  }
10296  #if CYTHON_FAST_PYCALL
10297  if (PyFunction_Check(__pyx_t_1)) {
10298  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_filename, __pyx_n_s_a};
10299  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
10300  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10301  __Pyx_GOTREF(__pyx_t_2);
10302  } else
10303  #endif
10304  #if CYTHON_FAST_PYCCALL
10305  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
10306  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_filename, __pyx_n_s_a};
10307  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
10308  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10309  __Pyx_GOTREF(__pyx_t_2);
10310  } else
10311  #endif
10312  {
10313  __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error)
10314  __Pyx_GOTREF(__pyx_t_3);
10315  if (__pyx_t_7) {
10316  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
10317  }
10318  __Pyx_INCREF(__pyx_v_filename);
10319  __Pyx_GIVEREF(__pyx_v_filename);
10320  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_v_filename);
10321  __Pyx_INCREF(__pyx_n_s_a);
10322  __Pyx_GIVEREF(__pyx_n_s_a);
10323  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_n_s_a);
10324  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
10325  __Pyx_GOTREF(__pyx_t_2);
10326  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10327  }
10328  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10329  __pyx_v_f = __pyx_t_2;
10330  __pyx_t_2 = 0;
10331  }
10332  __pyx_L3:;
10333 
10334  /* "Isosurface.pyx":370
10335  * else:
10336  * f = h5py.File(filename, "a")
10337  * dset = f.create_dataset('nodes'+str(self.nFrames), data=nodes) # <<<<<<<<<<<<<<
10338  * dset = f.create_dataset('elems'+str(self.nFrames), data=elements)
10339  * dset = f.create_dataset('normals'+str(self.nFrames), data=normals)
10340  */
10341  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error)
10342  __Pyx_GOTREF(__pyx_t_2);
10343  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
10344  __Pyx_GOTREF(__pyx_t_1);
10345  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error)
10346  __Pyx_GOTREF(__pyx_t_3);
10347  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10348  __pyx_t_1 = PyNumber_Add(__pyx_n_s_nodes, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
10349  __Pyx_GOTREF(__pyx_t_1);
10350  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10351  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error)
10352  __Pyx_GOTREF(__pyx_t_3);
10353  __Pyx_GIVEREF(__pyx_t_1);
10354  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
10355  __pyx_t_1 = 0;
10356  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
10357  __Pyx_GOTREF(__pyx_t_1);
10358  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_nodes) < 0) __PYX_ERR(0, 370, __pyx_L1_error)
10359  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error)
10360  __Pyx_GOTREF(__pyx_t_7);
10361  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10362  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10363  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10364  __pyx_v_dset = __pyx_t_7;
10365  __pyx_t_7 = 0;
10366 
10367  /* "Isosurface.pyx":371
10368  * f = h5py.File(filename, "a")
10369  * dset = f.create_dataset('nodes'+str(self.nFrames), data=nodes)
10370  * dset = f.create_dataset('elems'+str(self.nFrames), data=elements) # <<<<<<<<<<<<<<
10371  * dset = f.create_dataset('normals'+str(self.nFrames), data=normals)
10372  * dset = f.create_dataset('normal_indices'+str(self.nFrames), data=normal_indices)
10373  */
10374  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 371, __pyx_L1_error)
10375  __Pyx_GOTREF(__pyx_t_7);
10376  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
10377  __Pyx_GOTREF(__pyx_t_1);
10378  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
10379  __Pyx_GOTREF(__pyx_t_3);
10380  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10381  __pyx_t_1 = PyNumber_Add(__pyx_n_s_elems, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
10382  __Pyx_GOTREF(__pyx_t_1);
10383  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10384  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
10385  __Pyx_GOTREF(__pyx_t_3);
10386  __Pyx_GIVEREF(__pyx_t_1);
10387  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
10388  __pyx_t_1 = 0;
10389  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
10390  __Pyx_GOTREF(__pyx_t_1);
10391  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_elements) < 0) __PYX_ERR(0, 371, __pyx_L1_error)
10392  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
10393  __Pyx_GOTREF(__pyx_t_2);
10394  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10395  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10396  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10397  __Pyx_DECREF_SET(__pyx_v_dset, __pyx_t_2);
10398  __pyx_t_2 = 0;
10399 
10400  /* "Isosurface.pyx":372
10401  * dset = f.create_dataset('nodes'+str(self.nFrames), data=nodes)
10402  * dset = f.create_dataset('elems'+str(self.nFrames), data=elements)
10403  * dset = f.create_dataset('normals'+str(self.nFrames), data=normals) # <<<<<<<<<<<<<<
10404  * dset = f.create_dataset('normal_indices'+str(self.nFrames), data=normal_indices)
10405  * f.close()
10406  */
10407  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
10408  __Pyx_GOTREF(__pyx_t_2);
10409  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
10410  __Pyx_GOTREF(__pyx_t_1);
10411  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
10412  __Pyx_GOTREF(__pyx_t_3);
10413  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10414  __pyx_t_1 = PyNumber_Add(__pyx_n_s_normals, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
10415  __Pyx_GOTREF(__pyx_t_1);
10416  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10417  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
10418  __Pyx_GOTREF(__pyx_t_3);
10419  __Pyx_GIVEREF(__pyx_t_1);
10420  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
10421  __pyx_t_1 = 0;
10422  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
10423  __Pyx_GOTREF(__pyx_t_1);
10424  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_normals) < 0) __PYX_ERR(0, 372, __pyx_L1_error)
10425  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error)
10426  __Pyx_GOTREF(__pyx_t_7);
10427  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10428  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10429  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10430  __Pyx_DECREF_SET(__pyx_v_dset, __pyx_t_7);
10431  __pyx_t_7 = 0;
10432 
10433  /* "Isosurface.pyx":373
10434  * dset = f.create_dataset('elems'+str(self.nFrames), data=elements)
10435  * dset = f.create_dataset('normals'+str(self.nFrames), data=normals)
10436  * dset = f.create_dataset('normal_indices'+str(self.nFrames), data=normal_indices) # <<<<<<<<<<<<<<
10437  * f.close()
10438  *
10439  */
10440  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_create_dataset); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error)
10441  __Pyx_GOTREF(__pyx_t_7);
10442  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
10443  __Pyx_GOTREF(__pyx_t_1);
10444  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error)
10445  __Pyx_GOTREF(__pyx_t_3);
10446  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10447  __pyx_t_1 = PyNumber_Add(__pyx_n_s_normal_indices, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
10448  __Pyx_GOTREF(__pyx_t_1);
10449  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10450  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error)
10451  __Pyx_GOTREF(__pyx_t_3);
10452  __Pyx_GIVEREF(__pyx_t_1);
10453  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
10454  __pyx_t_1 = 0;
10455  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
10456  __Pyx_GOTREF(__pyx_t_1);
10457  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_data, __pyx_v_normal_indices) < 0) __PYX_ERR(0, 373, __pyx_L1_error)
10458  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
10459  __Pyx_GOTREF(__pyx_t_2);
10460  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10461  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10462  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10463  __Pyx_DECREF_SET(__pyx_v_dset, __pyx_t_2);
10464  __pyx_t_2 = 0;
10465 
10466  /* "Isosurface.pyx":374
10467  * dset = f.create_dataset('normals'+str(self.nFrames), data=normals)
10468  * dset = f.create_dataset('normal_indices'+str(self.nFrames), data=normal_indices)
10469  * f.close() # <<<<<<<<<<<<<<
10470  *
10471  * def writeIsosurfaceMesh_povray(self, field, value, frame):
10472  */
10473  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error)
10474  __Pyx_GOTREF(__pyx_t_1);
10475  __pyx_t_3 = NULL;
10476  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
10477  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
10478  if (likely(__pyx_t_3)) {
10479  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10480  __Pyx_INCREF(__pyx_t_3);
10481  __Pyx_INCREF(function);
10482  __Pyx_DECREF_SET(__pyx_t_1, function);
10483  }
10484  }
10485  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
10486  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10487  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error)
10488  __Pyx_GOTREF(__pyx_t_2);
10489  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10490  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10491 
10492  /* "Isosurface.pyx":359
10493  * log("Isosurface file format not recognized")
10494  *
10495  * def writeIsosurfaceMesh_h5(self, field, value, frame): # <<<<<<<<<<<<<<
10496  * import h5py
10497  * nodes = self.nodes[(field, value)]
10498  */
10499 
10500  /* function exit code */
10501  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10502  goto __pyx_L0;
10503  __pyx_L1_error:;
10504  __Pyx_XDECREF(__pyx_t_1);
10505  __Pyx_XDECREF(__pyx_t_2);
10506  __Pyx_XDECREF(__pyx_t_3);
10507  __Pyx_XDECREF(__pyx_t_4);
10508  __Pyx_XDECREF(__pyx_t_5);
10509  __Pyx_XDECREF(__pyx_t_6);
10510  __Pyx_XDECREF(__pyx_t_7);
10511  __Pyx_AddTraceback("Isosurface.Isosurface.writeIsosurfaceMesh_h5", __pyx_clineno, __pyx_lineno, __pyx_filename);
10512  __pyx_r = NULL;
10513  __pyx_L0:;
10514  __Pyx_XDECREF(__pyx_v_h5py);
10515  __Pyx_XDECREF(__pyx_v_nodes);
10516  __Pyx_XDECREF(__pyx_v_elements);
10517  __Pyx_XDECREF(__pyx_v_normals);
10518  __Pyx_XDECREF(__pyx_v_normal_indices);
10519  __Pyx_XDECREF(__pyx_v_filename);
10520  __Pyx_XDECREF(__pyx_v_f);
10521  __Pyx_XDECREF(__pyx_v_dset);
10522  __Pyx_XGIVEREF(__pyx_r);
10523  __Pyx_RefNannyFinishContext();
10524  return __pyx_r;
10525 }
10526 
10527 /* "Isosurface.pyx":376
10528  * f.close()
10529  *
10530  * def writeIsosurfaceMesh_povray(self, field, value, frame): # <<<<<<<<<<<<<<
10531  * """
10532  * Write the triangular mesh to a povray file
10533  */
10534 
10535 /* Python wrapper */
10536 static PyObject *__pyx_pw_10Isosurface_10Isosurface_13writeIsosurfaceMesh_povray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10537 static char __pyx_doc_10Isosurface_10Isosurface_12writeIsosurfaceMesh_povray[] = "Isosurface.writeIsosurfaceMesh_povray(self, field, value, frame)\n\n Write the triangular mesh to a povray file\n ";
10538 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_13writeIsosurfaceMesh_povray = {"writeIsosurfaceMesh_povray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_13writeIsosurfaceMesh_povray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_12writeIsosurfaceMesh_povray};
10539 static PyObject *__pyx_pw_10Isosurface_10Isosurface_13writeIsosurfaceMesh_povray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10540  PyObject *__pyx_v_self = 0;
10541  PyObject *__pyx_v_field = 0;
10542  PyObject *__pyx_v_value = 0;
10543  CYTHON_UNUSED PyObject *__pyx_v_frame = 0;
10544  int __pyx_lineno = 0;
10545  const char *__pyx_filename = NULL;
10546  int __pyx_clineno = 0;
10547  PyObject *__pyx_r = 0;
10548  __Pyx_RefNannyDeclarations
10549  __Pyx_RefNannySetupContext("writeIsosurfaceMesh_povray (wrapper)", 0);
10550  {
10551  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_field,&__pyx_n_s_value,&__pyx_n_s_frame,0};
10552  PyObject* values[4] = {0,0,0,0};
10553  if (unlikely(__pyx_kwds)) {
10554  Py_ssize_t kw_args;
10555  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10556  switch (pos_args) {
10557  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10558  CYTHON_FALLTHROUGH;
10559  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10560  CYTHON_FALLTHROUGH;
10561  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10562  CYTHON_FALLTHROUGH;
10563  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10564  CYTHON_FALLTHROUGH;
10565  case 0: break;
10566  default: goto __pyx_L5_argtuple_error;
10567  }
10568  kw_args = PyDict_Size(__pyx_kwds);
10569  switch (pos_args) {
10570  case 0:
10571  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
10572  else goto __pyx_L5_argtuple_error;
10573  CYTHON_FALLTHROUGH;
10574  case 1:
10575  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_field)) != 0)) kw_args--;
10576  else {
10577  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_povray", 1, 4, 4, 1); __PYX_ERR(0, 376, __pyx_L3_error)
10578  }
10579  CYTHON_FALLTHROUGH;
10580  case 2:
10581  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
10582  else {
10583  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_povray", 1, 4, 4, 2); __PYX_ERR(0, 376, __pyx_L3_error)
10584  }
10585  CYTHON_FALLTHROUGH;
10586  case 3:
10587  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
10588  else {
10589  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_povray", 1, 4, 4, 3); __PYX_ERR(0, 376, __pyx_L3_error)
10590  }
10591  }
10592  if (unlikely(kw_args > 0)) {
10593  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeIsosurfaceMesh_povray") < 0)) __PYX_ERR(0, 376, __pyx_L3_error)
10594  }
10595  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
10596  goto __pyx_L5_argtuple_error;
10597  } else {
10598  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10599  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10600  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10601  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10602  }
10603  __pyx_v_self = values[0];
10604  __pyx_v_field = values[1];
10605  __pyx_v_value = values[2];
10606  __pyx_v_frame = values[3];
10607  }
10608  goto __pyx_L4_argument_unpacking_done;
10609  __pyx_L5_argtuple_error:;
10610  __Pyx_RaiseArgtupleInvalid("writeIsosurfaceMesh_povray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 376, __pyx_L3_error)
10611  __pyx_L3_error:;
10612  __Pyx_AddTraceback("Isosurface.Isosurface.writeIsosurfaceMesh_povray", __pyx_clineno, __pyx_lineno, __pyx_filename);
10613  __Pyx_RefNannyFinishContext();
10614  return NULL;
10615  __pyx_L4_argument_unpacking_done:;
10616  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_12writeIsosurfaceMesh_povray(__pyx_self, __pyx_v_self, __pyx_v_field, __pyx_v_value, __pyx_v_frame);
10617 
10618  /* function exit code */
10619  __Pyx_RefNannyFinishContext();
10620  return __pyx_r;
10621 }
10622 
10623 static PyObject *__pyx_pf_10Isosurface_10Isosurface_12writeIsosurfaceMesh_povray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_field, PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_frame) {
10624  PyObject *__pyx_v_Template = NULL;
10625  PyObject *__pyx_v_nodes = NULL;
10626  PyObject *__pyx_v_elements = NULL;
10627  PyObject *__pyx_v_normals = NULL;
10628  PyObject *__pyx_v_normal_indices = NULL;
10629  PyObject *__pyx_v_pov_filename = NULL;
10630  PyObject *__pyx_v_pov = NULL;
10631  PyObject *__pyx_v_dx = NULL;
10632  PyObject *__pyx_v_nll = NULL;
10633  PyObject *__pyx_v_fur = NULL;
10634  PyObject *__pyx_v_povScene = NULL;
10635  PyObject *__pyx_v_n = NULL;
10636  PyObject *__pyx_v_ebN = NULL;
10637  PyObject *__pyx_v_bnt = NULL;
10638  PyObject *__pyx_v_e = NULL;
10639  PyObject *__pyx_v_ni = NULL;
10640  PyObject *__pyx_r = NULL;
10641  __Pyx_RefNannyDeclarations
10642  PyObject *__pyx_t_1 = NULL;
10643  PyObject *__pyx_t_2 = NULL;
10644  PyObject *__pyx_t_3 = NULL;
10645  int __pyx_t_4;
10646  PyObject *__pyx_t_5 = NULL;
10647  int __pyx_t_6;
10648  PyObject *__pyx_t_7 = NULL;
10649  PyObject *__pyx_t_8 = NULL;
10650  Py_ssize_t __pyx_t_9;
10651  PyObject *(*__pyx_t_10)(PyObject *);
10652  PyObject *__pyx_t_11 = NULL;
10653  PyObject *__pyx_t_12 = NULL;
10654  Py_ssize_t __pyx_t_13;
10655  PyObject *(*__pyx_t_14)(PyObject *);
10656  int __pyx_lineno = 0;
10657  const char *__pyx_filename = NULL;
10658  int __pyx_clineno = 0;
10659  __Pyx_RefNannySetupContext("writeIsosurfaceMesh_povray", 0);
10660 
10661  /* "Isosurface.pyx":380
10662  * Write the triangular mesh to a povray file
10663  * """
10664  * from string import Template # <<<<<<<<<<<<<<
10665  * nodes = self.nodes[(field, value)]
10666  * elements = self.elements[(field, value)]
10667  */
10668  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
10669  __Pyx_GOTREF(__pyx_t_1);
10670  __Pyx_INCREF(__pyx_n_s_Template);
10671  __Pyx_GIVEREF(__pyx_n_s_Template);
10672  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Template);
10673  __pyx_t_2 = __Pyx_Import(__pyx_n_s_string, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
10674  __Pyx_GOTREF(__pyx_t_2);
10675  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10676  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Template); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
10677  __Pyx_GOTREF(__pyx_t_1);
10678  __Pyx_INCREF(__pyx_t_1);
10679  __pyx_v_Template = __pyx_t_1;
10680  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10681  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10682 
10683  /* "Isosurface.pyx":381
10684  * """
10685  * from string import Template
10686  * nodes = self.nodes[(field, value)] # <<<<<<<<<<<<<<
10687  * elements = self.elements[(field, value)]
10688  * normals = self.normals[(field, value)]
10689  */
10690  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
10691  __Pyx_GOTREF(__pyx_t_2);
10692  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error)
10693  __Pyx_GOTREF(__pyx_t_1);
10694  __Pyx_INCREF(__pyx_v_field);
10695  __Pyx_GIVEREF(__pyx_v_field);
10696  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_field);
10697  __Pyx_INCREF(__pyx_v_value);
10698  __Pyx_GIVEREF(__pyx_v_value);
10699  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
10700  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error)
10701  __Pyx_GOTREF(__pyx_t_3);
10702  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10703  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10704  __pyx_v_nodes = __pyx_t_3;
10705  __pyx_t_3 = 0;
10706 
10707  /* "Isosurface.pyx":382
10708  * from string import Template
10709  * nodes = self.nodes[(field, value)]
10710  * elements = self.elements[(field, value)] # <<<<<<<<<<<<<<
10711  * normals = self.normals[(field, value)]
10712  * normal_indices = self.normal_indices[(field, value)]
10713  */
10714  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
10715  __Pyx_GOTREF(__pyx_t_3);
10716  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
10717  __Pyx_GOTREF(__pyx_t_1);
10718  __Pyx_INCREF(__pyx_v_field);
10719  __Pyx_GIVEREF(__pyx_v_field);
10720  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_field);
10721  __Pyx_INCREF(__pyx_v_value);
10722  __Pyx_GIVEREF(__pyx_v_value);
10723  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
10724  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
10725  __Pyx_GOTREF(__pyx_t_2);
10726  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10727  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10728  __pyx_v_elements = __pyx_t_2;
10729  __pyx_t_2 = 0;
10730 
10731  /* "Isosurface.pyx":383
10732  * nodes = self.nodes[(field, value)]
10733  * elements = self.elements[(field, value)]
10734  * normals = self.normals[(field, value)] # <<<<<<<<<<<<<<
10735  * normal_indices = self.normal_indices[(field, value)]
10736  * pov_filename = "{field:s}_{value:f}_{frame:04d}.pov".format(
10737  */
10738  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
10739  __Pyx_GOTREF(__pyx_t_2);
10740  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
10741  __Pyx_GOTREF(__pyx_t_1);
10742  __Pyx_INCREF(__pyx_v_field);
10743  __Pyx_GIVEREF(__pyx_v_field);
10744  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_field);
10745  __Pyx_INCREF(__pyx_v_value);
10746  __Pyx_GIVEREF(__pyx_v_value);
10747  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
10748  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
10749  __Pyx_GOTREF(__pyx_t_3);
10750  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10751  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10752  __pyx_v_normals = __pyx_t_3;
10753  __pyx_t_3 = 0;
10754 
10755  /* "Isosurface.pyx":384
10756  * elements = self.elements[(field, value)]
10757  * normals = self.normals[(field, value)]
10758  * normal_indices = self.normal_indices[(field, value)] # <<<<<<<<<<<<<<
10759  * pov_filename = "{field:s}_{value:f}_{frame:04d}.pov".format(
10760  * field=field,
10761  */
10762  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normal_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
10763  __Pyx_GOTREF(__pyx_t_3);
10764  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
10765  __Pyx_GOTREF(__pyx_t_1);
10766  __Pyx_INCREF(__pyx_v_field);
10767  __Pyx_GIVEREF(__pyx_v_field);
10768  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_field);
10769  __Pyx_INCREF(__pyx_v_value);
10770  __Pyx_GIVEREF(__pyx_v_value);
10771  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
10772  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
10773  __Pyx_GOTREF(__pyx_t_2);
10774  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10775  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10776  __pyx_v_normal_indices = __pyx_t_2;
10777  __pyx_t_2 = 0;
10778 
10779  /* "Isosurface.pyx":385
10780  * normals = self.normals[(field, value)]
10781  * normal_indices = self.normal_indices[(field, value)]
10782  * pov_filename = "{field:s}_{value:f}_{frame:04d}.pov".format( # <<<<<<<<<<<<<<
10783  * field=field,
10784  * value=value,
10785  */
10786  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_field_s___value_f___frame_04d_p, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error)
10787  __Pyx_GOTREF(__pyx_t_2);
10788 
10789  /* "Isosurface.pyx":386
10790  * normal_indices = self.normal_indices[(field, value)]
10791  * pov_filename = "{field:s}_{value:f}_{frame:04d}.pov".format(
10792  * field=field, # <<<<<<<<<<<<<<
10793  * value=value,
10794  * frame=self.nFrames)
10795  */
10796  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error)
10797  __Pyx_GOTREF(__pyx_t_1);
10798  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_field, __pyx_v_field) < 0) __PYX_ERR(0, 386, __pyx_L1_error)
10799 
10800  /* "Isosurface.pyx":387
10801  * pov_filename = "{field:s}_{value:f}_{frame:04d}.pov".format(
10802  * field=field,
10803  * value=value, # <<<<<<<<<<<<<<
10804  * frame=self.nFrames)
10805  * self.comm.beginSequential()
10806  */
10807  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_value, __pyx_v_value) < 0) __PYX_ERR(0, 386, __pyx_L1_error)
10808 
10809  /* "Isosurface.pyx":388
10810  * field=field,
10811  * value=value,
10812  * frame=self.nFrames) # <<<<<<<<<<<<<<
10813  * self.comm.beginSequential()
10814  * if self.comm.isMaster():
10815  */
10816  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
10817  __Pyx_GOTREF(__pyx_t_3);
10818  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_frame, __pyx_t_3) < 0) __PYX_ERR(0, 386, __pyx_L1_error)
10819  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10820 
10821  /* "Isosurface.pyx":385
10822  * normals = self.normals[(field, value)]
10823  * normal_indices = self.normal_indices[(field, value)]
10824  * pov_filename = "{field:s}_{value:f}_{frame:04d}.pov".format( # <<<<<<<<<<<<<<
10825  * field=field,
10826  * value=value,
10827  */
10828  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error)
10829  __Pyx_GOTREF(__pyx_t_3);
10830  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10831  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10832  __pyx_v_pov_filename = __pyx_t_3;
10833  __pyx_t_3 = 0;
10834 
10835  /* "Isosurface.pyx":389
10836  * value=value,
10837  * frame=self.nFrames)
10838  * self.comm.beginSequential() # <<<<<<<<<<<<<<
10839  * if self.comm.isMaster():
10840  * pov = open(pov_filename, "w")
10841  */
10842  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
10843  __Pyx_GOTREF(__pyx_t_1);
10844  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_beginSequential); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
10845  __Pyx_GOTREF(__pyx_t_2);
10846  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10847  __pyx_t_1 = NULL;
10848  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
10849  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
10850  if (likely(__pyx_t_1)) {
10851  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10852  __Pyx_INCREF(__pyx_t_1);
10853  __Pyx_INCREF(function);
10854  __Pyx_DECREF_SET(__pyx_t_2, function);
10855  }
10856  }
10857  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
10858  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10859  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
10860  __Pyx_GOTREF(__pyx_t_3);
10861  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10862  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10863 
10864  /* "Isosurface.pyx":390
10865  * frame=self.nFrames)
10866  * self.comm.beginSequential()
10867  * if self.comm.isMaster(): # <<<<<<<<<<<<<<
10868  * pov = open(pov_filename, "w")
10869  * dx = np.array(self.domain.L) * 0.02
10870  */
10871  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
10872  __Pyx_GOTREF(__pyx_t_2);
10873  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isMaster); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
10874  __Pyx_GOTREF(__pyx_t_1);
10875  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10876  __pyx_t_2 = NULL;
10877  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
10878  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
10879  if (likely(__pyx_t_2)) {
10880  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10881  __Pyx_INCREF(__pyx_t_2);
10882  __Pyx_INCREF(function);
10883  __Pyx_DECREF_SET(__pyx_t_1, function);
10884  }
10885  }
10886  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
10887  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10888  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
10889  __Pyx_GOTREF(__pyx_t_3);
10890  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10891  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 390, __pyx_L1_error)
10892  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10893  if (__pyx_t_4) {
10894 
10895  /* "Isosurface.pyx":391
10896  * self.comm.beginSequential()
10897  * if self.comm.isMaster():
10898  * pov = open(pov_filename, "w") # <<<<<<<<<<<<<<
10899  * dx = np.array(self.domain.L) * 0.02
10900  * nll = np.array(self.domain.x) - dx
10901  */
10902  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
10903  __Pyx_GOTREF(__pyx_t_3);
10904  __Pyx_INCREF(__pyx_v_pov_filename);
10905  __Pyx_GIVEREF(__pyx_v_pov_filename);
10906  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pov_filename);
10907  __Pyx_INCREF(__pyx_n_s_w);
10908  __Pyx_GIVEREF(__pyx_n_s_w);
10909  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_w);
10910  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error)
10911  __Pyx_GOTREF(__pyx_t_1);
10912  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10913  __pyx_v_pov = __pyx_t_1;
10914  __pyx_t_1 = 0;
10915 
10916  /* "Isosurface.pyx":392
10917  * if self.comm.isMaster():
10918  * pov = open(pov_filename, "w")
10919  * dx = np.array(self.domain.L) * 0.02 # <<<<<<<<<<<<<<
10920  * nll = np.array(self.domain.x) - dx
10921  * fur = np.array(self.domain.L) + dx
10922  */
10923  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
10924  __Pyx_GOTREF(__pyx_t_3);
10925  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
10926  __Pyx_GOTREF(__pyx_t_2);
10927  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10928  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
10929  __Pyx_GOTREF(__pyx_t_3);
10930  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 392, __pyx_L1_error)
10931  __Pyx_GOTREF(__pyx_t_5);
10932  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10933  __pyx_t_3 = NULL;
10934  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
10935  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
10936  if (likely(__pyx_t_3)) {
10937  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
10938  __Pyx_INCREF(__pyx_t_3);
10939  __Pyx_INCREF(function);
10940  __Pyx_DECREF_SET(__pyx_t_2, function);
10941  }
10942  }
10943  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
10944  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10945  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10946  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error)
10947  __Pyx_GOTREF(__pyx_t_1);
10948  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10949  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_float_0_02); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
10950  __Pyx_GOTREF(__pyx_t_2);
10951  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10952  __pyx_v_dx = __pyx_t_2;
10953  __pyx_t_2 = 0;
10954 
10955  /* "Isosurface.pyx":393
10956  * pov = open(pov_filename, "w")
10957  * dx = np.array(self.domain.L) * 0.02
10958  * nll = np.array(self.domain.x) - dx # <<<<<<<<<<<<<<
10959  * fur = np.array(self.domain.L) + dx
10960  * fur[2] = self.domain.L[2] - dx[2] # clip the top off
10961  */
10962  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
10963  __Pyx_GOTREF(__pyx_t_1);
10964  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error)
10965  __Pyx_GOTREF(__pyx_t_5);
10966  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10967  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
10968  __Pyx_GOTREF(__pyx_t_1);
10969  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
10970  __Pyx_GOTREF(__pyx_t_3);
10971  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10972  __pyx_t_1 = NULL;
10973  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
10974  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
10975  if (likely(__pyx_t_1)) {
10976  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
10977  __Pyx_INCREF(__pyx_t_1);
10978  __Pyx_INCREF(function);
10979  __Pyx_DECREF_SET(__pyx_t_5, function);
10980  }
10981  }
10982  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
10983  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10984  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10985  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
10986  __Pyx_GOTREF(__pyx_t_2);
10987  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10988  __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_v_dx); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error)
10989  __Pyx_GOTREF(__pyx_t_5);
10990  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10991  __pyx_v_nll = __pyx_t_5;
10992  __pyx_t_5 = 0;
10993 
10994  /* "Isosurface.pyx":394
10995  * dx = np.array(self.domain.L) * 0.02
10996  * nll = np.array(self.domain.x) - dx
10997  * fur = np.array(self.domain.L) + dx # <<<<<<<<<<<<<<
10998  * fur[2] = self.domain.L[2] - dx[2] # clip the top off
10999  * pov.write("""#version 3.7;
11000  */
11001  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error)
11002  __Pyx_GOTREF(__pyx_t_2);
11003  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error)
11004  __Pyx_GOTREF(__pyx_t_3);
11005  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11006  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error)
11007  __Pyx_GOTREF(__pyx_t_2);
11008  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
11009  __Pyx_GOTREF(__pyx_t_1);
11010  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11011  __pyx_t_2 = NULL;
11012  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11013  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
11014  if (likely(__pyx_t_2)) {
11015  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11016  __Pyx_INCREF(__pyx_t_2);
11017  __Pyx_INCREF(function);
11018  __Pyx_DECREF_SET(__pyx_t_3, function);
11019  }
11020  }
11021  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
11022  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11023  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11024  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 394, __pyx_L1_error)
11025  __Pyx_GOTREF(__pyx_t_5);
11026  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11027  __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_v_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error)
11028  __Pyx_GOTREF(__pyx_t_3);
11029  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11030  __pyx_v_fur = __pyx_t_3;
11031  __pyx_t_3 = 0;
11032 
11033  /* "Isosurface.pyx":395
11034  * nll = np.array(self.domain.x) - dx
11035  * fur = np.array(self.domain.L) + dx
11036  * fur[2] = self.domain.L[2] - dx[2] # clip the top off # <<<<<<<<<<<<<<
11037  * pov.write("""#version 3.7;
11038  * #include "proteus.inc"
11039  */
11040  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
11041  __Pyx_GOTREF(__pyx_t_3);
11042  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 395, __pyx_L1_error)
11043  __Pyx_GOTREF(__pyx_t_5);
11044  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11045  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error)
11046  __Pyx_GOTREF(__pyx_t_3);
11047  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11048  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_dx, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 395, __pyx_L1_error)
11049  __Pyx_GOTREF(__pyx_t_5);
11050  __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error)
11051  __Pyx_GOTREF(__pyx_t_1);
11052  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11053  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11054  if (unlikely(__Pyx_SetItemInt(__pyx_v_fur, 2, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
11055  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11056 
11057  /* "Isosurface.pyx":396
11058  * fur = np.array(self.domain.L) + dx
11059  * fur[2] = self.domain.L[2] - dx[2] # clip the top off
11060  * pov.write("""#version 3.7; # <<<<<<<<<<<<<<
11061  * #include "proteus.inc"
11062  * """)
11063  */
11064  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 396, __pyx_L1_error)
11065  __Pyx_GOTREF(__pyx_t_5);
11066  __pyx_t_3 = NULL;
11067  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11068  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
11069  if (likely(__pyx_t_3)) {
11070  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11071  __Pyx_INCREF(__pyx_t_3);
11072  __Pyx_INCREF(function);
11073  __Pyx_DECREF_SET(__pyx_t_5, function);
11074  }
11075  }
11076  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s_version_3_7_include_proteus_inc) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_version_3_7_include_proteus_inc);
11077  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11078  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error)
11079  __Pyx_GOTREF(__pyx_t_1);
11080  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11081  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11082 
11083  /* "Isosurface.pyx":399
11084  * #include "proteus.inc"
11085  * """)
11086  * if not self.writeBoundary: # <<<<<<<<<<<<<<
11087  * pov.write(Template("""
11088  * object
11089  */
11090  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeBoundary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
11091  __Pyx_GOTREF(__pyx_t_1);
11092  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
11093  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11094  __pyx_t_6 = ((!__pyx_t_4) != 0);
11095  if (__pyx_t_6) {
11096 
11097  /* "Isosurface.pyx":400
11098  * """)
11099  * if not self.writeBoundary:
11100  * pov.write(Template(""" # <<<<<<<<<<<<<<
11101  * object
11102  * {
11103  */
11104  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
11105  __Pyx_GOTREF(__pyx_t_5);
11106  __Pyx_INCREF(__pyx_v_Template);
11107  __pyx_t_2 = __pyx_v_Template; __pyx_t_7 = NULL;
11108  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11109  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
11110  if (likely(__pyx_t_7)) {
11111  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11112  __Pyx_INCREF(__pyx_t_7);
11113  __Pyx_INCREF(function);
11114  __Pyx_DECREF_SET(__pyx_t_2, function);
11115  }
11116  }
11117  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_kp_s_object_difference_box_nll_x_nll) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_object_difference_box_nll_x_nll);
11118  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11119  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)
11120  __Pyx_GOTREF(__pyx_t_3);
11121  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11122 
11123  /* "Isosurface.pyx":420
11124  * tank_material()
11125  * }//object
11126  * """).substitute(nll_x=nll[0], # <<<<<<<<<<<<<<
11127  * nll_y=nll[1],
11128  * nll_z=nll[2],
11129  */
11130  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_substitute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
11131  __Pyx_GOTREF(__pyx_t_2);
11132  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11133  __pyx_t_3 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error)
11134  __Pyx_GOTREF(__pyx_t_3);
11135  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_nll, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 420, __pyx_L1_error)
11136  __Pyx_GOTREF(__pyx_t_7);
11137  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nll_x, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11138  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11139 
11140  /* "Isosurface.pyx":421
11141  * }//object
11142  * """).substitute(nll_x=nll[0],
11143  * nll_y=nll[1], # <<<<<<<<<<<<<<
11144  * nll_z=nll[2],
11145  * fur_x=fur[0],
11146  */
11147  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_nll, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 421, __pyx_L1_error)
11148  __Pyx_GOTREF(__pyx_t_7);
11149  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nll_y, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11150  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11151 
11152  /* "Isosurface.pyx":422
11153  * """).substitute(nll_x=nll[0],
11154  * nll_y=nll[1],
11155  * nll_z=nll[2], # <<<<<<<<<<<<<<
11156  * fur_x=fur[0],
11157  * fur_y=fur[1],
11158  */
11159  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_nll, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 422, __pyx_L1_error)
11160  __Pyx_GOTREF(__pyx_t_7);
11161  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nll_z, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11162  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11163 
11164  /* "Isosurface.pyx":423
11165  * nll_y=nll[1],
11166  * nll_z=nll[2],
11167  * fur_x=fur[0], # <<<<<<<<<<<<<<
11168  * fur_y=fur[1],
11169  * fur_z=fur[2],
11170  */
11171  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fur, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error)
11172  __Pyx_GOTREF(__pyx_t_7);
11173  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fur_x, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11174  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11175 
11176  /* "Isosurface.pyx":424
11177  * nll_z=nll[2],
11178  * fur_x=fur[0],
11179  * fur_y=fur[1], # <<<<<<<<<<<<<<
11180  * fur_z=fur[2],
11181  * domain_nll_x=self.domain.x[0],
11182  */
11183  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fur, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 424, __pyx_L1_error)
11184  __Pyx_GOTREF(__pyx_t_7);
11185  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fur_y, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11186  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11187 
11188  /* "Isosurface.pyx":425
11189  * fur_x=fur[0],
11190  * fur_y=fur[1],
11191  * fur_z=fur[2], # <<<<<<<<<<<<<<
11192  * domain_nll_x=self.domain.x[0],
11193  * domain_nll_y=self.domain.x[1],
11194  */
11195  __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_fur, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 425, __pyx_L1_error)
11196  __Pyx_GOTREF(__pyx_t_7);
11197  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fur_z, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11198  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11199 
11200  /* "Isosurface.pyx":426
11201  * fur_y=fur[1],
11202  * fur_z=fur[2],
11203  * domain_nll_x=self.domain.x[0], # <<<<<<<<<<<<<<
11204  * domain_nll_y=self.domain.x[1],
11205  * domain_nll_z=self.domain.x[2],
11206  */
11207  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error)
11208  __Pyx_GOTREF(__pyx_t_7);
11209  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 426, __pyx_L1_error)
11210  __Pyx_GOTREF(__pyx_t_8);
11211  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11212  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error)
11213  __Pyx_GOTREF(__pyx_t_7);
11214  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11215  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain_nll_x, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11216  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11217 
11218  /* "Isosurface.pyx":427
11219  * fur_z=fur[2],
11220  * domain_nll_x=self.domain.x[0],
11221  * domain_nll_y=self.domain.x[1], # <<<<<<<<<<<<<<
11222  * domain_nll_z=self.domain.x[2],
11223  * domain_fur_x=self.domain.L[0],
11224  */
11225  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error)
11226  __Pyx_GOTREF(__pyx_t_7);
11227  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 427, __pyx_L1_error)
11228  __Pyx_GOTREF(__pyx_t_8);
11229  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11230  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 427, __pyx_L1_error)
11231  __Pyx_GOTREF(__pyx_t_7);
11232  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11233  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain_nll_y, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11234  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11235 
11236  /* "Isosurface.pyx":428
11237  * domain_nll_x=self.domain.x[0],
11238  * domain_nll_y=self.domain.x[1],
11239  * domain_nll_z=self.domain.x[2], # <<<<<<<<<<<<<<
11240  * domain_fur_x=self.domain.L[0],
11241  * domain_fur_y=self.domain.L[1],
11242  */
11243  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 428, __pyx_L1_error)
11244  __Pyx_GOTREF(__pyx_t_7);
11245  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 428, __pyx_L1_error)
11246  __Pyx_GOTREF(__pyx_t_8);
11247  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11248  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 428, __pyx_L1_error)
11249  __Pyx_GOTREF(__pyx_t_7);
11250  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11251  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain_nll_z, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11252  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11253 
11254  /* "Isosurface.pyx":429
11255  * domain_nll_y=self.domain.x[1],
11256  * domain_nll_z=self.domain.x[2],
11257  * domain_fur_x=self.domain.L[0], # <<<<<<<<<<<<<<
11258  * domain_fur_y=self.domain.L[1],
11259  * domain_fur_z=self.domain.L[2]))
11260  */
11261  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 429, __pyx_L1_error)
11262  __Pyx_GOTREF(__pyx_t_7);
11263  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 429, __pyx_L1_error)
11264  __Pyx_GOTREF(__pyx_t_8);
11265  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11266  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 429, __pyx_L1_error)
11267  __Pyx_GOTREF(__pyx_t_7);
11268  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11269  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain_fur_x, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11270  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11271 
11272  /* "Isosurface.pyx":430
11273  * domain_nll_z=self.domain.x[2],
11274  * domain_fur_x=self.domain.L[0],
11275  * domain_fur_y=self.domain.L[1], # <<<<<<<<<<<<<<
11276  * domain_fur_z=self.domain.L[2]))
11277  * pov.flush()
11278  */
11279  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
11280  __Pyx_GOTREF(__pyx_t_7);
11281  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 430, __pyx_L1_error)
11282  __Pyx_GOTREF(__pyx_t_8);
11283  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11284  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
11285  __Pyx_GOTREF(__pyx_t_7);
11286  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11287  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain_fur_y, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11288  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11289 
11290  /* "Isosurface.pyx":431
11291  * domain_fur_x=self.domain.L[0],
11292  * domain_fur_y=self.domain.L[1],
11293  * domain_fur_z=self.domain.L[2])) # <<<<<<<<<<<<<<
11294  * pov.flush()
11295  * if self.writeBoundary:
11296  */
11297  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
11298  __Pyx_GOTREF(__pyx_t_7);
11299  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 431, __pyx_L1_error)
11300  __Pyx_GOTREF(__pyx_t_8);
11301  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11302  __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
11303  __Pyx_GOTREF(__pyx_t_7);
11304  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11305  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_domain_fur_z, __pyx_t_7) < 0) __PYX_ERR(0, 420, __pyx_L1_error)
11306  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11307 
11308  /* "Isosurface.pyx":420
11309  * tank_material()
11310  * }//object
11311  * """).substitute(nll_x=nll[0], # <<<<<<<<<<<<<<
11312  * nll_y=nll[1],
11313  * nll_z=nll[2],
11314  */
11315  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 420, __pyx_L1_error)
11316  __Pyx_GOTREF(__pyx_t_7);
11317  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11318  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11319  __pyx_t_3 = NULL;
11320  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11321  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
11322  if (likely(__pyx_t_3)) {
11323  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11324  __Pyx_INCREF(__pyx_t_3);
11325  __Pyx_INCREF(function);
11326  __Pyx_DECREF_SET(__pyx_t_5, function);
11327  }
11328  }
11329  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
11330  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11331  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11332  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
11333  __Pyx_GOTREF(__pyx_t_1);
11334  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11335  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11336 
11337  /* "Isosurface.pyx":432
11338  * domain_fur_y=self.domain.L[1],
11339  * domain_fur_z=self.domain.L[2]))
11340  * pov.flush() # <<<<<<<<<<<<<<
11341  * if self.writeBoundary:
11342  * pov.write(Template("""
11343  */
11344  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_flush); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L1_error)
11345  __Pyx_GOTREF(__pyx_t_5);
11346  __pyx_t_7 = NULL;
11347  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11348  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11349  if (likely(__pyx_t_7)) {
11350  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11351  __Pyx_INCREF(__pyx_t_7);
11352  __Pyx_INCREF(function);
11353  __Pyx_DECREF_SET(__pyx_t_5, function);
11354  }
11355  }
11356  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
11357  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11358  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
11359  __Pyx_GOTREF(__pyx_t_1);
11360  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11361  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11362 
11363  /* "Isosurface.pyx":399
11364  * #include "proteus.inc"
11365  * """)
11366  * if not self.writeBoundary: # <<<<<<<<<<<<<<
11367  * pov.write(Template("""
11368  * object
11369  */
11370  }
11371 
11372  /* "Isosurface.pyx":433
11373  * domain_fur_z=self.domain.L[2]))
11374  * pov.flush()
11375  * if self.writeBoundary: # <<<<<<<<<<<<<<
11376  * pov.write(Template("""
11377  * object
11378  */
11379  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeBoundary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
11380  __Pyx_GOTREF(__pyx_t_1);
11381  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 433, __pyx_L1_error)
11382  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11383  if (__pyx_t_6) {
11384 
11385  /* "Isosurface.pyx":434
11386  * pov.flush()
11387  * if self.writeBoundary:
11388  * pov.write(Template(""" # <<<<<<<<<<<<<<
11389  * object
11390  * {
11391  */
11392  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error)
11393  __Pyx_GOTREF(__pyx_t_5);
11394  __Pyx_INCREF(__pyx_v_Template);
11395  __pyx_t_3 = __pyx_v_Template; __pyx_t_2 = NULL;
11396  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11397  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
11398  if (likely(__pyx_t_2)) {
11399  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11400  __Pyx_INCREF(__pyx_t_2);
11401  __Pyx_INCREF(function);
11402  __Pyx_DECREF_SET(__pyx_t_3, function);
11403  }
11404  }
11405  __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_object_difference_box_nll_x_nll_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_object_difference_box_nll_x_nll_2);
11406  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11407  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 434, __pyx_L1_error)
11408  __Pyx_GOTREF(__pyx_t_7);
11409  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11410 
11411  /* "Isosurface.pyx":445
11412  * union
11413  * {
11414  * """).substitute(nll_x=nll[0], # <<<<<<<<<<<<<<
11415  * nll_y=nll[1],
11416  * nll_z=nll[2],
11417  */
11418  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_substitute); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
11419  __Pyx_GOTREF(__pyx_t_3);
11420  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11421  __pyx_t_7 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L1_error)
11422  __Pyx_GOTREF(__pyx_t_7);
11423  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nll, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
11424  __Pyx_GOTREF(__pyx_t_2);
11425  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_nll_x, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
11426  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11427 
11428  /* "Isosurface.pyx":446
11429  * {
11430  * """).substitute(nll_x=nll[0],
11431  * nll_y=nll[1], # <<<<<<<<<<<<<<
11432  * nll_z=nll[2],
11433  * fur_x=fur[0],
11434  */
11435  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nll, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
11436  __Pyx_GOTREF(__pyx_t_2);
11437  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_nll_y, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
11438  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11439 
11440  /* "Isosurface.pyx":447
11441  * """).substitute(nll_x=nll[0],
11442  * nll_y=nll[1],
11443  * nll_z=nll[2], # <<<<<<<<<<<<<<
11444  * fur_x=fur[0],
11445  * fur_y=fur[1],
11446  */
11447  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nll, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
11448  __Pyx_GOTREF(__pyx_t_2);
11449  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_nll_z, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
11450  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11451 
11452  /* "Isosurface.pyx":448
11453  * nll_y=nll[1],
11454  * nll_z=nll[2],
11455  * fur_x=fur[0], # <<<<<<<<<<<<<<
11456  * fur_y=fur[1],
11457  * fur_z=fur[2]))
11458  */
11459  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fur, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error)
11460  __Pyx_GOTREF(__pyx_t_2);
11461  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fur_x, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
11462  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11463 
11464  /* "Isosurface.pyx":449
11465  * nll_z=nll[2],
11466  * fur_x=fur[0],
11467  * fur_y=fur[1], # <<<<<<<<<<<<<<
11468  * fur_z=fur[2]))
11469  * pov.flush()
11470  */
11471  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fur, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
11472  __Pyx_GOTREF(__pyx_t_2);
11473  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fur_y, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
11474  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11475 
11476  /* "Isosurface.pyx":450
11477  * fur_x=fur[0],
11478  * fur_y=fur[1],
11479  * fur_z=fur[2])) # <<<<<<<<<<<<<<
11480  * pov.flush()
11481  * else:
11482  */
11483  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fur, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error)
11484  __Pyx_GOTREF(__pyx_t_2);
11485  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fur_z, __pyx_t_2) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
11486  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11487 
11488  /* "Isosurface.pyx":445
11489  * union
11490  * {
11491  * """).substitute(nll_x=nll[0], # <<<<<<<<<<<<<<
11492  * nll_y=nll[1],
11493  * nll_z=nll[2],
11494  */
11495  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
11496  __Pyx_GOTREF(__pyx_t_2);
11497  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11498  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11499  __pyx_t_7 = NULL;
11500  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11501  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11502  if (likely(__pyx_t_7)) {
11503  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11504  __Pyx_INCREF(__pyx_t_7);
11505  __Pyx_INCREF(function);
11506  __Pyx_DECREF_SET(__pyx_t_5, function);
11507  }
11508  }
11509  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2);
11510  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11511  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11512  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 434, __pyx_L1_error)
11513  __Pyx_GOTREF(__pyx_t_1);
11514  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11515  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11516 
11517  /* "Isosurface.pyx":433
11518  * domain_fur_z=self.domain.L[2]))
11519  * pov.flush()
11520  * if self.writeBoundary: # <<<<<<<<<<<<<<
11521  * pov.write(Template("""
11522  * object
11523  */
11524  }
11525 
11526  /* "Isosurface.pyx":451
11527  * fur_y=fur[1],
11528  * fur_z=fur[2]))
11529  * pov.flush() # <<<<<<<<<<<<<<
11530  * else:
11531  * pov = open(pov_filename, "a")
11532  */
11533  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_flush); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error)
11534  __Pyx_GOTREF(__pyx_t_5);
11535  __pyx_t_2 = NULL;
11536  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11537  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
11538  if (likely(__pyx_t_2)) {
11539  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11540  __Pyx_INCREF(__pyx_t_2);
11541  __Pyx_INCREF(function);
11542  __Pyx_DECREF_SET(__pyx_t_5, function);
11543  }
11544  }
11545  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
11546  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11547  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error)
11548  __Pyx_GOTREF(__pyx_t_1);
11549  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11550  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11551 
11552  /* "Isosurface.pyx":390
11553  * frame=self.nFrames)
11554  * self.comm.beginSequential()
11555  * if self.comm.isMaster(): # <<<<<<<<<<<<<<
11556  * pov = open(pov_filename, "w")
11557  * dx = np.array(self.domain.L) * 0.02
11558  */
11559  goto __pyx_L3;
11560  }
11561 
11562  /* "Isosurface.pyx":453
11563  * pov.flush()
11564  * else:
11565  * pov = open(pov_filename, "a") # <<<<<<<<<<<<<<
11566  * if self.writeBoundary:
11567  * povScene = """mesh2 {
11568  */
11569  /*else*/ {
11570  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
11571  __Pyx_GOTREF(__pyx_t_1);
11572  __Pyx_INCREF(__pyx_v_pov_filename);
11573  __Pyx_GIVEREF(__pyx_v_pov_filename);
11574  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pov_filename);
11575  __Pyx_INCREF(__pyx_n_s_a);
11576  __Pyx_GIVEREF(__pyx_n_s_a);
11577  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_a);
11578  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
11579  __Pyx_GOTREF(__pyx_t_5);
11580  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11581  __pyx_v_pov = __pyx_t_5;
11582  __pyx_t_5 = 0;
11583  }
11584  __pyx_L3:;
11585 
11586  /* "Isosurface.pyx":454
11587  * else:
11588  * pov = open(pov_filename, "a")
11589  * if self.writeBoundary: # <<<<<<<<<<<<<<
11590  * povScene = """mesh2 {
11591  * vertex_vectors {"""
11592  */
11593  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeBoundary); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error)
11594  __Pyx_GOTREF(__pyx_t_5);
11595  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 454, __pyx_L1_error)
11596  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11597  if (__pyx_t_6) {
11598 
11599  /* "Isosurface.pyx":455
11600  * pov = open(pov_filename, "a")
11601  * if self.writeBoundary:
11602  * povScene = """mesh2 { # <<<<<<<<<<<<<<
11603  * vertex_vectors {"""
11604  * pov.write(povScene)
11605  */
11606  __Pyx_INCREF(__pyx_kp_s_mesh2_vertex_vectors);
11607  __pyx_v_povScene = __pyx_kp_s_mesh2_vertex_vectors;
11608 
11609  /* "Isosurface.pyx":457
11610  * povScene = """mesh2 {
11611  * vertex_vectors {"""
11612  * pov.write(povScene) # <<<<<<<<<<<<<<
11613  * pov.write("{0:d},\n".format(len(self.boundaryNodes)))
11614  * for n in self.boundaryNodes:
11615  */
11616  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error)
11617  __Pyx_GOTREF(__pyx_t_1);
11618  __pyx_t_2 = NULL;
11619  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
11620  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
11621  if (likely(__pyx_t_2)) {
11622  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11623  __Pyx_INCREF(__pyx_t_2);
11624  __Pyx_INCREF(function);
11625  __Pyx_DECREF_SET(__pyx_t_1, function);
11626  }
11627  }
11628  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_povScene) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_povScene);
11629  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11630  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L1_error)
11631  __Pyx_GOTREF(__pyx_t_5);
11632  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11633  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11634 
11635  /* "Isosurface.pyx":458
11636  * vertex_vectors {"""
11637  * pov.write(povScene)
11638  * pov.write("{0:d},\n".format(len(self.boundaryNodes))) # <<<<<<<<<<<<<<
11639  * for n in self.boundaryNodes:
11640  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(
11641  */
11642  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error)
11643  __Pyx_GOTREF(__pyx_t_1);
11644  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 458, __pyx_L1_error)
11645  __Pyx_GOTREF(__pyx_t_7);
11646  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_boundaryNodes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error)
11647  __Pyx_GOTREF(__pyx_t_3);
11648  __pyx_t_9 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 458, __pyx_L1_error)
11649  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11650  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error)
11651  __Pyx_GOTREF(__pyx_t_3);
11652  __pyx_t_8 = NULL;
11653  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
11654  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
11655  if (likely(__pyx_t_8)) {
11656  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
11657  __Pyx_INCREF(__pyx_t_8);
11658  __Pyx_INCREF(function);
11659  __Pyx_DECREF_SET(__pyx_t_7, function);
11660  }
11661  }
11662  __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3);
11663  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11664  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11665  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error)
11666  __Pyx_GOTREF(__pyx_t_2);
11667  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11668  __pyx_t_7 = NULL;
11669  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
11670  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
11671  if (likely(__pyx_t_7)) {
11672  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11673  __Pyx_INCREF(__pyx_t_7);
11674  __Pyx_INCREF(function);
11675  __Pyx_DECREF_SET(__pyx_t_1, function);
11676  }
11677  }
11678  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
11679  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11680  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11681  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error)
11682  __Pyx_GOTREF(__pyx_t_5);
11683  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11684  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11685 
11686  /* "Isosurface.pyx":459
11687  * pov.write(povScene)
11688  * pov.write("{0:d},\n".format(len(self.boundaryNodes)))
11689  * for n in self.boundaryNodes: # <<<<<<<<<<<<<<
11690  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(
11691  * *self.nodeArray[n]))
11692  */
11693  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_boundaryNodes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L1_error)
11694  __Pyx_GOTREF(__pyx_t_5);
11695  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
11696  __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
11697  __pyx_t_10 = NULL;
11698  } else {
11699  __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
11700  __Pyx_GOTREF(__pyx_t_1);
11701  __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 459, __pyx_L1_error)
11702  }
11703  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11704  for (;;) {
11705  if (likely(!__pyx_t_10)) {
11706  if (likely(PyList_CheckExact(__pyx_t_1))) {
11707  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
11708  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11709  __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
11710  #else
11711  __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L1_error)
11712  __Pyx_GOTREF(__pyx_t_5);
11713  #endif
11714  } else {
11715  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
11716  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11717  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
11718  #else
11719  __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 459, __pyx_L1_error)
11720  __Pyx_GOTREF(__pyx_t_5);
11721  #endif
11722  }
11723  } else {
11724  __pyx_t_5 = __pyx_t_10(__pyx_t_1);
11725  if (unlikely(!__pyx_t_5)) {
11726  PyObject* exc_type = PyErr_Occurred();
11727  if (exc_type) {
11728  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11729  else __PYX_ERR(0, 459, __pyx_L1_error)
11730  }
11731  break;
11732  }
11733  __Pyx_GOTREF(__pyx_t_5);
11734  }
11735  __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_5);
11736  __pyx_t_5 = 0;
11737 
11738  /* "Isosurface.pyx":460
11739  * pov.write("{0:d},\n".format(len(self.boundaryNodes)))
11740  * for n in self.boundaryNodes:
11741  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format( # <<<<<<<<<<<<<<
11742  * *self.nodeArray[n]))
11743  * pov.write("}\n")
11744  */
11745  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error)
11746  __Pyx_GOTREF(__pyx_t_2);
11747  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_f_1_f_2_f, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 460, __pyx_L1_error)
11748  __Pyx_GOTREF(__pyx_t_7);
11749 
11750  /* "Isosurface.pyx":461
11751  * for n in self.boundaryNodes:
11752  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(
11753  * *self.nodeArray[n])) # <<<<<<<<<<<<<<
11754  * pov.write("}\n")
11755  * pov.write("""face_indices {
11756  */
11757  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nodeArray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error)
11758  __Pyx_GOTREF(__pyx_t_3);
11759  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 461, __pyx_L1_error)
11760  __Pyx_GOTREF(__pyx_t_8);
11761  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11762 
11763  /* "Isosurface.pyx":460
11764  * pov.write("{0:d},\n".format(len(self.boundaryNodes)))
11765  * for n in self.boundaryNodes:
11766  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format( # <<<<<<<<<<<<<<
11767  * *self.nodeArray[n]))
11768  * pov.write("}\n")
11769  */
11770  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error)
11771  __Pyx_GOTREF(__pyx_t_3);
11772  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11773  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 460, __pyx_L1_error)
11774  __Pyx_GOTREF(__pyx_t_8);
11775  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11776  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11777  __pyx_t_3 = NULL;
11778  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
11779  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11780  if (likely(__pyx_t_3)) {
11781  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11782  __Pyx_INCREF(__pyx_t_3);
11783  __Pyx_INCREF(function);
11784  __Pyx_DECREF_SET(__pyx_t_2, function);
11785  }
11786  }
11787  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8);
11788  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11789  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11790  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error)
11791  __Pyx_GOTREF(__pyx_t_5);
11792  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11793  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11794 
11795  /* "Isosurface.pyx":459
11796  * pov.write(povScene)
11797  * pov.write("{0:d},\n".format(len(self.boundaryNodes)))
11798  * for n in self.boundaryNodes: # <<<<<<<<<<<<<<
11799  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(
11800  * *self.nodeArray[n]))
11801  */
11802  }
11803  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11804 
11805  /* "Isosurface.pyx":462
11806  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(
11807  * *self.nodeArray[n]))
11808  * pov.write("}\n") # <<<<<<<<<<<<<<
11809  * pov.write("""face_indices {
11810  * """)
11811  */
11812  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11813  __Pyx_GOTREF(__pyx_t_5);
11814  __pyx_t_2 = NULL;
11815  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11816  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
11817  if (likely(__pyx_t_2)) {
11818  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11819  __Pyx_INCREF(__pyx_t_2);
11820  __Pyx_INCREF(function);
11821  __Pyx_DECREF_SET(__pyx_t_5, function);
11822  }
11823  }
11824  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__6);
11825  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11826  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11827  __Pyx_GOTREF(__pyx_t_1);
11828  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11829  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11830 
11831  /* "Isosurface.pyx":463
11832  * *self.nodeArray[n]))
11833  * pov.write("}\n")
11834  * pov.write("""face_indices { # <<<<<<<<<<<<<<
11835  * """)
11836  * pov.write("{0:d},\n".format(
11837  */
11838  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error)
11839  __Pyx_GOTREF(__pyx_t_5);
11840  __pyx_t_2 = NULL;
11841  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11842  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
11843  if (likely(__pyx_t_2)) {
11844  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11845  __Pyx_INCREF(__pyx_t_2);
11846  __Pyx_INCREF(function);
11847  __Pyx_DECREF_SET(__pyx_t_5, function);
11848  }
11849  }
11850  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_s_face_indices) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_face_indices);
11851  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11852  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11853  __Pyx_GOTREF(__pyx_t_1);
11854  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11855  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11856 
11857  /* "Isosurface.pyx":465
11858  * pov.write("""face_indices {
11859  * """)
11860  * pov.write("{0:d},\n".format( # <<<<<<<<<<<<<<
11861  * np.count_nonzero(self.elementBoundaryMaterialTypes)))
11862  * for ebN in self.exteriorElementBoundariesArray:
11863  */
11864  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11865  __Pyx_GOTREF(__pyx_t_5);
11866  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 465, __pyx_L1_error)
11867  __Pyx_GOTREF(__pyx_t_8);
11868 
11869  /* "Isosurface.pyx":466
11870  * """)
11871  * pov.write("{0:d},\n".format(
11872  * np.count_nonzero(self.elementBoundaryMaterialTypes))) # <<<<<<<<<<<<<<
11873  * for ebN in self.exteriorElementBoundariesArray:
11874  * if self.elementBoundaryMaterialTypes[ebN] > 0:
11875  */
11876  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error)
11877  __Pyx_GOTREF(__pyx_t_7);
11878  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_count_nonzero); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 466, __pyx_L1_error)
11879  __Pyx_GOTREF(__pyx_t_11);
11880  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11881  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementBoundaryMaterialTypes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 466, __pyx_L1_error)
11882  __Pyx_GOTREF(__pyx_t_7);
11883  __pyx_t_12 = NULL;
11884  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
11885  __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
11886  if (likely(__pyx_t_12)) {
11887  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
11888  __Pyx_INCREF(__pyx_t_12);
11889  __Pyx_INCREF(function);
11890  __Pyx_DECREF_SET(__pyx_t_11, function);
11891  }
11892  }
11893  __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_7);
11894  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
11895  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11896  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error)
11897  __Pyx_GOTREF(__pyx_t_3);
11898  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
11899  __pyx_t_11 = NULL;
11900  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
11901  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
11902  if (likely(__pyx_t_11)) {
11903  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
11904  __Pyx_INCREF(__pyx_t_11);
11905  __Pyx_INCREF(function);
11906  __Pyx_DECREF_SET(__pyx_t_8, function);
11907  }
11908  }
11909  __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
11910  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
11911  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11912  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11913  __Pyx_GOTREF(__pyx_t_2);
11914  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11915  __pyx_t_8 = NULL;
11916  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11917  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
11918  if (likely(__pyx_t_8)) {
11919  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11920  __Pyx_INCREF(__pyx_t_8);
11921  __Pyx_INCREF(function);
11922  __Pyx_DECREF_SET(__pyx_t_5, function);
11923  }
11924  }
11925  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2);
11926  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11927  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11928  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11929  __Pyx_GOTREF(__pyx_t_1);
11930  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11931  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11932 
11933  /* "Isosurface.pyx":467
11934  * pov.write("{0:d},\n".format(
11935  * np.count_nonzero(self.elementBoundaryMaterialTypes)))
11936  * for ebN in self.exteriorElementBoundariesArray: # <<<<<<<<<<<<<<
11937  * if self.elementBoundaryMaterialTypes[ebN] > 0:
11938  * bnt = tuple(
11939  */
11940  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_exteriorElementBoundariesArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
11941  __Pyx_GOTREF(__pyx_t_1);
11942  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
11943  __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
11944  __pyx_t_10 = NULL;
11945  } else {
11946  __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 467, __pyx_L1_error)
11947  __Pyx_GOTREF(__pyx_t_5);
11948  __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 467, __pyx_L1_error)
11949  }
11950  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11951  for (;;) {
11952  if (likely(!__pyx_t_10)) {
11953  if (likely(PyList_CheckExact(__pyx_t_5))) {
11954  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
11955  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11956  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 467, __pyx_L1_error)
11957  #else
11958  __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
11959  __Pyx_GOTREF(__pyx_t_1);
11960  #endif
11961  } else {
11962  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
11963  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11964  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 467, __pyx_L1_error)
11965  #else
11966  __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
11967  __Pyx_GOTREF(__pyx_t_1);
11968  #endif
11969  }
11970  } else {
11971  __pyx_t_1 = __pyx_t_10(__pyx_t_5);
11972  if (unlikely(!__pyx_t_1)) {
11973  PyObject* exc_type = PyErr_Occurred();
11974  if (exc_type) {
11975  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11976  else __PYX_ERR(0, 467, __pyx_L1_error)
11977  }
11978  break;
11979  }
11980  __Pyx_GOTREF(__pyx_t_1);
11981  }
11982  __Pyx_XDECREF_SET(__pyx_v_ebN, __pyx_t_1);
11983  __pyx_t_1 = 0;
11984 
11985  /* "Isosurface.pyx":468
11986  * np.count_nonzero(self.elementBoundaryMaterialTypes)))
11987  * for ebN in self.exteriorElementBoundariesArray:
11988  * if self.elementBoundaryMaterialTypes[ebN] > 0: # <<<<<<<<<<<<<<
11989  * bnt = tuple(
11990  * [self.g2b[n] for n
11991  */
11992  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementBoundaryMaterialTypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
11993  __Pyx_GOTREF(__pyx_t_1);
11994  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_ebN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
11995  __Pyx_GOTREF(__pyx_t_2);
11996  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11997  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
11998  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11999  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 468, __pyx_L1_error)
12000  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12001  if (__pyx_t_6) {
12002 
12003  /* "Isosurface.pyx":470
12004  * if self.elementBoundaryMaterialTypes[ebN] > 0:
12005  * bnt = tuple(
12006  * [self.g2b[n] for n # <<<<<<<<<<<<<<
12007  * in self.elementBoundaryNodesArray[ebN]])
12008  * pov.write("<{0:d},{1:d},{2:d}>,\n".format(*bnt))
12009  */
12010  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
12011  __Pyx_GOTREF(__pyx_t_1);
12012 
12013  /* "Isosurface.pyx":471
12014  * bnt = tuple(
12015  * [self.g2b[n] for n
12016  * in self.elementBoundaryNodesArray[ebN]]) # <<<<<<<<<<<<<<
12017  * pov.write("<{0:d},{1:d},{2:d}>,\n".format(*bnt))
12018  * pov.write("}\n")
12019  */
12020  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementBoundaryNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
12021  __Pyx_GOTREF(__pyx_t_2);
12022  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_ebN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L1_error)
12023  __Pyx_GOTREF(__pyx_t_8);
12024  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12025  if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
12026  __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0;
12027  __pyx_t_14 = NULL;
12028  } else {
12029  __pyx_t_13 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
12030  __Pyx_GOTREF(__pyx_t_2);
12031  __pyx_t_14 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 471, __pyx_L1_error)
12032  }
12033  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12034  for (;;) {
12035  if (likely(!__pyx_t_14)) {
12036  if (likely(PyList_CheckExact(__pyx_t_2))) {
12037  if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break;
12038  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12039  __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 471, __pyx_L1_error)
12040  #else
12041  __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L1_error)
12042  __Pyx_GOTREF(__pyx_t_8);
12043  #endif
12044  } else {
12045  if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
12046  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12047  __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 471, __pyx_L1_error)
12048  #else
12049  __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L1_error)
12050  __Pyx_GOTREF(__pyx_t_8);
12051  #endif
12052  }
12053  } else {
12054  __pyx_t_8 = __pyx_t_14(__pyx_t_2);
12055  if (unlikely(!__pyx_t_8)) {
12056  PyObject* exc_type = PyErr_Occurred();
12057  if (exc_type) {
12058  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12059  else __PYX_ERR(0, 471, __pyx_L1_error)
12060  }
12061  break;
12062  }
12063  __Pyx_GOTREF(__pyx_t_8);
12064  }
12065  __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_8);
12066  __pyx_t_8 = 0;
12067 
12068  /* "Isosurface.pyx":470
12069  * if self.elementBoundaryMaterialTypes[ebN] > 0:
12070  * bnt = tuple(
12071  * [self.g2b[n] for n # <<<<<<<<<<<<<<
12072  * in self.elementBoundaryNodesArray[ebN]])
12073  * pov.write("<{0:d},{1:d},{2:d}>,\n".format(*bnt))
12074  */
12075  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_g2b); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error)
12076  __Pyx_GOTREF(__pyx_t_8);
12077  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
12078  __Pyx_GOTREF(__pyx_t_3);
12079  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12080  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 470, __pyx_L1_error)
12081  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12082  }
12083  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12084 
12085  /* "Isosurface.pyx":469
12086  * for ebN in self.exteriorElementBoundariesArray:
12087  * if self.elementBoundaryMaterialTypes[ebN] > 0:
12088  * bnt = tuple( # <<<<<<<<<<<<<<
12089  * [self.g2b[n] for n
12090  * in self.elementBoundaryNodesArray[ebN]])
12091  */
12092  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
12093  __Pyx_GOTREF(__pyx_t_2);
12094  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12095  __Pyx_XDECREF_SET(__pyx_v_bnt, ((PyObject*)__pyx_t_2));
12096  __pyx_t_2 = 0;
12097 
12098  /* "Isosurface.pyx":472
12099  * [self.g2b[n] for n
12100  * in self.elementBoundaryNodesArray[ebN]])
12101  * pov.write("<{0:d},{1:d},{2:d}>,\n".format(*bnt)) # <<<<<<<<<<<<<<
12102  * pov.write("}\n")
12103  * pov.write("//inside_vector on\n}//mesh\n")
12104  */
12105  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
12106  __Pyx_GOTREF(__pyx_t_1);
12107  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d_1_d_2_d, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
12108  __Pyx_GOTREF(__pyx_t_3);
12109  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_bnt, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 472, __pyx_L1_error)
12110  __Pyx_GOTREF(__pyx_t_8);
12111  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12112  __pyx_t_3 = NULL;
12113  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
12114  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
12115  if (likely(__pyx_t_3)) {
12116  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12117  __Pyx_INCREF(__pyx_t_3);
12118  __Pyx_INCREF(function);
12119  __Pyx_DECREF_SET(__pyx_t_1, function);
12120  }
12121  }
12122  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8);
12123  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12124  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12125  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
12126  __Pyx_GOTREF(__pyx_t_2);
12127  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12128  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12129 
12130  /* "Isosurface.pyx":468
12131  * np.count_nonzero(self.elementBoundaryMaterialTypes)))
12132  * for ebN in self.exteriorElementBoundariesArray:
12133  * if self.elementBoundaryMaterialTypes[ebN] > 0: # <<<<<<<<<<<<<<
12134  * bnt = tuple(
12135  * [self.g2b[n] for n
12136  */
12137  }
12138 
12139  /* "Isosurface.pyx":467
12140  * pov.write("{0:d},\n".format(
12141  * np.count_nonzero(self.elementBoundaryMaterialTypes)))
12142  * for ebN in self.exteriorElementBoundariesArray: # <<<<<<<<<<<<<<
12143  * if self.elementBoundaryMaterialTypes[ebN] > 0:
12144  * bnt = tuple(
12145  */
12146  }
12147  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12148 
12149  /* "Isosurface.pyx":473
12150  * in self.elementBoundaryNodesArray[ebN]])
12151  * pov.write("<{0:d},{1:d},{2:d}>,\n".format(*bnt))
12152  * pov.write("}\n") # <<<<<<<<<<<<<<
12153  * pov.write("//inside_vector on\n}//mesh\n")
12154  * pov.flush()
12155  */
12156  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error)
12157  __Pyx_GOTREF(__pyx_t_2);
12158  __pyx_t_1 = NULL;
12159  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12160  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12161  if (likely(__pyx_t_1)) {
12162  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12163  __Pyx_INCREF(__pyx_t_1);
12164  __Pyx_INCREF(function);
12165  __Pyx_DECREF_SET(__pyx_t_2, function);
12166  }
12167  }
12168  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s__6);
12169  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12170  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L1_error)
12171  __Pyx_GOTREF(__pyx_t_5);
12172  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12173  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12174 
12175  /* "Isosurface.pyx":474
12176  * pov.write("<{0:d},{1:d},{2:d}>,\n".format(*bnt))
12177  * pov.write("}\n")
12178  * pov.write("//inside_vector on\n}//mesh\n") # <<<<<<<<<<<<<<
12179  * pov.flush()
12180  * pov.close()
12181  */
12182  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
12183  __Pyx_GOTREF(__pyx_t_2);
12184  __pyx_t_1 = NULL;
12185  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12186  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12187  if (likely(__pyx_t_1)) {
12188  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12189  __Pyx_INCREF(__pyx_t_1);
12190  __Pyx_INCREF(function);
12191  __Pyx_DECREF_SET(__pyx_t_2, function);
12192  }
12193  }
12194  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_s_inside_vector_on_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_inside_vector_on_mesh);
12195  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12196  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 474, __pyx_L1_error)
12197  __Pyx_GOTREF(__pyx_t_5);
12198  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12199  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12200 
12201  /* "Isosurface.pyx":475
12202  * pov.write("}\n")
12203  * pov.write("//inside_vector on\n}//mesh\n")
12204  * pov.flush() # <<<<<<<<<<<<<<
12205  * pov.close()
12206  * self.comm.endSequential()
12207  */
12208  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
12209  __Pyx_GOTREF(__pyx_t_2);
12210  __pyx_t_1 = NULL;
12211  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12212  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12213  if (likely(__pyx_t_1)) {
12214  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12215  __Pyx_INCREF(__pyx_t_1);
12216  __Pyx_INCREF(function);
12217  __Pyx_DECREF_SET(__pyx_t_2, function);
12218  }
12219  }
12220  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
12221  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12222  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L1_error)
12223  __Pyx_GOTREF(__pyx_t_5);
12224  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12225  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12226 
12227  /* "Isosurface.pyx":476
12228  * pov.write("//inside_vector on\n}//mesh\n")
12229  * pov.flush()
12230  * pov.close() # <<<<<<<<<<<<<<
12231  * self.comm.endSequential()
12232  * self.comm.barrier()
12233  */
12234  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
12235  __Pyx_GOTREF(__pyx_t_2);
12236  __pyx_t_1 = NULL;
12237  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12238  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12239  if (likely(__pyx_t_1)) {
12240  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12241  __Pyx_INCREF(__pyx_t_1);
12242  __Pyx_INCREF(function);
12243  __Pyx_DECREF_SET(__pyx_t_2, function);
12244  }
12245  }
12246  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
12247  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12248  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error)
12249  __Pyx_GOTREF(__pyx_t_5);
12250  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12251  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12252 
12253  /* "Isosurface.pyx":477
12254  * pov.flush()
12255  * pov.close()
12256  * self.comm.endSequential() # <<<<<<<<<<<<<<
12257  * self.comm.barrier()
12258  * self.comm.beginSequential()
12259  */
12260  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
12261  __Pyx_GOTREF(__pyx_t_2);
12262  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_endSequential); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
12263  __Pyx_GOTREF(__pyx_t_1);
12264  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12265  __pyx_t_2 = NULL;
12266  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
12267  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
12268  if (likely(__pyx_t_2)) {
12269  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12270  __Pyx_INCREF(__pyx_t_2);
12271  __Pyx_INCREF(function);
12272  __Pyx_DECREF_SET(__pyx_t_1, function);
12273  }
12274  }
12275  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
12276  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12277  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 477, __pyx_L1_error)
12278  __Pyx_GOTREF(__pyx_t_5);
12279  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12280  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12281 
12282  /* "Isosurface.pyx":478
12283  * pov.close()
12284  * self.comm.endSequential()
12285  * self.comm.barrier() # <<<<<<<<<<<<<<
12286  * self.comm.beginSequential()
12287  * pov = open(pov_filename, "a")
12288  */
12289  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 478, __pyx_L1_error)
12290  __Pyx_GOTREF(__pyx_t_1);
12291  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_barrier); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
12292  __Pyx_GOTREF(__pyx_t_2);
12293  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12294  __pyx_t_1 = NULL;
12295  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12296  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
12297  if (likely(__pyx_t_1)) {
12298  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12299  __Pyx_INCREF(__pyx_t_1);
12300  __Pyx_INCREF(function);
12301  __Pyx_DECREF_SET(__pyx_t_2, function);
12302  }
12303  }
12304  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
12305  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12306  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error)
12307  __Pyx_GOTREF(__pyx_t_5);
12308  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12309  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12310 
12311  /* "Isosurface.pyx":479
12312  * self.comm.endSequential()
12313  * self.comm.barrier()
12314  * self.comm.beginSequential() # <<<<<<<<<<<<<<
12315  * pov = open(pov_filename, "a")
12316  * if self.comm.isMaster():
12317  */
12318  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
12319  __Pyx_GOTREF(__pyx_t_2);
12320  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_beginSequential); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
12321  __Pyx_GOTREF(__pyx_t_1);
12322  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12323  __pyx_t_2 = NULL;
12324  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
12325  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
12326  if (likely(__pyx_t_2)) {
12327  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12328  __Pyx_INCREF(__pyx_t_2);
12329  __Pyx_INCREF(function);
12330  __Pyx_DECREF_SET(__pyx_t_1, function);
12331  }
12332  }
12333  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
12334  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12335  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 479, __pyx_L1_error)
12336  __Pyx_GOTREF(__pyx_t_5);
12337  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12338  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12339 
12340  /* "Isosurface.pyx":480
12341  * self.comm.barrier()
12342  * self.comm.beginSequential()
12343  * pov = open(pov_filename, "a") # <<<<<<<<<<<<<<
12344  * if self.comm.isMaster():
12345  * pov.write("""}//union of meshes
12346  */
12347  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error)
12348  __Pyx_GOTREF(__pyx_t_5);
12349  __Pyx_INCREF(__pyx_v_pov_filename);
12350  __Pyx_GIVEREF(__pyx_v_pov_filename);
12351  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pov_filename);
12352  __Pyx_INCREF(__pyx_n_s_a);
12353  __Pyx_GIVEREF(__pyx_n_s_a);
12354  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_s_a);
12355  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
12356  __Pyx_GOTREF(__pyx_t_1);
12357  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12358  __Pyx_DECREF_SET(__pyx_v_pov, __pyx_t_1);
12359  __pyx_t_1 = 0;
12360 
12361  /* "Isosurface.pyx":481
12362  * self.comm.beginSequential()
12363  * pov = open(pov_filename, "a")
12364  * if self.comm.isMaster(): # <<<<<<<<<<<<<<
12365  * pov.write("""}//union of meshes
12366  * //}//difference of perturbed bounding box and boundary
12367  */
12368  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error)
12369  __Pyx_GOTREF(__pyx_t_5);
12370  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_isMaster); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
12371  __Pyx_GOTREF(__pyx_t_2);
12372  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12373  __pyx_t_5 = NULL;
12374  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12375  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
12376  if (likely(__pyx_t_5)) {
12377  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12378  __Pyx_INCREF(__pyx_t_5);
12379  __Pyx_INCREF(function);
12380  __Pyx_DECREF_SET(__pyx_t_2, function);
12381  }
12382  }
12383  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
12384  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12385  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
12386  __Pyx_GOTREF(__pyx_t_1);
12387  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12388  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 481, __pyx_L1_error)
12389  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12390  if (__pyx_t_6) {
12391 
12392  /* "Isosurface.pyx":482
12393  * pov = open(pov_filename, "a")
12394  * if self.comm.isMaster():
12395  * pov.write("""}//union of meshes # <<<<<<<<<<<<<<
12396  * //}//difference of perturbed bounding box and boundary
12397  * matrix < 1.000000, 0.000000, 0.000000,
12398  */
12399  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error)
12400  __Pyx_GOTREF(__pyx_t_2);
12401  __pyx_t_5 = NULL;
12402  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12403  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
12404  if (likely(__pyx_t_5)) {
12405  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12406  __Pyx_INCREF(__pyx_t_5);
12407  __Pyx_INCREF(function);
12408  __Pyx_DECREF_SET(__pyx_t_2, function);
12409  }
12410  }
12411  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_s_union_of_meshes_difference_of_p) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_union_of_meshes_difference_of_p);
12412  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12413  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error)
12414  __Pyx_GOTREF(__pyx_t_1);
12415  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12416  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12417 
12418  /* "Isosurface.pyx":481
12419  * self.comm.beginSequential()
12420  * pov = open(pov_filename, "a")
12421  * if self.comm.isMaster(): # <<<<<<<<<<<<<<
12422  * pov.write("""}//union of meshes
12423  * //}//difference of perturbed bounding box and boundary
12424  */
12425  }
12426 
12427  /* "Isosurface.pyx":454
12428  * else:
12429  * pov = open(pov_filename, "a")
12430  * if self.writeBoundary: # <<<<<<<<<<<<<<
12431  * povScene = """mesh2 {
12432  * vertex_vectors {"""
12433  */
12434  }
12435 
12436  /* "Isosurface.pyx":491
12437  * }//object
12438  * """)
12439  * povScene = """mesh2 { # <<<<<<<<<<<<<<
12440  * vertex_vectors {"""
12441  * pov.write(povScene)
12442  */
12443  __Pyx_INCREF(__pyx_kp_s_mesh2_vertex_vectors);
12444  __Pyx_XDECREF_SET(__pyx_v_povScene, __pyx_kp_s_mesh2_vertex_vectors);
12445 
12446  /* "Isosurface.pyx":493
12447  * povScene = """mesh2 {
12448  * vertex_vectors {"""
12449  * pov.write(povScene) # <<<<<<<<<<<<<<
12450  * pov.write("{0:d},\n".format(len(nodes)))
12451  * for n in nodes:
12452  */
12453  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error)
12454  __Pyx_GOTREF(__pyx_t_2);
12455  __pyx_t_5 = NULL;
12456  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12457  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
12458  if (likely(__pyx_t_5)) {
12459  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12460  __Pyx_INCREF(__pyx_t_5);
12461  __Pyx_INCREF(function);
12462  __Pyx_DECREF_SET(__pyx_t_2, function);
12463  }
12464  }
12465  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_povScene) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_povScene);
12466  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12467  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)
12468  __Pyx_GOTREF(__pyx_t_1);
12469  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12470  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12471 
12472  /* "Isosurface.pyx":494
12473  * vertex_vectors {"""
12474  * pov.write(povScene)
12475  * pov.write("{0:d},\n".format(len(nodes))) # <<<<<<<<<<<<<<
12476  * for n in nodes:
12477  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12478  */
12479  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
12480  __Pyx_GOTREF(__pyx_t_2);
12481  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 494, __pyx_L1_error)
12482  __Pyx_GOTREF(__pyx_t_8);
12483  __pyx_t_9 = PyObject_Length(__pyx_v_nodes); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 494, __pyx_L1_error)
12484  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 494, __pyx_L1_error)
12485  __Pyx_GOTREF(__pyx_t_3);
12486  __pyx_t_11 = NULL;
12487  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
12488  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
12489  if (likely(__pyx_t_11)) {
12490  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
12491  __Pyx_INCREF(__pyx_t_11);
12492  __Pyx_INCREF(function);
12493  __Pyx_DECREF_SET(__pyx_t_8, function);
12494  }
12495  }
12496  __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
12497  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
12498  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12499  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 494, __pyx_L1_error)
12500  __Pyx_GOTREF(__pyx_t_5);
12501  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12502  __pyx_t_8 = NULL;
12503  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12504  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
12505  if (likely(__pyx_t_8)) {
12506  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12507  __Pyx_INCREF(__pyx_t_8);
12508  __Pyx_INCREF(function);
12509  __Pyx_DECREF_SET(__pyx_t_2, function);
12510  }
12511  }
12512  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
12513  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
12514  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12515  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error)
12516  __Pyx_GOTREF(__pyx_t_1);
12517  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12518  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12519 
12520  /* "Isosurface.pyx":495
12521  * pov.write(povScene)
12522  * pov.write("{0:d},\n".format(len(nodes)))
12523  * for n in nodes: # <<<<<<<<<<<<<<
12524  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12525  * pov.write(""" }
12526  */
12527  if (likely(PyList_CheckExact(__pyx_v_nodes)) || PyTuple_CheckExact(__pyx_v_nodes)) {
12528  __pyx_t_1 = __pyx_v_nodes; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
12529  __pyx_t_10 = NULL;
12530  } else {
12531  __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_nodes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
12532  __Pyx_GOTREF(__pyx_t_1);
12533  __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 495, __pyx_L1_error)
12534  }
12535  for (;;) {
12536  if (likely(!__pyx_t_10)) {
12537  if (likely(PyList_CheckExact(__pyx_t_1))) {
12538  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
12539  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12540  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L1_error)
12541  #else
12542  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
12543  __Pyx_GOTREF(__pyx_t_2);
12544  #endif
12545  } else {
12546  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
12547  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12548  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L1_error)
12549  #else
12550  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
12551  __Pyx_GOTREF(__pyx_t_2);
12552  #endif
12553  }
12554  } else {
12555  __pyx_t_2 = __pyx_t_10(__pyx_t_1);
12556  if (unlikely(!__pyx_t_2)) {
12557  PyObject* exc_type = PyErr_Occurred();
12558  if (exc_type) {
12559  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12560  else __PYX_ERR(0, 495, __pyx_L1_error)
12561  }
12562  break;
12563  }
12564  __Pyx_GOTREF(__pyx_t_2);
12565  }
12566  __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_2);
12567  __pyx_t_2 = 0;
12568 
12569  /* "Isosurface.pyx":496
12570  * pov.write("{0:d},\n".format(len(nodes)))
12571  * for n in nodes:
12572  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n)) # <<<<<<<<<<<<<<
12573  * pov.write(""" }
12574  * normal_vectors {
12575  */
12576  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 496, __pyx_L1_error)
12577  __Pyx_GOTREF(__pyx_t_5);
12578  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_f_1_f_2_f, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 496, __pyx_L1_error)
12579  __Pyx_GOTREF(__pyx_t_8);
12580  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
12581  __Pyx_GOTREF(__pyx_t_3);
12582  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 496, __pyx_L1_error)
12583  __Pyx_GOTREF(__pyx_t_11);
12584  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12585  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12586  __pyx_t_3 = NULL;
12587  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
12588  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
12589  if (likely(__pyx_t_3)) {
12590  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
12591  __Pyx_INCREF(__pyx_t_3);
12592  __Pyx_INCREF(function);
12593  __Pyx_DECREF_SET(__pyx_t_5, function);
12594  }
12595  }
12596  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_11);
12597  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12598  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12599  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
12600  __Pyx_GOTREF(__pyx_t_2);
12601  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12602  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12603 
12604  /* "Isosurface.pyx":495
12605  * pov.write(povScene)
12606  * pov.write("{0:d},\n".format(len(nodes)))
12607  * for n in nodes: # <<<<<<<<<<<<<<
12608  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12609  * pov.write(""" }
12610  */
12611  }
12612  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12613 
12614  /* "Isosurface.pyx":497
12615  * for n in nodes:
12616  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12617  * pov.write(""" } # <<<<<<<<<<<<<<
12618  * normal_vectors {
12619  * """)
12620  */
12621  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
12622  __Pyx_GOTREF(__pyx_t_2);
12623  __pyx_t_5 = NULL;
12624  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12625  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
12626  if (likely(__pyx_t_5)) {
12627  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12628  __Pyx_INCREF(__pyx_t_5);
12629  __Pyx_INCREF(function);
12630  __Pyx_DECREF_SET(__pyx_t_2, function);
12631  }
12632  }
12633  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_s_normal_vectors) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_normal_vectors);
12634  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12635  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
12636  __Pyx_GOTREF(__pyx_t_1);
12637  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12638  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12639 
12640  /* "Isosurface.pyx":500
12641  * normal_vectors {
12642  * """)
12643  * pov.write("{0:d},\n".format((len(normals)))) # <<<<<<<<<<<<<<
12644  * for n in normals:
12645  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12646  */
12647  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
12648  __Pyx_GOTREF(__pyx_t_2);
12649  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 500, __pyx_L1_error)
12650  __Pyx_GOTREF(__pyx_t_11);
12651  __pyx_t_9 = PyObject_Length(__pyx_v_normals); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 500, __pyx_L1_error)
12652  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 500, __pyx_L1_error)
12653  __Pyx_GOTREF(__pyx_t_3);
12654  __pyx_t_8 = NULL;
12655  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
12656  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
12657  if (likely(__pyx_t_8)) {
12658  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
12659  __Pyx_INCREF(__pyx_t_8);
12660  __Pyx_INCREF(function);
12661  __Pyx_DECREF_SET(__pyx_t_11, function);
12662  }
12663  }
12664  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3);
12665  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
12666  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12667  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 500, __pyx_L1_error)
12668  __Pyx_GOTREF(__pyx_t_5);
12669  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12670  __pyx_t_11 = NULL;
12671  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12672  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
12673  if (likely(__pyx_t_11)) {
12674  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12675  __Pyx_INCREF(__pyx_t_11);
12676  __Pyx_INCREF(function);
12677  __Pyx_DECREF_SET(__pyx_t_2, function);
12678  }
12679  }
12680  __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_11, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
12681  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
12682  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12683  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error)
12684  __Pyx_GOTREF(__pyx_t_1);
12685  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12686  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12687 
12688  /* "Isosurface.pyx":501
12689  * """)
12690  * pov.write("{0:d},\n".format((len(normals))))
12691  * for n in normals: # <<<<<<<<<<<<<<
12692  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12693  * pov.write(""" }
12694  */
12695  if (likely(PyList_CheckExact(__pyx_v_normals)) || PyTuple_CheckExact(__pyx_v_normals)) {
12696  __pyx_t_1 = __pyx_v_normals; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
12697  __pyx_t_10 = NULL;
12698  } else {
12699  __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_normals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error)
12700  __Pyx_GOTREF(__pyx_t_1);
12701  __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 501, __pyx_L1_error)
12702  }
12703  for (;;) {
12704  if (likely(!__pyx_t_10)) {
12705  if (likely(PyList_CheckExact(__pyx_t_1))) {
12706  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
12707  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12708  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 501, __pyx_L1_error)
12709  #else
12710  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
12711  __Pyx_GOTREF(__pyx_t_2);
12712  #endif
12713  } else {
12714  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
12715  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12716  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 501, __pyx_L1_error)
12717  #else
12718  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
12719  __Pyx_GOTREF(__pyx_t_2);
12720  #endif
12721  }
12722  } else {
12723  __pyx_t_2 = __pyx_t_10(__pyx_t_1);
12724  if (unlikely(!__pyx_t_2)) {
12725  PyObject* exc_type = PyErr_Occurred();
12726  if (exc_type) {
12727  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12728  else __PYX_ERR(0, 501, __pyx_L1_error)
12729  }
12730  break;
12731  }
12732  __Pyx_GOTREF(__pyx_t_2);
12733  }
12734  __Pyx_XDECREF_SET(__pyx_v_n, __pyx_t_2);
12735  __pyx_t_2 = 0;
12736 
12737  /* "Isosurface.pyx":502
12738  * pov.write("{0:d},\n".format((len(normals))))
12739  * for n in normals:
12740  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n)) # <<<<<<<<<<<<<<
12741  * pov.write(""" }
12742  * face_indices {
12743  */
12744  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error)
12745  __Pyx_GOTREF(__pyx_t_5);
12746  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_f_1_f_2_f, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 502, __pyx_L1_error)
12747  __Pyx_GOTREF(__pyx_t_11);
12748  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error)
12749  __Pyx_GOTREF(__pyx_t_3);
12750  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 502, __pyx_L1_error)
12751  __Pyx_GOTREF(__pyx_t_8);
12752  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12753  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12754  __pyx_t_3 = NULL;
12755  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
12756  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
12757  if (likely(__pyx_t_3)) {
12758  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
12759  __Pyx_INCREF(__pyx_t_3);
12760  __Pyx_INCREF(function);
12761  __Pyx_DECREF_SET(__pyx_t_5, function);
12762  }
12763  }
12764  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
12765  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12766  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12767  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error)
12768  __Pyx_GOTREF(__pyx_t_2);
12769  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12770  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12771 
12772  /* "Isosurface.pyx":501
12773  * """)
12774  * pov.write("{0:d},\n".format((len(normals))))
12775  * for n in normals: # <<<<<<<<<<<<<<
12776  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12777  * pov.write(""" }
12778  */
12779  }
12780  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12781 
12782  /* "Isosurface.pyx":503
12783  * for n in normals:
12784  * pov.write("<{0:f}, {1:f}, {2:f}>,\n".format(*n))
12785  * pov.write(""" } # <<<<<<<<<<<<<<
12786  * face_indices {
12787  * """)
12788  */
12789  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
12790  __Pyx_GOTREF(__pyx_t_2);
12791  __pyx_t_5 = NULL;
12792  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12793  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
12794  if (likely(__pyx_t_5)) {
12795  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12796  __Pyx_INCREF(__pyx_t_5);
12797  __Pyx_INCREF(function);
12798  __Pyx_DECREF_SET(__pyx_t_2, function);
12799  }
12800  }
12801  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_s_face_indices_2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_face_indices_2);
12802  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12803  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
12804  __Pyx_GOTREF(__pyx_t_1);
12805  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12806  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12807 
12808  /* "Isosurface.pyx":506
12809  * face_indices {
12810  * """)
12811  * pov.write("{0:d},\n".format(len(elements))) # <<<<<<<<<<<<<<
12812  * for e in elements:
12813  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*e))
12814  */
12815  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
12816  __Pyx_GOTREF(__pyx_t_2);
12817  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 506, __pyx_L1_error)
12818  __Pyx_GOTREF(__pyx_t_8);
12819  __pyx_t_9 = PyObject_Length(__pyx_v_elements); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 506, __pyx_L1_error)
12820  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error)
12821  __Pyx_GOTREF(__pyx_t_3);
12822  __pyx_t_11 = NULL;
12823  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
12824  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
12825  if (likely(__pyx_t_11)) {
12826  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
12827  __Pyx_INCREF(__pyx_t_11);
12828  __Pyx_INCREF(function);
12829  __Pyx_DECREF_SET(__pyx_t_8, function);
12830  }
12831  }
12832  __pyx_t_5 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
12833  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
12834  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12835  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 506, __pyx_L1_error)
12836  __Pyx_GOTREF(__pyx_t_5);
12837  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12838  __pyx_t_8 = NULL;
12839  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12840  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
12841  if (likely(__pyx_t_8)) {
12842  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12843  __Pyx_INCREF(__pyx_t_8);
12844  __Pyx_INCREF(function);
12845  __Pyx_DECREF_SET(__pyx_t_2, function);
12846  }
12847  }
12848  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
12849  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
12850  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12851  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
12852  __Pyx_GOTREF(__pyx_t_1);
12853  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12854  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12855 
12856  /* "Isosurface.pyx":507
12857  * """)
12858  * pov.write("{0:d},\n".format(len(elements)))
12859  * for e in elements: # <<<<<<<<<<<<<<
12860  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*e))
12861  * pov.write(""" }
12862  */
12863  if (likely(PyList_CheckExact(__pyx_v_elements)) || PyTuple_CheckExact(__pyx_v_elements)) {
12864  __pyx_t_1 = __pyx_v_elements; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
12865  __pyx_t_10 = NULL;
12866  } else {
12867  __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_elements); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
12868  __Pyx_GOTREF(__pyx_t_1);
12869  __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 507, __pyx_L1_error)
12870  }
12871  for (;;) {
12872  if (likely(!__pyx_t_10)) {
12873  if (likely(PyList_CheckExact(__pyx_t_1))) {
12874  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
12875  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12876  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 507, __pyx_L1_error)
12877  #else
12878  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error)
12879  __Pyx_GOTREF(__pyx_t_2);
12880  #endif
12881  } else {
12882  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
12883  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12884  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 507, __pyx_L1_error)
12885  #else
12886  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error)
12887  __Pyx_GOTREF(__pyx_t_2);
12888  #endif
12889  }
12890  } else {
12891  __pyx_t_2 = __pyx_t_10(__pyx_t_1);
12892  if (unlikely(!__pyx_t_2)) {
12893  PyObject* exc_type = PyErr_Occurred();
12894  if (exc_type) {
12895  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12896  else __PYX_ERR(0, 507, __pyx_L1_error)
12897  }
12898  break;
12899  }
12900  __Pyx_GOTREF(__pyx_t_2);
12901  }
12902  __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_2);
12903  __pyx_t_2 = 0;
12904 
12905  /* "Isosurface.pyx":508
12906  * pov.write("{0:d},\n".format(len(elements)))
12907  * for e in elements:
12908  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*e)) # <<<<<<<<<<<<<<
12909  * pov.write(""" }
12910  * normal_indices {
12911  */
12912  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 508, __pyx_L1_error)
12913  __Pyx_GOTREF(__pyx_t_5);
12914  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d_1_d_2_d_2, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 508, __pyx_L1_error)
12915  __Pyx_GOTREF(__pyx_t_8);
12916  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
12917  __Pyx_GOTREF(__pyx_t_3);
12918  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 508, __pyx_L1_error)
12919  __Pyx_GOTREF(__pyx_t_11);
12920  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12921  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12922  __pyx_t_3 = NULL;
12923  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
12924  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
12925  if (likely(__pyx_t_3)) {
12926  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
12927  __Pyx_INCREF(__pyx_t_3);
12928  __Pyx_INCREF(function);
12929  __Pyx_DECREF_SET(__pyx_t_5, function);
12930  }
12931  }
12932  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_11);
12933  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12934  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
12935  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error)
12936  __Pyx_GOTREF(__pyx_t_2);
12937  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12938  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12939 
12940  /* "Isosurface.pyx":507
12941  * """)
12942  * pov.write("{0:d},\n".format(len(elements)))
12943  * for e in elements: # <<<<<<<<<<<<<<
12944  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*e))
12945  * pov.write(""" }
12946  */
12947  }
12948  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12949 
12950  /* "Isosurface.pyx":509
12951  * for e in elements:
12952  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*e))
12953  * pov.write(""" } # <<<<<<<<<<<<<<
12954  * normal_indices {
12955  * """)
12956  */
12957  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
12958  __Pyx_GOTREF(__pyx_t_2);
12959  __pyx_t_5 = NULL;
12960  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
12961  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
12962  if (likely(__pyx_t_5)) {
12963  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12964  __Pyx_INCREF(__pyx_t_5);
12965  __Pyx_INCREF(function);
12966  __Pyx_DECREF_SET(__pyx_t_2, function);
12967  }
12968  }
12969  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_s_normal_indices_2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_normal_indices_2);
12970  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12971  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error)
12972  __Pyx_GOTREF(__pyx_t_1);
12973  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12974  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12975 
12976  /* "Isosurface.pyx":512
12977  * normal_indices {
12978  * """)
12979  * pov.write("{0:d},\n".format(len(normal_indices))) # <<<<<<<<<<<<<<
12980  * for ni in normal_indices:
12981  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*ni))
12982  */
12983  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
12984  __Pyx_GOTREF(__pyx_t_2);
12985  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 512, __pyx_L1_error)
12986  __Pyx_GOTREF(__pyx_t_11);
12987  __pyx_t_9 = PyObject_Length(__pyx_v_normal_indices); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 512, __pyx_L1_error)
12988  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error)
12989  __Pyx_GOTREF(__pyx_t_3);
12990  __pyx_t_8 = NULL;
12991  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
12992  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
12993  if (likely(__pyx_t_8)) {
12994  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
12995  __Pyx_INCREF(__pyx_t_8);
12996  __Pyx_INCREF(function);
12997  __Pyx_DECREF_SET(__pyx_t_11, function);
12998  }
12999  }
13000  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3);
13001  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
13002  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13003  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 512, __pyx_L1_error)
13004  __Pyx_GOTREF(__pyx_t_5);
13005  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13006  __pyx_t_11 = NULL;
13007  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
13008  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
13009  if (likely(__pyx_t_11)) {
13010  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13011  __Pyx_INCREF(__pyx_t_11);
13012  __Pyx_INCREF(function);
13013  __Pyx_DECREF_SET(__pyx_t_2, function);
13014  }
13015  }
13016  __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_11, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
13017  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
13018  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13019  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
13020  __Pyx_GOTREF(__pyx_t_1);
13021  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13022  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13023 
13024  /* "Isosurface.pyx":513
13025  * """)
13026  * pov.write("{0:d},\n".format(len(normal_indices)))
13027  * for ni in normal_indices: # <<<<<<<<<<<<<<
13028  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*ni))
13029  * pov.write(""" }
13030  */
13031  if (likely(PyList_CheckExact(__pyx_v_normal_indices)) || PyTuple_CheckExact(__pyx_v_normal_indices)) {
13032  __pyx_t_1 = __pyx_v_normal_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
13033  __pyx_t_10 = NULL;
13034  } else {
13035  __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_normal_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
13036  __Pyx_GOTREF(__pyx_t_1);
13037  __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 513, __pyx_L1_error)
13038  }
13039  for (;;) {
13040  if (likely(!__pyx_t_10)) {
13041  if (likely(PyList_CheckExact(__pyx_t_1))) {
13042  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
13043  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13044  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 513, __pyx_L1_error)
13045  #else
13046  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
13047  __Pyx_GOTREF(__pyx_t_2);
13048  #endif
13049  } else {
13050  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
13051  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13052  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 513, __pyx_L1_error)
13053  #else
13054  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
13055  __Pyx_GOTREF(__pyx_t_2);
13056  #endif
13057  }
13058  } else {
13059  __pyx_t_2 = __pyx_t_10(__pyx_t_1);
13060  if (unlikely(!__pyx_t_2)) {
13061  PyObject* exc_type = PyErr_Occurred();
13062  if (exc_type) {
13063  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13064  else __PYX_ERR(0, 513, __pyx_L1_error)
13065  }
13066  break;
13067  }
13068  __Pyx_GOTREF(__pyx_t_2);
13069  }
13070  __Pyx_XDECREF_SET(__pyx_v_ni, __pyx_t_2);
13071  __pyx_t_2 = 0;
13072 
13073  /* "Isosurface.pyx":514
13074  * pov.write("{0:d},\n".format(len(normal_indices)))
13075  * for ni in normal_indices:
13076  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*ni)) # <<<<<<<<<<<<<<
13077  * pov.write(""" }
13078  * matrix < 1.000000, 0.000000, 0.000000,
13079  */
13080  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 514, __pyx_L1_error)
13081  __Pyx_GOTREF(__pyx_t_5);
13082  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_d_1_d_2_d_2, __pyx_n_s_format); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 514, __pyx_L1_error)
13083  __Pyx_GOTREF(__pyx_t_11);
13084  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_ni); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
13085  __Pyx_GOTREF(__pyx_t_3);
13086  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 514, __pyx_L1_error)
13087  __Pyx_GOTREF(__pyx_t_8);
13088  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13089  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13090  __pyx_t_3 = NULL;
13091  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13092  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
13093  if (likely(__pyx_t_3)) {
13094  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13095  __Pyx_INCREF(__pyx_t_3);
13096  __Pyx_INCREF(function);
13097  __Pyx_DECREF_SET(__pyx_t_5, function);
13098  }
13099  }
13100  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
13101  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13102  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13103  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error)
13104  __Pyx_GOTREF(__pyx_t_2);
13105  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13106  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13107 
13108  /* "Isosurface.pyx":513
13109  * """)
13110  * pov.write("{0:d},\n".format(len(normal_indices)))
13111  * for ni in normal_indices: # <<<<<<<<<<<<<<
13112  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*ni))
13113  * pov.write(""" }
13114  */
13115  }
13116  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13117 
13118  /* "Isosurface.pyx":515
13119  * for ni in normal_indices:
13120  * pov.write("<{0:d}, {1:d}, {2:d}>,\n".format(*ni))
13121  * pov.write(""" } # <<<<<<<<<<<<<<
13122  * matrix < 1.000000, 0.000000, 0.000000,
13123  * 0.000000, 1.000000, 0.000000,
13124  */
13125  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
13126  __Pyx_GOTREF(__pyx_t_2);
13127  __pyx_t_5 = NULL;
13128  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
13129  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
13130  if (likely(__pyx_t_5)) {
13131  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13132  __Pyx_INCREF(__pyx_t_5);
13133  __Pyx_INCREF(function);
13134  __Pyx_DECREF_SET(__pyx_t_2, function);
13135  }
13136  }
13137  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_s_matrix_1_000000_0_000000_0_0000) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_matrix_1_000000_0_000000_0_0000);
13138  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13139  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
13140  __Pyx_GOTREF(__pyx_t_1);
13141  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13142  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13143 
13144  /* "Isosurface.pyx":523
13145  * }
13146  * """)
13147  * pov.flush() # <<<<<<<<<<<<<<
13148  * pov.close()
13149  * self.comm.endSequential()
13150  */
13151  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
13152  __Pyx_GOTREF(__pyx_t_2);
13153  __pyx_t_5 = NULL;
13154  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
13155  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
13156  if (likely(__pyx_t_5)) {
13157  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13158  __Pyx_INCREF(__pyx_t_5);
13159  __Pyx_INCREF(function);
13160  __Pyx_DECREF_SET(__pyx_t_2, function);
13161  }
13162  }
13163  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
13164  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13165  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
13166  __Pyx_GOTREF(__pyx_t_1);
13167  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13168  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13169 
13170  /* "Isosurface.pyx":524
13171  * """)
13172  * pov.flush()
13173  * pov.close() # <<<<<<<<<<<<<<
13174  * self.comm.endSequential()
13175  *
13176  */
13177  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error)
13178  __Pyx_GOTREF(__pyx_t_2);
13179  __pyx_t_5 = NULL;
13180  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
13181  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
13182  if (likely(__pyx_t_5)) {
13183  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13184  __Pyx_INCREF(__pyx_t_5);
13185  __Pyx_INCREF(function);
13186  __Pyx_DECREF_SET(__pyx_t_2, function);
13187  }
13188  }
13189  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
13190  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13191  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error)
13192  __Pyx_GOTREF(__pyx_t_1);
13193  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13194  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13195 
13196  /* "Isosurface.pyx":525
13197  * pov.flush()
13198  * pov.close()
13199  * self.comm.endSequential() # <<<<<<<<<<<<<<
13200  *
13201  * def calculate(self, checkTime=True):
13202  */
13203  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
13204  __Pyx_GOTREF(__pyx_t_2);
13205  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_endSequential); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 525, __pyx_L1_error)
13206  __Pyx_GOTREF(__pyx_t_5);
13207  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13208  __pyx_t_2 = NULL;
13209  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13210  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
13211  if (likely(__pyx_t_2)) {
13212  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13213  __Pyx_INCREF(__pyx_t_2);
13214  __Pyx_INCREF(function);
13215  __Pyx_DECREF_SET(__pyx_t_5, function);
13216  }
13217  }
13218  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
13219  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13220  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
13221  __Pyx_GOTREF(__pyx_t_1);
13222  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13223  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13224 
13225  /* "Isosurface.pyx":376
13226  * f.close()
13227  *
13228  * def writeIsosurfaceMesh_povray(self, field, value, frame): # <<<<<<<<<<<<<<
13229  * """
13230  * Write the triangular mesh to a povray file
13231  */
13232 
13233  /* function exit code */
13234  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13235  goto __pyx_L0;
13236  __pyx_L1_error:;
13237  __Pyx_XDECREF(__pyx_t_1);
13238  __Pyx_XDECREF(__pyx_t_2);
13239  __Pyx_XDECREF(__pyx_t_3);
13240  __Pyx_XDECREF(__pyx_t_5);
13241  __Pyx_XDECREF(__pyx_t_7);
13242  __Pyx_XDECREF(__pyx_t_8);
13243  __Pyx_XDECREF(__pyx_t_11);
13244  __Pyx_XDECREF(__pyx_t_12);
13245  __Pyx_AddTraceback("Isosurface.Isosurface.writeIsosurfaceMesh_povray", __pyx_clineno, __pyx_lineno, __pyx_filename);
13246  __pyx_r = NULL;
13247  __pyx_L0:;
13248  __Pyx_XDECREF(__pyx_v_Template);
13249  __Pyx_XDECREF(__pyx_v_nodes);
13250  __Pyx_XDECREF(__pyx_v_elements);
13251  __Pyx_XDECREF(__pyx_v_normals);
13252  __Pyx_XDECREF(__pyx_v_normal_indices);
13253  __Pyx_XDECREF(__pyx_v_pov_filename);
13254  __Pyx_XDECREF(__pyx_v_pov);
13255  __Pyx_XDECREF(__pyx_v_dx);
13256  __Pyx_XDECREF(__pyx_v_nll);
13257  __Pyx_XDECREF(__pyx_v_fur);
13258  __Pyx_XDECREF(__pyx_v_povScene);
13259  __Pyx_XDECREF(__pyx_v_n);
13260  __Pyx_XDECREF(__pyx_v_ebN);
13261  __Pyx_XDECREF(__pyx_v_bnt);
13262  __Pyx_XDECREF(__pyx_v_e);
13263  __Pyx_XDECREF(__pyx_v_ni);
13264  __Pyx_XGIVEREF(__pyx_r);
13265  __Pyx_RefNannyFinishContext();
13266  return __pyx_r;
13267 }
13268 
13269 /* "Isosurface.pyx":527
13270  * self.comm.endSequential()
13271  *
13272  * def calculate(self, checkTime=True): # <<<<<<<<<<<<<<
13273  * """Extracts isosourfaces at current time and update open output files
13274  * """
13275  */
13276 
13277 /* Python wrapper */
13278 static PyObject *__pyx_pw_10Isosurface_10Isosurface_15calculate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13279 static char __pyx_doc_10Isosurface_10Isosurface_14calculate[] = "Isosurface.calculate(self, checkTime=True)\nExtracts isosourfaces at current time and update open output files\n ";
13280 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_15calculate = {"calculate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_15calculate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_14calculate};
13281 static PyObject *__pyx_pw_10Isosurface_10Isosurface_15calculate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13282  PyObject *__pyx_v_self = 0;
13283  PyObject *__pyx_v_checkTime = 0;
13284  int __pyx_lineno = 0;
13285  const char *__pyx_filename = NULL;
13286  int __pyx_clineno = 0;
13287  PyObject *__pyx_r = 0;
13288  __Pyx_RefNannyDeclarations
13289  __Pyx_RefNannySetupContext("calculate (wrapper)", 0);
13290  {
13291  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_checkTime,0};
13292  PyObject* values[2] = {0,0};
13293  values[1] = ((PyObject *)((PyObject *)Py_True));
13294  if (unlikely(__pyx_kwds)) {
13295  Py_ssize_t kw_args;
13296  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13297  switch (pos_args) {
13298  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13299  CYTHON_FALLTHROUGH;
13300  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13301  CYTHON_FALLTHROUGH;
13302  case 0: break;
13303  default: goto __pyx_L5_argtuple_error;
13304  }
13305  kw_args = PyDict_Size(__pyx_kwds);
13306  switch (pos_args) {
13307  case 0:
13308  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
13309  else goto __pyx_L5_argtuple_error;
13310  CYTHON_FALLTHROUGH;
13311  case 1:
13312  if (kw_args > 0) {
13313  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_checkTime);
13314  if (value) { values[1] = value; kw_args--; }
13315  }
13316  }
13317  if (unlikely(kw_args > 0)) {
13318  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate") < 0)) __PYX_ERR(0, 527, __pyx_L3_error)
13319  }
13320  } else {
13321  switch (PyTuple_GET_SIZE(__pyx_args)) {
13322  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13323  CYTHON_FALLTHROUGH;
13324  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13325  break;
13326  default: goto __pyx_L5_argtuple_error;
13327  }
13328  }
13329  __pyx_v_self = values[0];
13330  __pyx_v_checkTime = values[1];
13331  }
13332  goto __pyx_L4_argument_unpacking_done;
13333  __pyx_L5_argtuple_error:;
13334  __Pyx_RaiseArgtupleInvalid("calculate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 527, __pyx_L3_error)
13335  __pyx_L3_error:;
13336  __Pyx_AddTraceback("Isosurface.Isosurface.calculate", __pyx_clineno, __pyx_lineno, __pyx_filename);
13337  __Pyx_RefNannyFinishContext();
13338  return NULL;
13339  __pyx_L4_argument_unpacking_done:;
13340  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_14calculate(__pyx_self, __pyx_v_self, __pyx_v_checkTime);
13341 
13342  /* function exit code */
13343  __Pyx_RefNannyFinishContext();
13344  return __pyx_r;
13345 }
13346 
13347 static PyObject *__pyx_pf_10Isosurface_10Isosurface_14calculate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_checkTime) {
13348  CYTHON_UNUSED PyObject *__pyx_v_Template = NULL;
13349  PyObject *__pyx_v_time = NULL;
13350  PyObject *__pyx_v_field = NULL;
13351  PyObject *__pyx_v_values = NULL;
13352  PyObject *__pyx_v_v = NULL;
13353  PyObject *__pyx_r = NULL;
13354  __Pyx_RefNannyDeclarations
13355  PyObject *__pyx_t_1 = NULL;
13356  PyObject *__pyx_t_2 = NULL;
13357  int __pyx_t_3;
13358  PyObject *__pyx_t_4 = NULL;
13359  PyObject *__pyx_t_5 = NULL;
13360  int __pyx_t_6;
13361  int __pyx_t_7;
13362  Py_ssize_t __pyx_t_8;
13363  PyObject *(*__pyx_t_9)(PyObject *);
13364  PyObject *__pyx_t_10 = NULL;
13365  PyObject *(*__pyx_t_11)(PyObject *);
13366  Py_ssize_t __pyx_t_12;
13367  PyObject *(*__pyx_t_13)(PyObject *);
13368  int __pyx_t_14;
13369  PyObject *__pyx_t_15 = NULL;
13370  PyObject *__pyx_t_16 = NULL;
13371  int __pyx_lineno = 0;
13372  const char *__pyx_filename = NULL;
13373  int __pyx_clineno = 0;
13374  __Pyx_RefNannySetupContext("calculate", 0);
13375 
13376  /* "Isosurface.pyx":530
13377  * """Extracts isosourfaces at current time and update open output files
13378  * """
13379  * from string import Template # <<<<<<<<<<<<<<
13380  * if checkTime:
13381  * time = self.timeIntegration.tLast
13382  */
13383  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
13384  __Pyx_GOTREF(__pyx_t_1);
13385  __Pyx_INCREF(__pyx_n_s_Template);
13386  __Pyx_GIVEREF(__pyx_n_s_Template);
13387  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Template);
13388  __pyx_t_2 = __Pyx_Import(__pyx_n_s_string, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
13389  __Pyx_GOTREF(__pyx_t_2);
13390  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13391  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Template); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
13392  __Pyx_GOTREF(__pyx_t_1);
13393  __Pyx_INCREF(__pyx_t_1);
13394  __pyx_v_Template = __pyx_t_1;
13395  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13396  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13397 
13398  /* "Isosurface.pyx":531
13399  * """
13400  * from string import Template
13401  * if checkTime: # <<<<<<<<<<<<<<
13402  * time = self.timeIntegration.tLast
13403  * log("Calculate called at time " + repr(time))
13404  */
13405  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_checkTime); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 531, __pyx_L1_error)
13406  if (__pyx_t_3) {
13407 
13408  /* "Isosurface.pyx":532
13409  * from string import Template
13410  * if checkTime:
13411  * time = self.timeIntegration.tLast # <<<<<<<<<<<<<<
13412  * log("Calculate called at time " + repr(time))
13413  * # check that gauge is in its active time region
13414  */
13415  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_timeIntegration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
13416  __Pyx_GOTREF(__pyx_t_2);
13417  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tLast); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error)
13418  __Pyx_GOTREF(__pyx_t_1);
13419  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13420  __pyx_v_time = __pyx_t_1;
13421  __pyx_t_1 = 0;
13422 
13423  /* "Isosurface.pyx":533
13424  * if checkTime:
13425  * time = self.timeIntegration.tLast
13426  * log("Calculate called at time " + repr(time)) # <<<<<<<<<<<<<<
13427  * # check that gauge is in its active time region
13428  * if self.activeTime is not None and (self.activeTime[0] > time or
13429  */
13430  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
13431  __Pyx_GOTREF(__pyx_t_2);
13432  __pyx_t_4 = PyObject_Repr(__pyx_v_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 533, __pyx_L1_error)
13433  __Pyx_GOTREF(__pyx_t_4);
13434  __pyx_t_5 = PyNumber_Add(__pyx_kp_s_Calculate_called_at_time, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 533, __pyx_L1_error)
13435  __Pyx_GOTREF(__pyx_t_5);
13436  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13437  __pyx_t_4 = NULL;
13438  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
13439  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
13440  if (likely(__pyx_t_4)) {
13441  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13442  __Pyx_INCREF(__pyx_t_4);
13443  __Pyx_INCREF(function);
13444  __Pyx_DECREF_SET(__pyx_t_2, function);
13445  }
13446  }
13447  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
13448  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13449  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13450  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
13451  __Pyx_GOTREF(__pyx_t_1);
13452  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13453  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13454 
13455  /* "Isosurface.pyx":535
13456  * log("Calculate called at time " + repr(time))
13457  * # check that gauge is in its active time region
13458  * if self.activeTime is not None and (self.activeTime[0] > time or # <<<<<<<<<<<<<<
13459  * self.activeTime[1] < time):
13460  * return
13461  */
13462  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_activeTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
13463  __Pyx_GOTREF(__pyx_t_1);
13464  __pyx_t_6 = (__pyx_t_1 != Py_None);
13465  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13466  __pyx_t_7 = (__pyx_t_6 != 0);
13467  if (__pyx_t_7) {
13468  } else {
13469  __pyx_t_3 = __pyx_t_7;
13470  goto __pyx_L5_bool_binop_done;
13471  }
13472  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_activeTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
13473  __Pyx_GOTREF(__pyx_t_1);
13474  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
13475  __Pyx_GOTREF(__pyx_t_2);
13476  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13477  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_time, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
13478  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13479  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 535, __pyx_L1_error)
13480  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13481  if (!__pyx_t_7) {
13482  } else {
13483  __pyx_t_3 = __pyx_t_7;
13484  goto __pyx_L5_bool_binop_done;
13485  }
13486 
13487  /* "Isosurface.pyx":536
13488  * # check that gauge is in its active time region
13489  * if self.activeTime is not None and (self.activeTime[0] > time or
13490  * self.activeTime[1] < time): # <<<<<<<<<<<<<<
13491  * return
13492  *
13493  */
13494  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_activeTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
13495  __Pyx_GOTREF(__pyx_t_1);
13496  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
13497  __Pyx_GOTREF(__pyx_t_2);
13498  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13499  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_time, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
13500  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13501  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 536, __pyx_L1_error)
13502  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13503  __pyx_t_3 = __pyx_t_7;
13504  __pyx_L5_bool_binop_done:;
13505 
13506  /* "Isosurface.pyx":535
13507  * log("Calculate called at time " + repr(time))
13508  * # check that gauge is in its active time region
13509  * if self.activeTime is not None and (self.activeTime[0] > time or # <<<<<<<<<<<<<<
13510  * self.activeTime[1] < time):
13511  * return
13512  */
13513  if (__pyx_t_3) {
13514 
13515  /* "Isosurface.pyx":537
13516  * if self.activeTime is not None and (self.activeTime[0] > time or
13517  * self.activeTime[1] < time):
13518  * return # <<<<<<<<<<<<<<
13519  *
13520  * # check that gauge is ready to be sampled again
13521  */
13522  __Pyx_XDECREF(__pyx_r);
13523  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13524  goto __pyx_L0;
13525 
13526  /* "Isosurface.pyx":535
13527  * log("Calculate called at time " + repr(time))
13528  * # check that gauge is in its active time region
13529  * if self.activeTime is not None and (self.activeTime[0] > time or # <<<<<<<<<<<<<<
13530  * self.activeTime[1] < time):
13531  * return
13532  */
13533  }
13534 
13535  /* "Isosurface.pyx":540
13536  *
13537  * # check that gauge is ready to be sampled again
13538  * if (time < self.next_output): # <<<<<<<<<<<<<<
13539  * return
13540  * assert self.elementNodesArray.shape[1] == 4, \
13541  */
13542  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_next_output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
13543  __Pyx_GOTREF(__pyx_t_1);
13544  __pyx_t_2 = PyObject_RichCompare(__pyx_v_time, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error)
13545  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13546  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 540, __pyx_L1_error)
13547  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13548  if (__pyx_t_3) {
13549 
13550  /* "Isosurface.pyx":541
13551  * # check that gauge is ready to be sampled again
13552  * if (time < self.next_output):
13553  * return # <<<<<<<<<<<<<<
13554  * assert self.elementNodesArray.shape[1] == 4, \
13555  * "Elements have {0:d} vertices but algorithm is for tets".format(
13556  */
13557  __Pyx_XDECREF(__pyx_r);
13558  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13559  goto __pyx_L0;
13560 
13561  /* "Isosurface.pyx":540
13562  *
13563  * # check that gauge is ready to be sampled again
13564  * if (time < self.next_output): # <<<<<<<<<<<<<<
13565  * return
13566  * assert self.elementNodesArray.shape[1] == 4, \
13567  */
13568  }
13569 
13570  /* "Isosurface.pyx":531
13571  * """
13572  * from string import Template
13573  * if checkTime: # <<<<<<<<<<<<<<
13574  * time = self.timeIntegration.tLast
13575  * log("Calculate called at time " + repr(time))
13576  */
13577  }
13578 
13579  /* "Isosurface.pyx":542
13580  * if (time < self.next_output):
13581  * return
13582  * assert self.elementNodesArray.shape[1] == 4, \ # <<<<<<<<<<<<<<
13583  * "Elements have {0:d} vertices but algorithm is for tets".format(
13584  * self.elementNodesArray.shape[1])
13585  */
13586  #ifndef CYTHON_WITHOUT_ASSERTIONS
13587  if (unlikely(!Py_OptimizeFlag)) {
13588  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
13589  __Pyx_GOTREF(__pyx_t_2);
13590  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
13591  __Pyx_GOTREF(__pyx_t_1);
13592  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13593  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
13594  __Pyx_GOTREF(__pyx_t_2);
13595  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13596  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
13597  __Pyx_GOTREF(__pyx_t_1);
13598  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13599  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 542, __pyx_L1_error)
13600  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13601  if (unlikely(!__pyx_t_3)) {
13602 
13603  /* "Isosurface.pyx":543
13604  * return
13605  * assert self.elementNodesArray.shape[1] == 4, \
13606  * "Elements have {0:d} vertices but algorithm is for tets".format( # <<<<<<<<<<<<<<
13607  * self.elementNodesArray.shape[1])
13608  * for field, values in self.isosurfaces:
13609  */
13610  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Elements_have_0_d_vertices_but_a, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
13611  __Pyx_GOTREF(__pyx_t_2);
13612 
13613  /* "Isosurface.pyx":544
13614  * assert self.elementNodesArray.shape[1] == 4, \
13615  * "Elements have {0:d} vertices but algorithm is for tets".format(
13616  * self.elementNodesArray.shape[1]) # <<<<<<<<<<<<<<
13617  * for field, values in self.isosurfaces:
13618  * for v in values:
13619  */
13620  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
13621  __Pyx_GOTREF(__pyx_t_5);
13622  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error)
13623  __Pyx_GOTREF(__pyx_t_4);
13624  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13625  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L1_error)
13626  __Pyx_GOTREF(__pyx_t_5);
13627  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13628  __pyx_t_4 = NULL;
13629  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
13630  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
13631  if (likely(__pyx_t_4)) {
13632  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13633  __Pyx_INCREF(__pyx_t_4);
13634  __Pyx_INCREF(function);
13635  __Pyx_DECREF_SET(__pyx_t_2, function);
13636  }
13637  }
13638  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
13639  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13640  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13641  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
13642  __Pyx_GOTREF(__pyx_t_1);
13643  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13644 
13645  /* "Isosurface.pyx":543
13646  * return
13647  * assert self.elementNodesArray.shape[1] == 4, \
13648  * "Elements have {0:d} vertices but algorithm is for tets".format( # <<<<<<<<<<<<<<
13649  * self.elementNodesArray.shape[1])
13650  * for field, values in self.isosurfaces:
13651  */
13652  __pyx_t_2 = PyTuple_Pack(1, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
13653  __Pyx_GOTREF(__pyx_t_2);
13654  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13655  PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
13656  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13657  __PYX_ERR(0, 542, __pyx_L1_error)
13658  }
13659  }
13660  #endif
13661 
13662  /* "Isosurface.pyx":545
13663  * "Elements have {0:d} vertices but algorithm is for tets".format(
13664  * self.elementNodesArray.shape[1])
13665  * for field, values in self.isosurfaces: # <<<<<<<<<<<<<<
13666  * for v in values:
13667  * self.triangulateIsosurface(field, v)
13668  */
13669  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_isosurfaces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
13670  __Pyx_GOTREF(__pyx_t_2);
13671  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
13672  __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
13673  __pyx_t_9 = NULL;
13674  } else {
13675  __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error)
13676  __Pyx_GOTREF(__pyx_t_1);
13677  __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 545, __pyx_L1_error)
13678  }
13679  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13680  for (;;) {
13681  if (likely(!__pyx_t_9)) {
13682  if (likely(PyList_CheckExact(__pyx_t_1))) {
13683  if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
13684  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13685  __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
13686  #else
13687  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
13688  __Pyx_GOTREF(__pyx_t_2);
13689  #endif
13690  } else {
13691  if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
13692  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13693  __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
13694  #else
13695  __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
13696  __Pyx_GOTREF(__pyx_t_2);
13697  #endif
13698  }
13699  } else {
13700  __pyx_t_2 = __pyx_t_9(__pyx_t_1);
13701  if (unlikely(!__pyx_t_2)) {
13702  PyObject* exc_type = PyErr_Occurred();
13703  if (exc_type) {
13704  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13705  else __PYX_ERR(0, 545, __pyx_L1_error)
13706  }
13707  break;
13708  }
13709  __Pyx_GOTREF(__pyx_t_2);
13710  }
13711  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
13712  PyObject* sequence = __pyx_t_2;
13713  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13714  if (unlikely(size != 2)) {
13715  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13716  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13717  __PYX_ERR(0, 545, __pyx_L1_error)
13718  }
13719  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13720  if (likely(PyTuple_CheckExact(sequence))) {
13721  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
13722  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
13723  } else {
13724  __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
13725  __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
13726  }
13727  __Pyx_INCREF(__pyx_t_5);
13728  __Pyx_INCREF(__pyx_t_4);
13729  #else
13730  __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error)
13731  __Pyx_GOTREF(__pyx_t_5);
13732  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error)
13733  __Pyx_GOTREF(__pyx_t_4);
13734  #endif
13735  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13736  } else {
13737  Py_ssize_t index = -1;
13738  __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 545, __pyx_L1_error)
13739  __Pyx_GOTREF(__pyx_t_10);
13740  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13741  __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
13742  index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
13743  __Pyx_GOTREF(__pyx_t_5);
13744  index = 1; __pyx_t_4 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
13745  __Pyx_GOTREF(__pyx_t_4);
13746  if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 545, __pyx_L1_error)
13747  __pyx_t_11 = NULL;
13748  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13749  goto __pyx_L12_unpacking_done;
13750  __pyx_L11_unpacking_failed:;
13751  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13752  __pyx_t_11 = NULL;
13753  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
13754  __PYX_ERR(0, 545, __pyx_L1_error)
13755  __pyx_L12_unpacking_done:;
13756  }
13757  __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_5);
13758  __pyx_t_5 = 0;
13759  __Pyx_XDECREF_SET(__pyx_v_values, __pyx_t_4);
13760  __pyx_t_4 = 0;
13761 
13762  /* "Isosurface.pyx":546
13763  * self.elementNodesArray.shape[1])
13764  * for field, values in self.isosurfaces:
13765  * for v in values: # <<<<<<<<<<<<<<
13766  * self.triangulateIsosurface(field, v)
13767  * self.writeIsosurfaceMesh(field, v, self.nFrames)
13768  */
13769  if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
13770  __pyx_t_2 = __pyx_v_values; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0;
13771  __pyx_t_13 = NULL;
13772  } else {
13773  __pyx_t_12 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
13774  __Pyx_GOTREF(__pyx_t_2);
13775  __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 546, __pyx_L1_error)
13776  }
13777  for (;;) {
13778  if (likely(!__pyx_t_13)) {
13779  if (likely(PyList_CheckExact(__pyx_t_2))) {
13780  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break;
13781  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13782  __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 546, __pyx_L1_error)
13783  #else
13784  __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
13785  __Pyx_GOTREF(__pyx_t_4);
13786  #endif
13787  } else {
13788  if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
13789  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13790  __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 546, __pyx_L1_error)
13791  #else
13792  __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
13793  __Pyx_GOTREF(__pyx_t_4);
13794  #endif
13795  }
13796  } else {
13797  __pyx_t_4 = __pyx_t_13(__pyx_t_2);
13798  if (unlikely(!__pyx_t_4)) {
13799  PyObject* exc_type = PyErr_Occurred();
13800  if (exc_type) {
13801  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13802  else __PYX_ERR(0, 546, __pyx_L1_error)
13803  }
13804  break;
13805  }
13806  __Pyx_GOTREF(__pyx_t_4);
13807  }
13808  __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
13809  __pyx_t_4 = 0;
13810 
13811  /* "Isosurface.pyx":547
13812  * for field, values in self.isosurfaces:
13813  * for v in values:
13814  * self.triangulateIsosurface(field, v) # <<<<<<<<<<<<<<
13815  * self.writeIsosurfaceMesh(field, v, self.nFrames)
13816  * self.nFrames += 1
13817  */
13818  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_triangulateIsosurface); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error)
13819  __Pyx_GOTREF(__pyx_t_5);
13820  __pyx_t_10 = NULL;
13821  __pyx_t_14 = 0;
13822  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13823  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
13824  if (likely(__pyx_t_10)) {
13825  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13826  __Pyx_INCREF(__pyx_t_10);
13827  __Pyx_INCREF(function);
13828  __Pyx_DECREF_SET(__pyx_t_5, function);
13829  __pyx_t_14 = 1;
13830  }
13831  }
13832  #if CYTHON_FAST_PYCALL
13833  if (PyFunction_Check(__pyx_t_5)) {
13834  PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_field, __pyx_v_v};
13835  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error)
13836  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13837  __Pyx_GOTREF(__pyx_t_4);
13838  } else
13839  #endif
13840  #if CYTHON_FAST_PYCCALL
13841  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
13842  PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_field, __pyx_v_v};
13843  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error)
13844  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13845  __Pyx_GOTREF(__pyx_t_4);
13846  } else
13847  #endif
13848  {
13849  __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 547, __pyx_L1_error)
13850  __Pyx_GOTREF(__pyx_t_15);
13851  if (__pyx_t_10) {
13852  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); __pyx_t_10 = NULL;
13853  }
13854  __Pyx_INCREF(__pyx_v_field);
13855  __Pyx_GIVEREF(__pyx_v_field);
13856  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_v_field);
13857  __Pyx_INCREF(__pyx_v_v);
13858  __Pyx_GIVEREF(__pyx_v_v);
13859  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_v_v);
13860  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error)
13861  __Pyx_GOTREF(__pyx_t_4);
13862  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
13863  }
13864  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13865  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13866 
13867  /* "Isosurface.pyx":548
13868  * for v in values:
13869  * self.triangulateIsosurface(field, v)
13870  * self.writeIsosurfaceMesh(field, v, self.nFrames) # <<<<<<<<<<<<<<
13871  * self.nFrames += 1
13872  * if checkTime and time != 0:
13873  */
13874  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_writeIsosurfaceMesh); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error)
13875  __Pyx_GOTREF(__pyx_t_5);
13876  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 548, __pyx_L1_error)
13877  __Pyx_GOTREF(__pyx_t_15);
13878  __pyx_t_10 = NULL;
13879  __pyx_t_14 = 0;
13880  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13881  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
13882  if (likely(__pyx_t_10)) {
13883  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13884  __Pyx_INCREF(__pyx_t_10);
13885  __Pyx_INCREF(function);
13886  __Pyx_DECREF_SET(__pyx_t_5, function);
13887  __pyx_t_14 = 1;
13888  }
13889  }
13890  #if CYTHON_FAST_PYCALL
13891  if (PyFunction_Check(__pyx_t_5)) {
13892  PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_field, __pyx_v_v, __pyx_t_15};
13893  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error)
13894  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13895  __Pyx_GOTREF(__pyx_t_4);
13896  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
13897  } else
13898  #endif
13899  #if CYTHON_FAST_PYCCALL
13900  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
13901  PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_field, __pyx_v_v, __pyx_t_15};
13902  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error)
13903  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13904  __Pyx_GOTREF(__pyx_t_4);
13905  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
13906  } else
13907  #endif
13908  {
13909  __pyx_t_16 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 548, __pyx_L1_error)
13910  __Pyx_GOTREF(__pyx_t_16);
13911  if (__pyx_t_10) {
13912  __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_10); __pyx_t_10 = NULL;
13913  }
13914  __Pyx_INCREF(__pyx_v_field);
13915  __Pyx_GIVEREF(__pyx_v_field);
13916  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_14, __pyx_v_field);
13917  __Pyx_INCREF(__pyx_v_v);
13918  __Pyx_GIVEREF(__pyx_v_v);
13919  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_14, __pyx_v_v);
13920  __Pyx_GIVEREF(__pyx_t_15);
13921  PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_14, __pyx_t_15);
13922  __pyx_t_15 = 0;
13923  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error)
13924  __Pyx_GOTREF(__pyx_t_4);
13925  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
13926  }
13927  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13928  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13929 
13930  /* "Isosurface.pyx":546
13931  * self.elementNodesArray.shape[1])
13932  * for field, values in self.isosurfaces:
13933  * for v in values: # <<<<<<<<<<<<<<
13934  * self.triangulateIsosurface(field, v)
13935  * self.writeIsosurfaceMesh(field, v, self.nFrames)
13936  */
13937  }
13938  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13939 
13940  /* "Isosurface.pyx":545
13941  * "Elements have {0:d} vertices but algorithm is for tets".format(
13942  * self.elementNodesArray.shape[1])
13943  * for field, values in self.isosurfaces: # <<<<<<<<<<<<<<
13944  * for v in values:
13945  * self.triangulateIsosurface(field, v)
13946  */
13947  }
13948  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13949 
13950  /* "Isosurface.pyx":549
13951  * self.triangulateIsosurface(field, v)
13952  * self.writeIsosurfaceMesh(field, v, self.nFrames)
13953  * self.nFrames += 1 # <<<<<<<<<<<<<<
13954  * if checkTime and time != 0:
13955  * self.next_output += self.sampleRate
13956  */
13957  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nFrames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
13958  __Pyx_GOTREF(__pyx_t_1);
13959  __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
13960  __Pyx_GOTREF(__pyx_t_2);
13961  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13962  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nFrames, __pyx_t_2) < 0) __PYX_ERR(0, 549, __pyx_L1_error)
13963  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13964 
13965  /* "Isosurface.pyx":550
13966  * self.writeIsosurfaceMesh(field, v, self.nFrames)
13967  * self.nFrames += 1
13968  * if checkTime and time != 0: # <<<<<<<<<<<<<<
13969  * self.next_output += self.sampleRate
13970  *
13971  */
13972  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_checkTime); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 550, __pyx_L1_error)
13973  if (__pyx_t_7) {
13974  } else {
13975  __pyx_t_3 = __pyx_t_7;
13976  goto __pyx_L16_bool_binop_done;
13977  }
13978  if (unlikely(!__pyx_v_time)) { __Pyx_RaiseUnboundLocalError("time"); __PYX_ERR(0, 550, __pyx_L1_error) }
13979  __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_v_time, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error)
13980  __Pyx_GOTREF(__pyx_t_2);
13981  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 550, __pyx_L1_error)
13982  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13983  __pyx_t_3 = __pyx_t_7;
13984  __pyx_L16_bool_binop_done:;
13985  if (__pyx_t_3) {
13986 
13987  /* "Isosurface.pyx":551
13988  * self.nFrames += 1
13989  * if checkTime and time != 0:
13990  * self.next_output += self.sampleRate # <<<<<<<<<<<<<<
13991  *
13992  * def writeSceneHeader(self, cam = None):
13993  */
13994  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_next_output); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error)
13995  __Pyx_GOTREF(__pyx_t_2);
13996  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sampleRate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error)
13997  __Pyx_GOTREF(__pyx_t_1);
13998  __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 551, __pyx_L1_error)
13999  __Pyx_GOTREF(__pyx_t_4);
14000  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14001  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14002  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_next_output, __pyx_t_4) < 0) __PYX_ERR(0, 551, __pyx_L1_error)
14003  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14004 
14005  /* "Isosurface.pyx":550
14006  * self.writeIsosurfaceMesh(field, v, self.nFrames)
14007  * self.nFrames += 1
14008  * if checkTime and time != 0: # <<<<<<<<<<<<<<
14009  * self.next_output += self.sampleRate
14010  *
14011  */
14012  }
14013 
14014  /* "Isosurface.pyx":527
14015  * self.comm.endSequential()
14016  *
14017  * def calculate(self, checkTime=True): # <<<<<<<<<<<<<<
14018  * """Extracts isosourfaces at current time and update open output files
14019  * """
14020  */
14021 
14022  /* function exit code */
14023  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14024  goto __pyx_L0;
14025  __pyx_L1_error:;
14026  __Pyx_XDECREF(__pyx_t_1);
14027  __Pyx_XDECREF(__pyx_t_2);
14028  __Pyx_XDECREF(__pyx_t_4);
14029  __Pyx_XDECREF(__pyx_t_5);
14030  __Pyx_XDECREF(__pyx_t_10);
14031  __Pyx_XDECREF(__pyx_t_15);
14032  __Pyx_XDECREF(__pyx_t_16);
14033  __Pyx_AddTraceback("Isosurface.Isosurface.calculate", __pyx_clineno, __pyx_lineno, __pyx_filename);
14034  __pyx_r = NULL;
14035  __pyx_L0:;
14036  __Pyx_XDECREF(__pyx_v_Template);
14037  __Pyx_XDECREF(__pyx_v_time);
14038  __Pyx_XDECREF(__pyx_v_field);
14039  __Pyx_XDECREF(__pyx_v_values);
14040  __Pyx_XDECREF(__pyx_v_v);
14041  __Pyx_XGIVEREF(__pyx_r);
14042  __Pyx_RefNannyFinishContext();
14043  return __pyx_r;
14044 }
14045 
14046 /* "Isosurface.pyx":553
14047  * self.next_output += self.sampleRate
14048  *
14049  * def writeSceneHeader(self, cam = None): # <<<<<<<<<<<<<<
14050  * """
14051  * Write a scene description (can be modified before running povray)
14052  */
14053 
14054 /* Python wrapper */
14055 static PyObject *__pyx_pw_10Isosurface_10Isosurface_17writeSceneHeader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14056 static char __pyx_doc_10Isosurface_10Isosurface_16writeSceneHeader[] = "Isosurface.writeSceneHeader(self, cam=None)\n\n Write a scene description (can be modified before running povray)\n ";
14057 static PyMethodDef __pyx_mdef_10Isosurface_10Isosurface_17writeSceneHeader = {"writeSceneHeader", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10Isosurface_10Isosurface_17writeSceneHeader, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10Isosurface_10Isosurface_16writeSceneHeader};
14058 static PyObject *__pyx_pw_10Isosurface_10Isosurface_17writeSceneHeader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14059  PyObject *__pyx_v_self = 0;
14060  PyObject *__pyx_v_cam = 0;
14061  int __pyx_lineno = 0;
14062  const char *__pyx_filename = NULL;
14063  int __pyx_clineno = 0;
14064  PyObject *__pyx_r = 0;
14065  __Pyx_RefNannyDeclarations
14066  __Pyx_RefNannySetupContext("writeSceneHeader (wrapper)", 0);
14067  {
14068  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_cam,0};
14069  PyObject* values[2] = {0,0};
14070  values[1] = ((PyObject *)((PyObject *)Py_None));
14071  if (unlikely(__pyx_kwds)) {
14072  Py_ssize_t kw_args;
14073  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14074  switch (pos_args) {
14075  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14076  CYTHON_FALLTHROUGH;
14077  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14078  CYTHON_FALLTHROUGH;
14079  case 0: break;
14080  default: goto __pyx_L5_argtuple_error;
14081  }
14082  kw_args = PyDict_Size(__pyx_kwds);
14083  switch (pos_args) {
14084  case 0:
14085  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
14086  else goto __pyx_L5_argtuple_error;
14087  CYTHON_FALLTHROUGH;
14088  case 1:
14089  if (kw_args > 0) {
14090  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cam);
14091  if (value) { values[1] = value; kw_args--; }
14092  }
14093  }
14094  if (unlikely(kw_args > 0)) {
14095  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writeSceneHeader") < 0)) __PYX_ERR(0, 553, __pyx_L3_error)
14096  }
14097  } else {
14098  switch (PyTuple_GET_SIZE(__pyx_args)) {
14099  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14100  CYTHON_FALLTHROUGH;
14101  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14102  break;
14103  default: goto __pyx_L5_argtuple_error;
14104  }
14105  }
14106  __pyx_v_self = values[0];
14107  __pyx_v_cam = values[1];
14108  }
14109  goto __pyx_L4_argument_unpacking_done;
14110  __pyx_L5_argtuple_error:;
14111  __Pyx_RaiseArgtupleInvalid("writeSceneHeader", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 553, __pyx_L3_error)
14112  __pyx_L3_error:;
14113  __Pyx_AddTraceback("Isosurface.Isosurface.writeSceneHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
14114  __Pyx_RefNannyFinishContext();
14115  return NULL;
14116  __pyx_L4_argument_unpacking_done:;
14117  __pyx_r = __pyx_pf_10Isosurface_10Isosurface_16writeSceneHeader(__pyx_self, __pyx_v_self, __pyx_v_cam);
14118 
14119  /* function exit code */
14120  __Pyx_RefNannyFinishContext();
14121  return __pyx_r;
14122 }
14123 
14124 static PyObject *__pyx_pf_10Isosurface_10Isosurface_16writeSceneHeader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_cam) {
14125  PyObject *__pyx_v_Template = NULL;
14126  PyObject *__pyx_v_look_at = NULL;
14127  PyObject *__pyx_v_light = NULL;
14128  PyObject *__pyx_v_light_dx = NULL;
14129  PyObject *__pyx_v_light_dy = NULL;
14130  PyObject *__pyx_v_floor_z = NULL;
14131  PyObject *__pyx_v_wall_y = NULL;
14132  PyObject *__pyx_v_sky_z = NULL;
14133  PyObject *__pyx_v_pov = NULL;
14134  PyObject *__pyx_v_povSceneTemplate = NULL;
14135  PyObject *__pyx_v_x = NULL;
14136  PyObject *__pyx_v_L = NULL;
14137  PyObject *__pyx_r = NULL;
14138  __Pyx_RefNannyDeclarations
14139  PyObject *__pyx_t_1 = NULL;
14140  PyObject *__pyx_t_2 = NULL;
14141  PyObject *__pyx_t_3 = NULL;
14142  int __pyx_t_4;
14143  PyObject *__pyx_t_5 = NULL;
14144  Py_ssize_t __pyx_t_6;
14145  PyObject *(*__pyx_t_7)(PyObject *);
14146  PyObject *__pyx_t_8 = NULL;
14147  PyObject *__pyx_t_9 = NULL;
14148  PyObject *(*__pyx_t_10)(PyObject *);
14149  int __pyx_t_11;
14150  int __pyx_lineno = 0;
14151  const char *__pyx_filename = NULL;
14152  int __pyx_clineno = 0;
14153  __Pyx_RefNannySetupContext("writeSceneHeader", 0);
14154  __Pyx_INCREF(__pyx_v_cam);
14155 
14156  /* "Isosurface.pyx":557
14157  * Write a scene description (can be modified before running povray)
14158  * """
14159  * from string import Template # <<<<<<<<<<<<<<
14160  * if self.comm.isMaster():
14161  * look_at = [0.5 * (x + L)
14162  */
14163  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
14164  __Pyx_GOTREF(__pyx_t_1);
14165  __Pyx_INCREF(__pyx_n_s_Template);
14166  __Pyx_GIVEREF(__pyx_n_s_Template);
14167  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Template);
14168  __pyx_t_2 = __Pyx_Import(__pyx_n_s_string, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 557, __pyx_L1_error)
14169  __Pyx_GOTREF(__pyx_t_2);
14170  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14171  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Template); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
14172  __Pyx_GOTREF(__pyx_t_1);
14173  __Pyx_INCREF(__pyx_t_1);
14174  __pyx_v_Template = __pyx_t_1;
14175  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14176  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14177 
14178  /* "Isosurface.pyx":558
14179  * """
14180  * from string import Template
14181  * if self.comm.isMaster(): # <<<<<<<<<<<<<<
14182  * look_at = [0.5 * (x + L)
14183  * for x, L in zip(self.domain.x, self.domain.L)]
14184  */
14185  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_comm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
14186  __Pyx_GOTREF(__pyx_t_1);
14187  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isMaster); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
14188  __Pyx_GOTREF(__pyx_t_3);
14189  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14190  __pyx_t_1 = NULL;
14191  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
14192  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
14193  if (likely(__pyx_t_1)) {
14194  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14195  __Pyx_INCREF(__pyx_t_1);
14196  __Pyx_INCREF(function);
14197  __Pyx_DECREF_SET(__pyx_t_3, function);
14198  }
14199  }
14200  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
14201  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14202  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
14203  __Pyx_GOTREF(__pyx_t_2);
14204  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14205  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 558, __pyx_L1_error)
14206  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14207  if (__pyx_t_4) {
14208 
14209  /* "Isosurface.pyx":559
14210  * from string import Template
14211  * if self.comm.isMaster():
14212  * look_at = [0.5 * (x + L) # <<<<<<<<<<<<<<
14213  * for x, L in zip(self.domain.x, self.domain.L)]
14214  * if cam is None:
14215  */
14216  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error)
14217  __Pyx_GOTREF(__pyx_t_2);
14218 
14219  /* "Isosurface.pyx":560
14220  * if self.comm.isMaster():
14221  * look_at = [0.5 * (x + L)
14222  * for x, L in zip(self.domain.x, self.domain.L)] # <<<<<<<<<<<<<<
14223  * if cam is None:
14224  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]),
14225  */
14226  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error)
14227  __Pyx_GOTREF(__pyx_t_3);
14228  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
14229  __Pyx_GOTREF(__pyx_t_1);
14230  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14231  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error)
14232  __Pyx_GOTREF(__pyx_t_3);
14233  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error)
14234  __Pyx_GOTREF(__pyx_t_5);
14235  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14236  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error)
14237  __Pyx_GOTREF(__pyx_t_3);
14238  __Pyx_GIVEREF(__pyx_t_1);
14239  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
14240  __Pyx_GIVEREF(__pyx_t_5);
14241  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
14242  __pyx_t_1 = 0;
14243  __pyx_t_5 = 0;
14244  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error)
14245  __Pyx_GOTREF(__pyx_t_5);
14246  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14247  if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
14248  __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
14249  __pyx_t_7 = NULL;
14250  } else {
14251  __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error)
14252  __Pyx_GOTREF(__pyx_t_3);
14253  __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 560, __pyx_L1_error)
14254  }
14255  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14256  for (;;) {
14257  if (likely(!__pyx_t_7)) {
14258  if (likely(PyList_CheckExact(__pyx_t_3))) {
14259  if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
14260  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14261  __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 560, __pyx_L1_error)
14262  #else
14263  __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error)
14264  __Pyx_GOTREF(__pyx_t_5);
14265  #endif
14266  } else {
14267  if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
14268  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14269  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 560, __pyx_L1_error)
14270  #else
14271  __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error)
14272  __Pyx_GOTREF(__pyx_t_5);
14273  #endif
14274  }
14275  } else {
14276  __pyx_t_5 = __pyx_t_7(__pyx_t_3);
14277  if (unlikely(!__pyx_t_5)) {
14278  PyObject* exc_type = PyErr_Occurred();
14279  if (exc_type) {
14280  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14281  else __PYX_ERR(0, 560, __pyx_L1_error)
14282  }
14283  break;
14284  }
14285  __Pyx_GOTREF(__pyx_t_5);
14286  }
14287  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
14288  PyObject* sequence = __pyx_t_5;
14289  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14290  if (unlikely(size != 2)) {
14291  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
14292  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14293  __PYX_ERR(0, 560, __pyx_L1_error)
14294  }
14295  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14296  if (likely(PyTuple_CheckExact(sequence))) {
14297  __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
14298  __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
14299  } else {
14300  __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
14301  __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
14302  }
14303  __Pyx_INCREF(__pyx_t_1);
14304  __Pyx_INCREF(__pyx_t_8);
14305  #else
14306  __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
14307  __Pyx_GOTREF(__pyx_t_1);
14308  __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 560, __pyx_L1_error)
14309  __Pyx_GOTREF(__pyx_t_8);
14310  #endif
14311  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14312  } else {
14313  Py_ssize_t index = -1;
14314  __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 560, __pyx_L1_error)
14315  __Pyx_GOTREF(__pyx_t_9);
14316  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14317  __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
14318  index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
14319  __Pyx_GOTREF(__pyx_t_1);
14320  index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
14321  __Pyx_GOTREF(__pyx_t_8);
14322  if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 560, __pyx_L1_error)
14323  __pyx_t_10 = NULL;
14324  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14325  goto __pyx_L7_unpacking_done;
14326  __pyx_L6_unpacking_failed:;
14327  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14328  __pyx_t_10 = NULL;
14329  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14330  __PYX_ERR(0, 560, __pyx_L1_error)
14331  __pyx_L7_unpacking_done:;
14332  }
14333  __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
14334  __pyx_t_1 = 0;
14335  __Pyx_XDECREF_SET(__pyx_v_L, __pyx_t_8);
14336  __pyx_t_8 = 0;
14337 
14338  /* "Isosurface.pyx":559
14339  * from string import Template
14340  * if self.comm.isMaster():
14341  * look_at = [0.5 * (x + L) # <<<<<<<<<<<<<<
14342  * for x, L in zip(self.domain.x, self.domain.L)]
14343  * if cam is None:
14344  */
14345  __pyx_t_5 = PyNumber_Add(__pyx_v_x, __pyx_v_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error)
14346  __Pyx_GOTREF(__pyx_t_5);
14347  __pyx_t_8 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 559, __pyx_L1_error)
14348  __Pyx_GOTREF(__pyx_t_8);
14349  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14350  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 559, __pyx_L1_error)
14351  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14352 
14353  /* "Isosurface.pyx":560
14354  * if self.comm.isMaster():
14355  * look_at = [0.5 * (x + L)
14356  * for x, L in zip(self.domain.x, self.domain.L)] # <<<<<<<<<<<<<<
14357  * if cam is None:
14358  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]),
14359  */
14360  }
14361  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14362  __pyx_v_look_at = ((PyObject*)__pyx_t_2);
14363  __pyx_t_2 = 0;
14364 
14365  /* "Isosurface.pyx":561
14366  * look_at = [0.5 * (x + L)
14367  * for x, L in zip(self.domain.x, self.domain.L)]
14368  * if cam is None: # <<<<<<<<<<<<<<
14369  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]),
14370  * self.domain.x[1] - 2*self.domain.L[1],
14371  */
14372  __pyx_t_4 = (__pyx_v_cam == Py_None);
14373  __pyx_t_11 = (__pyx_t_4 != 0);
14374  if (__pyx_t_11) {
14375 
14376  /* "Isosurface.pyx":562
14377  * for x, L in zip(self.domain.x, self.domain.L)]
14378  * if cam is None:
14379  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]), # <<<<<<<<<<<<<<
14380  * self.domain.x[1] - 2*self.domain.L[1],
14381  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14382  */
14383  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
14384  __Pyx_GOTREF(__pyx_t_2);
14385  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
14386  __Pyx_GOTREF(__pyx_t_3);
14387  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14388  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
14389  __Pyx_GOTREF(__pyx_t_2);
14390  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14391  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
14392  __Pyx_GOTREF(__pyx_t_3);
14393  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error)
14394  __Pyx_GOTREF(__pyx_t_8);
14395  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14396  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
14397  __Pyx_GOTREF(__pyx_t_3);
14398  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14399  __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 562, __pyx_L1_error)
14400  __Pyx_GOTREF(__pyx_t_8);
14401  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14402  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14403  __pyx_t_3 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
14404  __Pyx_GOTREF(__pyx_t_3);
14405  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14406 
14407  /* "Isosurface.pyx":563
14408  * if cam is None:
14409  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]),
14410  * self.domain.x[1] - 2*self.domain.L[1], # <<<<<<<<<<<<<<
14411  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14412  * light = [0.5 * (x + L)
14413  */
14414  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 563, __pyx_L1_error)
14415  __Pyx_GOTREF(__pyx_t_8);
14416  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
14417  __Pyx_GOTREF(__pyx_t_2);
14418  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14419  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 563, __pyx_L1_error)
14420  __Pyx_GOTREF(__pyx_t_8);
14421  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14422  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
14423  __Pyx_GOTREF(__pyx_t_2);
14424  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
14425  __Pyx_GOTREF(__pyx_t_5);
14426  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14427  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
14428  __Pyx_GOTREF(__pyx_t_2);
14429  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14430  __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
14431  __Pyx_GOTREF(__pyx_t_5);
14432  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14433  __pyx_t_2 = PyNumber_Subtract(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
14434  __Pyx_GOTREF(__pyx_t_2);
14435  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14436  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14437 
14438  /* "Isosurface.pyx":564
14439  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]),
14440  * self.domain.x[1] - 2*self.domain.L[1],
14441  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])] # <<<<<<<<<<<<<<
14442  * light = [0.5 * (x + L)
14443  * for x, L in zip(self.domain.x, self.domain.L)]
14444  */
14445  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
14446  __Pyx_GOTREF(__pyx_t_5);
14447  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 564, __pyx_L1_error)
14448  __Pyx_GOTREF(__pyx_t_8);
14449  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14450  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
14451  __Pyx_GOTREF(__pyx_t_5);
14452  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14453  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 564, __pyx_L1_error)
14454  __Pyx_GOTREF(__pyx_t_8);
14455  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
14456  __Pyx_GOTREF(__pyx_t_1);
14457  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14458  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 564, __pyx_L1_error)
14459  __Pyx_GOTREF(__pyx_t_8);
14460  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14461  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
14462  __Pyx_GOTREF(__pyx_t_1);
14463  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_x); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 564, __pyx_L1_error)
14464  __Pyx_GOTREF(__pyx_t_9);
14465  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14466  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
14467  __Pyx_GOTREF(__pyx_t_1);
14468  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14469  __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 564, __pyx_L1_error)
14470  __Pyx_GOTREF(__pyx_t_9);
14471  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14472  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14473  __pyx_t_1 = PyNumber_Multiply(__pyx_float_0_85, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
14474  __Pyx_GOTREF(__pyx_t_1);
14475  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14476  __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 564, __pyx_L1_error)
14477  __Pyx_GOTREF(__pyx_t_9);
14478  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14479  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14480 
14481  /* "Isosurface.pyx":562
14482  * for x, L in zip(self.domain.x, self.domain.L)]
14483  * if cam is None:
14484  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]), # <<<<<<<<<<<<<<
14485  * self.domain.x[1] - 2*self.domain.L[1],
14486  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14487  */
14488  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
14489  __Pyx_GOTREF(__pyx_t_1);
14490  __Pyx_GIVEREF(__pyx_t_3);
14491  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
14492  __Pyx_GIVEREF(__pyx_t_2);
14493  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
14494  __Pyx_GIVEREF(__pyx_t_9);
14495  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_9);
14496  __pyx_t_3 = 0;
14497  __pyx_t_2 = 0;
14498  __pyx_t_9 = 0;
14499  __Pyx_DECREF_SET(__pyx_v_cam, __pyx_t_1);
14500  __pyx_t_1 = 0;
14501 
14502  /* "Isosurface.pyx":561
14503  * look_at = [0.5 * (x + L)
14504  * for x, L in zip(self.domain.x, self.domain.L)]
14505  * if cam is None: # <<<<<<<<<<<<<<
14506  * cam = [0.5*(self.domain.x[0] + self.domain.L[0]),
14507  * self.domain.x[1] - 2*self.domain.L[1],
14508  */
14509  }
14510 
14511  /* "Isosurface.pyx":565
14512  * self.domain.x[1] - 2*self.domain.L[1],
14513  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14514  * light = [0.5 * (x + L) # <<<<<<<<<<<<<<
14515  * for x, L in zip(self.domain.x, self.domain.L)]
14516  * light[2] = self.domain.x[2] + 5 * self.domain.L[2]
14517  */
14518  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
14519  __Pyx_GOTREF(__pyx_t_1);
14520 
14521  /* "Isosurface.pyx":566
14522  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14523  * light = [0.5 * (x + L)
14524  * for x, L in zip(self.domain.x, self.domain.L)] # <<<<<<<<<<<<<<
14525  * light[2] = self.domain.x[2] + 5 * self.domain.L[2]
14526  * light_dx, light_dy = (self.domain.x[0] - light[0],
14527  */
14528  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 566, __pyx_L1_error)
14529  __Pyx_GOTREF(__pyx_t_9);
14530  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
14531  __Pyx_GOTREF(__pyx_t_2);
14532  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14533  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 566, __pyx_L1_error)
14534  __Pyx_GOTREF(__pyx_t_9);
14535  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
14536  __Pyx_GOTREF(__pyx_t_3);
14537  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14538  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 566, __pyx_L1_error)
14539  __Pyx_GOTREF(__pyx_t_9);
14540  __Pyx_GIVEREF(__pyx_t_2);
14541  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
14542  __Pyx_GIVEREF(__pyx_t_3);
14543  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
14544  __pyx_t_2 = 0;
14545  __pyx_t_3 = 0;
14546  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
14547  __Pyx_GOTREF(__pyx_t_3);
14548  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14549  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
14550  __pyx_t_9 = __pyx_t_3; __Pyx_INCREF(__pyx_t_9); __pyx_t_6 = 0;
14551  __pyx_t_7 = NULL;
14552  } else {
14553  __pyx_t_6 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 566, __pyx_L1_error)
14554  __Pyx_GOTREF(__pyx_t_9);
14555  __pyx_t_7 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 566, __pyx_L1_error)
14556  }
14557  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14558  for (;;) {
14559  if (likely(!__pyx_t_7)) {
14560  if (likely(PyList_CheckExact(__pyx_t_9))) {
14561  if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_9)) break;
14562  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14563  __pyx_t_3 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 566, __pyx_L1_error)
14564  #else
14565  __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
14566  __Pyx_GOTREF(__pyx_t_3);
14567  #endif
14568  } else {
14569  if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
14570  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14571  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 566, __pyx_L1_error)
14572  #else
14573  __pyx_t_3 = PySequence_ITEM(__pyx_t_9, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
14574  __Pyx_GOTREF(__pyx_t_3);
14575  #endif
14576  }
14577  } else {
14578  __pyx_t_3 = __pyx_t_7(__pyx_t_9);
14579  if (unlikely(!__pyx_t_3)) {
14580  PyObject* exc_type = PyErr_Occurred();
14581  if (exc_type) {
14582  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14583  else __PYX_ERR(0, 566, __pyx_L1_error)
14584  }
14585  break;
14586  }
14587  __Pyx_GOTREF(__pyx_t_3);
14588  }
14589  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
14590  PyObject* sequence = __pyx_t_3;
14591  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
14592  if (unlikely(size != 2)) {
14593  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
14594  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
14595  __PYX_ERR(0, 566, __pyx_L1_error)
14596  }
14597  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14598  if (likely(PyTuple_CheckExact(sequence))) {
14599  __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
14600  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
14601  } else {
14602  __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
14603  __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
14604  }
14605  __Pyx_INCREF(__pyx_t_2);
14606  __Pyx_INCREF(__pyx_t_5);
14607  #else
14608  __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
14609  __Pyx_GOTREF(__pyx_t_2);
14610  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 566, __pyx_L1_error)
14611  __Pyx_GOTREF(__pyx_t_5);
14612  #endif
14613  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14614  } else {
14615  Py_ssize_t index = -1;
14616  __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 566, __pyx_L1_error)
14617  __Pyx_GOTREF(__pyx_t_8);
14618  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14619  __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext;
14620  index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
14621  __Pyx_GOTREF(__pyx_t_2);
14622  index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
14623  __Pyx_GOTREF(__pyx_t_5);
14624  if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 566, __pyx_L1_error)
14625  __pyx_t_10 = NULL;
14626  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14627  goto __pyx_L12_unpacking_done;
14628  __pyx_L11_unpacking_failed:;
14629  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14630  __pyx_t_10 = NULL;
14631  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
14632  __PYX_ERR(0, 566, __pyx_L1_error)
14633  __pyx_L12_unpacking_done:;
14634  }
14635  __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_2);
14636  __pyx_t_2 = 0;
14637  __Pyx_XDECREF_SET(__pyx_v_L, __pyx_t_5);
14638  __pyx_t_5 = 0;
14639 
14640  /* "Isosurface.pyx":565
14641  * self.domain.x[1] - 2*self.domain.L[1],
14642  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14643  * light = [0.5 * (x + L) # <<<<<<<<<<<<<<
14644  * for x, L in zip(self.domain.x, self.domain.L)]
14645  * light[2] = self.domain.x[2] + 5 * self.domain.L[2]
14646  */
14647  __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_v_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error)
14648  __Pyx_GOTREF(__pyx_t_3);
14649  __pyx_t_5 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
14650  __Pyx_GOTREF(__pyx_t_5);
14651  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14652  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 565, __pyx_L1_error)
14653  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14654 
14655  /* "Isosurface.pyx":566
14656  * self.domain.x[2] + 0.85*(self.domain.L[2] + self.domain.x[2])]
14657  * light = [0.5 * (x + L)
14658  * for x, L in zip(self.domain.x, self.domain.L)] # <<<<<<<<<<<<<<
14659  * light[2] = self.domain.x[2] + 5 * self.domain.L[2]
14660  * light_dx, light_dy = (self.domain.x[0] - light[0],
14661  */
14662  }
14663  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14664  __pyx_v_light = ((PyObject*)__pyx_t_1);
14665  __pyx_t_1 = 0;
14666 
14667  /* "Isosurface.pyx":567
14668  * light = [0.5 * (x + L)
14669  * for x, L in zip(self.domain.x, self.domain.L)]
14670  * light[2] = self.domain.x[2] + 5 * self.domain.L[2] # <<<<<<<<<<<<<<
14671  * light_dx, light_dy = (self.domain.x[0] - light[0],
14672  * self.domain.x[1] - light[1])
14673  */
14674  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
14675  __Pyx_GOTREF(__pyx_t_1);
14676  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_x); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error)
14677  __Pyx_GOTREF(__pyx_t_9);
14678  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14679  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error)
14680  __Pyx_GOTREF(__pyx_t_1);
14681  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14682  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error)
14683  __Pyx_GOTREF(__pyx_t_9);
14684  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error)
14685  __Pyx_GOTREF(__pyx_t_5);
14686  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14687  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error)
14688  __Pyx_GOTREF(__pyx_t_9);
14689  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14690  __pyx_t_5 = PyNumber_Multiply(__pyx_int_5, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error)
14691  __Pyx_GOTREF(__pyx_t_5);
14692  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14693  __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error)
14694  __Pyx_GOTREF(__pyx_t_9);
14695  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14696  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14697  if (unlikely(__Pyx_SetItemInt(__pyx_v_light, 2, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 567, __pyx_L1_error)
14698  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14699 
14700  /* "Isosurface.pyx":568
14701  * for x, L in zip(self.domain.x, self.domain.L)]
14702  * light[2] = self.domain.x[2] + 5 * self.domain.L[2]
14703  * light_dx, light_dy = (self.domain.x[0] - light[0], # <<<<<<<<<<<<<<
14704  * self.domain.x[1] - light[1])
14705  * floor_z = self.domain.x[2] - 0.01 * \
14706  */
14707  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 568, __pyx_L1_error)
14708  __Pyx_GOTREF(__pyx_t_9);
14709  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 568, __pyx_L1_error)
14710  __Pyx_GOTREF(__pyx_t_5);
14711  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14712  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 568, __pyx_L1_error)
14713  __Pyx_GOTREF(__pyx_t_9);
14714  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14715  __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_light, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 568, __pyx_L1_error)
14716  __Pyx_GOTREF(__pyx_t_5);
14717  __pyx_t_1 = PyNumber_Subtract(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
14718  __Pyx_GOTREF(__pyx_t_1);
14719  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14720  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14721 
14722  /* "Isosurface.pyx":569
14723  * light[2] = self.domain.x[2] + 5 * self.domain.L[2]
14724  * light_dx, light_dy = (self.domain.x[0] - light[0],
14725  * self.domain.x[1] - light[1]) # <<<<<<<<<<<<<<
14726  * floor_z = self.domain.x[2] - 0.01 * \
14727  * self.domain.L[2] # offset slightly
14728  */
14729  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 569, __pyx_L1_error)
14730  __Pyx_GOTREF(__pyx_t_5);
14731  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_x); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 569, __pyx_L1_error)
14732  __Pyx_GOTREF(__pyx_t_9);
14733  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14734  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 569, __pyx_L1_error)
14735  __Pyx_GOTREF(__pyx_t_5);
14736  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14737  __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_light, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 569, __pyx_L1_error)
14738  __Pyx_GOTREF(__pyx_t_9);
14739  __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 569, __pyx_L1_error)
14740  __Pyx_GOTREF(__pyx_t_3);
14741  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14742  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14743  __pyx_v_light_dx = __pyx_t_1;
14744  __pyx_t_1 = 0;
14745  __pyx_v_light_dy = __pyx_t_3;
14746  __pyx_t_3 = 0;
14747 
14748  /* "Isosurface.pyx":570
14749  * light_dx, light_dy = (self.domain.x[0] - light[0],
14750  * self.domain.x[1] - light[1])
14751  * floor_z = self.domain.x[2] - 0.01 * \ # <<<<<<<<<<<<<<
14752  * self.domain.L[2] # offset slightly
14753  * wall_y = self.domain.x[1] - 2.0 * \
14754  */
14755  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
14756  __Pyx_GOTREF(__pyx_t_3);
14757  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
14758  __Pyx_GOTREF(__pyx_t_1);
14759  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14760  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
14761  __Pyx_GOTREF(__pyx_t_3);
14762  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14763 
14764  /* "Isosurface.pyx":571
14765  * self.domain.x[1] - light[1])
14766  * floor_z = self.domain.x[2] - 0.01 * \
14767  * self.domain.L[2] # offset slightly # <<<<<<<<<<<<<<
14768  * wall_y = self.domain.x[1] - 2.0 * \
14769  * self.domain.L[1] # offset slightly
14770  */
14771  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
14772  __Pyx_GOTREF(__pyx_t_1);
14773  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_L); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 571, __pyx_L1_error)
14774  __Pyx_GOTREF(__pyx_t_9);
14775  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14776  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
14777  __Pyx_GOTREF(__pyx_t_1);
14778  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14779 
14780  /* "Isosurface.pyx":570
14781  * light_dx, light_dy = (self.domain.x[0] - light[0],
14782  * self.domain.x[1] - light[1])
14783  * floor_z = self.domain.x[2] - 0.01 * \ # <<<<<<<<<<<<<<
14784  * self.domain.L[2] # offset slightly
14785  * wall_y = self.domain.x[1] - 2.0 * \
14786  */
14787  __pyx_t_9 = PyNumber_Multiply(__pyx_float_0_01, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 570, __pyx_L1_error)
14788  __Pyx_GOTREF(__pyx_t_9);
14789  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14790  __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
14791  __Pyx_GOTREF(__pyx_t_1);
14792  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14793  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14794  __pyx_v_floor_z = __pyx_t_1;
14795  __pyx_t_1 = 0;
14796 
14797  /* "Isosurface.pyx":572
14798  * floor_z = self.domain.x[2] - 0.01 * \
14799  * self.domain.L[2] # offset slightly
14800  * wall_y = self.domain.x[1] - 2.0 * \ # <<<<<<<<<<<<<<
14801  * self.domain.L[1] # offset slightly
14802  * sky_z = self.domain.x[2] + 10 * self.domain.L[2]
14803  */
14804  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
14805  __Pyx_GOTREF(__pyx_t_1);
14806  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_x); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 572, __pyx_L1_error)
14807  __Pyx_GOTREF(__pyx_t_9);
14808  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14809  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
14810  __Pyx_GOTREF(__pyx_t_1);
14811  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14812 
14813  /* "Isosurface.pyx":573
14814  * self.domain.L[2] # offset slightly
14815  * wall_y = self.domain.x[1] - 2.0 * \
14816  * self.domain.L[1] # offset slightly # <<<<<<<<<<<<<<
14817  * sky_z = self.domain.x[2] + 10 * self.domain.L[2]
14818  * pov = open("proteus.inc", "w")
14819  */
14820  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 573, __pyx_L1_error)
14821  __Pyx_GOTREF(__pyx_t_9);
14822  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
14823  __Pyx_GOTREF(__pyx_t_3);
14824  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14825  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 573, __pyx_L1_error)
14826  __Pyx_GOTREF(__pyx_t_9);
14827  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14828 
14829  /* "Isosurface.pyx":572
14830  * floor_z = self.domain.x[2] - 0.01 * \
14831  * self.domain.L[2] # offset slightly
14832  * wall_y = self.domain.x[1] - 2.0 * \ # <<<<<<<<<<<<<<
14833  * self.domain.L[1] # offset slightly
14834  * sky_z = self.domain.x[2] + 10 * self.domain.L[2]
14835  */
14836  __pyx_t_3 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error)
14837  __Pyx_GOTREF(__pyx_t_3);
14838  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14839  __pyx_t_9 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 572, __pyx_L1_error)
14840  __Pyx_GOTREF(__pyx_t_9);
14841  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14842  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14843  __pyx_v_wall_y = __pyx_t_9;
14844  __pyx_t_9 = 0;
14845 
14846  /* "Isosurface.pyx":574
14847  * wall_y = self.domain.x[1] - 2.0 * \
14848  * self.domain.L[1] # offset slightly
14849  * sky_z = self.domain.x[2] + 10 * self.domain.L[2] # <<<<<<<<<<<<<<
14850  * pov = open("proteus.inc", "w")
14851  * povSceneTemplate = Template("""#include "colors.inc"
14852  */
14853  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 574, __pyx_L1_error)
14854  __Pyx_GOTREF(__pyx_t_9);
14855  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
14856  __Pyx_GOTREF(__pyx_t_3);
14857  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14858  __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_3, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 574, __pyx_L1_error)
14859  __Pyx_GOTREF(__pyx_t_9);
14860  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14861  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_domain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
14862  __Pyx_GOTREF(__pyx_t_3);
14863  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
14864  __Pyx_GOTREF(__pyx_t_1);
14865  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14866  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
14867  __Pyx_GOTREF(__pyx_t_3);
14868  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14869  __pyx_t_1 = PyNumber_Multiply(__pyx_int_10, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
14870  __Pyx_GOTREF(__pyx_t_1);
14871  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14872  __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
14873  __Pyx_GOTREF(__pyx_t_3);
14874  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14875  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14876  __pyx_v_sky_z = __pyx_t_3;
14877  __pyx_t_3 = 0;
14878 
14879  /* "Isosurface.pyx":575
14880  * self.domain.L[1] # offset slightly
14881  * sky_z = self.domain.x[2] + 10 * self.domain.L[2]
14882  * pov = open("proteus.inc", "w") # <<<<<<<<<<<<<<
14883  * povSceneTemplate = Template("""#include "colors.inc"
14884  * #include "textures.inc"
14885  */
14886  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
14887  __Pyx_GOTREF(__pyx_t_3);
14888  __pyx_v_pov = __pyx_t_3;
14889  __pyx_t_3 = 0;
14890 
14891  /* "Isosurface.pyx":576
14892  * sky_z = self.domain.x[2] + 10 * self.domain.L[2]
14893  * pov = open("proteus.inc", "w")
14894  * povSceneTemplate = Template("""#include "colors.inc" # <<<<<<<<<<<<<<
14895  * #include "textures.inc"
14896  * #include "glass.inc"
14897  */
14898  __Pyx_INCREF(__pyx_v_Template);
14899  __pyx_t_1 = __pyx_v_Template; __pyx_t_9 = NULL;
14900  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
14901  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
14902  if (likely(__pyx_t_9)) {
14903  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
14904  __Pyx_INCREF(__pyx_t_9);
14905  __Pyx_INCREF(function);
14906  __Pyx_DECREF_SET(__pyx_t_1, function);
14907  }
14908  }
14909  __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_kp_s_include_colors_inc_include_text) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_include_colors_inc_include_text);
14910  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
14911  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error)
14912  __Pyx_GOTREF(__pyx_t_3);
14913  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14914  __pyx_v_povSceneTemplate = __pyx_t_3;
14915  __pyx_t_3 = 0;
14916 
14917  /* "Isosurface.pyx":718
14918  * #end
14919  * """)
14920  * pov.write(povSceneTemplate.substitute(look_at_x=look_at[0], # <<<<<<<<<<<<<<
14921  * look_at_y=look_at[1],
14922  * look_at_z=look_at[2],
14923  */
14924  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
14925  __Pyx_GOTREF(__pyx_t_1);
14926  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_povSceneTemplate, __pyx_n_s_substitute); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 718, __pyx_L1_error)
14927  __Pyx_GOTREF(__pyx_t_9);
14928  __pyx_t_5 = __Pyx_PyDict_NewPresized(14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 718, __pyx_L1_error)
14929  __Pyx_GOTREF(__pyx_t_5);
14930  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_look_at, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
14931  __Pyx_GOTREF(__pyx_t_2);
14932  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_look_at_x, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
14933  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14934 
14935  /* "Isosurface.pyx":719
14936  * """)
14937  * pov.write(povSceneTemplate.substitute(look_at_x=look_at[0],
14938  * look_at_y=look_at[1], # <<<<<<<<<<<<<<
14939  * look_at_z=look_at[2],
14940  * cam_x=cam[0],
14941  */
14942  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_look_at, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
14943  __Pyx_GOTREF(__pyx_t_2);
14944  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_look_at_y, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
14945  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14946 
14947  /* "Isosurface.pyx":720
14948  * pov.write(povSceneTemplate.substitute(look_at_x=look_at[0],
14949  * look_at_y=look_at[1],
14950  * look_at_z=look_at[2], # <<<<<<<<<<<<<<
14951  * cam_x=cam[0],
14952  * cam_y=cam[1],
14953  */
14954  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_look_at, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
14955  __Pyx_GOTREF(__pyx_t_2);
14956  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_look_at_z, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
14957  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14958 
14959  /* "Isosurface.pyx":721
14960  * look_at_y=look_at[1],
14961  * look_at_z=look_at[2],
14962  * cam_x=cam[0], # <<<<<<<<<<<<<<
14963  * cam_y=cam[1],
14964  * cam_z=cam[2],
14965  */
14966  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cam, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
14967  __Pyx_GOTREF(__pyx_t_2);
14968  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_cam_x, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
14969  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14970 
14971  /* "Isosurface.pyx":722
14972  * look_at_z=look_at[2],
14973  * cam_x=cam[0],
14974  * cam_y=cam[1], # <<<<<<<<<<<<<<
14975  * cam_z=cam[2],
14976  * light_x=light[0],
14977  */
14978  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cam, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error)
14979  __Pyx_GOTREF(__pyx_t_2);
14980  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_cam_y, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
14981  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14982 
14983  /* "Isosurface.pyx":723
14984  * cam_x=cam[0],
14985  * cam_y=cam[1],
14986  * cam_z=cam[2], # <<<<<<<<<<<<<<
14987  * light_x=light[0],
14988  * light_y=light[1],
14989  */
14990  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cam, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
14991  __Pyx_GOTREF(__pyx_t_2);
14992  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_cam_z, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
14993  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14994 
14995  /* "Isosurface.pyx":724
14996  * cam_y=cam[1],
14997  * cam_z=cam[2],
14998  * light_x=light[0], # <<<<<<<<<<<<<<
14999  * light_y=light[1],
15000  * light_z=light[2],
15001  */
15002  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_light, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
15003  __Pyx_GOTREF(__pyx_t_2);
15004  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_light_x, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15005  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15006 
15007  /* "Isosurface.pyx":725
15008  * cam_z=cam[2],
15009  * light_x=light[0],
15010  * light_y=light[1], # <<<<<<<<<<<<<<
15011  * light_z=light[2],
15012  * light_dx=light_dx,
15013  */
15014  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_light, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
15015  __Pyx_GOTREF(__pyx_t_2);
15016  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_light_y, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15017  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15018 
15019  /* "Isosurface.pyx":726
15020  * light_x=light[0],
15021  * light_y=light[1],
15022  * light_z=light[2], # <<<<<<<<<<<<<<
15023  * light_dx=light_dx,
15024  * light_dy=light_dy,
15025  */
15026  __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_light, 2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
15027  __Pyx_GOTREF(__pyx_t_2);
15028  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_light_z, __pyx_t_2) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15029  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15030 
15031  /* "Isosurface.pyx":727
15032  * light_y=light[1],
15033  * light_z=light[2],
15034  * light_dx=light_dx, # <<<<<<<<<<<<<<
15035  * light_dy=light_dy,
15036  * floor_z=floor_z,
15037  */
15038  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_light_dx, __pyx_v_light_dx) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15039 
15040  /* "Isosurface.pyx":728
15041  * light_z=light[2],
15042  * light_dx=light_dx,
15043  * light_dy=light_dy, # <<<<<<<<<<<<<<
15044  * floor_z=floor_z,
15045  * wall_y=wall_y,
15046  */
15047  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_light_dy, __pyx_v_light_dy) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15048 
15049  /* "Isosurface.pyx":729
15050  * light_dx=light_dx,
15051  * light_dy=light_dy,
15052  * floor_z=floor_z, # <<<<<<<<<<<<<<
15053  * wall_y=wall_y,
15054  * sky_z=sky_z
15055  */
15056  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_floor_z, __pyx_v_floor_z) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15057 
15058  /* "Isosurface.pyx":730
15059  * light_dy=light_dy,
15060  * floor_z=floor_z,
15061  * wall_y=wall_y, # <<<<<<<<<<<<<<
15062  * sky_z=sky_z
15063  * )
15064  */
15065  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_wall_y, __pyx_v_wall_y) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15066 
15067  /* "Isosurface.pyx":731
15068  * floor_z=floor_z,
15069  * wall_y=wall_y,
15070  * sky_z=sky_z # <<<<<<<<<<<<<<
15071  * )
15072  * )
15073  */
15074  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_sky_z, __pyx_v_sky_z) < 0) __PYX_ERR(0, 718, __pyx_L1_error)
15075 
15076  /* "Isosurface.pyx":718
15077  * #end
15078  * """)
15079  * pov.write(povSceneTemplate.substitute(look_at_x=look_at[0], # <<<<<<<<<<<<<<
15080  * look_at_y=look_at[1],
15081  * look_at_z=look_at[2],
15082  */
15083  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
15084  __Pyx_GOTREF(__pyx_t_2);
15085  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15086  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15087  __pyx_t_5 = NULL;
15088  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
15089  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
15090  if (likely(__pyx_t_5)) {
15091  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
15092  __Pyx_INCREF(__pyx_t_5);
15093  __Pyx_INCREF(function);
15094  __Pyx_DECREF_SET(__pyx_t_1, function);
15095  }
15096  }
15097  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
15098  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15099  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15100  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error)
15101  __Pyx_GOTREF(__pyx_t_3);
15102  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15103  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15104 
15105  /* "Isosurface.pyx":734
15106  * )
15107  * )
15108  * pov.close() # <<<<<<<<<<<<<<
15109  */
15110  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pov, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
15111  __Pyx_GOTREF(__pyx_t_1);
15112  __pyx_t_2 = NULL;
15113  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
15114  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
15115  if (likely(__pyx_t_2)) {
15116  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
15117  __Pyx_INCREF(__pyx_t_2);
15118  __Pyx_INCREF(function);
15119  __Pyx_DECREF_SET(__pyx_t_1, function);
15120  }
15121  }
15122  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
15123  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15124  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L1_error)
15125  __Pyx_GOTREF(__pyx_t_3);
15126  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15127  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15128 
15129  /* "Isosurface.pyx":558
15130  * """
15131  * from string import Template
15132  * if self.comm.isMaster(): # <<<<<<<<<<<<<<
15133  * look_at = [0.5 * (x + L)
15134  * for x, L in zip(self.domain.x, self.domain.L)]
15135  */
15136  }
15137 
15138  /* "Isosurface.pyx":553
15139  * self.next_output += self.sampleRate
15140  *
15141  * def writeSceneHeader(self, cam = None): # <<<<<<<<<<<<<<
15142  * """
15143  * Write a scene description (can be modified before running povray)
15144  */
15145 
15146  /* function exit code */
15147  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15148  goto __pyx_L0;
15149  __pyx_L1_error:;
15150  __Pyx_XDECREF(__pyx_t_1);
15151  __Pyx_XDECREF(__pyx_t_2);
15152  __Pyx_XDECREF(__pyx_t_3);
15153  __Pyx_XDECREF(__pyx_t_5);
15154  __Pyx_XDECREF(__pyx_t_8);
15155  __Pyx_XDECREF(__pyx_t_9);
15156  __Pyx_AddTraceback("Isosurface.Isosurface.writeSceneHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
15157  __pyx_r = NULL;
15158  __pyx_L0:;
15159  __Pyx_XDECREF(__pyx_v_Template);
15160  __Pyx_XDECREF(__pyx_v_look_at);
15161  __Pyx_XDECREF(__pyx_v_light);
15162  __Pyx_XDECREF(__pyx_v_light_dx);
15163  __Pyx_XDECREF(__pyx_v_light_dy);
15164  __Pyx_XDECREF(__pyx_v_floor_z);
15165  __Pyx_XDECREF(__pyx_v_wall_y);
15166  __Pyx_XDECREF(__pyx_v_sky_z);
15167  __Pyx_XDECREF(__pyx_v_pov);
15168  __Pyx_XDECREF(__pyx_v_povSceneTemplate);
15169  __Pyx_XDECREF(__pyx_v_x);
15170  __Pyx_XDECREF(__pyx_v_L);
15171  __Pyx_XDECREF(__pyx_v_cam);
15172  __Pyx_XGIVEREF(__pyx_r);
15173  __Pyx_RefNannyFinishContext();
15174  return __pyx_r;
15175 }
15176 
15177 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
15178  * ctypedef npy_cdouble complex_t
15179  *
15180  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
15181  * return PyArray_MultiIterNew(1, <void*>a)
15182  *
15183  */
15184 
15185 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
15186  PyObject *__pyx_r = NULL;
15187  __Pyx_RefNannyDeclarations
15188  PyObject *__pyx_t_1 = NULL;
15189  int __pyx_lineno = 0;
15190  const char *__pyx_filename = NULL;
15191  int __pyx_clineno = 0;
15192  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
15193 
15194  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":736
15195  *
15196  * cdef inline object PyArray_MultiIterNew1(a):
15197  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
15198  *
15199  * cdef inline object PyArray_MultiIterNew2(a, b):
15200  */
15201  __Pyx_XDECREF(__pyx_r);
15202  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
15203  __Pyx_GOTREF(__pyx_t_1);
15204  __pyx_r = __pyx_t_1;
15205  __pyx_t_1 = 0;
15206  goto __pyx_L0;
15207 
15208  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
15209  * ctypedef npy_cdouble complex_t
15210  *
15211  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
15212  * return PyArray_MultiIterNew(1, <void*>a)
15213  *
15214  */
15215 
15216  /* function exit code */
15217  __pyx_L1_error:;
15218  __Pyx_XDECREF(__pyx_t_1);
15219  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
15220  __pyx_r = 0;
15221  __pyx_L0:;
15222  __Pyx_XGIVEREF(__pyx_r);
15223  __Pyx_RefNannyFinishContext();
15224  return __pyx_r;
15225 }
15226 
15227 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
15228  * return PyArray_MultiIterNew(1, <void*>a)
15229  *
15230  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
15231  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15232  *
15233  */
15234 
15235 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
15236  PyObject *__pyx_r = NULL;
15237  __Pyx_RefNannyDeclarations
15238  PyObject *__pyx_t_1 = NULL;
15239  int __pyx_lineno = 0;
15240  const char *__pyx_filename = NULL;
15241  int __pyx_clineno = 0;
15242  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
15243 
15244  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":739
15245  *
15246  * cdef inline object PyArray_MultiIterNew2(a, b):
15247  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
15248  *
15249  * cdef inline object PyArray_MultiIterNew3(a, b, c):
15250  */
15251  __Pyx_XDECREF(__pyx_r);
15252  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
15253  __Pyx_GOTREF(__pyx_t_1);
15254  __pyx_r = __pyx_t_1;
15255  __pyx_t_1 = 0;
15256  goto __pyx_L0;
15257 
15258  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
15259  * return PyArray_MultiIterNew(1, <void*>a)
15260  *
15261  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
15262  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15263  *
15264  */
15265 
15266  /* function exit code */
15267  __pyx_L1_error:;
15268  __Pyx_XDECREF(__pyx_t_1);
15269  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
15270  __pyx_r = 0;
15271  __pyx_L0:;
15272  __Pyx_XGIVEREF(__pyx_r);
15273  __Pyx_RefNannyFinishContext();
15274  return __pyx_r;
15275 }
15276 
15277 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
15278  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15279  *
15280  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
15281  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15282  *
15283  */
15284 
15285 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
15286  PyObject *__pyx_r = NULL;
15287  __Pyx_RefNannyDeclarations
15288  PyObject *__pyx_t_1 = NULL;
15289  int __pyx_lineno = 0;
15290  const char *__pyx_filename = NULL;
15291  int __pyx_clineno = 0;
15292  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
15293 
15294  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":742
15295  *
15296  * cdef inline object PyArray_MultiIterNew3(a, b, c):
15297  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
15298  *
15299  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
15300  */
15301  __Pyx_XDECREF(__pyx_r);
15302  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
15303  __Pyx_GOTREF(__pyx_t_1);
15304  __pyx_r = __pyx_t_1;
15305  __pyx_t_1 = 0;
15306  goto __pyx_L0;
15307 
15308  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
15309  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15310  *
15311  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
15312  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15313  *
15314  */
15315 
15316  /* function exit code */
15317  __pyx_L1_error:;
15318  __Pyx_XDECREF(__pyx_t_1);
15319  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
15320  __pyx_r = 0;
15321  __pyx_L0:;
15322  __Pyx_XGIVEREF(__pyx_r);
15323  __Pyx_RefNannyFinishContext();
15324  return __pyx_r;
15325 }
15326 
15327 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
15328  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15329  *
15330  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
15331  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15332  *
15333  */
15334 
15335 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) {
15336  PyObject *__pyx_r = NULL;
15337  __Pyx_RefNannyDeclarations
15338  PyObject *__pyx_t_1 = NULL;
15339  int __pyx_lineno = 0;
15340  const char *__pyx_filename = NULL;
15341  int __pyx_clineno = 0;
15342  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
15343 
15344  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":745
15345  *
15346  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
15347  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
15348  *
15349  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
15350  */
15351  __Pyx_XDECREF(__pyx_r);
15352  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
15353  __Pyx_GOTREF(__pyx_t_1);
15354  __pyx_r = __pyx_t_1;
15355  __pyx_t_1 = 0;
15356  goto __pyx_L0;
15357 
15358  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
15359  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15360  *
15361  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
15362  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15363  *
15364  */
15365 
15366  /* function exit code */
15367  __pyx_L1_error:;
15368  __Pyx_XDECREF(__pyx_t_1);
15369  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
15370  __pyx_r = 0;
15371  __pyx_L0:;
15372  __Pyx_XGIVEREF(__pyx_r);
15373  __Pyx_RefNannyFinishContext();
15374  return __pyx_r;
15375 }
15376 
15377 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
15378  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15379  *
15380  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
15381  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15382  *
15383  */
15384 
15385 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) {
15386  PyObject *__pyx_r = NULL;
15387  __Pyx_RefNannyDeclarations
15388  PyObject *__pyx_t_1 = NULL;
15389  int __pyx_lineno = 0;
15390  const char *__pyx_filename = NULL;
15391  int __pyx_clineno = 0;
15392  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
15393 
15394  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":748
15395  *
15396  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
15397  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
15398  *
15399  * cdef inline tuple PyDataType_SHAPE(dtype d):
15400  */
15401  __Pyx_XDECREF(__pyx_r);
15402  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
15403  __Pyx_GOTREF(__pyx_t_1);
15404  __pyx_r = __pyx_t_1;
15405  __pyx_t_1 = 0;
15406  goto __pyx_L0;
15407 
15408  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
15409  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15410  *
15411  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
15412  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15413  *
15414  */
15415 
15416  /* function exit code */
15417  __pyx_L1_error:;
15418  __Pyx_XDECREF(__pyx_t_1);
15419  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
15420  __pyx_r = 0;
15421  __pyx_L0:;
15422  __Pyx_XGIVEREF(__pyx_r);
15423  __Pyx_RefNannyFinishContext();
15424  return __pyx_r;
15425 }
15426 
15427 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
15428  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15429  *
15430  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
15431  * if PyDataType_HASSUBARRAY(d):
15432  * return <tuple>d.subarray.shape
15433  */
15434 
15435 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
15436  PyObject *__pyx_r = NULL;
15437  __Pyx_RefNannyDeclarations
15438  int __pyx_t_1;
15439  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
15440 
15441  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
15442  *
15443  * cdef inline tuple PyDataType_SHAPE(dtype d):
15444  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
15445  * return <tuple>d.subarray.shape
15446  * else:
15447  */
15448  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
15449  if (__pyx_t_1) {
15450 
15451  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":752
15452  * cdef inline tuple PyDataType_SHAPE(dtype d):
15453  * if PyDataType_HASSUBARRAY(d):
15454  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
15455  * else:
15456  * return ()
15457  */
15458  __Pyx_XDECREF(__pyx_r);
15459  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
15460  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
15461  goto __pyx_L0;
15462 
15463  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
15464  *
15465  * cdef inline tuple PyDataType_SHAPE(dtype d):
15466  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
15467  * return <tuple>d.subarray.shape
15468  * else:
15469  */
15470  }
15471 
15472  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":754
15473  * return <tuple>d.subarray.shape
15474  * else:
15475  * return () # <<<<<<<<<<<<<<
15476  *
15477  *
15478  */
15479  /*else*/ {
15480  __Pyx_XDECREF(__pyx_r);
15481  __Pyx_INCREF(__pyx_empty_tuple);
15482  __pyx_r = __pyx_empty_tuple;
15483  goto __pyx_L0;
15484  }
15485 
15486  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
15487  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15488  *
15489  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
15490  * if PyDataType_HASSUBARRAY(d):
15491  * return <tuple>d.subarray.shape
15492  */
15493 
15494  /* function exit code */
15495  __pyx_L0:;
15496  __Pyx_XGIVEREF(__pyx_r);
15497  __Pyx_RefNannyFinishContext();
15498  return __pyx_r;
15499 }
15500 
15501 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
15502  * int _import_umath() except -1
15503  *
15504  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
15505  * Py_INCREF(base) # important to do this before stealing the reference below!
15506  * PyArray_SetBaseObject(arr, base)
15507  */
15508 
15509 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
15510  __Pyx_RefNannyDeclarations
15511  __Pyx_RefNannySetupContext("set_array_base", 0);
15512 
15513  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":930
15514  *
15515  * cdef inline void set_array_base(ndarray arr, object base):
15516  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
15517  * PyArray_SetBaseObject(arr, base)
15518  *
15519  */
15520  Py_INCREF(__pyx_v_base);
15521 
15522  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":931
15523  * cdef inline void set_array_base(ndarray arr, object base):
15524  * Py_INCREF(base) # important to do this before stealing the reference below!
15525  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
15526  *
15527  * cdef inline object get_array_base(ndarray arr):
15528  */
15529  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
15530 
15531  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
15532  * int _import_umath() except -1
15533  *
15534  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
15535  * Py_INCREF(base) # important to do this before stealing the reference below!
15536  * PyArray_SetBaseObject(arr, base)
15537  */
15538 
15539  /* function exit code */
15540  __Pyx_RefNannyFinishContext();
15541 }
15542 
15543 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
15544  * PyArray_SetBaseObject(arr, base)
15545  *
15546  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
15547  * base = PyArray_BASE(arr)
15548  * if base is NULL:
15549  */
15550 
15551 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
15552  PyObject *__pyx_v_base;
15553  PyObject *__pyx_r = NULL;
15554  __Pyx_RefNannyDeclarations
15555  int __pyx_t_1;
15556  __Pyx_RefNannySetupContext("get_array_base", 0);
15557 
15558  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":934
15559  *
15560  * cdef inline object get_array_base(ndarray arr):
15561  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
15562  * if base is NULL:
15563  * return None
15564  */
15565  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
15566 
15567  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
15568  * cdef inline object get_array_base(ndarray arr):
15569  * base = PyArray_BASE(arr)
15570  * if base is NULL: # <<<<<<<<<<<<<<
15571  * return None
15572  * return <object>base
15573  */
15574  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
15575  if (__pyx_t_1) {
15576 
15577  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":936
15578  * base = PyArray_BASE(arr)
15579  * if base is NULL:
15580  * return None # <<<<<<<<<<<<<<
15581  * return <object>base
15582  *
15583  */
15584  __Pyx_XDECREF(__pyx_r);
15585  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15586  goto __pyx_L0;
15587 
15588  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
15589  * cdef inline object get_array_base(ndarray arr):
15590  * base = PyArray_BASE(arr)
15591  * if base is NULL: # <<<<<<<<<<<<<<
15592  * return None
15593  * return <object>base
15594  */
15595  }
15596 
15597  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":937
15598  * if base is NULL:
15599  * return None
15600  * return <object>base # <<<<<<<<<<<<<<
15601  *
15602  * # Versions of the import_* functions which are more suitable for
15603  */
15604  __Pyx_XDECREF(__pyx_r);
15605  __Pyx_INCREF(((PyObject *)__pyx_v_base));
15606  __pyx_r = ((PyObject *)__pyx_v_base);
15607  goto __pyx_L0;
15608 
15609  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
15610  * PyArray_SetBaseObject(arr, base)
15611  *
15612  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
15613  * base = PyArray_BASE(arr)
15614  * if base is NULL:
15615  */
15616 
15617  /* function exit code */
15618  __pyx_L0:;
15619  __Pyx_XGIVEREF(__pyx_r);
15620  __Pyx_RefNannyFinishContext();
15621  return __pyx_r;
15622 }
15623 
15624 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
15625  * # Versions of the import_* functions which are more suitable for
15626  * # Cython code.
15627  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
15628  * try:
15629  * __pyx_import_array()
15630  */
15631 
15632 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
15633  int __pyx_r;
15634  __Pyx_RefNannyDeclarations
15635  PyObject *__pyx_t_1 = NULL;
15636  PyObject *__pyx_t_2 = NULL;
15637  PyObject *__pyx_t_3 = NULL;
15638  int __pyx_t_4;
15639  PyObject *__pyx_t_5 = NULL;
15640  PyObject *__pyx_t_6 = NULL;
15641  PyObject *__pyx_t_7 = NULL;
15642  PyObject *__pyx_t_8 = NULL;
15643  int __pyx_lineno = 0;
15644  const char *__pyx_filename = NULL;
15645  int __pyx_clineno = 0;
15646  __Pyx_RefNannySetupContext("import_array", 0);
15647 
15648  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
15649  * # Cython code.
15650  * cdef inline int import_array() except -1:
15651  * try: # <<<<<<<<<<<<<<
15652  * __pyx_import_array()
15653  * except Exception:
15654  */
15655  {
15656  __Pyx_PyThreadState_declare
15657  __Pyx_PyThreadState_assign
15658  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
15659  __Pyx_XGOTREF(__pyx_t_1);
15660  __Pyx_XGOTREF(__pyx_t_2);
15661  __Pyx_XGOTREF(__pyx_t_3);
15662  /*try:*/ {
15663 
15664  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":943
15665  * cdef inline int import_array() except -1:
15666  * try:
15667  * __pyx_import_array() # <<<<<<<<<<<<<<
15668  * except Exception:
15669  * raise ImportError("numpy.core.multiarray failed to import")
15670  */
15671  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
15672 
15673  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
15674  * # Cython code.
15675  * cdef inline int import_array() except -1:
15676  * try: # <<<<<<<<<<<<<<
15677  * __pyx_import_array()
15678  * except Exception:
15679  */
15680  }
15681  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15682  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15683  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15684  goto __pyx_L8_try_end;
15685  __pyx_L3_error:;
15686 
15687  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":944
15688  * try:
15689  * __pyx_import_array()
15690  * except Exception: # <<<<<<<<<<<<<<
15691  * raise ImportError("numpy.core.multiarray failed to import")
15692  *
15693  */
15694  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
15695  if (__pyx_t_4) {
15696  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
15697  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
15698  __Pyx_GOTREF(__pyx_t_5);
15699  __Pyx_GOTREF(__pyx_t_6);
15700  __Pyx_GOTREF(__pyx_t_7);
15701 
15702  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
15703  * __pyx_import_array()
15704  * except Exception:
15705  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
15706  *
15707  * cdef inline int import_umath() except -1:
15708  */
15709  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
15710  __Pyx_GOTREF(__pyx_t_8);
15711  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
15712  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
15713  __PYX_ERR(1, 945, __pyx_L5_except_error)
15714  }
15715  goto __pyx_L5_except_error;
15716  __pyx_L5_except_error:;
15717 
15718  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
15719  * # Cython code.
15720  * cdef inline int import_array() except -1:
15721  * try: # <<<<<<<<<<<<<<
15722  * __pyx_import_array()
15723  * except Exception:
15724  */
15725  __Pyx_XGIVEREF(__pyx_t_1);
15726  __Pyx_XGIVEREF(__pyx_t_2);
15727  __Pyx_XGIVEREF(__pyx_t_3);
15728  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
15729  goto __pyx_L1_error;
15730  __pyx_L8_try_end:;
15731  }
15732 
15733  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
15734  * # Versions of the import_* functions which are more suitable for
15735  * # Cython code.
15736  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
15737  * try:
15738  * __pyx_import_array()
15739  */
15740 
15741  /* function exit code */
15742  __pyx_r = 0;
15743  goto __pyx_L0;
15744  __pyx_L1_error:;
15745  __Pyx_XDECREF(__pyx_t_5);
15746  __Pyx_XDECREF(__pyx_t_6);
15747  __Pyx_XDECREF(__pyx_t_7);
15748  __Pyx_XDECREF(__pyx_t_8);
15749  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
15750  __pyx_r = -1;
15751  __pyx_L0:;
15752  __Pyx_RefNannyFinishContext();
15753  return __pyx_r;
15754 }
15755 
15756 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
15757  * raise ImportError("numpy.core.multiarray failed to import")
15758  *
15759  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
15760  * try:
15761  * _import_umath()
15762  */
15763 
15764 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
15765  int __pyx_r;
15766  __Pyx_RefNannyDeclarations
15767  PyObject *__pyx_t_1 = NULL;
15768  PyObject *__pyx_t_2 = NULL;
15769  PyObject *__pyx_t_3 = NULL;
15770  int __pyx_t_4;
15771  PyObject *__pyx_t_5 = NULL;
15772  PyObject *__pyx_t_6 = NULL;
15773  PyObject *__pyx_t_7 = NULL;
15774  PyObject *__pyx_t_8 = NULL;
15775  int __pyx_lineno = 0;
15776  const char *__pyx_filename = NULL;
15777  int __pyx_clineno = 0;
15778  __Pyx_RefNannySetupContext("import_umath", 0);
15779 
15780  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
15781  *
15782  * cdef inline int import_umath() except -1:
15783  * try: # <<<<<<<<<<<<<<
15784  * _import_umath()
15785  * except Exception:
15786  */
15787  {
15788  __Pyx_PyThreadState_declare
15789  __Pyx_PyThreadState_assign
15790  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
15791  __Pyx_XGOTREF(__pyx_t_1);
15792  __Pyx_XGOTREF(__pyx_t_2);
15793  __Pyx_XGOTREF(__pyx_t_3);
15794  /*try:*/ {
15795 
15796  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":949
15797  * cdef inline int import_umath() except -1:
15798  * try:
15799  * _import_umath() # <<<<<<<<<<<<<<
15800  * except Exception:
15801  * raise ImportError("numpy.core.umath failed to import")
15802  */
15803  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
15804 
15805  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
15806  *
15807  * cdef inline int import_umath() except -1:
15808  * try: # <<<<<<<<<<<<<<
15809  * _import_umath()
15810  * except Exception:
15811  */
15812  }
15813  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15814  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15815  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15816  goto __pyx_L8_try_end;
15817  __pyx_L3_error:;
15818 
15819  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":950
15820  * try:
15821  * _import_umath()
15822  * except Exception: # <<<<<<<<<<<<<<
15823  * raise ImportError("numpy.core.umath failed to import")
15824  *
15825  */
15826  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
15827  if (__pyx_t_4) {
15828  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
15829  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
15830  __Pyx_GOTREF(__pyx_t_5);
15831  __Pyx_GOTREF(__pyx_t_6);
15832  __Pyx_GOTREF(__pyx_t_7);
15833 
15834  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
15835  * _import_umath()
15836  * except Exception:
15837  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
15838  *
15839  * cdef inline int import_ufunc() except -1:
15840  */
15841  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
15842  __Pyx_GOTREF(__pyx_t_8);
15843  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
15844  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
15845  __PYX_ERR(1, 951, __pyx_L5_except_error)
15846  }
15847  goto __pyx_L5_except_error;
15848  __pyx_L5_except_error:;
15849 
15850  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
15851  *
15852  * cdef inline int import_umath() except -1:
15853  * try: # <<<<<<<<<<<<<<
15854  * _import_umath()
15855  * except Exception:
15856  */
15857  __Pyx_XGIVEREF(__pyx_t_1);
15858  __Pyx_XGIVEREF(__pyx_t_2);
15859  __Pyx_XGIVEREF(__pyx_t_3);
15860  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
15861  goto __pyx_L1_error;
15862  __pyx_L8_try_end:;
15863  }
15864 
15865  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
15866  * raise ImportError("numpy.core.multiarray failed to import")
15867  *
15868  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
15869  * try:
15870  * _import_umath()
15871  */
15872 
15873  /* function exit code */
15874  __pyx_r = 0;
15875  goto __pyx_L0;
15876  __pyx_L1_error:;
15877  __Pyx_XDECREF(__pyx_t_5);
15878  __Pyx_XDECREF(__pyx_t_6);
15879  __Pyx_XDECREF(__pyx_t_7);
15880  __Pyx_XDECREF(__pyx_t_8);
15881  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
15882  __pyx_r = -1;
15883  __pyx_L0:;
15884  __Pyx_RefNannyFinishContext();
15885  return __pyx_r;
15886 }
15887 
15888 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
15889  * raise ImportError("numpy.core.umath failed to import")
15890  *
15891  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
15892  * try:
15893  * _import_umath()
15894  */
15895 
15896 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
15897  int __pyx_r;
15898  __Pyx_RefNannyDeclarations
15899  PyObject *__pyx_t_1 = NULL;
15900  PyObject *__pyx_t_2 = NULL;
15901  PyObject *__pyx_t_3 = NULL;
15902  int __pyx_t_4;
15903  PyObject *__pyx_t_5 = NULL;
15904  PyObject *__pyx_t_6 = NULL;
15905  PyObject *__pyx_t_7 = NULL;
15906  PyObject *__pyx_t_8 = NULL;
15907  int __pyx_lineno = 0;
15908  const char *__pyx_filename = NULL;
15909  int __pyx_clineno = 0;
15910  __Pyx_RefNannySetupContext("import_ufunc", 0);
15911 
15912  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
15913  *
15914  * cdef inline int import_ufunc() except -1:
15915  * try: # <<<<<<<<<<<<<<
15916  * _import_umath()
15917  * except Exception:
15918  */
15919  {
15920  __Pyx_PyThreadState_declare
15921  __Pyx_PyThreadState_assign
15922  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
15923  __Pyx_XGOTREF(__pyx_t_1);
15924  __Pyx_XGOTREF(__pyx_t_2);
15925  __Pyx_XGOTREF(__pyx_t_3);
15926  /*try:*/ {
15927 
15928  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":955
15929  * cdef inline int import_ufunc() except -1:
15930  * try:
15931  * _import_umath() # <<<<<<<<<<<<<<
15932  * except Exception:
15933  * raise ImportError("numpy.core.umath failed to import")
15934  */
15935  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
15936 
15937  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
15938  *
15939  * cdef inline int import_ufunc() except -1:
15940  * try: # <<<<<<<<<<<<<<
15941  * _import_umath()
15942  * except Exception:
15943  */
15944  }
15945  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
15946  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
15947  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15948  goto __pyx_L8_try_end;
15949  __pyx_L3_error:;
15950 
15951  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":956
15952  * try:
15953  * _import_umath()
15954  * except Exception: # <<<<<<<<<<<<<<
15955  * raise ImportError("numpy.core.umath failed to import")
15956  *
15957  */
15958  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
15959  if (__pyx_t_4) {
15960  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
15961  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
15962  __Pyx_GOTREF(__pyx_t_5);
15963  __Pyx_GOTREF(__pyx_t_6);
15964  __Pyx_GOTREF(__pyx_t_7);
15965 
15966  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":957
15967  * _import_umath()
15968  * except Exception:
15969  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
15970  *
15971  * cdef extern from *:
15972  */
15973  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
15974  __Pyx_GOTREF(__pyx_t_8);
15975  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
15976  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
15977  __PYX_ERR(1, 957, __pyx_L5_except_error)
15978  }
15979  goto __pyx_L5_except_error;
15980  __pyx_L5_except_error:;
15981 
15982  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
15983  *
15984  * cdef inline int import_ufunc() except -1:
15985  * try: # <<<<<<<<<<<<<<
15986  * _import_umath()
15987  * except Exception:
15988  */
15989  __Pyx_XGIVEREF(__pyx_t_1);
15990  __Pyx_XGIVEREF(__pyx_t_2);
15991  __Pyx_XGIVEREF(__pyx_t_3);
15992  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
15993  goto __pyx_L1_error;
15994  __pyx_L8_try_end:;
15995  }
15996 
15997  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
15998  * raise ImportError("numpy.core.umath failed to import")
15999  *
16000  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
16001  * try:
16002  * _import_umath()
16003  */
16004 
16005  /* function exit code */
16006  __pyx_r = 0;
16007  goto __pyx_L0;
16008  __pyx_L1_error:;
16009  __Pyx_XDECREF(__pyx_t_5);
16010  __Pyx_XDECREF(__pyx_t_6);
16011  __Pyx_XDECREF(__pyx_t_7);
16012  __Pyx_XDECREF(__pyx_t_8);
16013  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
16014  __pyx_r = -1;
16015  __pyx_L0:;
16016  __Pyx_RefNannyFinishContext();
16017  return __pyx_r;
16018 }
16019 
16020 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
16021  *
16022  *
16023  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
16024  * """
16025  * Cython equivalent of `isinstance(obj, np.timedelta64)`
16026  */
16027 
16028 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
16029  int __pyx_r;
16030  __Pyx_RefNannyDeclarations
16031  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
16032 
16033  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":979
16034  * bool
16035  * """
16036  * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
16037  *
16038  *
16039  */
16040  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
16041  goto __pyx_L0;
16042 
16043  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
16044  *
16045  *
16046  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
16047  * """
16048  * Cython equivalent of `isinstance(obj, np.timedelta64)`
16049  */
16050 
16051  /* function exit code */
16052  __pyx_L0:;
16053  __Pyx_RefNannyFinishContext();
16054  return __pyx_r;
16055 }
16056 
16057 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
16058  *
16059  *
16060  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
16061  * """
16062  * Cython equivalent of `isinstance(obj, np.datetime64)`
16063  */
16064 
16065 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
16066  int __pyx_r;
16067  __Pyx_RefNannyDeclarations
16068  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
16069 
16070  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":994
16071  * bool
16072  * """
16073  * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
16074  *
16075  *
16076  */
16077  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
16078  goto __pyx_L0;
16079 
16080  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
16081  *
16082  *
16083  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
16084  * """
16085  * Cython equivalent of `isinstance(obj, np.datetime64)`
16086  */
16087 
16088  /* function exit code */
16089  __pyx_L0:;
16090  __Pyx_RefNannyFinishContext();
16091  return __pyx_r;
16092 }
16093 
16094 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
16095  *
16096  *
16097  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
16098  * """
16099  * returns the int64 value underlying scalar numpy datetime64 object
16100  */
16101 
16102 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
16103  npy_datetime __pyx_r;
16104 
16105  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1004
16106  * also needed. That can be found using `get_datetime64_unit`.
16107  * """
16108  * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
16109  *
16110  *
16111  */
16112  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
16113  goto __pyx_L0;
16114 
16115  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
16116  *
16117  *
16118  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
16119  * """
16120  * returns the int64 value underlying scalar numpy datetime64 object
16121  */
16122 
16123  /* function exit code */
16124  __pyx_L0:;
16125  return __pyx_r;
16126 }
16127 
16128 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
16129  *
16130  *
16131  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
16132  * """
16133  * returns the int64 value underlying scalar numpy timedelta64 object
16134  */
16135 
16136 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
16137  npy_timedelta __pyx_r;
16138 
16139  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1011
16140  * returns the int64 value underlying scalar numpy timedelta64 object
16141  * """
16142  * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
16143  *
16144  *
16145  */
16146  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
16147  goto __pyx_L0;
16148 
16149  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
16150  *
16151  *
16152  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
16153  * """
16154  * returns the int64 value underlying scalar numpy timedelta64 object
16155  */
16156 
16157  /* function exit code */
16158  __pyx_L0:;
16159  return __pyx_r;
16160 }
16161 
16162 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
16163  *
16164  *
16165  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
16166  * """
16167  * returns the unit part of the dtype for a numpy datetime64 object.
16168  */
16169 
16170 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
16171  NPY_DATETIMEUNIT __pyx_r;
16172 
16173  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1018
16174  * returns the unit part of the dtype for a numpy datetime64 object.
16175  * """
16176  * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
16177  */
16178  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
16179  goto __pyx_L0;
16180 
16181  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
16182  *
16183  *
16184  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
16185  * """
16186  * returns the unit part of the dtype for a numpy datetime64 object.
16187  */
16188 
16189  /* function exit code */
16190  __pyx_L0:;
16191  return __pyx_r;
16192 }
16193 
16194 static struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *__pyx_freelist_10Isosurface___pyx_scope_struct__attachModel[8];
16195 static int __pyx_freecount_10Isosurface___pyx_scope_struct__attachModel = 0;
16196 
16197 static PyObject *__pyx_tp_new_10Isosurface___pyx_scope_struct__attachModel(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
16198  PyObject *o;
16199  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10Isosurface___pyx_scope_struct__attachModel > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel)))) {
16200  o = (PyObject*)__pyx_freelist_10Isosurface___pyx_scope_struct__attachModel[--__pyx_freecount_10Isosurface___pyx_scope_struct__attachModel];
16201  memset(o, 0, sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel));
16202  (void) PyObject_INIT(o, t);
16203  PyObject_GC_Track(o);
16204  } else {
16205  o = (*t->tp_alloc)(t, 0);
16206  if (unlikely(!o)) return 0;
16207  }
16208  return o;
16209 }
16210 
16211 static void __pyx_tp_dealloc_10Isosurface___pyx_scope_struct__attachModel(PyObject *o) {
16212  struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *p = (struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *)o;
16213  PyObject_GC_UnTrack(o);
16214  Py_CLEAR(p->__pyx_v_self);
16215  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10Isosurface___pyx_scope_struct__attachModel < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel)))) {
16216  __pyx_freelist_10Isosurface___pyx_scope_struct__attachModel[__pyx_freecount_10Isosurface___pyx_scope_struct__attachModel++] = ((struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *)o);
16217  } else {
16218  (*Py_TYPE(o)->tp_free)(o);
16219  }
16220 }
16221 
16222 static int __pyx_tp_traverse_10Isosurface___pyx_scope_struct__attachModel(PyObject *o, visitproc v, void *a) {
16223  int e;
16224  struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *p = (struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *)o;
16225  if (p->__pyx_v_self) {
16226  e = (*v)(p->__pyx_v_self, a); if (e) return e;
16227  }
16228  return 0;
16229 }
16230 
16231 static int __pyx_tp_clear_10Isosurface___pyx_scope_struct__attachModel(PyObject *o) {
16232  PyObject* tmp;
16233  struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *p = (struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel *)o;
16234  tmp = ((PyObject*)p->__pyx_v_self);
16235  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
16236  Py_XDECREF(tmp);
16237  return 0;
16238 }
16239 
16240 static PyTypeObject __pyx_type_10Isosurface___pyx_scope_struct__attachModel = {
16241  PyVarObject_HEAD_INIT(0, 0)
16242  "Isosurface.__pyx_scope_struct__attachModel", /*tp_name*/
16243  sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct__attachModel), /*tp_basicsize*/
16244  0, /*tp_itemsize*/
16245  __pyx_tp_dealloc_10Isosurface___pyx_scope_struct__attachModel, /*tp_dealloc*/
16246  #if PY_VERSION_HEX < 0x030800b4
16247  0, /*tp_print*/
16248  #endif
16249  #if PY_VERSION_HEX >= 0x030800b4
16250  0, /*tp_vectorcall_offset*/
16251  #endif
16252  0, /*tp_getattr*/
16253  0, /*tp_setattr*/
16254  #if PY_MAJOR_VERSION < 3
16255  0, /*tp_compare*/
16256  #endif
16257  #if PY_MAJOR_VERSION >= 3
16258  0, /*tp_as_async*/
16259  #endif
16260  0, /*tp_repr*/
16261  0, /*tp_as_number*/
16262  0, /*tp_as_sequence*/
16263  0, /*tp_as_mapping*/
16264  0, /*tp_hash*/
16265  0, /*tp_call*/
16266  0, /*tp_str*/
16267  0, /*tp_getattro*/
16268  0, /*tp_setattro*/
16269  0, /*tp_as_buffer*/
16270  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16271  0, /*tp_doc*/
16272  __pyx_tp_traverse_10Isosurface___pyx_scope_struct__attachModel, /*tp_traverse*/
16273  __pyx_tp_clear_10Isosurface___pyx_scope_struct__attachModel, /*tp_clear*/
16274  0, /*tp_richcompare*/
16275  0, /*tp_weaklistoffset*/
16276  0, /*tp_iter*/
16277  0, /*tp_iternext*/
16278  0, /*tp_methods*/
16279  0, /*tp_members*/
16280  0, /*tp_getset*/
16281  0, /*tp_base*/
16282  0, /*tp_dict*/
16283  0, /*tp_descr_get*/
16284  0, /*tp_descr_set*/
16285  0, /*tp_dictoffset*/
16286  0, /*tp_init*/
16287  0, /*tp_alloc*/
16288  __pyx_tp_new_10Isosurface___pyx_scope_struct__attachModel, /*tp_new*/
16289  0, /*tp_free*/
16290  0, /*tp_is_gc*/
16291  0, /*tp_bases*/
16292  0, /*tp_mro*/
16293  0, /*tp_cache*/
16294  0, /*tp_subclasses*/
16295  0, /*tp_weaklist*/
16296  0, /*tp_del*/
16297  0, /*tp_version_tag*/
16298  #if PY_VERSION_HEX >= 0x030400a1
16299  0, /*tp_finalize*/
16300  #endif
16301  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
16302  0, /*tp_vectorcall*/
16303  #endif
16304  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16305  0, /*tp_print*/
16306  #endif
16307  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
16308  0, /*tp_pypy_flags*/
16309  #endif
16310 };
16311 
16312 static struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *__pyx_freelist_10Isosurface___pyx_scope_struct_1_genexpr[8];
16313 static int __pyx_freecount_10Isosurface___pyx_scope_struct_1_genexpr = 0;
16314 
16315 static PyObject *__pyx_tp_new_10Isosurface___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
16316  PyObject *o;
16317  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10Isosurface___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr)))) {
16318  o = (PyObject*)__pyx_freelist_10Isosurface___pyx_scope_struct_1_genexpr[--__pyx_freecount_10Isosurface___pyx_scope_struct_1_genexpr];
16319  memset(o, 0, sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr));
16320  (void) PyObject_INIT(o, t);
16321  PyObject_GC_Track(o);
16322  } else {
16323  o = (*t->tp_alloc)(t, 0);
16324  if (unlikely(!o)) return 0;
16325  }
16326  return o;
16327 }
16328 
16329 static void __pyx_tp_dealloc_10Isosurface___pyx_scope_struct_1_genexpr(PyObject *o) {
16330  struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *)o;
16331  PyObject_GC_UnTrack(o);
16332  Py_CLEAR(p->__pyx_outer_scope);
16333  Py_CLEAR(p->__pyx_v_bn);
16334  Py_CLEAR(p->__pyx_v_gn);
16335  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10Isosurface___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr)))) {
16336  __pyx_freelist_10Isosurface___pyx_scope_struct_1_genexpr[__pyx_freecount_10Isosurface___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *)o);
16337  } else {
16338  (*Py_TYPE(o)->tp_free)(o);
16339  }
16340 }
16341 
16342 static int __pyx_tp_traverse_10Isosurface___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
16343  int e;
16344  struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr *)o;
16345  if (p->__pyx_outer_scope) {
16346  e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
16347  }
16348  if (p->__pyx_v_bn) {
16349  e = (*v)(p->__pyx_v_bn, a); if (e) return e;
16350  }
16351  if (p->__pyx_v_gn) {
16352  e = (*v)(p->__pyx_v_gn, a); if (e) return e;
16353  }
16354  return 0;
16355 }
16356 
16357 static PyTypeObject __pyx_type_10Isosurface___pyx_scope_struct_1_genexpr = {
16358  PyVarObject_HEAD_INIT(0, 0)
16359  "Isosurface.__pyx_scope_struct_1_genexpr", /*tp_name*/
16360  sizeof(struct __pyx_obj_10Isosurface___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
16361  0, /*tp_itemsize*/
16362  __pyx_tp_dealloc_10Isosurface___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
16363  #if PY_VERSION_HEX < 0x030800b4
16364  0, /*tp_print*/
16365  #endif
16366  #if PY_VERSION_HEX >= 0x030800b4
16367  0, /*tp_vectorcall_offset*/
16368  #endif
16369  0, /*tp_getattr*/
16370  0, /*tp_setattr*/
16371  #if PY_MAJOR_VERSION < 3
16372  0, /*tp_compare*/
16373  #endif
16374  #if PY_MAJOR_VERSION >= 3
16375  0, /*tp_as_async*/
16376  #endif
16377  0, /*tp_repr*/
16378  0, /*tp_as_number*/
16379  0, /*tp_as_sequence*/
16380  0, /*tp_as_mapping*/
16381  0, /*tp_hash*/
16382  0, /*tp_call*/
16383  0, /*tp_str*/
16384  0, /*tp_getattro*/
16385  0, /*tp_setattro*/
16386  0, /*tp_as_buffer*/
16387  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
16388  0, /*tp_doc*/
16389  __pyx_tp_traverse_10Isosurface___pyx_scope_struct_1_genexpr, /*tp_traverse*/
16390  0, /*tp_clear*/
16391  0, /*tp_richcompare*/
16392  0, /*tp_weaklistoffset*/
16393  0, /*tp_iter*/
16394  0, /*tp_iternext*/
16395  0, /*tp_methods*/
16396  0, /*tp_members*/
16397  0, /*tp_getset*/
16398  0, /*tp_base*/
16399  0, /*tp_dict*/
16400  0, /*tp_descr_get*/
16401  0, /*tp_descr_set*/
16402  0, /*tp_dictoffset*/
16403  0, /*tp_init*/
16404  0, /*tp_alloc*/
16405  __pyx_tp_new_10Isosurface___pyx_scope_struct_1_genexpr, /*tp_new*/
16406  0, /*tp_free*/
16407  0, /*tp_is_gc*/
16408  0, /*tp_bases*/
16409  0, /*tp_mro*/
16410  0, /*tp_cache*/
16411  0, /*tp_subclasses*/
16412  0, /*tp_weaklist*/
16413  0, /*tp_del*/
16414  0, /*tp_version_tag*/
16415  #if PY_VERSION_HEX >= 0x030400a1
16416  0, /*tp_finalize*/
16417  #endif
16418  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
16419  0, /*tp_vectorcall*/
16420  #endif
16421  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
16422  0, /*tp_print*/
16423  #endif
16424  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
16425  0, /*tp_pypy_flags*/
16426  #endif
16427 };
16428 
16429 static PyMethodDef __pyx_methods[] = {
16430  {0, 0, 0, 0}
16431 };
16432 
16433 #if PY_MAJOR_VERSION >= 3
16434 #if CYTHON_PEP489_MULTI_PHASE_INIT
16435 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
16436 static int __pyx_pymod_exec_Isosurface(PyObject* module); /*proto*/
16437 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
16438  {Py_mod_create, (void*)__pyx_pymod_create},
16439  {Py_mod_exec, (void*)__pyx_pymod_exec_Isosurface},
16440  {0, NULL}
16441 };
16442 #endif
16443 
16444 static struct PyModuleDef __pyx_moduledef = {
16445  PyModuleDef_HEAD_INIT,
16446  "Isosurface",
16447  __pyx_k_AuxiliaryVariables_subclasses_f, /* m_doc */
16448  #if CYTHON_PEP489_MULTI_PHASE_INIT
16449  0, /* m_size */
16450  #else
16451  -1, /* m_size */
16452  #endif
16453  __pyx_methods /* m_methods */,
16454  #if CYTHON_PEP489_MULTI_PHASE_INIT
16455  __pyx_moduledef_slots, /* m_slots */
16456  #else
16457  NULL, /* m_reload */
16458  #endif
16459  NULL, /* m_traverse */
16460  NULL, /* m_clear */
16461  NULL /* m_free */
16462 };
16463 #endif
16464 #ifndef CYTHON_SMALL_CODE
16465 #if defined(__clang__)
16466  #define CYTHON_SMALL_CODE
16467 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
16468  #define CYTHON_SMALL_CODE __attribute__((cold))
16469 #else
16470  #define CYTHON_SMALL_CODE
16471 #endif
16472 #endif
16473 
16474 static __Pyx_StringTabEntry __pyx_string_tab[] = {
16475  {&__pyx_kp_s_0_d, __pyx_k_0_d, sizeof(__pyx_k_0_d), 0, 0, 1, 0},
16476  {&__pyx_kp_s_0_d_1_d_2_d, __pyx_k_0_d_1_d_2_d, sizeof(__pyx_k_0_d_1_d_2_d), 0, 0, 1, 0},
16477  {&__pyx_kp_s_0_d_1_d_2_d_2, __pyx_k_0_d_1_d_2_d_2, sizeof(__pyx_k_0_d_1_d_2_d_2), 0, 0, 1, 0},
16478  {&__pyx_kp_s_0_f_1_f_2_f, __pyx_k_0_f_1_f_2_f, sizeof(__pyx_k_0_f_1_f_2_f), 0, 0, 1, 0},
16479  {&__pyx_kp_s_ATTACHING_TO_HDF5, __pyx_k_ATTACHING_TO_HDF5, sizeof(__pyx_k_ATTACHING_TO_HDF5), 0, 0, 1, 0},
16480  {&__pyx_n_s_AV_base, __pyx_k_AV_base, sizeof(__pyx_k_AV_base), 0, 0, 1, 1},
16481  {&__pyx_n_s_AuxiliaryVariables, __pyx_k_AuxiliaryVariables, sizeof(__pyx_k_AuxiliaryVariables), 0, 0, 1, 1},
16482  {&__pyx_kp_s_Calculate_called_at_time, __pyx_k_Calculate_called_at_time, sizeof(__pyx_k_Calculate_called_at_time), 0, 0, 1, 0},
16483  {&__pyx_n_s_Comm, __pyx_k_Comm, sizeof(__pyx_k_Comm), 0, 0, 1, 1},
16484  {&__pyx_kp_s_Elements_have_0_d_vertices_but_a, __pyx_k_Elements_have_0_d_vertices_but_a, sizeof(__pyx_k_Elements_have_0_d_vertices_but_a), 0, 0, 1, 0},
16485  {&__pyx_kp_s_Extract_isosurfaces, __pyx_k_Extract_isosurfaces, sizeof(__pyx_k_Extract_isosurfaces), 0, 0, 1, 0},
16486  {&__pyx_n_s_FemField, __pyx_k_FemField, sizeof(__pyx_k_FemField), 0, 0, 1, 1},
16487  {&__pyx_n_s_File, __pyx_k_File, sizeof(__pyx_k_File), 0, 0, 1, 1},
16488  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
16489  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
16490  {&__pyx_n_s_Isosurface, __pyx_k_Isosurface, sizeof(__pyx_k_Isosurface), 0, 0, 1, 1},
16491  {&__pyx_n_s_Isosurface___init, __pyx_k_Isosurface___init, sizeof(__pyx_k_Isosurface___init), 0, 0, 1, 1},
16492  {&__pyx_n_s_Isosurface_attachHDF5, __pyx_k_Isosurface_attachHDF5, sizeof(__pyx_k_Isosurface_attachHDF5), 0, 0, 1, 1},
16493  {&__pyx_n_s_Isosurface_attachModel, __pyx_k_Isosurface_attachModel, sizeof(__pyx_k_Isosurface_attachModel), 0, 0, 1, 1},
16494  {&__pyx_n_s_Isosurface_attachModel_locals_ge, __pyx_k_Isosurface_attachModel_locals_ge, sizeof(__pyx_k_Isosurface_attachModel_locals_ge), 0, 0, 1, 1},
16495  {&__pyx_n_s_Isosurface_calculate, __pyx_k_Isosurface_calculate, sizeof(__pyx_k_Isosurface_calculate), 0, 0, 1, 1},
16496  {&__pyx_kp_s_Isosurface_file_format_not_recog, __pyx_k_Isosurface_file_format_not_recog, sizeof(__pyx_k_Isosurface_file_format_not_recog), 0, 0, 1, 0},
16497  {&__pyx_n_s_Isosurface_triangulateIsosurface, __pyx_k_Isosurface_triangulateIsosurface, sizeof(__pyx_k_Isosurface_triangulateIsosurface), 0, 0, 1, 1},
16498  {&__pyx_n_s_Isosurface_writeIsosurfaceMesh, __pyx_k_Isosurface_writeIsosurfaceMesh, sizeof(__pyx_k_Isosurface_writeIsosurfaceMesh), 0, 0, 1, 1},
16499  {&__pyx_n_s_Isosurface_writeIsosurfaceMesh_h, __pyx_k_Isosurface_writeIsosurfaceMesh_h, sizeof(__pyx_k_Isosurface_writeIsosurfaceMesh_h), 0, 0, 1, 1},
16500  {&__pyx_n_s_Isosurface_writeIsosurfaceMesh_p, __pyx_k_Isosurface_writeIsosurfaceMesh_p, sizeof(__pyx_k_Isosurface_writeIsosurfaceMesh_p), 0, 0, 1, 1},
16501  {&__pyx_n_s_Isosurface_writeSceneHeader, __pyx_k_Isosurface_writeSceneHeader, sizeof(__pyx_k_Isosurface_writeSceneHeader), 0, 0, 1, 1},
16502  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
16503  {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
16504  {&__pyx_n_s_MPI, __pyx_k_MPI, sizeof(__pyx_k_MPI), 0, 0, 1, 1},
16505  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
16506  {&__pyx_kp_s_Only_zero_isocontour_extraction, __pyx_k_Only_zero_isocontour_extraction, sizeof(__pyx_k_Only_zero_isocontour_extraction), 0, 0, 1, 0},
16507  {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1},
16508  {&__pyx_n_s_PETSc, __pyx_k_PETSc, sizeof(__pyx_k_PETSc), 0, 0, 1, 1},
16509  {&__pyx_n_s_Profiling, __pyx_k_Profiling, sizeof(__pyx_k_Profiling), 0, 0, 1, 1},
16510  {&__pyx_n_s_Template, __pyx_k_Template, sizeof(__pyx_k_Template), 0, 0, 1, 1},
16511  {&__pyx_kp_s_Writing_pov_frame, __pyx_k_Writing_pov_frame, sizeof(__pyx_k_Writing_pov_frame), 0, 0, 1, 0},
16512  {&__pyx_n_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 1},
16513  {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
16514  {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
16515  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
16516  {&__pyx_n_s_activeTime, __pyx_k_activeTime, sizeof(__pyx_k_activeTime), 0, 0, 1, 1},
16517  {&__pyx_n_s_ar, __pyx_k_ar, sizeof(__pyx_k_ar), 0, 0, 1, 1},
16518  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
16519  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
16520  {&__pyx_n_s_attachHDF5, __pyx_k_attachHDF5, sizeof(__pyx_k_attachHDF5), 0, 0, 1, 1},
16521  {&__pyx_n_s_attachModel, __pyx_k_attachModel, sizeof(__pyx_k_attachModel), 0, 0, 1, 1},
16522  {&__pyx_n_s_barrier, __pyx_k_barrier, sizeof(__pyx_k_barrier), 0, 0, 1, 1},
16523  {&__pyx_n_s_beginSequential, __pyx_k_beginSequential, sizeof(__pyx_k_beginSequential), 0, 0, 1, 1},
16524  {&__pyx_n_s_bnt, __pyx_k_bnt, sizeof(__pyx_k_bnt), 0, 0, 1, 1},
16525  {&__pyx_n_s_boundaryNodes, __pyx_k_boundaryNodes, sizeof(__pyx_k_boundaryNodes), 0, 0, 1, 1},
16526  {&__pyx_n_s_calculate, __pyx_k_calculate, sizeof(__pyx_k_calculate), 0, 0, 1, 1},
16527  {&__pyx_n_s_cam, __pyx_k_cam, sizeof(__pyx_k_cam), 0, 0, 1, 1},
16528  {&__pyx_n_s_cam_x, __pyx_k_cam_x, sizeof(__pyx_k_cam_x), 0, 0, 1, 1},
16529  {&__pyx_n_s_cam_y, __pyx_k_cam_y, sizeof(__pyx_k_cam_y), 0, 0, 1, 1},
16530  {&__pyx_n_s_cam_z, __pyx_k_cam_z, sizeof(__pyx_k_cam_z), 0, 0, 1, 1},
16531  {&__pyx_n_s_checkTime, __pyx_k_checkTime, sizeof(__pyx_k_checkTime), 0, 0, 1, 1},
16532  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
16533  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
16534  {&__pyx_n_s_coefficients, __pyx_k_coefficients, sizeof(__pyx_k_coefficients), 0, 0, 1, 1},
16535  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
16536  {&__pyx_n_s_comm, __pyx_k_comm, sizeof(__pyx_k_comm), 0, 0, 1, 1},
16537  {&__pyx_n_s_count_nonzero, __pyx_k_count_nonzero, sizeof(__pyx_k_count_nonzero), 0, 0, 1, 1},
16538  {&__pyx_n_s_create_dataset, __pyx_k_create_dataset, sizeof(__pyx_k_create_dataset), 0, 0, 1, 1},
16539  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
16540  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
16541  {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
16542  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
16543  {&__pyx_n_s_dof, __pyx_k_dof, sizeof(__pyx_k_dof), 0, 0, 1, 1},
16544  {&__pyx_n_s_domain, __pyx_k_domain, sizeof(__pyx_k_domain), 0, 0, 1, 1},
16545  {&__pyx_n_s_domain_fur_x, __pyx_k_domain_fur_x, sizeof(__pyx_k_domain_fur_x), 0, 0, 1, 1},
16546  {&__pyx_n_s_domain_fur_y, __pyx_k_domain_fur_y, sizeof(__pyx_k_domain_fur_y), 0, 0, 1, 1},
16547  {&__pyx_n_s_domain_fur_z, __pyx_k_domain_fur_z, sizeof(__pyx_k_domain_fur_z), 0, 0, 1, 1},
16548  {&__pyx_n_s_domain_nll_x, __pyx_k_domain_nll_x, sizeof(__pyx_k_domain_nll_x), 0, 0, 1, 1},
16549  {&__pyx_n_s_domain_nll_y, __pyx_k_domain_nll_y, sizeof(__pyx_k_domain_nll_y), 0, 0, 1, 1},
16550  {&__pyx_n_s_domain_nll_z, __pyx_k_domain_nll_z, sizeof(__pyx_k_domain_nll_z), 0, 0, 1, 1},
16551  {&__pyx_n_s_dset, __pyx_k_dset, sizeof(__pyx_k_dset), 0, 0, 1, 1},
16552  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
16553  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
16554  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
16555  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
16556  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
16557  {&__pyx_n_s_elementBoundaryNodesArray, __pyx_k_elementBoundaryNodesArray, sizeof(__pyx_k_elementBoundaryNodesArray), 0, 0, 1, 1},
16558  {&__pyx_n_s_elementNodesArray, __pyx_k_elementNodesArray, sizeof(__pyx_k_elementNodesArray), 0, 0, 1, 1},
16559  {&__pyx_n_s_elements, __pyx_k_elements, sizeof(__pyx_k_elements), 0, 0, 1, 1},
16560  {&__pyx_kp_s_elementsSpatial_Domain, __pyx_k_elementsSpatial_Domain, sizeof(__pyx_k_elementsSpatial_Domain), 0, 0, 1, 0},
16561  {&__pyx_n_s_elems, __pyx_k_elems, sizeof(__pyx_k_elems), 0, 0, 1, 1},
16562  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
16563  {&__pyx_n_s_endSequential, __pyx_k_endSequential, sizeof(__pyx_k_endSequential), 0, 0, 1, 1},
16564  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
16565  {&__pyx_n_s_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 0, 0, 1, 1},
16566  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
16567  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
16568  {&__pyx_kp_s_face_indices, __pyx_k_face_indices, sizeof(__pyx_k_face_indices), 0, 0, 1, 0},
16569  {&__pyx_kp_s_face_indices_2, __pyx_k_face_indices_2, sizeof(__pyx_k_face_indices_2), 0, 0, 1, 0},
16570  {&__pyx_n_s_field, __pyx_k_field, sizeof(__pyx_k_field), 0, 0, 1, 1},
16571  {&__pyx_n_s_fieldNames, __pyx_k_fieldNames, sizeof(__pyx_k_fieldNames), 0, 0, 1, 1},
16572  {&__pyx_n_s_field_i, __pyx_k_field_i, sizeof(__pyx_k_field_i), 0, 0, 1, 1},
16573  {&__pyx_kp_s_field_s___value_f___frame_04d_p, __pyx_k_field_s___value_f___frame_04d_p, sizeof(__pyx_k_field_s___value_f___frame_04d_p), 0, 0, 1, 0},
16574  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
16575  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
16576  {&__pyx_n_s_fileprefix, __pyx_k_fileprefix, sizeof(__pyx_k_fileprefix), 0, 0, 1, 1},
16577  {&__pyx_n_s_fine_grid, __pyx_k_fine_grid, sizeof(__pyx_k_fine_grid), 0, 0, 1, 1},
16578  {&__pyx_n_s_flatten, __pyx_k_flatten, sizeof(__pyx_k_flatten), 0, 0, 1, 1},
16579  {&__pyx_n_s_floor_z, __pyx_k_floor_z, sizeof(__pyx_k_floor_z), 0, 0, 1, 1},
16580  {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
16581  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
16582  {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1},
16583  {&__pyx_n_s_fur, __pyx_k_fur, sizeof(__pyx_k_fur), 0, 0, 1, 1},
16584  {&__pyx_n_s_fur_x, __pyx_k_fur_x, sizeof(__pyx_k_fur_x), 0, 0, 1, 1},
16585  {&__pyx_n_s_fur_y, __pyx_k_fur_y, sizeof(__pyx_k_fur_y), 0, 0, 1, 1},
16586  {&__pyx_n_s_fur_z, __pyx_k_fur_z, sizeof(__pyx_k_fur_z), 0, 0, 1, 1},
16587  {&__pyx_n_s_g2b, __pyx_k_g2b, sizeof(__pyx_k_g2b), 0, 0, 1, 1},
16588  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
16589  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
16590  {&__pyx_n_s_get_node, __pyx_k_get_node, sizeof(__pyx_k_get_node), 0, 0, 1, 1},
16591  {&__pyx_n_s_h5, __pyx_k_h5, sizeof(__pyx_k_h5), 0, 0, 1, 1},
16592  {&__pyx_kp_s_h5_2, __pyx_k_h5_2, sizeof(__pyx_k_h5_2), 0, 0, 1, 0},
16593  {&__pyx_n_s_h5py, __pyx_k_h5py, sizeof(__pyx_k_h5py), 0, 0, 1, 1},
16594  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
16595  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
16596  {&__pyx_kp_s_include_colors_inc_include_text, __pyx_k_include_colors_inc_include_text, sizeof(__pyx_k_include_colors_inc_include_text), 0, 0, 1, 0},
16597  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
16598  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
16599  {&__pyx_kp_s_inside_vector_on_mesh, __pyx_k_inside_vector_on_mesh, sizeof(__pyx_k_inside_vector_on_mesh), 0, 0, 1, 0},
16600  {&__pyx_n_s_isMaster, __pyx_k_isMaster, sizeof(__pyx_k_isMaster), 0, 0, 1, 1},
16601  {&__pyx_n_s_isosurface, __pyx_k_isosurface, sizeof(__pyx_k_isosurface), 0, 0, 1, 1},
16602  {&__pyx_n_s_isosurfaces, __pyx_k_isosurfaces, sizeof(__pyx_k_isosurfaces), 0, 0, 1, 1},
16603  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
16604  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
16605  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
16606  {&__pyx_n_s_levelModelList, __pyx_k_levelModelList, sizeof(__pyx_k_levelModelList), 0, 0, 1, 1},
16607  {&__pyx_n_s_light, __pyx_k_light, sizeof(__pyx_k_light), 0, 0, 1, 1},
16608  {&__pyx_n_s_light_dx, __pyx_k_light_dx, sizeof(__pyx_k_light_dx), 0, 0, 1, 1},
16609  {&__pyx_n_s_light_dy, __pyx_k_light_dy, sizeof(__pyx_k_light_dy), 0, 0, 1, 1},
16610  {&__pyx_n_s_light_x, __pyx_k_light_x, sizeof(__pyx_k_light_x), 0, 0, 1, 1},
16611  {&__pyx_n_s_light_y, __pyx_k_light_y, sizeof(__pyx_k_light_y), 0, 0, 1, 1},
16612  {&__pyx_n_s_light_z, __pyx_k_light_z, sizeof(__pyx_k_light_z), 0, 0, 1, 1},
16613  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
16614  {&__pyx_n_s_logDir, __pyx_k_logDir, sizeof(__pyx_k_logDir), 0, 0, 1, 1},
16615  {&__pyx_n_s_logEvent, __pyx_k_logEvent, sizeof(__pyx_k_logEvent), 0, 0, 1, 1},
16616  {&__pyx_n_s_look_at, __pyx_k_look_at, sizeof(__pyx_k_look_at), 0, 0, 1, 1},
16617  {&__pyx_n_s_look_at_x, __pyx_k_look_at_x, sizeof(__pyx_k_look_at_x), 0, 0, 1, 1},
16618  {&__pyx_n_s_look_at_y, __pyx_k_look_at_y, sizeof(__pyx_k_look_at_y), 0, 0, 1, 1},
16619  {&__pyx_n_s_look_at_z, __pyx_k_look_at_z, sizeof(__pyx_k_look_at_z), 0, 0, 1, 1},
16620  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
16621  {&__pyx_kp_s_matrix_1_000000_0_000000_0_0000, __pyx_k_matrix_1_000000_0_000000_0_0000, sizeof(__pyx_k_matrix_1_000000_0_000000_0_0000), 0, 0, 1, 0},
16622  {&__pyx_n_s_mesh, __pyx_k_mesh, sizeof(__pyx_k_mesh), 0, 0, 1, 1},
16623  {&__pyx_kp_s_mesh2_vertex_vectors, __pyx_k_mesh2_vertex_vectors, sizeof(__pyx_k_mesh2_vertex_vectors), 0, 0, 1, 0},
16624  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
16625  {&__pyx_n_s_minus, __pyx_k_minus, sizeof(__pyx_k_minus), 0, 0, 1, 1},
16626  {&__pyx_n_s_model, __pyx_k_model, sizeof(__pyx_k_model), 0, 0, 1, 1},
16627  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
16628  {&__pyx_n_s_mpi4py, __pyx_k_mpi4py, sizeof(__pyx_k_mpi4py), 0, 0, 1, 1},
16629  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
16630  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
16631  {&__pyx_n_s_nFrames, __pyx_k_nFrames, sizeof(__pyx_k_nFrames), 0, 0, 1, 1},
16632  {&__pyx_n_s_nMinus, __pyx_k_nMinus, sizeof(__pyx_k_nMinus), 0, 0, 1, 1},
16633  {&__pyx_n_s_nN_start, __pyx_k_nN_start, sizeof(__pyx_k_nN_start), 0, 0, 1, 1},
16634  {&__pyx_n_s_nPlus, __pyx_k_nPlus, sizeof(__pyx_k_nPlus), 0, 0, 1, 1},
16635  {&__pyx_n_s_nZeros, __pyx_k_nZeros, sizeof(__pyx_k_nZeros), 0, 0, 1, 1},
16636  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
16637  {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
16638  {&__pyx_n_s_next_output, __pyx_k_next_output, sizeof(__pyx_k_next_output), 0, 0, 1, 1},
16639  {&__pyx_n_s_ni, __pyx_k_ni, sizeof(__pyx_k_ni), 0, 0, 1, 1},
16640  {&__pyx_n_s_nll, __pyx_k_nll, sizeof(__pyx_k_nll), 0, 0, 1, 1},
16641  {&__pyx_n_s_nll_x, __pyx_k_nll_x, sizeof(__pyx_k_nll_x), 0, 0, 1, 1},
16642  {&__pyx_n_s_nll_y, __pyx_k_nll_y, sizeof(__pyx_k_nll_y), 0, 0, 1, 1},
16643  {&__pyx_n_s_nll_z, __pyx_k_nll_z, sizeof(__pyx_k_nll_z), 0, 0, 1, 1},
16644  {&__pyx_n_s_nodeArray, __pyx_k_nodeArray, sizeof(__pyx_k_nodeArray), 0, 0, 1, 1},
16645  {&__pyx_n_s_nodes, __pyx_k_nodes, sizeof(__pyx_k_nodes), 0, 0, 1, 1},
16646  {&__pyx_kp_s_nodesSpatial_Domain, __pyx_k_nodesSpatial_Domain, sizeof(__pyx_k_nodesSpatial_Domain), 0, 0, 1, 0},
16647  {&__pyx_n_s_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 0, 0, 1, 1},
16648  {&__pyx_n_s_normal, __pyx_k_normal, sizeof(__pyx_k_normal), 0, 0, 1, 1},
16649  {&__pyx_n_s_normal_indices, __pyx_k_normal_indices, sizeof(__pyx_k_normal_indices), 0, 0, 1, 1},
16650  {&__pyx_kp_s_normal_indices_2, __pyx_k_normal_indices_2, sizeof(__pyx_k_normal_indices_2), 0, 0, 1, 0},
16651  {&__pyx_kp_s_normal_vectors, __pyx_k_normal_vectors, sizeof(__pyx_k_normal_vectors), 0, 0, 1, 0},
16652  {&__pyx_n_s_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 0, 1, 1},
16653  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
16654  {&__pyx_n_s_num_owned_elements, __pyx_k_num_owned_elements, sizeof(__pyx_k_num_owned_elements), 0, 0, 1, 1},
16655  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
16656  {&__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},
16657  {&__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},
16658  {&__pyx_n_s_numpy_linalg, __pyx_k_numpy_linalg, sizeof(__pyx_k_numpy_linalg), 0, 0, 1, 1},
16659  {&__pyx_kp_s_object_difference_box_nll_x_nll, __pyx_k_object_difference_box_nll_x_nll, sizeof(__pyx_k_object_difference_box_nll_x_nll), 0, 0, 1, 0},
16660  {&__pyx_kp_s_object_difference_box_nll_x_nll_2, __pyx_k_object_difference_box_nll_x_nll_2, sizeof(__pyx_k_object_difference_box_nll_x_nll_2), 0, 0, 1, 0},
16661  {&__pyx_kp_s_only_implemented_for_0_isosurfac, __pyx_k_only_implemented_for_0_isosurfac, sizeof(__pyx_k_only_implemented_for_0_isosurfac), 0, 0, 1, 0},
16662  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
16663  {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
16664  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
16665  {&__pyx_n_s_petsc4py, __pyx_k_petsc4py, sizeof(__pyx_k_petsc4py), 0, 0, 1, 1},
16666  {&__pyx_n_s_phi, __pyx_k_phi, sizeof(__pyx_k_phi), 0, 0, 1, 1},
16667  {&__pyx_n_s_plus, __pyx_k_plus, sizeof(__pyx_k_plus), 0, 0, 1, 1},
16668  {&__pyx_n_s_pov, __pyx_k_pov, sizeof(__pyx_k_pov), 0, 0, 1, 1},
16669  {&__pyx_n_s_povScene, __pyx_k_povScene, sizeof(__pyx_k_povScene), 0, 0, 1, 1},
16670  {&__pyx_n_s_povSceneTemplate, __pyx_k_povSceneTemplate, sizeof(__pyx_k_povSceneTemplate), 0, 0, 1, 1},
16671  {&__pyx_n_s_pov_filename, __pyx_k_pov_filename, sizeof(__pyx_k_pov_filename), 0, 0, 1, 1},
16672  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
16673  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
16674  {&__pyx_n_s_product, __pyx_k_product, sizeof(__pyx_k_product), 0, 0, 1, 1},
16675  {&__pyx_n_s_proteus, __pyx_k_proteus, sizeof(__pyx_k_proteus), 0, 0, 1, 1},
16676  {&__pyx_kp_s_proteus_Isosurface_pyx, __pyx_k_proteus_Isosurface_pyx, sizeof(__pyx_k_proteus_Isosurface_pyx), 0, 0, 1, 0},
16677  {&__pyx_kp_s_proteus_inc, __pyx_k_proteus_inc, sizeof(__pyx_k_proteus_inc), 0, 0, 1, 0},
16678  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
16679  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
16680  {&__pyx_n_s_rank, __pyx_k_rank, sizeof(__pyx_k_rank), 0, 0, 1, 1},
16681  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
16682  {&__pyx_n_s_sampleRate, __pyx_k_sampleRate, sizeof(__pyx_k_sampleRate), 0, 0, 1, 1},
16683  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
16684  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
16685  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
16686  {&__pyx_n_s_sky_z, __pyx_k_sky_z, sizeof(__pyx_k_sky_z), 0, 0, 1, 1},
16687  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
16688  {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
16689  {&__pyx_n_s_substitute, __pyx_k_substitute, sizeof(__pyx_k_substitute), 0, 0, 1, 1},
16690  {&__pyx_n_s_tLast, __pyx_k_tLast, sizeof(__pyx_k_tLast), 0, 0, 1, 1},
16691  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
16692  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
16693  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
16694  {&__pyx_n_s_timeIntegration, __pyx_k_timeIntegration, sizeof(__pyx_k_timeIntegration), 0, 0, 1, 1},
16695  {&__pyx_n_s_triangulateIsosurface, __pyx_k_triangulateIsosurface, sizeof(__pyx_k_triangulateIsosurface), 0, 0, 1, 1},
16696  {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
16697  {&__pyx_kp_s_union_of_meshes_difference_of_p, __pyx_k_union_of_meshes_difference_of_p, sizeof(__pyx_k_union_of_meshes_difference_of_p), 0, 0, 1, 0},
16698  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
16699  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
16700  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
16701  {&__pyx_n_s_variableNames, __pyx_k_variableNames, sizeof(__pyx_k_variableNames), 0, 0, 1, 1},
16702  {&__pyx_kp_s_version_3_7_include_proteus_inc, __pyx_k_version_3_7_include_proteus_inc, sizeof(__pyx_k_version_3_7_include_proteus_inc), 0, 0, 1, 0},
16703  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
16704  {&__pyx_n_s_wall_y, __pyx_k_wall_y, sizeof(__pyx_k_wall_y), 0, 0, 1, 1},
16705  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
16706  {&__pyx_n_s_writeBoundary, __pyx_k_writeBoundary, sizeof(__pyx_k_writeBoundary), 0, 0, 1, 1},
16707  {&__pyx_n_s_writeIsosurfaceMesh, __pyx_k_writeIsosurfaceMesh, sizeof(__pyx_k_writeIsosurfaceMesh), 0, 0, 1, 1},
16708  {&__pyx_n_s_writeIsosurfaceMesh_h5, __pyx_k_writeIsosurfaceMesh_h5, sizeof(__pyx_k_writeIsosurfaceMesh_h5), 0, 0, 1, 1},
16709  {&__pyx_n_s_writeIsosurfaceMesh_povray, __pyx_k_writeIsosurfaceMesh_povray, sizeof(__pyx_k_writeIsosurfaceMesh_povray), 0, 0, 1, 1},
16710  {&__pyx_n_s_writeSceneHeader, __pyx_k_writeSceneHeader, sizeof(__pyx_k_writeSceneHeader), 0, 0, 1, 1},
16711  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
16712  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
16713  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
16714  {0, 0, 0, 0, 0, 0, 0}
16715 };
16716 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
16717  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 125, __pyx_L1_error)
16718  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 170, __pyx_L1_error)
16719  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 172, __pyx_L1_error)
16720  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 391, __pyx_L1_error)
16721  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 560, __pyx_L1_error)
16722  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
16723  return 0;
16724  __pyx_L1_error:;
16725  return -1;
16726 }
16727 
16728 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
16729  __Pyx_RefNannyDeclarations
16730  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
16731 
16732  /* "Isosurface.pyx":29
16733  *
16734  * cdef np.ndarray[np.float64_t,ndim=1] EVec(double x=0.0, double y=0.0, double z=0.0):
16735  * cdef np.ndarray [np.float64_t, ndim=1] v = np.zeros((3,),'d') # <<<<<<<<<<<<<<
16736  * v[X] = x
16737  * v[Y] = y
16738  */
16739  __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 29, __pyx_L1_error)
16740  __Pyx_GOTREF(__pyx_tuple_);
16741  __Pyx_GIVEREF(__pyx_tuple_);
16742  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_tuple_, __pyx_n_s_d); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 29, __pyx_L1_error)
16743  __Pyx_GOTREF(__pyx_tuple__2);
16744  __Pyx_GIVEREF(__pyx_tuple__2);
16745 
16746  /* "Isosurface.pyx":143
16747  * print("ATTACHING TO HDF5 !!", self.fieldNames)
16748  * self.elementNodesArray = h5.get_node("/elementsSpatial_Domain" +
16749  * repr(step))[:] # <<<<<<<<<<<<<<
16750  * self.nodeArray = h5.get_node("/nodesSpatial_Domain" + repr(step))[:]
16751  * self.num_owned_elements = len(self.elementNodesArray)
16752  */
16753  __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 143, __pyx_L1_error)
16754  __Pyx_GOTREF(__pyx_slice__3);
16755  __Pyx_GIVEREF(__pyx_slice__3);
16756 
16757  /* "Isosurface.pyx":170
16758  * self.normal_indices[(field, value)] = normal_indices = []
16759  * if value != 0.0:
16760  * raise NotImplementedError("Only zero isocontour extraction") # <<<<<<<<<<<<<<
16761  * phi = self.u[self.fieldNames.index(field)].dof
16762  * for eN in range(self.num_owned_elements):
16763  */
16764  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Only_zero_isocontour_extraction); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 170, __pyx_L1_error)
16765  __Pyx_GOTREF(__pyx_tuple__5);
16766  __Pyx_GIVEREF(__pyx_tuple__5);
16767 
16768  /* "Isosurface.pyx":575
16769  * self.domain.L[1] # offset slightly
16770  * sky_z = self.domain.x[2] + 10 * self.domain.L[2]
16771  * pov = open("proteus.inc", "w") # <<<<<<<<<<<<<<
16772  * povSceneTemplate = Template("""#include "colors.inc"
16773  * #include "textures.inc"
16774  */
16775  __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s_proteus_inc, __pyx_n_s_w); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 575, __pyx_L1_error)
16776  __Pyx_GOTREF(__pyx_tuple__7);
16777  __Pyx_GIVEREF(__pyx_tuple__7);
16778 
16779  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
16780  * __pyx_import_array()
16781  * except Exception:
16782  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
16783  *
16784  * cdef inline int import_umath() except -1:
16785  */
16786  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 945, __pyx_L1_error)
16787  __Pyx_GOTREF(__pyx_tuple__8);
16788  __Pyx_GIVEREF(__pyx_tuple__8);
16789 
16790  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
16791  * _import_umath()
16792  * except Exception:
16793  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
16794  *
16795  * cdef inline int import_ufunc() except -1:
16796  */
16797  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 951, __pyx_L1_error)
16798  __Pyx_GOTREF(__pyx_tuple__9);
16799  __Pyx_GIVEREF(__pyx_tuple__9);
16800 
16801  /* "Isosurface.pyx":54
16802  * """Extract isosurfaces"""
16803  *
16804  * def __init__(self, isosurfaces, domain, activeTime=None, # <<<<<<<<<<<<<<
16805  * sampleRate=0, format='pov', writeBoundary=True):
16806  * """Create a set of isosurfaces that will be extracted and serialized
16807  */
16808  __pyx_tuple__11 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_isosurfaces, __pyx_n_s_domain, __pyx_n_s_activeTime, __pyx_n_s_sampleRate, __pyx_n_s_format, __pyx_n_s_writeBoundary, __pyx_n_s_f, __pyx_n_s_values, __pyx_n_s_v); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 54, __pyx_L1_error)
16809  __Pyx_GOTREF(__pyx_tuple__11);
16810  __Pyx_GIVEREF(__pyx_tuple__11);
16811  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 54, __pyx_L1_error)
16812  __pyx_tuple__13 = PyTuple_Pack(4, ((PyObject *)Py_None), ((PyObject *)__pyx_int_0), ((PyObject*)__pyx_n_s_pov), ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 54, __pyx_L1_error)
16813  __Pyx_GOTREF(__pyx_tuple__13);
16814  __Pyx_GIVEREF(__pyx_tuple__13);
16815 
16816  /* "Isosurface.pyx":108
16817  * self.fileprefix = 'isosurface'
16818  *
16819  * def attachModel(self, model, ar): # <<<<<<<<<<<<<<
16820  * """ Attach this isosurface to the given simulation model.
16821  * """
16822  */
16823  __pyx_tuple__14 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_model, __pyx_n_s_ar, __pyx_n_s_fine_grid, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 108, __pyx_L1_error)
16824  __Pyx_GOTREF(__pyx_tuple__14);
16825  __Pyx_GIVEREF(__pyx_tuple__14);
16826  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_attachModel, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 108, __pyx_L1_error)
16827 
16828  /* "Isosurface.pyx":135
16829  * return self
16830  *
16831  * def attachHDF5(self, h5, step, cam=None): # <<<<<<<<<<<<<<
16832  * """
16833  * Attach this isosurface to and HDF5 archive
16834  */
16835  __pyx_tuple__16 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_h5, __pyx_n_s_step, __pyx_n_s_cam, __pyx_n_s_namedtuple, __pyx_n_s_FemField, __pyx_n_s_field_i, __pyx_n_s_field, __pyx_n_s_isosurface); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 135, __pyx_L1_error)
16836  __Pyx_GOTREF(__pyx_tuple__16);
16837  __Pyx_GIVEREF(__pyx_tuple__16);
16838  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_attachHDF5, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 135, __pyx_L1_error)
16839  __pyx_tuple__18 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 135, __pyx_L1_error)
16840  __Pyx_GOTREF(__pyx_tuple__18);
16841  __Pyx_GIVEREF(__pyx_tuple__18);
16842 
16843  /* "Isosurface.pyx":158
16844  * return self
16845  *
16846  * def triangulateIsosurface(self, field, value): # <<<<<<<<<<<<<<
16847  * """
16848  * Build a triangular mesh of the isosurface
16849  */
16850  __pyx_tuple__19 = PyTuple_Pack(24, __pyx_n_s_self, __pyx_n_s_field, __pyx_n_s_value, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_J, __pyx_n_s_I, __pyx_n_s_nMinus, __pyx_n_s_nPlus, __pyx_n_s_nZeros, __pyx_n_s_nN_start, __pyx_n_s_eps, __pyx_n_s_s, __pyx_n_s_x, __pyx_n_s_normal, __pyx_n_s_nodes, __pyx_n_s_elements, __pyx_n_s_normals, __pyx_n_s_normal_indices, __pyx_n_s_phi, __pyx_n_s_plus, __pyx_n_s_minus, __pyx_n_s_zeros, __pyx_n_s_j); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 158, __pyx_L1_error)
16851  __Pyx_GOTREF(__pyx_tuple__19);
16852  __Pyx_GIVEREF(__pyx_tuple__19);
16853  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_triangulateIsosurface, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 158, __pyx_L1_error)
16854 
16855  /* "Isosurface.pyx":348
16856  * normal_indices.append(elements[-1])
16857  *
16858  * def writeIsosurfaceMesh(self, field, value, frame): # <<<<<<<<<<<<<<
16859  * if self.format == 'pov':
16860  * log("Writing pov frame " + repr(frame))
16861  */
16862  __pyx_tuple__21 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_field, __pyx_n_s_value, __pyx_n_s_frame); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 348, __pyx_L1_error)
16863  __Pyx_GOTREF(__pyx_tuple__21);
16864  __Pyx_GIVEREF(__pyx_tuple__21);
16865  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_writeIsosurfaceMesh, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 348, __pyx_L1_error)
16866 
16867  /* "Isosurface.pyx":359
16868  * log("Isosurface file format not recognized")
16869  *
16870  * def writeIsosurfaceMesh_h5(self, field, value, frame): # <<<<<<<<<<<<<<
16871  * import h5py
16872  * nodes = self.nodes[(field, value)]
16873  */
16874  __pyx_tuple__23 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_field, __pyx_n_s_value, __pyx_n_s_frame, __pyx_n_s_h5py, __pyx_n_s_nodes, __pyx_n_s_elements, __pyx_n_s_normals, __pyx_n_s_normal_indices, __pyx_n_s_filename, __pyx_n_s_f, __pyx_n_s_dset); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 359, __pyx_L1_error)
16875  __Pyx_GOTREF(__pyx_tuple__23);
16876  __Pyx_GIVEREF(__pyx_tuple__23);
16877  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_writeIsosurfaceMesh_h5, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 359, __pyx_L1_error)
16878 
16879  /* "Isosurface.pyx":376
16880  * f.close()
16881  *
16882  * def writeIsosurfaceMesh_povray(self, field, value, frame): # <<<<<<<<<<<<<<
16883  * """
16884  * Write the triangular mesh to a povray file
16885  */
16886  __pyx_tuple__25 = PyTuple_Pack(20, __pyx_n_s_self, __pyx_n_s_field, __pyx_n_s_value, __pyx_n_s_frame, __pyx_n_s_Template, __pyx_n_s_nodes, __pyx_n_s_elements, __pyx_n_s_normals, __pyx_n_s_normal_indices, __pyx_n_s_pov_filename, __pyx_n_s_pov, __pyx_n_s_dx, __pyx_n_s_nll, __pyx_n_s_fur, __pyx_n_s_povScene, __pyx_n_s_n, __pyx_n_s_ebN, __pyx_n_s_bnt, __pyx_n_s_e, __pyx_n_s_ni); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 376, __pyx_L1_error)
16887  __Pyx_GOTREF(__pyx_tuple__25);
16888  __Pyx_GIVEREF(__pyx_tuple__25);
16889  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_writeIsosurfaceMesh_povray, 376, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 376, __pyx_L1_error)
16890 
16891  /* "Isosurface.pyx":527
16892  * self.comm.endSequential()
16893  *
16894  * def calculate(self, checkTime=True): # <<<<<<<<<<<<<<
16895  * """Extracts isosourfaces at current time and update open output files
16896  * """
16897  */
16898  __pyx_tuple__27 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_checkTime, __pyx_n_s_Template, __pyx_n_s_time, __pyx_n_s_field, __pyx_n_s_values, __pyx_n_s_v); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 527, __pyx_L1_error)
16899  __Pyx_GOTREF(__pyx_tuple__27);
16900  __Pyx_GIVEREF(__pyx_tuple__27);
16901  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_calculate, 527, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 527, __pyx_L1_error)
16902  __pyx_tuple__29 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 527, __pyx_L1_error)
16903  __Pyx_GOTREF(__pyx_tuple__29);
16904  __Pyx_GIVEREF(__pyx_tuple__29);
16905 
16906  /* "Isosurface.pyx":553
16907  * self.next_output += self.sampleRate
16908  *
16909  * def writeSceneHeader(self, cam = None): # <<<<<<<<<<<<<<
16910  * """
16911  * Write a scene description (can be modified before running povray)
16912  */
16913  __pyx_tuple__30 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_cam, __pyx_n_s_Template, __pyx_n_s_look_at, __pyx_n_s_light, __pyx_n_s_light_dx, __pyx_n_s_light_dy, __pyx_n_s_floor_z, __pyx_n_s_wall_y, __pyx_n_s_sky_z, __pyx_n_s_pov, __pyx_n_s_povSceneTemplate, __pyx_n_s_x, __pyx_n_s_L); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 553, __pyx_L1_error)
16914  __Pyx_GOTREF(__pyx_tuple__30);
16915  __Pyx_GIVEREF(__pyx_tuple__30);
16916  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_Isosurface_pyx, __pyx_n_s_writeSceneHeader, 553, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 553, __pyx_L1_error)
16917  __pyx_tuple__32 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 553, __pyx_L1_error)
16918  __Pyx_GOTREF(__pyx_tuple__32);
16919  __Pyx_GIVEREF(__pyx_tuple__32);
16920  __Pyx_RefNannyFinishContext();
16921  return 0;
16922  __pyx_L1_error:;
16923  __Pyx_RefNannyFinishContext();
16924  return -1;
16925 }
16926 
16927 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
16928  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
16929  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
16930  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
16931  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
16932  __pyx_float_0_01 = PyFloat_FromDouble(0.01); if (unlikely(!__pyx_float_0_01)) __PYX_ERR(0, 1, __pyx_L1_error)
16933  __pyx_float_0_02 = PyFloat_FromDouble(0.02); if (unlikely(!__pyx_float_0_02)) __PYX_ERR(0, 1, __pyx_L1_error)
16934  __pyx_float_0_85 = PyFloat_FromDouble(0.85); if (unlikely(!__pyx_float_0_85)) __PYX_ERR(0, 1, __pyx_L1_error)
16935  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
16936  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
16937  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
16938  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
16939  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
16940  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
16941  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
16942  return 0;
16943  __pyx_L1_error:;
16944  return -1;
16945 }
16946 
16947 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
16948 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
16949 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
16950 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
16951 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
16952 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
16953 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
16954 
16955 static int __Pyx_modinit_global_init_code(void) {
16956  __Pyx_RefNannyDeclarations
16957  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
16958  /*--- Global init code ---*/
16959  __Pyx_RefNannyFinishContext();
16960  return 0;
16961 }
16962 
16963 static int __Pyx_modinit_variable_export_code(void) {
16964  __Pyx_RefNannyDeclarations
16965  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
16966  /*--- Variable export code ---*/
16967  __Pyx_RefNannyFinishContext();
16968  return 0;
16969 }
16970 
16971 static int __Pyx_modinit_function_export_code(void) {
16972  __Pyx_RefNannyDeclarations
16973  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
16974  /*--- Function export code ---*/
16975  __Pyx_RefNannyFinishContext();
16976  return 0;
16977 }
16978 
16979 static int __Pyx_modinit_type_init_code(void) {
16980  __Pyx_RefNannyDeclarations
16981  int __pyx_lineno = 0;
16982  const char *__pyx_filename = NULL;
16983  int __pyx_clineno = 0;
16984  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
16985  /*--- Type init code ---*/
16986  if (PyType_Ready(&__pyx_type_10Isosurface___pyx_scope_struct__attachModel) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
16987  #if PY_VERSION_HEX < 0x030800B1
16988  __pyx_type_10Isosurface___pyx_scope_struct__attachModel.tp_print = 0;
16989  #endif
16990  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10Isosurface___pyx_scope_struct__attachModel.tp_dictoffset && __pyx_type_10Isosurface___pyx_scope_struct__attachModel.tp_getattro == PyObject_GenericGetAttr)) {
16991  __pyx_type_10Isosurface___pyx_scope_struct__attachModel.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
16992  }
16993  __pyx_ptype_10Isosurface___pyx_scope_struct__attachModel = &__pyx_type_10Isosurface___pyx_scope_struct__attachModel;
16994  if (PyType_Ready(&__pyx_type_10Isosurface___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 125, __pyx_L1_error)
16995  #if PY_VERSION_HEX < 0x030800B1
16996  __pyx_type_10Isosurface___pyx_scope_struct_1_genexpr.tp_print = 0;
16997  #endif
16998  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10Isosurface___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_10Isosurface___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
16999  __pyx_type_10Isosurface___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
17000  }
17001  __pyx_ptype_10Isosurface___pyx_scope_struct_1_genexpr = &__pyx_type_10Isosurface___pyx_scope_struct_1_genexpr;
17002  __Pyx_RefNannyFinishContext();
17003  return 0;
17004  __pyx_L1_error:;
17005  __Pyx_RefNannyFinishContext();
17006  return -1;
17007 }
17008 
17009 static int __Pyx_modinit_type_import_code(void) {
17010  __Pyx_RefNannyDeclarations
17011  PyObject *__pyx_t_1 = NULL;
17012  int __pyx_lineno = 0;
17013  const char *__pyx_filename = NULL;
17014  int __pyx_clineno = 0;
17015  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
17016  /*--- Type import code ---*/
17017  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
17018  __Pyx_GOTREF(__pyx_t_1);
17019  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
17020  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
17021  sizeof(PyTypeObject),
17022  #else
17023  sizeof(PyHeapTypeObject),
17024  #endif
17025  __Pyx_ImportType_CheckSize_Warn);
17026  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
17027  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17028  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
17029  __Pyx_GOTREF(__pyx_t_1);
17030  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
17031  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
17032  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
17033  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
17034  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
17035  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
17036  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
17037  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
17038  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17039  if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
17040  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17041  if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
17042  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17043  if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
17044  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17045  if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
17046  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17047  if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
17048  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17049  if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
17050  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17051  if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
17052  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17053  if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
17054  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17055  if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
17056  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
17057  if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
17058  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
17059  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
17060  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17061  __Pyx_RefNannyFinishContext();
17062  return 0;
17063  __pyx_L1_error:;
17064  __Pyx_XDECREF(__pyx_t_1);
17065  __Pyx_RefNannyFinishContext();
17066  return -1;
17067 }
17068 
17069 static int __Pyx_modinit_variable_import_code(void) {
17070  __Pyx_RefNannyDeclarations
17071  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
17072  /*--- Variable import code ---*/
17073  __Pyx_RefNannyFinishContext();
17074  return 0;
17075 }
17076 
17077 static int __Pyx_modinit_function_import_code(void) {
17078  __Pyx_RefNannyDeclarations
17079  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
17080  /*--- Function import code ---*/
17081  __Pyx_RefNannyFinishContext();
17082  return 0;
17083 }
17084 
17085 
17086 #ifndef CYTHON_NO_PYINIT_EXPORT
17087 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
17088 #elif PY_MAJOR_VERSION < 3
17089 #ifdef __cplusplus
17090 #define __Pyx_PyMODINIT_FUNC extern "C" void
17091 #else
17092 #define __Pyx_PyMODINIT_FUNC void
17093 #endif
17094 #else
17095 #ifdef __cplusplus
17096 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
17097 #else
17098 #define __Pyx_PyMODINIT_FUNC PyObject *
17099 #endif
17100 #endif
17101 
17102 
17103 #if PY_MAJOR_VERSION < 3
17104 __Pyx_PyMODINIT_FUNC initIsosurface(void) CYTHON_SMALL_CODE; /*proto*/
17105 __Pyx_PyMODINIT_FUNC initIsosurface(void)
17106 #else
17107 __Pyx_PyMODINIT_FUNC PyInit_Isosurface(void) CYTHON_SMALL_CODE; /*proto*/
17108 __Pyx_PyMODINIT_FUNC PyInit_Isosurface(void)
17109 #if CYTHON_PEP489_MULTI_PHASE_INIT
17110 {
17111  return PyModuleDef_Init(&__pyx_moduledef);
17112 }
17113 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
17114  #if PY_VERSION_HEX >= 0x030700A1
17115  static PY_INT64_T main_interpreter_id = -1;
17116  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
17117  if (main_interpreter_id == -1) {
17118  main_interpreter_id = current_id;
17119  return (unlikely(current_id == -1)) ? -1 : 0;
17120  } else if (unlikely(main_interpreter_id != current_id))
17121  #else
17122  static PyInterpreterState *main_interpreter = NULL;
17123  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
17124  if (!main_interpreter) {
17125  main_interpreter = current_interpreter;
17126  } else if (unlikely(main_interpreter != current_interpreter))
17127  #endif
17128  {
17129  PyErr_SetString(
17130  PyExc_ImportError,
17131  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
17132  return -1;
17133  }
17134  return 0;
17135 }
17136 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) {
17137  PyObject *value = PyObject_GetAttrString(spec, from_name);
17138  int result = 0;
17139  if (likely(value)) {
17140  if (allow_none || value != Py_None) {
17141  result = PyDict_SetItemString(moddict, to_name, value);
17142  }
17143  Py_DECREF(value);
17144  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
17145  PyErr_Clear();
17146  } else {
17147  result = -1;
17148  }
17149  return result;
17150 }
17151 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
17152  PyObject *module = NULL, *moddict, *modname;
17153  if (__Pyx_check_single_interpreter())
17154  return NULL;
17155  if (__pyx_m)
17156  return __Pyx_NewRef(__pyx_m);
17157  modname = PyObject_GetAttrString(spec, "name");
17158  if (unlikely(!modname)) goto bad;
17159  module = PyModule_NewObject(modname);
17160  Py_DECREF(modname);
17161  if (unlikely(!module)) goto bad;
17162  moddict = PyModule_GetDict(module);
17163  if (unlikely(!moddict)) goto bad;
17164  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
17165  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
17166  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
17167  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
17168  return module;
17169 bad:
17170  Py_XDECREF(module);
17171  return NULL;
17172 }
17173 
17174 
17175 static CYTHON_SMALL_CODE int __pyx_pymod_exec_Isosurface(PyObject *__pyx_pyinit_module)
17176 #endif
17177 #endif
17178 {
17179  PyObject *__pyx_t_1 = NULL;
17180  PyObject *__pyx_t_2 = NULL;
17181  PyObject *__pyx_t_3 = NULL;
17182  PyObject *__pyx_t_4 = NULL;
17183  int __pyx_lineno = 0;
17184  const char *__pyx_filename = NULL;
17185  int __pyx_clineno = 0;
17186  __Pyx_RefNannyDeclarations
17187  #if CYTHON_PEP489_MULTI_PHASE_INIT
17188  if (__pyx_m) {
17189  if (__pyx_m == __pyx_pyinit_module) return 0;
17190  PyErr_SetString(PyExc_RuntimeError, "Module 'Isosurface' has already been imported. Re-initialisation is not supported.");
17191  return -1;
17192  }
17193  #elif PY_MAJOR_VERSION >= 3
17194  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
17195  #endif
17196  #if CYTHON_REFNANNY
17197 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
17198 if (!__Pyx_RefNanny) {
17199  PyErr_Clear();
17200  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
17201  if (!__Pyx_RefNanny)
17202  Py_FatalError("failed to import 'refnanny' module");
17203 }
17204 #endif
17205  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_Isosurface(void)", 0);
17206  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17207  #ifdef __Pxy_PyFrame_Initialize_Offsets
17208  __Pxy_PyFrame_Initialize_Offsets();
17209  #endif
17210  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
17211  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
17212  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
17213  #ifdef __Pyx_CyFunction_USED
17214  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17215  #endif
17216  #ifdef __Pyx_FusedFunction_USED
17217  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17218  #endif
17219  #ifdef __Pyx_Coroutine_USED
17220  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17221  #endif
17222  #ifdef __Pyx_Generator_USED
17223  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17224  #endif
17225  #ifdef __Pyx_AsyncGen_USED
17226  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17227  #endif
17228  #ifdef __Pyx_StopAsyncIteration_USED
17229  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17230  #endif
17231  /*--- Library function declarations ---*/
17232  /*--- Threads initialization code ---*/
17233  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
17234  PyEval_InitThreads();
17235  #endif
17236  /*--- Module creation code ---*/
17237  #if CYTHON_PEP489_MULTI_PHASE_INIT
17238  __pyx_m = __pyx_pyinit_module;
17239  Py_INCREF(__pyx_m);
17240  #else
17241  #if PY_MAJOR_VERSION < 3
17242  __pyx_m = Py_InitModule4("Isosurface", __pyx_methods, __pyx_k_AuxiliaryVariables_subclasses_f, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
17243  #else
17244  __pyx_m = PyModule_Create(&__pyx_moduledef);
17245  #endif
17246  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
17247  #endif
17248  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
17249  Py_INCREF(__pyx_d);
17250  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
17251  Py_INCREF(__pyx_b);
17252  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
17253  Py_INCREF(__pyx_cython_runtime);
17254  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
17255  /*--- Initialize various global constants etc. ---*/
17256  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17257  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
17258  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17259  #endif
17260  if (__pyx_module_is_main_Isosurface) {
17261  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17262  }
17263  #if PY_MAJOR_VERSION >= 3
17264  {
17265  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
17266  if (!PyDict_GetItemString(modules, "Isosurface")) {
17267  if (unlikely(PyDict_SetItemString(modules, "Isosurface", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
17268  }
17269  }
17270  #endif
17271  /*--- Builtin init code ---*/
17272  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17273  /*--- Constants init code ---*/
17274  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17275  /*--- Global type/function init code ---*/
17276  (void)__Pyx_modinit_global_init_code();
17277  (void)__Pyx_modinit_variable_export_code();
17278  (void)__Pyx_modinit_function_export_code();
17279  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
17280  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
17281  (void)__Pyx_modinit_variable_import_code();
17282  (void)__Pyx_modinit_function_import_code();
17283  /*--- Execution code ---*/
17284  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
17285  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17286  #endif
17287 
17288  /* "Isosurface.pyx":6
17289  * AuxiliaryVariables subclasses for extracting isosurfaces and contours
17290  * """
17291  * from collections import defaultdict, OrderedDict # <<<<<<<<<<<<<<
17292  * from itertools import product
17293  * import os
17294  */
17295  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
17296  __Pyx_GOTREF(__pyx_t_1);
17297  __Pyx_INCREF(__pyx_n_s_defaultdict);
17298  __Pyx_GIVEREF(__pyx_n_s_defaultdict);
17299  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_defaultdict);
17300  __Pyx_INCREF(__pyx_n_s_OrderedDict);
17301  __Pyx_GIVEREF(__pyx_n_s_OrderedDict);
17302  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_OrderedDict);
17303  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
17304  __Pyx_GOTREF(__pyx_t_2);
17305  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17306  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
17307  __Pyx_GOTREF(__pyx_t_1);
17308  if (PyDict_SetItem(__pyx_d, __pyx_n_s_defaultdict, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
17309  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17310  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
17311  __Pyx_GOTREF(__pyx_t_1);
17312  if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
17313  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17314  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17315 
17316  /* "Isosurface.pyx":7
17317  * """
17318  * from collections import defaultdict, OrderedDict
17319  * from itertools import product # <<<<<<<<<<<<<<
17320  * import os
17321  * #from proteus.EGeometry import etriple, ecross, enorm, edot
17322  */
17323  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
17324  __Pyx_GOTREF(__pyx_t_2);
17325  __Pyx_INCREF(__pyx_n_s_product);
17326  __Pyx_GIVEREF(__pyx_n_s_product);
17327  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_product);
17328  __pyx_t_1 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
17329  __Pyx_GOTREF(__pyx_t_1);
17330  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17331  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_product); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
17332  __Pyx_GOTREF(__pyx_t_2);
17333  if (PyDict_SetItem(__pyx_d, __pyx_n_s_product, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
17334  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17335  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17336 
17337  /* "Isosurface.pyx":8
17338  * from collections import defaultdict, OrderedDict
17339  * from itertools import product
17340  * import os # <<<<<<<<<<<<<<
17341  * #from proteus.EGeometry import etriple, ecross, enorm, edot
17342  *
17343  */
17344  __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
17345  __Pyx_GOTREF(__pyx_t_1);
17346  if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
17347  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17348 
17349  /* "Isosurface.pyx":11
17350  * #from proteus.EGeometry import etriple, ecross, enorm, edot
17351  *
17352  * from mpi4py import MPI # <<<<<<<<<<<<<<
17353  * from petsc4py import PETSc
17354  * import numpy as np
17355  */
17356  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
17357  __Pyx_GOTREF(__pyx_t_1);
17358  __Pyx_INCREF(__pyx_n_s_MPI);
17359  __Pyx_GIVEREF(__pyx_n_s_MPI);
17360  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MPI);
17361  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpi4py, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
17362  __Pyx_GOTREF(__pyx_t_2);
17363  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17364  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
17365  __Pyx_GOTREF(__pyx_t_1);
17366  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MPI, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
17367  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17368  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17369 
17370  /* "Isosurface.pyx":12
17371  *
17372  * from mpi4py import MPI
17373  * from petsc4py import PETSc # <<<<<<<<<<<<<<
17374  * import numpy as np
17375  * cimport numpy as np
17376  */
17377  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
17378  __Pyx_GOTREF(__pyx_t_2);
17379  __Pyx_INCREF(__pyx_n_s_PETSc);
17380  __Pyx_GIVEREF(__pyx_n_s_PETSc);
17381  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PETSc);
17382  __pyx_t_1 = __Pyx_Import(__pyx_n_s_petsc4py, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
17383  __Pyx_GOTREF(__pyx_t_1);
17384  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17385  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_PETSc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
17386  __Pyx_GOTREF(__pyx_t_2);
17387  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PETSc, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
17388  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17389  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17390 
17391  /* "Isosurface.pyx":13
17392  * from mpi4py import MPI
17393  * from petsc4py import PETSc
17394  * import numpy as np # <<<<<<<<<<<<<<
17395  * cimport numpy as np
17396  * from numpy.linalg import norm
17397  */
17398  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
17399  __Pyx_GOTREF(__pyx_t_1);
17400  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
17401  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17402 
17403  /* "Isosurface.pyx":15
17404  * import numpy as np
17405  * cimport numpy as np
17406  * from numpy.linalg import norm # <<<<<<<<<<<<<<
17407  *
17408  * from . import Comm
17409  */
17410  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
17411  __Pyx_GOTREF(__pyx_t_1);
17412  __Pyx_INCREF(__pyx_n_s_norm);
17413  __Pyx_GIVEREF(__pyx_n_s_norm);
17414  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_norm);
17415  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy_linalg, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
17416  __Pyx_GOTREF(__pyx_t_2);
17417  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17418  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_norm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
17419  __Pyx_GOTREF(__pyx_t_1);
17420  if (PyDict_SetItem(__pyx_d, __pyx_n_s_norm, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
17421  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17422  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17423 
17424  /* "Isosurface.pyx":17
17425  * from numpy.linalg import norm
17426  *
17427  * from . import Comm # <<<<<<<<<<<<<<
17428  * from .AuxiliaryVariables import AV_base
17429  * from proteus import Profiling
17430  */
17431  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
17432  __Pyx_GOTREF(__pyx_t_2);
17433  __Pyx_INCREF(__pyx_n_s_Comm);
17434  __Pyx_GIVEREF(__pyx_n_s_Comm);
17435  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Comm);
17436  __pyx_t_1 = __Pyx_Import(__pyx_n_s__10, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
17437  __Pyx_GOTREF(__pyx_t_1);
17438  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17439  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Comm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
17440  __Pyx_GOTREF(__pyx_t_2);
17441  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Comm, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
17442  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17443  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17444 
17445  /* "Isosurface.pyx":18
17446  *
17447  * from . import Comm
17448  * from .AuxiliaryVariables import AV_base # <<<<<<<<<<<<<<
17449  * from proteus import Profiling
17450  * from .Profiling import logEvent as log
17451  */
17452  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
17453  __Pyx_GOTREF(__pyx_t_1);
17454  __Pyx_INCREF(__pyx_n_s_AV_base);
17455  __Pyx_GIVEREF(__pyx_n_s_AV_base);
17456  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_AV_base);
17457  __pyx_t_2 = __Pyx_Import(__pyx_n_s_AuxiliaryVariables, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
17458  __Pyx_GOTREF(__pyx_t_2);
17459  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17460  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_AV_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
17461  __Pyx_GOTREF(__pyx_t_1);
17462  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AV_base, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
17463  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17464  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17465 
17466  /* "Isosurface.pyx":19
17467  * from . import Comm
17468  * from .AuxiliaryVariables import AV_base
17469  * from proteus import Profiling # <<<<<<<<<<<<<<
17470  * from .Profiling import logEvent as log
17471  *
17472  */
17473  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
17474  __Pyx_GOTREF(__pyx_t_2);
17475  __Pyx_INCREF(__pyx_n_s_Profiling);
17476  __Pyx_GIVEREF(__pyx_n_s_Profiling);
17477  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Profiling);
17478  __pyx_t_1 = __Pyx_Import(__pyx_n_s_proteus, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
17479  __Pyx_GOTREF(__pyx_t_1);
17480  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17481  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Profiling); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
17482  __Pyx_GOTREF(__pyx_t_2);
17483  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Profiling, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
17484  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17485  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17486 
17487  /* "Isosurface.pyx":20
17488  * from .AuxiliaryVariables import AV_base
17489  * from proteus import Profiling
17490  * from .Profiling import logEvent as log # <<<<<<<<<<<<<<
17491  *
17492  * from libc.math cimport sqrt
17493  */
17494  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
17495  __Pyx_GOTREF(__pyx_t_1);
17496  __Pyx_INCREF(__pyx_n_s_logEvent);
17497  __Pyx_GIVEREF(__pyx_n_s_logEvent);
17498  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_logEvent);
17499  __pyx_t_2 = __Pyx_Import(__pyx_n_s_Profiling, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
17500  __Pyx_GOTREF(__pyx_t_2);
17501  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17502  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_logEvent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
17503  __Pyx_GOTREF(__pyx_t_1);
17504  if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
17505  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17506  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17507 
17508  /* "Isosurface.pyx":50
17509  *
17510  *
17511  * class Isosurface(AV_base): # <<<<<<<<<<<<<<
17512  *
17513  * """Extract isosurfaces"""
17514  */
17515  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_AV_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
17516  __Pyx_GOTREF(__pyx_t_2);
17517  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
17518  __Pyx_GOTREF(__pyx_t_1);
17519  __Pyx_GIVEREF(__pyx_t_2);
17520  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
17521  __pyx_t_2 = 0;
17522  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
17523  __Pyx_GOTREF(__pyx_t_2);
17524  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Isosurface, __pyx_n_s_Isosurface, (PyObject *) NULL, __pyx_n_s_Isosurface, __pyx_kp_s_Extract_isosurfaces); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error)
17525  __Pyx_GOTREF(__pyx_t_3);
17526 
17527  /* "Isosurface.pyx":54
17528  * """Extract isosurfaces"""
17529  *
17530  * def __init__(self, isosurfaces, domain, activeTime=None, # <<<<<<<<<<<<<<
17531  * sampleRate=0, format='pov', writeBoundary=True):
17532  * """Create a set of isosurfaces that will be extracted and serialized
17533  */
17534  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_1__init__, 0, __pyx_n_s_Isosurface___init, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
17535  __Pyx_GOTREF(__pyx_t_4);
17536  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__13);
17537  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
17538  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17539 
17540  /* "Isosurface.pyx":108
17541  * self.fileprefix = 'isosurface'
17542  *
17543  * def attachModel(self, model, ar): # <<<<<<<<<<<<<<
17544  * """ Attach this isosurface to the given simulation model.
17545  * """
17546  */
17547  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_3attachModel, 0, __pyx_n_s_Isosurface_attachModel, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
17548  __Pyx_GOTREF(__pyx_t_4);
17549  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_attachModel, __pyx_t_4) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
17550  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17551 
17552  /* "Isosurface.pyx":135
17553  * return self
17554  *
17555  * def attachHDF5(self, h5, step, cam=None): # <<<<<<<<<<<<<<
17556  * """
17557  * Attach this isosurface to and HDF5 archive
17558  */
17559  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_5attachHDF5, 0, __pyx_n_s_Isosurface_attachHDF5, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
17560  __Pyx_GOTREF(__pyx_t_4);
17561  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__18);
17562  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_attachHDF5, __pyx_t_4) < 0) __PYX_ERR(0, 135, __pyx_L1_error)
17563  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17564 
17565  /* "Isosurface.pyx":158
17566  * return self
17567  *
17568  * def triangulateIsosurface(self, field, value): # <<<<<<<<<<<<<<
17569  * """
17570  * Build a triangular mesh of the isosurface
17571  */
17572  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_7triangulateIsosurface, 0, __pyx_n_s_Isosurface_triangulateIsosurface, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error)
17573  __Pyx_GOTREF(__pyx_t_4);
17574  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_triangulateIsosurface, __pyx_t_4) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
17575  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17576 
17577  /* "Isosurface.pyx":348
17578  * normal_indices.append(elements[-1])
17579  *
17580  * def writeIsosurfaceMesh(self, field, value, frame): # <<<<<<<<<<<<<<
17581  * if self.format == 'pov':
17582  * log("Writing pov frame " + repr(frame))
17583  */
17584  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_9writeIsosurfaceMesh, 0, __pyx_n_s_Isosurface_writeIsosurfaceMesh, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
17585  __Pyx_GOTREF(__pyx_t_4);
17586  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_writeIsosurfaceMesh, __pyx_t_4) < 0) __PYX_ERR(0, 348, __pyx_L1_error)
17587  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17588 
17589  /* "Isosurface.pyx":359
17590  * log("Isosurface file format not recognized")
17591  *
17592  * def writeIsosurfaceMesh_h5(self, field, value, frame): # <<<<<<<<<<<<<<
17593  * import h5py
17594  * nodes = self.nodes[(field, value)]
17595  */
17596  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_11writeIsosurfaceMesh_h5, 0, __pyx_n_s_Isosurface_writeIsosurfaceMesh_h, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error)
17597  __Pyx_GOTREF(__pyx_t_4);
17598  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_writeIsosurfaceMesh_h5, __pyx_t_4) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
17599  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17600 
17601  /* "Isosurface.pyx":376
17602  * f.close()
17603  *
17604  * def writeIsosurfaceMesh_povray(self, field, value, frame): # <<<<<<<<<<<<<<
17605  * """
17606  * Write the triangular mesh to a povray file
17607  */
17608  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_13writeIsosurfaceMesh_povray, 0, __pyx_n_s_Isosurface_writeIsosurfaceMesh_p, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error)
17609  __Pyx_GOTREF(__pyx_t_4);
17610  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_writeIsosurfaceMesh_povray, __pyx_t_4) < 0) __PYX_ERR(0, 376, __pyx_L1_error)
17611  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17612 
17613  /* "Isosurface.pyx":527
17614  * self.comm.endSequential()
17615  *
17616  * def calculate(self, checkTime=True): # <<<<<<<<<<<<<<
17617  * """Extracts isosourfaces at current time and update open output files
17618  * """
17619  */
17620  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_15calculate, 0, __pyx_n_s_Isosurface_calculate, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 527, __pyx_L1_error)
17621  __Pyx_GOTREF(__pyx_t_4);
17622  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__29);
17623  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_calculate, __pyx_t_4) < 0) __PYX_ERR(0, 527, __pyx_L1_error)
17624  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17625 
17626  /* "Isosurface.pyx":553
17627  * self.next_output += self.sampleRate
17628  *
17629  * def writeSceneHeader(self, cam = None): # <<<<<<<<<<<<<<
17630  * """
17631  * Write a scene description (can be modified before running povray)
17632  */
17633  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10Isosurface_10Isosurface_17writeSceneHeader, 0, __pyx_n_s_Isosurface_writeSceneHeader, NULL, __pyx_n_s_Isosurface, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error)
17634  __Pyx_GOTREF(__pyx_t_4);
17635  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__32);
17636  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_writeSceneHeader, __pyx_t_4) < 0) __PYX_ERR(0, 553, __pyx_L1_error)
17637  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17638 
17639  /* "Isosurface.pyx":50
17640  *
17641  *
17642  * class Isosurface(AV_base): # <<<<<<<<<<<<<<
17643  *
17644  * """Extract isosurfaces"""
17645  */
17646  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Isosurface, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
17647  __Pyx_GOTREF(__pyx_t_4);
17648  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Isosurface, __pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
17649  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17650  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17651  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17652  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17653 
17654  /* "Isosurface.pyx":1
17655  * #!python # <<<<<<<<<<<<<<
17656  * #cython: embedsignature=True
17657  * """
17658  */
17659  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
17660  __Pyx_GOTREF(__pyx_t_1);
17661  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
17662  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17663 
17664  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
17665  *
17666  *
17667  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
17668  * """
17669  * returns the unit part of the dtype for a numpy datetime64 object.
17670  */
17671 
17672  /*--- Wrapped vars code ---*/
17673 
17674  goto __pyx_L0;
17675  __pyx_L1_error:;
17676  __Pyx_XDECREF(__pyx_t_1);
17677  __Pyx_XDECREF(__pyx_t_2);
17678  __Pyx_XDECREF(__pyx_t_3);
17679  __Pyx_XDECREF(__pyx_t_4);
17680  if (__pyx_m) {
17681  if (__pyx_d) {
17682  __Pyx_AddTraceback("init Isosurface", __pyx_clineno, __pyx_lineno, __pyx_filename);
17683  }
17684  Py_CLEAR(__pyx_m);
17685  } else if (!PyErr_Occurred()) {
17686  PyErr_SetString(PyExc_ImportError, "init Isosurface");
17687  }
17688  __pyx_L0:;
17689  __Pyx_RefNannyFinishContext();
17690  #if CYTHON_PEP489_MULTI_PHASE_INIT
17691  return (__pyx_m != NULL) ? 0 : -1;
17692  #elif PY_MAJOR_VERSION >= 3
17693  return __pyx_m;
17694  #else
17695  return;
17696  #endif
17697 }
17698 
17699 /* --- Runtime support code --- */
17700 /* Refnanny */
17701 #if CYTHON_REFNANNY
17702 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
17703  PyObject *m = NULL, *p = NULL;
17704  void *r = NULL;
17705  m = PyImport_ImportModule(modname);
17706  if (!m) goto end;
17707  p = PyObject_GetAttrString(m, "RefNannyAPI");
17708  if (!p) goto end;
17709  r = PyLong_AsVoidPtr(p);
17710 end:
17711  Py_XDECREF(p);
17712  Py_XDECREF(m);
17713  return (__Pyx_RefNannyAPIStruct *)r;
17714 }
17715 #endif
17716 
17717 /* PyObjectGetAttrStr */
17718 #if CYTHON_USE_TYPE_SLOTS
17719 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
17720  PyTypeObject* tp = Py_TYPE(obj);
17721  if (likely(tp->tp_getattro))
17722  return tp->tp_getattro(obj, attr_name);
17723 #if PY_MAJOR_VERSION < 3
17724  if (likely(tp->tp_getattr))
17725  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
17726 #endif
17727  return PyObject_GetAttr(obj, attr_name);
17728 }
17729 #endif
17730 
17731 /* GetBuiltinName */
17732 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
17733  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
17734  if (unlikely(!result)) {
17735  PyErr_Format(PyExc_NameError,
17736 #if PY_MAJOR_VERSION >= 3
17737  "name '%U' is not defined", name);
17738 #else
17739  "name '%.200s' is not defined", PyString_AS_STRING(name));
17740 #endif
17741  }
17742  return result;
17743 }
17744 
17745 /* PyDictVersioning */
17746 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
17747 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
17748  PyObject *dict = Py_TYPE(obj)->tp_dict;
17749  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
17750 }
17751 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
17752  PyObject **dictptr = NULL;
17753  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
17754  if (offset) {
17755 #if CYTHON_COMPILING_IN_CPYTHON
17756  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
17757 #else
17758  dictptr = _PyObject_GetDictPtr(obj);
17759 #endif
17760  }
17761  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
17762 }
17763 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
17764  PyObject *dict = Py_TYPE(obj)->tp_dict;
17765  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
17766  return 0;
17767  return obj_dict_version == __Pyx_get_object_dict_version(obj);
17768 }
17769 #endif
17770 
17771 /* GetModuleGlobalName */
17772 #if CYTHON_USE_DICT_VERSIONS
17773 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
17774 #else
17775 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
17776 #endif
17777 {
17778  PyObject *result;
17779 #if !CYTHON_AVOID_BORROWED_REFS
17780 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
17781  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
17782  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
17783  if (likely(result)) {
17784  return __Pyx_NewRef(result);
17785  } else if (unlikely(PyErr_Occurred())) {
17786  return NULL;
17787  }
17788 #else
17789  result = PyDict_GetItem(__pyx_d, name);
17790  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
17791  if (likely(result)) {
17792  return __Pyx_NewRef(result);
17793  }
17794 #endif
17795 #else
17796  result = PyObject_GetItem(__pyx_d, name);
17797  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
17798  if (likely(result)) {
17799  return __Pyx_NewRef(result);
17800  }
17801  PyErr_Clear();
17802 #endif
17803  return __Pyx_GetBuiltinName(name);
17804 }
17805 
17806 /* PyObjectCall */
17807 #if CYTHON_COMPILING_IN_CPYTHON
17808 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
17809  PyObject *result;
17810  ternaryfunc call = Py_TYPE(func)->tp_call;
17811  if (unlikely(!call))
17812  return PyObject_Call(func, arg, kw);
17813  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
17814  return NULL;
17815  result = (*call)(func, arg, kw);
17816  Py_LeaveRecursiveCall();
17817  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
17818  PyErr_SetString(
17819  PyExc_SystemError,
17820  "NULL result without error in PyObject_Call");
17821  }
17822  return result;
17823 }
17824 #endif
17825 
17826 /* ExtTypeTest */
17827 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
17828  if (unlikely(!type)) {
17829  PyErr_SetString(PyExc_SystemError, "Missing type object");
17830  return 0;
17831  }
17832  if (likely(__Pyx_TypeCheck(obj, type)))
17833  return 1;
17834  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
17835  Py_TYPE(obj)->tp_name, type->tp_name);
17836  return 0;
17837 }
17838 
17839 /* IsLittleEndian */
17840 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
17841 {
17842  union {
17843  uint32_t u32;
17844  uint8_t u8[4];
17845  } S;
17846  S.u32 = 0x01020304;
17847  return S.u8[0] == 4;
17848 }
17849 
17850 /* BufferFormatCheck */
17851 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
17852  __Pyx_BufFmt_StackElem* stack,
17853  __Pyx_TypeInfo* type) {
17854  stack[0].field = &ctx->root;
17855  stack[0].parent_offset = 0;
17856  ctx->root.type = type;
17857  ctx->root.name = "buffer dtype";
17858  ctx->root.offset = 0;
17859  ctx->head = stack;
17860  ctx->head->field = &ctx->root;
17861  ctx->fmt_offset = 0;
17862  ctx->head->parent_offset = 0;
17863  ctx->new_packmode = '@';
17864  ctx->enc_packmode = '@';
17865  ctx->new_count = 1;
17866  ctx->enc_count = 0;
17867  ctx->enc_type = 0;
17868  ctx->is_complex = 0;
17869  ctx->is_valid_array = 0;
17870  ctx->struct_alignment = 0;
17871  while (type->typegroup == 'S') {
17872  ++ctx->head;
17873  ctx->head->field = type->fields;
17874  ctx->head->parent_offset = 0;
17875  type = type->fields->type;
17876  }
17877 }
17878 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
17879  int count;
17880  const char* t = *ts;
17881  if (*t < '0' || *t > '9') {
17882  return -1;
17883  } else {
17884  count = *t++ - '0';
17885  while (*t >= '0' && *t <= '9') {
17886  count *= 10;
17887  count += *t++ - '0';
17888  }
17889  }
17890  *ts = t;
17891  return count;
17892 }
17893 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
17894  int number = __Pyx_BufFmt_ParseNumber(ts);
17895  if (number == -1)
17896  PyErr_Format(PyExc_ValueError,\
17897  "Does not understand character buffer dtype format string ('%c')", **ts);
17898  return number;
17899 }
17900 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
17901  PyErr_Format(PyExc_ValueError,
17902  "Unexpected format string character: '%c'", ch);
17903 }
17904 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
17905  switch (ch) {
17906  case '?': return "'bool'";
17907  case 'c': return "'char'";
17908  case 'b': return "'signed char'";
17909  case 'B': return "'unsigned char'";
17910  case 'h': return "'short'";
17911  case 'H': return "'unsigned short'";
17912  case 'i': return "'int'";
17913  case 'I': return "'unsigned int'";
17914  case 'l': return "'long'";
17915  case 'L': return "'unsigned long'";
17916  case 'q': return "'long long'";
17917  case 'Q': return "'unsigned long long'";
17918  case 'f': return (is_complex ? "'complex float'" : "'float'");
17919  case 'd': return (is_complex ? "'complex double'" : "'double'");
17920  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
17921  case 'T': return "a struct";
17922  case 'O': return "Python object";
17923  case 'P': return "a pointer";
17924  case 's': case 'p': return "a string";
17925  case 0: return "end";
17926  default: return "unparseable format string";
17927  }
17928 }
17929 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
17930  switch (ch) {
17931  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
17932  case 'h': case 'H': return 2;
17933  case 'i': case 'I': case 'l': case 'L': return 4;
17934  case 'q': case 'Q': return 8;
17935  case 'f': return (is_complex ? 8 : 4);
17936  case 'd': return (is_complex ? 16 : 8);
17937  case 'g': {
17938  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
17939  return 0;
17940  }
17941  case 'O': case 'P': return sizeof(void*);
17942  default:
17943  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
17944  return 0;
17945  }
17946 }
17947 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
17948  switch (ch) {
17949  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
17950  case 'h': case 'H': return sizeof(short);
17951  case 'i': case 'I': return sizeof(int);
17952  case 'l': case 'L': return sizeof(long);
17953  #ifdef HAVE_LONG_LONG
17954  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
17955  #endif
17956  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
17957  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
17958  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
17959  case 'O': case 'P': return sizeof(void*);
17960  default: {
17961  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
17962  return 0;
17963  }
17964  }
17965 }
17966 typedef struct { char c; short x; } __Pyx_st_short;
17967 typedef struct { char c; int x; } __Pyx_st_int;
17968 typedef struct { char c; long x; } __Pyx_st_long;
17969 typedef struct { char c; float x; } __Pyx_st_float;
17970 typedef struct { char c; double x; } __Pyx_st_double;
17971 typedef struct { char c; long double x; } __Pyx_st_longdouble;
17972 typedef struct { char c; void *x; } __Pyx_st_void_p;
17973 #ifdef HAVE_LONG_LONG
17974 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
17975 #endif
17976 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
17977  switch (ch) {
17978  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
17979  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
17980  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
17981  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
17982 #ifdef HAVE_LONG_LONG
17983  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
17984 #endif
17985  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
17986  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
17987  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
17988  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
17989  default:
17990  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
17991  return 0;
17992  }
17993 }
17994 /* These are for computing the padding at the end of the struct to align
17995  on the first member of the struct. This will probably the same as above,
17996  but we don't have any guarantees.
17997  */
17998 typedef struct { short x; char c; } __Pyx_pad_short;
17999 typedef struct { int x; char c; } __Pyx_pad_int;
18000 typedef struct { long x; char c; } __Pyx_pad_long;
18001 typedef struct { float x; char c; } __Pyx_pad_float;
18002 typedef struct { double x; char c; } __Pyx_pad_double;
18003 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
18004 typedef struct { void *x; char c; } __Pyx_pad_void_p;
18005 #ifdef HAVE_LONG_LONG
18006 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
18007 #endif
18008 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
18009  switch (ch) {
18010  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
18011  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
18012  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
18013  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
18014 #ifdef HAVE_LONG_LONG
18015  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
18016 #endif
18017  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
18018  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
18019  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
18020  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
18021  default:
18022  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
18023  return 0;
18024  }
18025 }
18026 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
18027  switch (ch) {
18028  case 'c':
18029  return 'H';
18030  case 'b': case 'h': case 'i':
18031  case 'l': case 'q': case 's': case 'p':
18032  return 'I';
18033  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
18034  return 'U';
18035  case 'f': case 'd': case 'g':
18036  return (is_complex ? 'C' : 'R');
18037  case 'O':
18038  return 'O';
18039  case 'P':
18040  return 'P';
18041  default: {
18042  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
18043  return 0;
18044  }
18045  }
18046 }
18047 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
18048  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
18049  const char* expected;
18050  const char* quote;
18051  if (ctx->head == NULL) {
18052  expected = "end";
18053  quote = "";
18054  } else {
18055  expected = ctx->head->field->type->name;
18056  quote = "'";
18057  }
18058  PyErr_Format(PyExc_ValueError,
18059  "Buffer dtype mismatch, expected %s%s%s but got %s",
18060  quote, expected, quote,
18061  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
18062  } else {
18063  __Pyx_StructField* field = ctx->head->field;
18064  __Pyx_StructField* parent = (ctx->head - 1)->field;
18065  PyErr_Format(PyExc_ValueError,
18066  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
18067  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
18068  parent->type->name, field->name);
18069  }
18070 }
18071 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
18072  char group;
18073  size_t size, offset, arraysize = 1;
18074  if (ctx->enc_type == 0) return 0;
18075  if (ctx->head->field->type->arraysize[0]) {
18076  int i, ndim = 0;
18077  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
18078  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
18079  ndim = 1;
18080  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
18081  PyErr_Format(PyExc_ValueError,
18082  "Expected a dimension of size %zu, got %zu",
18083  ctx->head->field->type->arraysize[0], ctx->enc_count);
18084  return -1;
18085  }
18086  }
18087  if (!ctx->is_valid_array) {
18088  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
18089  ctx->head->field->type->ndim, ndim);
18090  return -1;
18091  }
18092  for (i = 0; i < ctx->head->field->type->ndim; i++) {
18093  arraysize *= ctx->head->field->type->arraysize[i];
18094  }
18095  ctx->is_valid_array = 0;
18096  ctx->enc_count = 1;
18097  }
18098  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
18099  do {
18100  __Pyx_StructField* field = ctx->head->field;
18101  __Pyx_TypeInfo* type = field->type;
18102  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
18103  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
18104  } else {
18105  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
18106  }
18107  if (ctx->enc_packmode == '@') {
18108  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
18109  size_t align_mod_offset;
18110  if (align_at == 0) return -1;
18111  align_mod_offset = ctx->fmt_offset % align_at;
18112  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
18113  if (ctx->struct_alignment == 0)
18114  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
18115  ctx->is_complex);
18116  }
18117  if (type->size != size || type->typegroup != group) {
18118  if (type->typegroup == 'C' && type->fields != NULL) {
18119  size_t parent_offset = ctx->head->parent_offset + field->offset;
18120  ++ctx->head;
18121  ctx->head->field = type->fields;
18122  ctx->head->parent_offset = parent_offset;
18123  continue;
18124  }
18125  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
18126  } else {
18127  __Pyx_BufFmt_RaiseExpected(ctx);
18128  return -1;
18129  }
18130  }
18131  offset = ctx->head->parent_offset + field->offset;
18132  if (ctx->fmt_offset != offset) {
18133  PyErr_Format(PyExc_ValueError,
18134  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
18135  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
18136  return -1;
18137  }
18138  ctx->fmt_offset += size;
18139  if (arraysize)
18140  ctx->fmt_offset += (arraysize - 1) * size;
18141  --ctx->enc_count;
18142  while (1) {
18143  if (field == &ctx->root) {
18144  ctx->head = NULL;
18145  if (ctx->enc_count != 0) {
18146  __Pyx_BufFmt_RaiseExpected(ctx);
18147  return -1;
18148  }
18149  break;
18150  }
18151  ctx->head->field = ++field;
18152  if (field->type == NULL) {
18153  --ctx->head;
18154  field = ctx->head->field;
18155  continue;
18156  } else if (field->type->typegroup == 'S') {
18157  size_t parent_offset = ctx->head->parent_offset + field->offset;
18158  if (field->type->fields->type == NULL) continue;
18159  field = field->type->fields;
18160  ++ctx->head;
18161  ctx->head->field = field;
18162  ctx->head->parent_offset = parent_offset;
18163  break;
18164  } else {
18165  break;
18166  }
18167  }
18168  } while (ctx->enc_count);
18169  ctx->enc_type = 0;
18170  ctx->is_complex = 0;
18171  return 0;
18172 }
18173 static PyObject *
18174 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
18175 {
18176  const char *ts = *tsp;
18177  int i = 0, number, ndim;
18178  ++ts;
18179  if (ctx->new_count != 1) {
18180  PyErr_SetString(PyExc_ValueError,
18181  "Cannot handle repeated arrays in format string");
18182  return NULL;
18183  }
18184  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
18185  ndim = ctx->head->field->type->ndim;
18186  while (*ts && *ts != ')') {
18187  switch (*ts) {
18188  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
18189  default: break;
18190  }
18191  number = __Pyx_BufFmt_ExpectNumber(&ts);
18192  if (number == -1) return NULL;
18193  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
18194  return PyErr_Format(PyExc_ValueError,
18195  "Expected a dimension of size %zu, got %d",
18196  ctx->head->field->type->arraysize[i], number);
18197  if (*ts != ',' && *ts != ')')
18198  return PyErr_Format(PyExc_ValueError,
18199  "Expected a comma in format string, got '%c'", *ts);
18200  if (*ts == ',') ts++;
18201  i++;
18202  }
18203  if (i != ndim)
18204  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
18205  ctx->head->field->type->ndim, i);
18206  if (!*ts) {
18207  PyErr_SetString(PyExc_ValueError,
18208  "Unexpected end of format string, expected ')'");
18209  return NULL;
18210  }
18211  ctx->is_valid_array = 1;
18212  ctx->new_count = 1;
18213  *tsp = ++ts;
18214  return Py_None;
18215 }
18216 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
18217  int got_Z = 0;
18218  while (1) {
18219  switch(*ts) {
18220  case 0:
18221  if (ctx->enc_type != 0 && ctx->head == NULL) {
18222  __Pyx_BufFmt_RaiseExpected(ctx);
18223  return NULL;
18224  }
18225  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
18226  if (ctx->head != NULL) {
18227  __Pyx_BufFmt_RaiseExpected(ctx);
18228  return NULL;
18229  }
18230  return ts;
18231  case ' ':
18232  case '\r':
18233  case '\n':
18234  ++ts;
18235  break;
18236  case '<':
18237  if (!__Pyx_Is_Little_Endian()) {
18238  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
18239  return NULL;
18240  }
18241  ctx->new_packmode = '=';
18242  ++ts;
18243  break;
18244  case '>':
18245  case '!':
18246  if (__Pyx_Is_Little_Endian()) {
18247  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
18248  return NULL;
18249  }
18250  ctx->new_packmode = '=';
18251  ++ts;
18252  break;
18253  case '=':
18254  case '@':
18255  case '^':
18256  ctx->new_packmode = *ts++;
18257  break;
18258  case 'T':
18259  {
18260  const char* ts_after_sub;
18261  size_t i, struct_count = ctx->new_count;
18262  size_t struct_alignment = ctx->struct_alignment;
18263  ctx->new_count = 1;
18264  ++ts;
18265  if (*ts != '{') {
18266  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
18267  return NULL;
18268  }
18269  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
18270  ctx->enc_type = 0;
18271  ctx->enc_count = 0;
18272  ctx->struct_alignment = 0;
18273  ++ts;
18274  ts_after_sub = ts;
18275  for (i = 0; i != struct_count; ++i) {
18276  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
18277  if (!ts_after_sub) return NULL;
18278  }
18279  ts = ts_after_sub;
18280  if (struct_alignment) ctx->struct_alignment = struct_alignment;
18281  }
18282  break;
18283  case '}':
18284  {
18285  size_t alignment = ctx->struct_alignment;
18286  ++ts;
18287  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
18288  ctx->enc_type = 0;
18289  if (alignment && ctx->fmt_offset % alignment) {
18290  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
18291  }
18292  }
18293  return ts;
18294  case 'x':
18295  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
18296  ctx->fmt_offset += ctx->new_count;
18297  ctx->new_count = 1;
18298  ctx->enc_count = 0;
18299  ctx->enc_type = 0;
18300  ctx->enc_packmode = ctx->new_packmode;
18301  ++ts;
18302  break;
18303  case 'Z':
18304  got_Z = 1;
18305  ++ts;
18306  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
18307  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
18308  return NULL;
18309  }
18310  CYTHON_FALLTHROUGH;
18311  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
18312  case 'l': case 'L': case 'q': case 'Q':
18313  case 'f': case 'd': case 'g':
18314  case 'O': case 'p':
18315  if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
18316  (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
18317  ctx->enc_count += ctx->new_count;
18318  ctx->new_count = 1;
18319  got_Z = 0;
18320  ++ts;
18321  break;
18322  }
18323  CYTHON_FALLTHROUGH;
18324  case 's':
18325  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
18326  ctx->enc_count = ctx->new_count;
18327  ctx->enc_packmode = ctx->new_packmode;
18328  ctx->enc_type = *ts;
18329  ctx->is_complex = got_Z;
18330  ++ts;
18331  ctx->new_count = 1;
18332  got_Z = 0;
18333  break;
18334  case ':':
18335  ++ts;
18336  while(*ts != ':') ++ts;
18337  ++ts;
18338  break;
18339  case '(':
18340  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
18341  break;
18342  default:
18343  {
18344  int number = __Pyx_BufFmt_ExpectNumber(&ts);
18345  if (number == -1) return NULL;
18346  ctx->new_count = (size_t)number;
18347  }
18348  }
18349  }
18350 }
18351 
18352 /* BufferGetAndValidate */
18353  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
18354  if (unlikely(info->buf == NULL)) return;
18355  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
18356  __Pyx_ReleaseBuffer(info);
18357 }
18358 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
18359  buf->buf = NULL;
18360  buf->obj = NULL;
18361  buf->strides = __Pyx_zeros;
18362  buf->shape = __Pyx_zeros;
18363  buf->suboffsets = __Pyx_minusones;
18364 }
18365 static int __Pyx__GetBufferAndValidate(
18366  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
18367  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
18368 {
18369  buf->buf = NULL;
18370  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
18371  __Pyx_ZeroBuffer(buf);
18372  return -1;
18373  }
18374  if (unlikely(buf->ndim != nd)) {
18375  PyErr_Format(PyExc_ValueError,
18376  "Buffer has wrong number of dimensions (expected %d, got %d)",
18377  nd, buf->ndim);
18378  goto fail;
18379  }
18380  if (!cast) {
18381  __Pyx_BufFmt_Context ctx;
18382  __Pyx_BufFmt_Init(&ctx, stack, dtype);
18383  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
18384  }
18385  if (unlikely((size_t)buf->itemsize != dtype->size)) {
18386  PyErr_Format(PyExc_ValueError,
18387  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
18388  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
18389  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
18390  goto fail;
18391  }
18392  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
18393  return 0;
18394 fail:;
18395  __Pyx_SafeReleaseBuffer(buf);
18396  return -1;
18397 }
18398 
18399 /* BufferIndexError */
18400  static void __Pyx_RaiseBufferIndexError(int axis) {
18401  PyErr_Format(PyExc_IndexError,
18402  "Out of bounds on buffer access (axis %d)", axis);
18403 }
18404 
18405 /* PyErrFetchRestore */
18406  #if CYTHON_FAST_THREAD_STATE
18407 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
18408  PyObject *tmp_type, *tmp_value, *tmp_tb;
18409  tmp_type = tstate->curexc_type;
18410  tmp_value = tstate->curexc_value;
18411  tmp_tb = tstate->curexc_traceback;
18412  tstate->curexc_type = type;
18413  tstate->curexc_value = value;
18414  tstate->curexc_traceback = tb;
18415  Py_XDECREF(tmp_type);
18416  Py_XDECREF(tmp_value);
18417  Py_XDECREF(tmp_tb);
18418 }
18419 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
18420  *type = tstate->curexc_type;
18421  *value = tstate->curexc_value;
18422  *tb = tstate->curexc_traceback;
18423  tstate->curexc_type = 0;
18424  tstate->curexc_value = 0;
18425  tstate->curexc_traceback = 0;
18426 }
18427 #endif
18428 
18429 /* WriteUnraisableException */
18430  static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
18431  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
18432  int full_traceback, CYTHON_UNUSED int nogil) {
18433  PyObject *old_exc, *old_val, *old_tb;
18434  PyObject *ctx;
18435  __Pyx_PyThreadState_declare
18436 #ifdef WITH_THREAD
18437  PyGILState_STATE state;
18438  if (nogil)
18439  state = PyGILState_Ensure();
18440 #ifdef _MSC_VER
18441  else state = (PyGILState_STATE)-1;
18442 #endif
18443 #endif
18444  __Pyx_PyThreadState_assign
18445  __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
18446  if (full_traceback) {
18447  Py_XINCREF(old_exc);
18448  Py_XINCREF(old_val);
18449  Py_XINCREF(old_tb);
18450  __Pyx_ErrRestore(old_exc, old_val, old_tb);
18451  PyErr_PrintEx(1);
18452  }
18453  #if PY_MAJOR_VERSION < 3
18454  ctx = PyString_FromString(name);
18455  #else
18456  ctx = PyUnicode_FromString(name);
18457  #endif
18458  __Pyx_ErrRestore(old_exc, old_val, old_tb);
18459  if (!ctx) {
18460  PyErr_WriteUnraisable(Py_None);
18461  } else {
18462  PyErr_WriteUnraisable(ctx);
18463  Py_DECREF(ctx);
18464  }
18465 #ifdef WITH_THREAD
18466  if (nogil)
18467  PyGILState_Release(state);
18468 #endif
18469 }
18470 
18471 /* RaiseArgTupleInvalid */
18472  static void __Pyx_RaiseArgtupleInvalid(
18473  const char* func_name,
18474  int exact,
18475  Py_ssize_t num_min,
18476  Py_ssize_t num_max,
18477  Py_ssize_t num_found)
18478 {
18479  Py_ssize_t num_expected;
18480  const char *more_or_less;
18481  if (num_found < num_min) {
18482  num_expected = num_min;
18483  more_or_less = "at least";
18484  } else {
18485  num_expected = num_max;
18486  more_or_less = "at most";
18487  }
18488  if (exact) {
18489  more_or_less = "exactly";
18490  }
18491  PyErr_Format(PyExc_TypeError,
18492  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
18493  func_name, more_or_less, num_expected,
18494  (num_expected == 1) ? "" : "s", num_found);
18495 }
18496 
18497 /* RaiseDoubleKeywords */
18498  static void __Pyx_RaiseDoubleKeywordsError(
18499  const char* func_name,
18500  PyObject* kw_name)
18501 {
18502  PyErr_Format(PyExc_TypeError,
18503  #if PY_MAJOR_VERSION >= 3
18504  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
18505  #else
18506  "%s() got multiple values for keyword argument '%s'", func_name,
18507  PyString_AsString(kw_name));
18508  #endif
18509 }
18510 
18511 /* ParseKeywords */
18512  static int __Pyx_ParseOptionalKeywords(
18513  PyObject *kwds,
18514  PyObject **argnames[],
18515  PyObject *kwds2,
18516  PyObject *values[],
18517  Py_ssize_t num_pos_args,
18518  const char* function_name)
18519 {
18520  PyObject *key = 0, *value = 0;
18521  Py_ssize_t pos = 0;
18522  PyObject*** name;
18523  PyObject*** first_kw_arg = argnames + num_pos_args;
18524  while (PyDict_Next(kwds, &pos, &key, &value)) {
18525  name = first_kw_arg;
18526  while (*name && (**name != key)) name++;
18527  if (*name) {
18528  values[name-argnames] = value;
18529  continue;
18530  }
18531  name = first_kw_arg;
18532  #if PY_MAJOR_VERSION < 3
18533  if (likely(PyString_Check(key))) {
18534  while (*name) {
18535  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
18536  && _PyString_Eq(**name, key)) {
18537  values[name-argnames] = value;
18538  break;
18539  }
18540  name++;
18541  }
18542  if (*name) continue;
18543  else {
18544  PyObject*** argname = argnames;
18545  while (argname != first_kw_arg) {
18546  if ((**argname == key) || (
18547  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
18548  && _PyString_Eq(**argname, key))) {
18549  goto arg_passed_twice;
18550  }
18551  argname++;
18552  }
18553  }
18554  } else
18555  #endif
18556  if (likely(PyUnicode_Check(key))) {
18557  while (*name) {
18558  int cmp = (**name == key) ? 0 :
18559  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
18560  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
18561  #endif
18562  PyUnicode_Compare(**name, key);
18563  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
18564  if (cmp == 0) {
18565  values[name-argnames] = value;
18566  break;
18567  }
18568  name++;
18569  }
18570  if (*name) continue;
18571  else {
18572  PyObject*** argname = argnames;
18573  while (argname != first_kw_arg) {
18574  int cmp = (**argname == key) ? 0 :
18575  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
18576  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
18577  #endif
18578  PyUnicode_Compare(**argname, key);
18579  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
18580  if (cmp == 0) goto arg_passed_twice;
18581  argname++;
18582  }
18583  }
18584  } else
18585  goto invalid_keyword_type;
18586  if (kwds2) {
18587  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
18588  } else {
18589  goto invalid_keyword;
18590  }
18591  }
18592  return 0;
18593 arg_passed_twice:
18594  __Pyx_RaiseDoubleKeywordsError(function_name, key);
18595  goto bad;
18596 invalid_keyword_type:
18597  PyErr_Format(PyExc_TypeError,
18598  "%.200s() keywords must be strings", function_name);
18599  goto bad;
18600 invalid_keyword:
18601  PyErr_Format(PyExc_TypeError,
18602  #if PY_MAJOR_VERSION < 3
18603  "%.200s() got an unexpected keyword argument '%.200s'",
18604  function_name, PyString_AsString(key));
18605  #else
18606  "%s() got an unexpected keyword argument '%U'",
18607  function_name, key);
18608  #endif
18609 bad:
18610  return -1;
18611 }
18612 
18613 /* PyObjectSetAttrStr */
18614  #if CYTHON_USE_TYPE_SLOTS
18615 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
18616  PyTypeObject* tp = Py_TYPE(obj);
18617  if (likely(tp->tp_setattro))
18618  return tp->tp_setattro(obj, attr_name, value);
18619 #if PY_MAJOR_VERSION < 3
18620  if (likely(tp->tp_setattr))
18621  return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
18622 #endif
18623  return PyObject_SetAttr(obj, attr_name, value);
18624 }
18625 #endif
18626 
18627 /* RaiseTooManyValuesToUnpack */
18628  static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
18629  PyErr_Format(PyExc_ValueError,
18630  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
18631 }
18632 
18633 /* RaiseNeedMoreValuesToUnpack */
18634  static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
18635  PyErr_Format(PyExc_ValueError,
18636  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
18637  index, (index == 1) ? "" : "s");
18638 }
18639 
18640 /* IterFinish */
18641  static CYTHON_INLINE int __Pyx_IterFinish(void) {
18642 #if CYTHON_FAST_THREAD_STATE
18643  PyThreadState *tstate = __Pyx_PyThreadState_Current;
18644  PyObject* exc_type = tstate->curexc_type;
18645  if (unlikely(exc_type)) {
18646  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
18647  PyObject *exc_value, *exc_tb;
18648  exc_value = tstate->curexc_value;
18649  exc_tb = tstate->curexc_traceback;
18650  tstate->curexc_type = 0;
18651  tstate->curexc_value = 0;
18652  tstate->curexc_traceback = 0;
18653  Py_DECREF(exc_type);
18654  Py_XDECREF(exc_value);
18655  Py_XDECREF(exc_tb);
18656  return 0;
18657  } else {
18658  return -1;
18659  }
18660  }
18661  return 0;
18662 #else
18663  if (unlikely(PyErr_Occurred())) {
18664  if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
18665  PyErr_Clear();
18666  return 0;
18667  } else {
18668  return -1;
18669  }
18670  }
18671  return 0;
18672 #endif
18673 }
18674 
18675 /* UnpackItemEndCheck */
18676  static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
18677  if (unlikely(retval)) {
18678  Py_DECREF(retval);
18679  __Pyx_RaiseTooManyValuesError(expected);
18680  return -1;
18681  } else {
18682  return __Pyx_IterFinish();
18683  }
18684  return 0;
18685 }
18686 
18687 /* PyFloatBinop */
18688  #if !CYTHON_COMPILING_IN_PYPY
18689 static PyObject* __Pyx_PyFloat_EqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
18690  const double b = floatval;
18691  double a;
18692  (void)inplace;
18693  (void)zerodivision_check;
18694  if (op1 == op2) {
18695  Py_RETURN_TRUE;
18696  }
18697  if (likely(PyFloat_CheckExact(op1))) {
18698  a = PyFloat_AS_DOUBLE(op1);
18699 
18700  } else
18701  #if PY_MAJOR_VERSION < 3
18702  if (likely(PyInt_CheckExact(op1))) {
18703  a = (double) PyInt_AS_LONG(op1);
18704 
18705  } else
18706  #endif
18707  if (likely(PyLong_CheckExact(op1))) {
18708  #if CYTHON_USE_PYLONG_INTERNALS
18709  const digit* digits = ((PyLongObject*)op1)->ob_digit;
18710  const Py_ssize_t size = Py_SIZE(op1);
18711  switch (size) {
18712  case 0: a = 0.0; break;
18713  case -1: a = -(double) digits[0]; break;
18714  case 1: a = (double) digits[0]; break;
18715  case -2:
18716  case 2:
18717  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
18718  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18719  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
18720  if (size == -2)
18721  a = -a;
18722  break;
18723  }
18724  }
18725  CYTHON_FALLTHROUGH;
18726  case -3:
18727  case 3:
18728  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
18729  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18730  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
18731  if (size == -3)
18732  a = -a;
18733  break;
18734  }
18735  }
18736  CYTHON_FALLTHROUGH;
18737  case -4:
18738  case 4:
18739  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
18740  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
18741  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
18742  if (size == -4)
18743  a = -a;
18744  break;
18745  }
18746  }
18747  CYTHON_FALLTHROUGH;
18748  default:
18749  #else
18750  {
18751  #endif
18752  return (
18753  PyFloat_Type.tp_richcompare(op2, op1, Py_EQ));
18754  }
18755  } else {
18756  return (
18757  PyObject_RichCompare(op1, op2, Py_EQ));
18758  }
18759  if (a == b) {
18760  Py_RETURN_TRUE;
18761  } else {
18762  Py_RETURN_FALSE;
18763  }
18764 }
18765 #endif
18766 
18767 /* PyFunctionFastCall */
18768  #if CYTHON_FAST_PYCALL
18769 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
18770  PyObject *globals) {
18771  PyFrameObject *f;
18772  PyThreadState *tstate = __Pyx_PyThreadState_Current;
18773  PyObject **fastlocals;
18774  Py_ssize_t i;
18775  PyObject *result;
18776  assert(globals != NULL);
18777  /* XXX Perhaps we should create a specialized
18778  PyFrame_New() that doesn't take locals, but does
18779  take builtins without sanity checking them.
18780  */
18781  assert(tstate != NULL);
18782  f = PyFrame_New(tstate, co, globals, NULL);
18783  if (f == NULL) {
18784  return NULL;
18785  }
18786  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
18787  for (i = 0; i < na; i++) {
18788  Py_INCREF(*args);
18789  fastlocals[i] = *args++;
18790  }
18791  result = PyEval_EvalFrameEx(f,0);
18792  ++tstate->recursion_depth;
18793  Py_DECREF(f);
18794  --tstate->recursion_depth;
18795  return result;
18796 }
18797 #if 1 || PY_VERSION_HEX < 0x030600B1
18798 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
18799  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
18800  PyObject *globals = PyFunction_GET_GLOBALS(func);
18801  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
18802  PyObject *closure;
18803 #if PY_MAJOR_VERSION >= 3
18804  PyObject *kwdefs;
18805 #endif
18806  PyObject *kwtuple, **k;
18807  PyObject **d;
18808  Py_ssize_t nd;
18809  Py_ssize_t nk;
18810  PyObject *result;
18811  assert(kwargs == NULL || PyDict_Check(kwargs));
18812  nk = kwargs ? PyDict_Size(kwargs) : 0;
18813  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
18814  return NULL;
18815  }
18816  if (
18817 #if PY_MAJOR_VERSION >= 3
18818  co->co_kwonlyargcount == 0 &&
18819 #endif
18820  likely(kwargs == NULL || nk == 0) &&
18821  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
18822  if (argdefs == NULL && co->co_argcount == nargs) {
18823  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
18824  goto done;
18825  }
18826  else if (nargs == 0 && argdefs != NULL
18827  && co->co_argcount == Py_SIZE(argdefs)) {
18828  /* function called with no arguments, but all parameters have
18829  a default value: use default values as arguments .*/
18830  args = &PyTuple_GET_ITEM(argdefs, 0);
18831  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
18832  goto done;
18833  }
18834  }
18835  if (kwargs != NULL) {
18836  Py_ssize_t pos, i;
18837  kwtuple = PyTuple_New(2 * nk);
18838  if (kwtuple == NULL) {
18839  result = NULL;
18840  goto done;
18841  }
18842  k = &PyTuple_GET_ITEM(kwtuple, 0);
18843  pos = i = 0;
18844  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
18845  Py_INCREF(k[i]);
18846  Py_INCREF(k[i+1]);
18847  i += 2;
18848  }
18849  nk = i / 2;
18850  }
18851  else {
18852  kwtuple = NULL;
18853  k = NULL;
18854  }
18855  closure = PyFunction_GET_CLOSURE(func);
18856 #if PY_MAJOR_VERSION >= 3
18857  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
18858 #endif
18859  if (argdefs != NULL) {
18860  d = &PyTuple_GET_ITEM(argdefs, 0);
18861  nd = Py_SIZE(argdefs);
18862  }
18863  else {
18864  d = NULL;
18865  nd = 0;
18866  }
18867 #if PY_MAJOR_VERSION >= 3
18868  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
18869  args, (int)nargs,
18870  k, (int)nk,
18871  d, (int)nd, kwdefs, closure);
18872 #else
18873  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
18874  args, (int)nargs,
18875  k, (int)nk,
18876  d, (int)nd, closure);
18877 #endif
18878  Py_XDECREF(kwtuple);
18879 done:
18880  Py_LeaveRecursiveCall();
18881  return result;
18882 }
18883 #endif
18884 #endif
18885 
18886 /* PyObjectCallMethO */
18887  #if CYTHON_COMPILING_IN_CPYTHON
18888 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
18889  PyObject *self, *result;
18890  PyCFunction cfunc;
18891  cfunc = PyCFunction_GET_FUNCTION(func);
18892  self = PyCFunction_GET_SELF(func);
18893  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
18894  return NULL;
18895  result = cfunc(self, arg);
18896  Py_LeaveRecursiveCall();
18897  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
18898  PyErr_SetString(
18899  PyExc_SystemError,
18900  "NULL result without error in PyObject_Call");
18901  }
18902  return result;
18903 }
18904 #endif
18905 
18906 /* PyObjectCallNoArg */
18907  #if CYTHON_COMPILING_IN_CPYTHON
18908 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
18909 #if CYTHON_FAST_PYCALL
18910  if (PyFunction_Check(func)) {
18911  return __Pyx_PyFunction_FastCall(func, NULL, 0);
18912  }
18913 #endif
18914 #ifdef __Pyx_CyFunction_USED
18915  if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
18916 #else
18917  if (likely(PyCFunction_Check(func)))
18918 #endif
18919  {
18920  if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
18921  return __Pyx_PyObject_CallMethO(func, NULL);
18922  }
18923  }
18924  return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
18925 }
18926 #endif
18927 
18928 /* PyCFunctionFastCall */
18929  #if CYTHON_FAST_PYCCALL
18930 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
18931  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
18932  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
18933  PyObject *self = PyCFunction_GET_SELF(func);
18934  int flags = PyCFunction_GET_FLAGS(func);
18935  assert(PyCFunction_Check(func));
18936  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
18937  assert(nargs >= 0);
18938  assert(nargs == 0 || args != NULL);
18939  /* _PyCFunction_FastCallDict() must not be called with an exception set,
18940  because it may clear it (directly or indirectly) and so the
18941  caller loses its exception */
18942  assert(!PyErr_Occurred());
18943  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
18944  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
18945  } else {
18946  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
18947  }
18948 }
18949 #endif
18950 
18951 /* PyObjectCallOneArg */
18952  #if CYTHON_COMPILING_IN_CPYTHON
18953 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
18954  PyObject *result;
18955  PyObject *args = PyTuple_New(1);
18956  if (unlikely(!args)) return NULL;
18957  Py_INCREF(arg);
18958  PyTuple_SET_ITEM(args, 0, arg);
18959  result = __Pyx_PyObject_Call(func, args, NULL);
18960  Py_DECREF(args);
18961  return result;
18962 }
18963 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
18964 #if CYTHON_FAST_PYCALL
18965  if (PyFunction_Check(func)) {
18966  return __Pyx_PyFunction_FastCall(func, &arg, 1);
18967  }
18968 #endif
18969  if (likely(PyCFunction_Check(func))) {
18970  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
18971  return __Pyx_PyObject_CallMethO(func, arg);
18972 #if CYTHON_FAST_PYCCALL
18973  } else if (__Pyx_PyFastCFunction_Check(func)) {
18974  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
18975 #endif
18976  }
18977  }
18978  return __Pyx__PyObject_CallOneArg(func, arg);
18979 }
18980 #else
18981 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
18982  PyObject *result;
18983  PyObject *args = PyTuple_Pack(1, arg);
18984  if (unlikely(!args)) return NULL;
18985  result = __Pyx_PyObject_Call(func, args, NULL);
18986  Py_DECREF(args);
18987  return result;
18988 }
18989 #endif
18990 
18991 /* None */
18992  static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
18993  PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
18994 }
18995 
18996 /* PyIntBinop */
18997  #if !CYTHON_COMPILING_IN_PYPY
18998 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
18999  (void)inplace;
19000  (void)zerodivision_check;
19001  #if PY_MAJOR_VERSION < 3
19002  if (likely(PyInt_CheckExact(op1))) {
19003  const long b = intval;
19004  long x;
19005  long a = PyInt_AS_LONG(op1);
19006  x = (long)((unsigned long)a + b);
19007  if (likely((x^a) >= 0 || (x^b) >= 0))
19008  return PyInt_FromLong(x);
19009  return PyLong_Type.tp_as_number->nb_add(op1, op2);
19010  }
19011  #endif
19012  #if CYTHON_USE_PYLONG_INTERNALS
19013  if (likely(PyLong_CheckExact(op1))) {
19014  const long b = intval;
19015  long a, x;
19016 #ifdef HAVE_LONG_LONG
19017  const PY_LONG_LONG llb = intval;
19018  PY_LONG_LONG lla, llx;
19019 #endif
19020  const digit* digits = ((PyLongObject*)op1)->ob_digit;
19021  const Py_ssize_t size = Py_SIZE(op1);
19022  if (likely(__Pyx_sst_abs(size) <= 1)) {
19023  a = likely(size) ? digits[0] : 0;
19024  if (size == -1) a = -a;
19025  } else {
19026  switch (size) {
19027  case -2:
19028  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
19029  a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19030  break;
19031 #ifdef HAVE_LONG_LONG
19032  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
19033  lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
19034  goto long_long;
19035 #endif
19036  }
19037  CYTHON_FALLTHROUGH;
19038  case 2:
19039  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
19040  a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19041  break;
19042 #ifdef HAVE_LONG_LONG
19043  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
19044  lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
19045  goto long_long;
19046 #endif
19047  }
19048  CYTHON_FALLTHROUGH;
19049  case -3:
19050  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
19051  a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19052  break;
19053 #ifdef HAVE_LONG_LONG
19054  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
19055  lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
19056  goto long_long;
19057 #endif
19058  }
19059  CYTHON_FALLTHROUGH;
19060  case 3:
19061  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
19062  a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19063  break;
19064 #ifdef HAVE_LONG_LONG
19065  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
19066  lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
19067  goto long_long;
19068 #endif
19069  }
19070  CYTHON_FALLTHROUGH;
19071  case -4:
19072  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
19073  a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19074  break;
19075 #ifdef HAVE_LONG_LONG
19076  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
19077  lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
19078  goto long_long;
19079 #endif
19080  }
19081  CYTHON_FALLTHROUGH;
19082  case 4:
19083  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
19084  a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19085  break;
19086 #ifdef HAVE_LONG_LONG
19087  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
19088  lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
19089  goto long_long;
19090 #endif
19091  }
19092  CYTHON_FALLTHROUGH;
19093  default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
19094  }
19095  }
19096  x = a + b;
19097  return PyLong_FromLong(x);
19098 #ifdef HAVE_LONG_LONG
19099  long_long:
19100  llx = lla + llb;
19101  return PyLong_FromLongLong(llx);
19102 #endif
19103 
19104 
19105  }
19106  #endif
19107  if (PyFloat_CheckExact(op1)) {
19108  const long b = intval;
19109  double a = PyFloat_AS_DOUBLE(op1);
19110  double result;
19111  PyFPE_START_PROTECT("add", return NULL)
19112  result = ((double)a) + (double)b;
19113  PyFPE_END_PROTECT(result)
19114  return PyFloat_FromDouble(result);
19115  }
19116  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
19117 }
19118 #endif
19119 
19120 /* GetItemInt */
19121  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
19122  PyObject *r;
19123  if (!j) return NULL;
19124  r = PyObject_GetItem(o, j);
19125  Py_DECREF(j);
19126  return r;
19127 }
19128 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
19129  CYTHON_NCP_UNUSED int wraparound,
19130  CYTHON_NCP_UNUSED int boundscheck) {
19131 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19132  Py_ssize_t wrapped_i = i;
19133  if (wraparound & unlikely(i < 0)) {
19134  wrapped_i += PyList_GET_SIZE(o);
19135  }
19136  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
19137  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
19138  Py_INCREF(r);
19139  return r;
19140  }
19141  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
19142 #else
19143  return PySequence_GetItem(o, i);
19144 #endif
19145 }
19146 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
19147  CYTHON_NCP_UNUSED int wraparound,
19148  CYTHON_NCP_UNUSED int boundscheck) {
19149 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19150  Py_ssize_t wrapped_i = i;
19151  if (wraparound & unlikely(i < 0)) {
19152  wrapped_i += PyTuple_GET_SIZE(o);
19153  }
19154  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
19155  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
19156  Py_INCREF(r);
19157  return r;
19158  }
19159  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
19160 #else
19161  return PySequence_GetItem(o, i);
19162 #endif
19163 }
19164 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
19165  CYTHON_NCP_UNUSED int wraparound,
19166  CYTHON_NCP_UNUSED int boundscheck) {
19167 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
19168  if (is_list || PyList_CheckExact(o)) {
19169  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
19170  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
19171  PyObject *r = PyList_GET_ITEM(o, n);
19172  Py_INCREF(r);
19173  return r;
19174  }
19175  }
19176  else if (PyTuple_CheckExact(o)) {
19177  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
19178  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
19179  PyObject *r = PyTuple_GET_ITEM(o, n);
19180  Py_INCREF(r);
19181  return r;
19182  }
19183  } else {
19184  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
19185  if (likely(m && m->sq_item)) {
19186  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
19187  Py_ssize_t l = m->sq_length(o);
19188  if (likely(l >= 0)) {
19189  i += l;
19190  } else {
19191  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
19192  return NULL;
19193  PyErr_Clear();
19194  }
19195  }
19196  return m->sq_item(o, i);
19197  }
19198  }
19199 #else
19200  if (is_list || PySequence_Check(o)) {
19201  return PySequence_GetItem(o, i);
19202  }
19203 #endif
19204  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
19205 }
19206 
19207 /* ObjectGetItem */
19208  #if CYTHON_USE_TYPE_SLOTS
19209 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
19210  PyObject *runerr;
19211  Py_ssize_t key_value;
19212  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
19213  if (unlikely(!(m && m->sq_item))) {
19214  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
19215  return NULL;
19216  }
19217  key_value = __Pyx_PyIndex_AsSsize_t(index);
19218  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
19219  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
19220  }
19221  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
19222  PyErr_Clear();
19223  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
19224  }
19225  return NULL;
19226 }
19227 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
19228  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
19229  if (likely(m && m->mp_subscript)) {
19230  return m->mp_subscript(obj, key);
19231  }
19232  return __Pyx_PyObject_GetIndex(obj, key);
19233 }
19234 #endif
19235 
19236 /* Import */
19237  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
19238  PyObject *empty_list = 0;
19239  PyObject *module = 0;
19240  PyObject *global_dict = 0;
19241  PyObject *empty_dict = 0;
19242  PyObject *list;
19243  #if PY_MAJOR_VERSION < 3
19244  PyObject *py_import;
19245  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
19246  if (!py_import)
19247  goto bad;
19248  #endif
19249  if (from_list)
19250  list = from_list;
19251  else {
19252  empty_list = PyList_New(0);
19253  if (!empty_list)
19254  goto bad;
19255  list = empty_list;
19256  }
19257  global_dict = PyModule_GetDict(__pyx_m);
19258  if (!global_dict)
19259  goto bad;
19260  empty_dict = PyDict_New();
19261  if (!empty_dict)
19262  goto bad;
19263  {
19264  #if PY_MAJOR_VERSION >= 3
19265  if (level == -1) {
19266  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
19267  module = PyImport_ImportModuleLevelObject(
19268  name, global_dict, empty_dict, list, 1);
19269  if (!module) {
19270  if (!PyErr_ExceptionMatches(PyExc_ImportError))
19271  goto bad;
19272  PyErr_Clear();
19273  }
19274  }
19275  level = 0;
19276  }
19277  #endif
19278  if (!module) {
19279  #if PY_MAJOR_VERSION < 3
19280  PyObject *py_level = PyInt_FromLong(level);
19281  if (!py_level)
19282  goto bad;
19283  module = PyObject_CallFunctionObjArgs(py_import,
19284  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
19285  Py_DECREF(py_level);
19286  #else
19287  module = PyImport_ImportModuleLevelObject(
19288  name, global_dict, empty_dict, list, level);
19289  #endif
19290  }
19291  }
19292 bad:
19293  #if PY_MAJOR_VERSION < 3
19294  Py_XDECREF(py_import);
19295  #endif
19296  Py_XDECREF(empty_list);
19297  Py_XDECREF(empty_dict);
19298  return module;
19299 }
19300 
19301 /* ImportFrom */
19302  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
19303  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
19304  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
19305  PyErr_Format(PyExc_ImportError,
19306  #if PY_MAJOR_VERSION < 3
19307  "cannot import name %.230s", PyString_AS_STRING(name));
19308  #else
19309  "cannot import name %S", name);
19310  #endif
19311  }
19312  return value;
19313 }
19314 
19315 /* PyObjectCall2Args */
19316  static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
19317  PyObject *args, *result = NULL;
19318  #if CYTHON_FAST_PYCALL
19319  if (PyFunction_Check(function)) {
19320  PyObject *args[2] = {arg1, arg2};
19321  return __Pyx_PyFunction_FastCall(function, args, 2);
19322  }
19323  #endif
19324  #if CYTHON_FAST_PYCCALL
19325  if (__Pyx_PyFastCFunction_Check(function)) {
19326  PyObject *args[2] = {arg1, arg2};
19327  return __Pyx_PyCFunction_FastCall(function, args, 2);
19328  }
19329  #endif
19330  args = PyTuple_New(2);
19331  if (unlikely(!args)) goto done;
19332  Py_INCREF(arg1);
19333  PyTuple_SET_ITEM(args, 0, arg1);
19334  Py_INCREF(arg2);
19335  PyTuple_SET_ITEM(args, 1, arg2);
19336  Py_INCREF(function);
19337  result = __Pyx_PyObject_Call(function, args, NULL);
19338  Py_DECREF(args);
19339  Py_DECREF(function);
19340 done:
19341  return result;
19342 }
19343 
19344 /* SliceObject */
19345  static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
19346  Py_ssize_t cstart, Py_ssize_t cstop,
19347  PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
19348  int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
19349 #if CYTHON_USE_TYPE_SLOTS
19350  PyMappingMethods* mp;
19351 #if PY_MAJOR_VERSION < 3
19352  PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
19353  if (likely(ms && ms->sq_slice)) {
19354  if (!has_cstart) {
19355  if (_py_start && (*_py_start != Py_None)) {
19356  cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
19357  if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
19358  } else
19359  cstart = 0;
19360  }
19361  if (!has_cstop) {
19362  if (_py_stop && (*_py_stop != Py_None)) {
19363  cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
19364  if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
19365  } else
19366  cstop = PY_SSIZE_T_MAX;
19367  }
19368  if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
19369  Py_ssize_t l = ms->sq_length(obj);
19370  if (likely(l >= 0)) {
19371  if (cstop < 0) {
19372  cstop += l;
19373  if (cstop < 0) cstop = 0;
19374  }
19375  if (cstart < 0) {
19376  cstart += l;
19377  if (cstart < 0) cstart = 0;
19378  }
19379  } else {
19380  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
19381  goto bad;
19382  PyErr_Clear();
19383  }
19384  }
19385  return ms->sq_slice(obj, cstart, cstop);
19386  }
19387 #endif
19388  mp = Py_TYPE(obj)->tp_as_mapping;
19389  if (likely(mp && mp->mp_subscript))
19390 #endif
19391  {
19392  PyObject* result;
19393  PyObject *py_slice, *py_start, *py_stop;
19394  if (_py_slice) {
19395  py_slice = *_py_slice;
19396  } else {
19397  PyObject* owned_start = NULL;
19398  PyObject* owned_stop = NULL;
19399  if (_py_start) {
19400  py_start = *_py_start;
19401  } else {
19402  if (has_cstart) {
19403  owned_start = py_start = PyInt_FromSsize_t(cstart);
19404  if (unlikely(!py_start)) goto bad;
19405  } else
19406  py_start = Py_None;
19407  }
19408  if (_py_stop) {
19409  py_stop = *_py_stop;
19410  } else {
19411  if (has_cstop) {
19412  owned_stop = py_stop = PyInt_FromSsize_t(cstop);
19413  if (unlikely(!py_stop)) {
19414  Py_XDECREF(owned_start);
19415  goto bad;
19416  }
19417  } else
19418  py_stop = Py_None;
19419  }
19420  py_slice = PySlice_New(py_start, py_stop, Py_None);
19421  Py_XDECREF(owned_start);
19422  Py_XDECREF(owned_stop);
19423  if (unlikely(!py_slice)) goto bad;
19424  }
19425 #if CYTHON_USE_TYPE_SLOTS
19426  result = mp->mp_subscript(obj, py_slice);
19427 #else
19428  result = PyObject_GetItem(obj, py_slice);
19429 #endif
19430  if (!_py_slice) {
19431  Py_DECREF(py_slice);
19432  }
19433  return result;
19434  }
19435  PyErr_Format(PyExc_TypeError,
19436  "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
19437 bad:
19438  return NULL;
19439 }
19440 
19441 /* PyIntCompare */
19442  static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
19443  if (op1 == op2) {
19444  Py_RETURN_TRUE;
19445  }
19446  #if PY_MAJOR_VERSION < 3
19447  if (likely(PyInt_CheckExact(op1))) {
19448  const long b = intval;
19449  long a = PyInt_AS_LONG(op1);
19450  if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19451  }
19452  #endif
19453  #if CYTHON_USE_PYLONG_INTERNALS
19454  if (likely(PyLong_CheckExact(op1))) {
19455  int unequal;
19456  unsigned long uintval;
19457  Py_ssize_t size = Py_SIZE(op1);
19458  const digit* digits = ((PyLongObject*)op1)->ob_digit;
19459  if (intval == 0) {
19460  if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19461  } else if (intval < 0) {
19462  if (size >= 0)
19463  Py_RETURN_FALSE;
19464  intval = -intval;
19465  size = -size;
19466  } else {
19467  if (size <= 0)
19468  Py_RETURN_FALSE;
19469  }
19470  uintval = (unsigned long) intval;
19471 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
19472  if (uintval >> (PyLong_SHIFT * 4)) {
19473  unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19474  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19475  } else
19476 #endif
19477 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
19478  if (uintval >> (PyLong_SHIFT * 3)) {
19479  unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19480  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19481  } else
19482 #endif
19483 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
19484  if (uintval >> (PyLong_SHIFT * 2)) {
19485  unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19486  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19487  } else
19488 #endif
19489 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
19490  if (uintval >> (PyLong_SHIFT * 1)) {
19491  unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19492  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19493  } else
19494 #endif
19495  unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
19496  if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19497  }
19498  #endif
19499  if (PyFloat_CheckExact(op1)) {
19500  const long b = intval;
19501  double a = PyFloat_AS_DOUBLE(op1);
19502  if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19503  }
19504  return (
19505  PyObject_RichCompare(op1, op2, Py_EQ));
19506 }
19507 
19508 /* PyFloatBinop */
19509  #if !CYTHON_COMPILING_IN_PYPY
19510 static PyObject* __Pyx_PyFloat_NeObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
19511  const double b = floatval;
19512  double a;
19513  (void)inplace;
19514  (void)zerodivision_check;
19515  if (op1 == op2) {
19516  Py_RETURN_FALSE;
19517  }
19518  if (likely(PyFloat_CheckExact(op1))) {
19519  a = PyFloat_AS_DOUBLE(op1);
19520 
19521  } else
19522  #if PY_MAJOR_VERSION < 3
19523  if (likely(PyInt_CheckExact(op1))) {
19524  a = (double) PyInt_AS_LONG(op1);
19525 
19526  } else
19527  #endif
19528  if (likely(PyLong_CheckExact(op1))) {
19529  #if CYTHON_USE_PYLONG_INTERNALS
19530  const digit* digits = ((PyLongObject*)op1)->ob_digit;
19531  const Py_ssize_t size = Py_SIZE(op1);
19532  switch (size) {
19533  case 0: a = 0.0; break;
19534  case -1: a = -(double) digits[0]; break;
19535  case 1: a = (double) digits[0]; break;
19536  case -2:
19537  case 2:
19538  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
19539  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19540  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
19541  if (size == -2)
19542  a = -a;
19543  break;
19544  }
19545  }
19546  CYTHON_FALLTHROUGH;
19547  case -3:
19548  case 3:
19549  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
19550  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19551  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
19552  if (size == -3)
19553  a = -a;
19554  break;
19555  }
19556  }
19557  CYTHON_FALLTHROUGH;
19558  case -4:
19559  case 4:
19560  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
19561  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
19562  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
19563  if (size == -4)
19564  a = -a;
19565  break;
19566  }
19567  }
19568  CYTHON_FALLTHROUGH;
19569  default:
19570  #else
19571  {
19572  #endif
19573  return (
19574  PyFloat_Type.tp_richcompare(op2, op1, Py_NE));
19575  }
19576  } else {
19577  return (
19578  PyObject_RichCompare(op1, op2, Py_NE));
19579  }
19580  if (a != b) {
19581  Py_RETURN_TRUE;
19582  } else {
19583  Py_RETURN_FALSE;
19584  }
19585 }
19586 #endif
19587 
19588 /* RaiseException */
19589  #if PY_MAJOR_VERSION < 3
19590 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
19591  CYTHON_UNUSED PyObject *cause) {
19592  __Pyx_PyThreadState_declare
19593  Py_XINCREF(type);
19594  if (!value || value == Py_None)
19595  value = NULL;
19596  else
19597  Py_INCREF(value);
19598  if (!tb || tb == Py_None)
19599  tb = NULL;
19600  else {
19601  Py_INCREF(tb);
19602  if (!PyTraceBack_Check(tb)) {
19603  PyErr_SetString(PyExc_TypeError,
19604  "raise: arg 3 must be a traceback or None");
19605  goto raise_error;
19606  }
19607  }
19608  if (PyType_Check(type)) {
19609 #if CYTHON_COMPILING_IN_PYPY
19610  if (!value) {
19611  Py_INCREF(Py_None);
19612  value = Py_None;
19613  }
19614 #endif
19615  PyErr_NormalizeException(&type, &value, &tb);
19616  } else {
19617  if (value) {
19618  PyErr_SetString(PyExc_TypeError,
19619  "instance exception may not have a separate value");
19620  goto raise_error;
19621  }
19622  value = type;
19623  type = (PyObject*) Py_TYPE(type);
19624  Py_INCREF(type);
19625  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
19626  PyErr_SetString(PyExc_TypeError,
19627  "raise: exception class must be a subclass of BaseException");
19628  goto raise_error;
19629  }
19630  }
19631  __Pyx_PyThreadState_assign
19632  __Pyx_ErrRestore(type, value, tb);
19633  return;
19634 raise_error:
19635  Py_XDECREF(value);
19636  Py_XDECREF(type);
19637  Py_XDECREF(tb);
19638  return;
19639 }
19640 #else
19641 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
19642  PyObject* owned_instance = NULL;
19643  if (tb == Py_None) {
19644  tb = 0;
19645  } else if (tb && !PyTraceBack_Check(tb)) {
19646  PyErr_SetString(PyExc_TypeError,
19647  "raise: arg 3 must be a traceback or None");
19648  goto bad;
19649  }
19650  if (value == Py_None)
19651  value = 0;
19652  if (PyExceptionInstance_Check(type)) {
19653  if (value) {
19654  PyErr_SetString(PyExc_TypeError,
19655  "instance exception may not have a separate value");
19656  goto bad;
19657  }
19658  value = type;
19659  type = (PyObject*) Py_TYPE(value);
19660  } else if (PyExceptionClass_Check(type)) {
19661  PyObject *instance_class = NULL;
19662  if (value && PyExceptionInstance_Check(value)) {
19663  instance_class = (PyObject*) Py_TYPE(value);
19664  if (instance_class != type) {
19665  int is_subclass = PyObject_IsSubclass(instance_class, type);
19666  if (!is_subclass) {
19667  instance_class = NULL;
19668  } else if (unlikely(is_subclass == -1)) {
19669  goto bad;
19670  } else {
19671  type = instance_class;
19672  }
19673  }
19674  }
19675  if (!instance_class) {
19676  PyObject *args;
19677  if (!value)
19678  args = PyTuple_New(0);
19679  else if (PyTuple_Check(value)) {
19680  Py_INCREF(value);
19681  args = value;
19682  } else
19683  args = PyTuple_Pack(1, value);
19684  if (!args)
19685  goto bad;
19686  owned_instance = PyObject_Call(type, args, NULL);
19687  Py_DECREF(args);
19688  if (!owned_instance)
19689  goto bad;
19690  value = owned_instance;
19691  if (!PyExceptionInstance_Check(value)) {
19692  PyErr_Format(PyExc_TypeError,
19693  "calling %R should have returned an instance of "
19694  "BaseException, not %R",
19695  type, Py_TYPE(value));
19696  goto bad;
19697  }
19698  }
19699  } else {
19700  PyErr_SetString(PyExc_TypeError,
19701  "raise: exception class must be a subclass of BaseException");
19702  goto bad;
19703  }
19704  if (cause) {
19705  PyObject *fixed_cause;
19706  if (cause == Py_None) {
19707  fixed_cause = NULL;
19708  } else if (PyExceptionClass_Check(cause)) {
19709  fixed_cause = PyObject_CallObject(cause, NULL);
19710  if (fixed_cause == NULL)
19711  goto bad;
19712  } else if (PyExceptionInstance_Check(cause)) {
19713  fixed_cause = cause;
19714  Py_INCREF(fixed_cause);
19715  } else {
19716  PyErr_SetString(PyExc_TypeError,
19717  "exception causes must derive from "
19718  "BaseException");
19719  goto bad;
19720  }
19721  PyException_SetCause(value, fixed_cause);
19722  }
19723  PyErr_SetObject(type, value);
19724  if (tb) {
19725 #if CYTHON_COMPILING_IN_PYPY
19726  PyObject *tmp_type, *tmp_value, *tmp_tb;
19727  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
19728  Py_INCREF(tb);
19729  PyErr_Restore(tmp_type, tmp_value, tb);
19730  Py_XDECREF(tmp_tb);
19731 #else
19732  PyThreadState *tstate = __Pyx_PyThreadState_Current;
19733  PyObject* tmp_tb = tstate->curexc_traceback;
19734  if (tb != tmp_tb) {
19735  Py_INCREF(tb);
19736  tstate->curexc_traceback = tb;
19737  Py_XDECREF(tmp_tb);
19738  }
19739 #endif
19740  }
19741 bad:
19742  Py_XDECREF(owned_instance);
19743  return;
19744 }
19745 #endif
19746 
19747 /* BufferFallbackError */
19748  static void __Pyx_RaiseBufferFallbackError(void) {
19749  PyErr_SetString(PyExc_ValueError,
19750  "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
19751 }
19752 
19753 /* SetItemInt */
19754  static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
19755  int r;
19756  if (!j) return -1;
19757  r = PyObject_SetItem(o, j, v);
19758  Py_DECREF(j);
19759  return r;
19760 }
19761 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
19762  CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
19763 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
19764  if (is_list || PyList_CheckExact(o)) {
19765  Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
19766  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
19767  PyObject* old = PyList_GET_ITEM(o, n);
19768  Py_INCREF(v);
19769  PyList_SET_ITEM(o, n, v);
19770  Py_DECREF(old);
19771  return 1;
19772  }
19773  } else {
19774  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
19775  if (likely(m && m->sq_ass_item)) {
19776  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
19777  Py_ssize_t l = m->sq_length(o);
19778  if (likely(l >= 0)) {
19779  i += l;
19780  } else {
19781  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
19782  return -1;
19783  PyErr_Clear();
19784  }
19785  }
19786  return m->sq_ass_item(o, i, v);
19787  }
19788  }
19789 #else
19790 #if CYTHON_COMPILING_IN_PYPY
19791  if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
19792 #else
19793  if (is_list || PySequence_Check(o))
19794 #endif
19795  {
19796  return PySequence_SetItem(o, i, v);
19797  }
19798 #endif
19799  return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
19800 }
19801 
19802 /* BytesEquals */
19803  static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
19804 #if CYTHON_COMPILING_IN_PYPY
19805  return PyObject_RichCompareBool(s1, s2, equals);
19806 #else
19807  if (s1 == s2) {
19808  return (equals == Py_EQ);
19809  } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
19810  const char *ps1, *ps2;
19811  Py_ssize_t length = PyBytes_GET_SIZE(s1);
19812  if (length != PyBytes_GET_SIZE(s2))
19813  return (equals == Py_NE);
19814  ps1 = PyBytes_AS_STRING(s1);
19815  ps2 = PyBytes_AS_STRING(s2);
19816  if (ps1[0] != ps2[0]) {
19817  return (equals == Py_NE);
19818  } else if (length == 1) {
19819  return (equals == Py_EQ);
19820  } else {
19821  int result;
19822 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
19823  Py_hash_t hash1, hash2;
19824  hash1 = ((PyBytesObject*)s1)->ob_shash;
19825  hash2 = ((PyBytesObject*)s2)->ob_shash;
19826  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
19827  return (equals == Py_NE);
19828  }
19829 #endif
19830  result = memcmp(ps1, ps2, (size_t)length);
19831  return (equals == Py_EQ) ? (result == 0) : (result != 0);
19832  }
19833  } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
19834  return (equals == Py_NE);
19835  } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
19836  return (equals == Py_NE);
19837  } else {
19838  int result;
19839  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
19840  if (!py_result)
19841  return -1;
19842  result = __Pyx_PyObject_IsTrue(py_result);
19843  Py_DECREF(py_result);
19844  return result;
19845  }
19846 #endif
19847 }
19848 
19849 /* UnicodeEquals */
19850  static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
19851 #if CYTHON_COMPILING_IN_PYPY
19852  return PyObject_RichCompareBool(s1, s2, equals);
19853 #else
19854 #if PY_MAJOR_VERSION < 3
19855  PyObject* owned_ref = NULL;
19856 #endif
19857  int s1_is_unicode, s2_is_unicode;
19858  if (s1 == s2) {
19859  goto return_eq;
19860  }
19861  s1_is_unicode = PyUnicode_CheckExact(s1);
19862  s2_is_unicode = PyUnicode_CheckExact(s2);
19863 #if PY_MAJOR_VERSION < 3
19864  if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
19865  owned_ref = PyUnicode_FromObject(s2);
19866  if (unlikely(!owned_ref))
19867  return -1;
19868  s2 = owned_ref;
19869  s2_is_unicode = 1;
19870  } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
19871  owned_ref = PyUnicode_FromObject(s1);
19872  if (unlikely(!owned_ref))
19873  return -1;
19874  s1 = owned_ref;
19875  s1_is_unicode = 1;
19876  } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
19877  return __Pyx_PyBytes_Equals(s1, s2, equals);
19878  }
19879 #endif
19880  if (s1_is_unicode & s2_is_unicode) {
19881  Py_ssize_t length;
19882  int kind;
19883  void *data1, *data2;
19884  if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
19885  return -1;
19886  length = __Pyx_PyUnicode_GET_LENGTH(s1);
19887  if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
19888  goto return_ne;
19889  }
19890 #if CYTHON_USE_UNICODE_INTERNALS
19891  {
19892  Py_hash_t hash1, hash2;
19893  #if CYTHON_PEP393_ENABLED
19894  hash1 = ((PyASCIIObject*)s1)->hash;
19895  hash2 = ((PyASCIIObject*)s2)->hash;
19896  #else
19897  hash1 = ((PyUnicodeObject*)s1)->hash;
19898  hash2 = ((PyUnicodeObject*)s2)->hash;
19899  #endif
19900  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
19901  goto return_ne;
19902  }
19903  }
19904 #endif
19905  kind = __Pyx_PyUnicode_KIND(s1);
19906  if (kind != __Pyx_PyUnicode_KIND(s2)) {
19907  goto return_ne;
19908  }
19909  data1 = __Pyx_PyUnicode_DATA(s1);
19910  data2 = __Pyx_PyUnicode_DATA(s2);
19911  if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
19912  goto return_ne;
19913  } else if (length == 1) {
19914  goto return_eq;
19915  } else {
19916  int result = memcmp(data1, data2, (size_t)(length * kind));
19917  #if PY_MAJOR_VERSION < 3
19918  Py_XDECREF(owned_ref);
19919  #endif
19920  return (equals == Py_EQ) ? (result == 0) : (result != 0);
19921  }
19922  } else if ((s1 == Py_None) & s2_is_unicode) {
19923  goto return_ne;
19924  } else if ((s2 == Py_None) & s1_is_unicode) {
19925  goto return_ne;
19926  } else {
19927  int result;
19928  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
19929  #if PY_MAJOR_VERSION < 3
19930  Py_XDECREF(owned_ref);
19931  #endif
19932  if (!py_result)
19933  return -1;
19934  result = __Pyx_PyObject_IsTrue(py_result);
19935  Py_DECREF(py_result);
19936  return result;
19937  }
19938 return_eq:
19939  #if PY_MAJOR_VERSION < 3
19940  Py_XDECREF(owned_ref);
19941  #endif
19942  return (equals == Py_EQ);
19943 return_ne:
19944  #if PY_MAJOR_VERSION < 3
19945  Py_XDECREF(owned_ref);
19946  #endif
19947  return (equals == Py_NE);
19948 #endif
19949 }
19950 
19951 /* PyIntCompare */
19952  static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
19953  if (op1 == op2) {
19954  Py_RETURN_FALSE;
19955  }
19956  #if PY_MAJOR_VERSION < 3
19957  if (likely(PyInt_CheckExact(op1))) {
19958  const long b = intval;
19959  long a = PyInt_AS_LONG(op1);
19960  if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19961  }
19962  #endif
19963  #if CYTHON_USE_PYLONG_INTERNALS
19964  if (likely(PyLong_CheckExact(op1))) {
19965  int unequal;
19966  unsigned long uintval;
19967  Py_ssize_t size = Py_SIZE(op1);
19968  const digit* digits = ((PyLongObject*)op1)->ob_digit;
19969  if (intval == 0) {
19970  if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
19971  } else if (intval < 0) {
19972  if (size >= 0)
19973  Py_RETURN_TRUE;
19974  intval = -intval;
19975  size = -size;
19976  } else {
19977  if (size <= 0)
19978  Py_RETURN_TRUE;
19979  }
19980  uintval = (unsigned long) intval;
19981 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
19982  if (uintval >> (PyLong_SHIFT * 4)) {
19983  unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19984  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19985  } else
19986 #endif
19987 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
19988  if (uintval >> (PyLong_SHIFT * 3)) {
19989  unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19990  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19991  } else
19992 #endif
19993 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
19994  if (uintval >> (PyLong_SHIFT * 2)) {
19995  unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
19996  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
19997  } else
19998 #endif
19999 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
20000  if (uintval >> (PyLong_SHIFT * 1)) {
20001  unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
20002  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
20003  } else
20004 #endif
20005  unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
20006  if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
20007  }
20008  #endif
20009  if (PyFloat_CheckExact(op1)) {
20010  const long b = intval;
20011  double a = PyFloat_AS_DOUBLE(op1);
20012  if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
20013  }
20014  return (
20015  PyObject_RichCompare(op1, op2, Py_NE));
20016 }
20017 
20018 /* None */
20019  static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
20020  PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
20021 }
20022 
20023 /* GetTopmostException */
20024  #if CYTHON_USE_EXC_INFO_STACK
20025 static _PyErr_StackItem *
20026 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
20027 {
20028  _PyErr_StackItem *exc_info = tstate->exc_info;
20029  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
20030  exc_info->previous_item != NULL)
20031  {
20032  exc_info = exc_info->previous_item;
20033  }
20034  return exc_info;
20035 }
20036 #endif
20037 
20038 /* SaveResetException */
20039  #if CYTHON_FAST_THREAD_STATE
20040 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
20041  #if CYTHON_USE_EXC_INFO_STACK
20042  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
20043  *type = exc_info->exc_type;
20044  *value = exc_info->exc_value;
20045  *tb = exc_info->exc_traceback;
20046  #else
20047  *type = tstate->exc_type;
20048  *value = tstate->exc_value;
20049  *tb = tstate->exc_traceback;
20050  #endif
20051  Py_XINCREF(*type);
20052  Py_XINCREF(*value);
20053  Py_XINCREF(*tb);
20054 }
20055 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
20056  PyObject *tmp_type, *tmp_value, *tmp_tb;
20057  #if CYTHON_USE_EXC_INFO_STACK
20058  _PyErr_StackItem *exc_info = tstate->exc_info;
20059  tmp_type = exc_info->exc_type;
20060  tmp_value = exc_info->exc_value;
20061  tmp_tb = exc_info->exc_traceback;
20062  exc_info->exc_type = type;
20063  exc_info->exc_value = value;
20064  exc_info->exc_traceback = tb;
20065  #else
20066  tmp_type = tstate->exc_type;
20067  tmp_value = tstate->exc_value;
20068  tmp_tb = tstate->exc_traceback;
20069  tstate->exc_type = type;
20070  tstate->exc_value = value;
20071  tstate->exc_traceback = tb;
20072  #endif
20073  Py_XDECREF(tmp_type);
20074  Py_XDECREF(tmp_value);
20075  Py_XDECREF(tmp_tb);
20076 }
20077 #endif
20078 
20079 /* PyErrExceptionMatches */
20080  #if CYTHON_FAST_THREAD_STATE
20081 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
20082  Py_ssize_t i, n;
20083  n = PyTuple_GET_SIZE(tuple);
20084 #if PY_MAJOR_VERSION >= 3
20085  for (i=0; i<n; i++) {
20086  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
20087  }
20088 #endif
20089  for (i=0; i<n; i++) {
20090  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
20091  }
20092  return 0;
20093 }
20094 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
20095  PyObject *exc_type = tstate->curexc_type;
20096  if (exc_type == err) return 1;
20097  if (unlikely(!exc_type)) return 0;
20098  if (unlikely(PyTuple_Check(err)))
20099  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
20100  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
20101 }
20102 #endif
20103 
20104 /* GetException */
20105  #if CYTHON_FAST_THREAD_STATE
20106 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
20107 #else
20108 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
20109 #endif
20110 {
20111  PyObject *local_type, *local_value, *local_tb;
20112 #if CYTHON_FAST_THREAD_STATE
20113  PyObject *tmp_type, *tmp_value, *tmp_tb;
20114  local_type = tstate->curexc_type;
20115  local_value = tstate->curexc_value;
20116  local_tb = tstate->curexc_traceback;
20117  tstate->curexc_type = 0;
20118  tstate->curexc_value = 0;
20119  tstate->curexc_traceback = 0;
20120 #else
20121  PyErr_Fetch(&local_type, &local_value, &local_tb);
20122 #endif
20123  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
20124 #if CYTHON_FAST_THREAD_STATE
20125  if (unlikely(tstate->curexc_type))
20126 #else
20127  if (unlikely(PyErr_Occurred()))
20128 #endif
20129  goto bad;
20130  #if PY_MAJOR_VERSION >= 3
20131  if (local_tb) {
20132  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
20133  goto bad;
20134  }
20135  #endif
20136  Py_XINCREF(local_tb);
20137  Py_XINCREF(local_type);
20138  Py_XINCREF(local_value);
20139  *type = local_type;
20140  *value = local_value;
20141  *tb = local_tb;
20142 #if CYTHON_FAST_THREAD_STATE
20143  #if CYTHON_USE_EXC_INFO_STACK
20144  {
20145  _PyErr_StackItem *exc_info = tstate->exc_info;
20146  tmp_type = exc_info->exc_type;
20147  tmp_value = exc_info->exc_value;
20148  tmp_tb = exc_info->exc_traceback;
20149  exc_info->exc_type = local_type;
20150  exc_info->exc_value = local_value;
20151  exc_info->exc_traceback = local_tb;
20152  }
20153  #else
20154  tmp_type = tstate->exc_type;
20155  tmp_value = tstate->exc_value;
20156  tmp_tb = tstate->exc_traceback;
20157  tstate->exc_type = local_type;
20158  tstate->exc_value = local_value;
20159  tstate->exc_traceback = local_tb;
20160  #endif
20161  Py_XDECREF(tmp_type);
20162  Py_XDECREF(tmp_value);
20163  Py_XDECREF(tmp_tb);
20164 #else
20165  PyErr_SetExcInfo(local_type, local_value, local_tb);
20166 #endif
20167  return 0;
20168 bad:
20169  *type = 0;
20170  *value = 0;
20171  *tb = 0;
20172  Py_XDECREF(local_type);
20173  Py_XDECREF(local_value);
20174  Py_XDECREF(local_tb);
20175  return -1;
20176 }
20177 
20178 /* PyObject_GenericGetAttrNoDict */
20179  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
20180 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
20181  PyErr_Format(PyExc_AttributeError,
20182 #if PY_MAJOR_VERSION >= 3
20183  "'%.50s' object has no attribute '%U'",
20184  tp->tp_name, attr_name);
20185 #else
20186  "'%.50s' object has no attribute '%.400s'",
20187  tp->tp_name, PyString_AS_STRING(attr_name));
20188 #endif
20189  return NULL;
20190 }
20191 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
20192  PyObject *descr;
20193  PyTypeObject *tp = Py_TYPE(obj);
20194  if (unlikely(!PyString_Check(attr_name))) {
20195  return PyObject_GenericGetAttr(obj, attr_name);
20196  }
20197  assert(!tp->tp_dictoffset);
20198  descr = _PyType_Lookup(tp, attr_name);
20199  if (unlikely(!descr)) {
20200  return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
20201  }
20202  Py_INCREF(descr);
20203  #if PY_MAJOR_VERSION < 3
20204  if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
20205  #endif
20206  {
20207  descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
20208  if (unlikely(f)) {
20209  PyObject *res = f(descr, obj, (PyObject *)tp);
20210  Py_DECREF(descr);
20211  return res;
20212  }
20213  }
20214  return descr;
20215 }
20216 #endif
20217 
20218 /* TypeImport */
20219  #ifndef __PYX_HAVE_RT_ImportType
20220 #define __PYX_HAVE_RT_ImportType
20221 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
20222  size_t size, enum __Pyx_ImportType_CheckSize check_size)
20223 {
20224  PyObject *result = 0;
20225  char warning[200];
20226  Py_ssize_t basicsize;
20227 #ifdef Py_LIMITED_API
20228  PyObject *py_basicsize;
20229 #endif
20230  result = PyObject_GetAttrString(module, class_name);
20231  if (!result)
20232  goto bad;
20233  if (!PyType_Check(result)) {
20234  PyErr_Format(PyExc_TypeError,
20235  "%.200s.%.200s is not a type object",
20236  module_name, class_name);
20237  goto bad;
20238  }
20239 #ifndef Py_LIMITED_API
20240  basicsize = ((PyTypeObject *)result)->tp_basicsize;
20241 #else
20242  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
20243  if (!py_basicsize)
20244  goto bad;
20245  basicsize = PyLong_AsSsize_t(py_basicsize);
20246  Py_DECREF(py_basicsize);
20247  py_basicsize = 0;
20248  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
20249  goto bad;
20250 #endif
20251  if ((size_t)basicsize < size) {
20252  PyErr_Format(PyExc_ValueError,
20253  "%.200s.%.200s size changed, may indicate binary incompatibility. "
20254  "Expected %zd from C header, got %zd from PyObject",
20255  module_name, class_name, size, basicsize);
20256  goto bad;
20257  }
20258  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
20259  PyErr_Format(PyExc_ValueError,
20260  "%.200s.%.200s size changed, may indicate binary incompatibility. "
20261  "Expected %zd from C header, got %zd from PyObject",
20262  module_name, class_name, size, basicsize);
20263  goto bad;
20264  }
20265  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
20266  PyOS_snprintf(warning, sizeof(warning),
20267  "%s.%s size changed, may indicate binary incompatibility. "
20268  "Expected %zd from C header, got %zd from PyObject",
20269  module_name, class_name, size, basicsize);
20270  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
20271  }
20272  return (PyTypeObject *)result;
20273 bad:
20274  Py_XDECREF(result);
20275  return NULL;
20276 }
20277 #endif
20278 
20279 /* CalculateMetaclass */
20280  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
20281  Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
20282  for (i=0; i < nbases; i++) {
20283  PyTypeObject *tmptype;
20284  PyObject *tmp = PyTuple_GET_ITEM(bases, i);
20285  tmptype = Py_TYPE(tmp);
20286 #if PY_MAJOR_VERSION < 3
20287  if (tmptype == &PyClass_Type)
20288  continue;
20289 #endif
20290  if (!metaclass) {
20291  metaclass = tmptype;
20292  continue;
20293  }
20294  if (PyType_IsSubtype(metaclass, tmptype))
20295  continue;
20296  if (PyType_IsSubtype(tmptype, metaclass)) {
20297  metaclass = tmptype;
20298  continue;
20299  }
20300  PyErr_SetString(PyExc_TypeError,
20301  "metaclass conflict: "
20302  "the metaclass of a derived class "
20303  "must be a (non-strict) subclass "
20304  "of the metaclasses of all its bases");
20305  return NULL;
20306  }
20307  if (!metaclass) {
20308 #if PY_MAJOR_VERSION < 3
20309  metaclass = &PyClass_Type;
20310 #else
20311  metaclass = &PyType_Type;
20312 #endif
20313  }
20314  Py_INCREF((PyObject*) metaclass);
20315  return (PyObject*) metaclass;
20316 }
20317 
20318 /* FetchCommonType */
20319  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
20320  PyObject* fake_module;
20321  PyTypeObject* cached_type = NULL;
20322  fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
20323  if (!fake_module) return NULL;
20324  Py_INCREF(fake_module);
20325  cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
20326  if (cached_type) {
20327  if (!PyType_Check((PyObject*)cached_type)) {
20328  PyErr_Format(PyExc_TypeError,
20329  "Shared Cython type %.200s is not a type object",
20330  type->tp_name);
20331  goto bad;
20332  }
20333  if (cached_type->tp_basicsize != type->tp_basicsize) {
20334  PyErr_Format(PyExc_TypeError,
20335  "Shared Cython type %.200s has the wrong size, try recompiling",
20336  type->tp_name);
20337  goto bad;
20338  }
20339  } else {
20340  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
20341  PyErr_Clear();
20342  if (PyType_Ready(type) < 0) goto bad;
20343  if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
20344  goto bad;
20345  Py_INCREF(type);
20346  cached_type = type;
20347  }
20348 done:
20349  Py_DECREF(fake_module);
20350  return cached_type;
20351 bad:
20352  Py_XDECREF(cached_type);
20353  cached_type = NULL;
20354  goto done;
20355 }
20356 
20357 /* CythonFunctionShared */
20358  #include <structmember.h>
20359 static PyObject *
20360 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
20361 {
20362  if (unlikely(op->func_doc == NULL)) {
20363  if (op->func.m_ml->ml_doc) {
20364 #if PY_MAJOR_VERSION >= 3
20365  op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
20366 #else
20367  op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
20368 #endif
20369  if (unlikely(op->func_doc == NULL))
20370  return NULL;
20371  } else {
20372  Py_INCREF(Py_None);
20373  return Py_None;
20374  }
20375  }
20376  Py_INCREF(op->func_doc);
20377  return op->func_doc;
20378 }
20379 static int
20380 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
20381 {
20382  PyObject *tmp = op->func_doc;
20383  if (value == NULL) {
20384  value = Py_None;
20385  }
20386  Py_INCREF(value);
20387  op->func_doc = value;
20388  Py_XDECREF(tmp);
20389  return 0;
20390 }
20391 static PyObject *
20392 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
20393 {
20394  if (unlikely(op->func_name == NULL)) {
20395 #if PY_MAJOR_VERSION >= 3
20396  op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
20397 #else
20398  op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
20399 #endif
20400  if (unlikely(op->func_name == NULL))
20401  return NULL;
20402  }
20403  Py_INCREF(op->func_name);
20404  return op->func_name;
20405 }
20406 static int
20407 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
20408 {
20409  PyObject *tmp;
20410 #if PY_MAJOR_VERSION >= 3
20411  if (unlikely(value == NULL || !PyUnicode_Check(value)))
20412 #else
20413  if (unlikely(value == NULL || !PyString_Check(value)))
20414 #endif
20415  {
20416  PyErr_SetString(PyExc_TypeError,
20417  "__name__ must be set to a string object");
20418  return -1;
20419  }
20420  tmp = op->func_name;
20421  Py_INCREF(value);
20422  op->func_name = value;
20423  Py_XDECREF(tmp);
20424  return 0;
20425 }
20426 static PyObject *
20427 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
20428 {
20429  Py_INCREF(op->func_qualname);
20430  return op->func_qualname;
20431 }
20432 static int
20433 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
20434 {
20435  PyObject *tmp;
20436 #if PY_MAJOR_VERSION >= 3
20437  if (unlikely(value == NULL || !PyUnicode_Check(value)))
20438 #else
20439  if (unlikely(value == NULL || !PyString_Check(value)))
20440 #endif
20441  {
20442  PyErr_SetString(PyExc_TypeError,
20443  "__qualname__ must be set to a string object");
20444  return -1;
20445  }
20446  tmp = op->func_qualname;
20447  Py_INCREF(value);
20448  op->func_qualname = value;
20449  Py_XDECREF(tmp);
20450  return 0;
20451 }
20452 static PyObject *
20453 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
20454 {
20455  PyObject *self;
20456  self = m->func_closure;
20457  if (self == NULL)
20458  self = Py_None;
20459  Py_INCREF(self);
20460  return self;
20461 }
20462 static PyObject *
20463 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
20464 {
20465  if (unlikely(op->func_dict == NULL)) {
20466  op->func_dict = PyDict_New();
20467  if (unlikely(op->func_dict == NULL))
20468  return NULL;
20469  }
20470  Py_INCREF(op->func_dict);
20471  return op->func_dict;
20472 }
20473 static int
20474 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
20475 {
20476  PyObject *tmp;
20477  if (unlikely(value == NULL)) {
20478  PyErr_SetString(PyExc_TypeError,
20479  "function's dictionary may not be deleted");
20480  return -1;
20481  }
20482  if (unlikely(!PyDict_Check(value))) {
20483  PyErr_SetString(PyExc_TypeError,
20484  "setting function's dictionary to a non-dict");
20485  return -1;
20486  }
20487  tmp = op->func_dict;
20488  Py_INCREF(value);
20489  op->func_dict = value;
20490  Py_XDECREF(tmp);
20491  return 0;
20492 }
20493 static PyObject *
20494 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
20495 {
20496  Py_INCREF(op->func_globals);
20497  return op->func_globals;
20498 }
20499 static PyObject *
20500 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
20501 {
20502  Py_INCREF(Py_None);
20503  return Py_None;
20504 }
20505 static PyObject *
20506 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
20507 {
20508  PyObject* result = (op->func_code) ? op->func_code : Py_None;
20509  Py_INCREF(result);
20510  return result;
20511 }
20512 static int
20513 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
20514  int result = 0;
20515  PyObject *res = op->defaults_getter((PyObject *) op);
20516  if (unlikely(!res))
20517  return -1;
20518  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20519  op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
20520  Py_INCREF(op->defaults_tuple);
20521  op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
20522  Py_INCREF(op->defaults_kwdict);
20523  #else
20524  op->defaults_tuple = PySequence_ITEM(res, 0);
20525  if (unlikely(!op->defaults_tuple)) result = -1;
20526  else {
20527  op->defaults_kwdict = PySequence_ITEM(res, 1);
20528  if (unlikely(!op->defaults_kwdict)) result = -1;
20529  }
20530  #endif
20531  Py_DECREF(res);
20532  return result;
20533 }
20534 static int
20535 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
20536  PyObject* tmp;
20537  if (!value) {
20538  value = Py_None;
20539  } else if (value != Py_None && !PyTuple_Check(value)) {
20540  PyErr_SetString(PyExc_TypeError,
20541  "__defaults__ must be set to a tuple object");
20542  return -1;
20543  }
20544  Py_INCREF(value);
20545  tmp = op->defaults_tuple;
20546  op->defaults_tuple = value;
20547  Py_XDECREF(tmp);
20548  return 0;
20549 }
20550 static PyObject *
20551 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
20552  PyObject* result = op->defaults_tuple;
20553  if (unlikely(!result)) {
20554  if (op->defaults_getter) {
20555  if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
20556  result = op->defaults_tuple;
20557  } else {
20558  result = Py_None;
20559  }
20560  }
20561  Py_INCREF(result);
20562  return result;
20563 }
20564 static int
20565 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
20566  PyObject* tmp;
20567  if (!value) {
20568  value = Py_None;
20569  } else if (value != Py_None && !PyDict_Check(value)) {
20570  PyErr_SetString(PyExc_TypeError,
20571  "__kwdefaults__ must be set to a dict object");
20572  return -1;
20573  }
20574  Py_INCREF(value);
20575  tmp = op->defaults_kwdict;
20576  op->defaults_kwdict = value;
20577  Py_XDECREF(tmp);
20578  return 0;
20579 }
20580 static PyObject *
20581 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
20582  PyObject* result = op->defaults_kwdict;
20583  if (unlikely(!result)) {
20584  if (op->defaults_getter) {
20585  if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
20586  result = op->defaults_kwdict;
20587  } else {
20588  result = Py_None;
20589  }
20590  }
20591  Py_INCREF(result);
20592  return result;
20593 }
20594 static int
20595 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
20596  PyObject* tmp;
20597  if (!value || value == Py_None) {
20598  value = NULL;
20599  } else if (!PyDict_Check(value)) {
20600  PyErr_SetString(PyExc_TypeError,
20601  "__annotations__ must be set to a dict object");
20602  return -1;
20603  }
20604  Py_XINCREF(value);
20605  tmp = op->func_annotations;
20606  op->func_annotations = value;
20607  Py_XDECREF(tmp);
20608  return 0;
20609 }
20610 static PyObject *
20611 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
20612  PyObject* result = op->func_annotations;
20613  if (unlikely(!result)) {
20614  result = PyDict_New();
20615  if (unlikely(!result)) return NULL;
20616  op->func_annotations = result;
20617  }
20618  Py_INCREF(result);
20619  return result;
20620 }
20621 static PyGetSetDef __pyx_CyFunction_getsets[] = {
20622  {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
20623  {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
20624  {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
20625  {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
20626  {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
20627  {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
20628  {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
20629  {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
20630  {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
20631  {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
20632  {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
20633  {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
20634  {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
20635  {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
20636  {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
20637  {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
20638  {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
20639  {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
20640  {0, 0, 0, 0, 0}
20641 };
20642 static PyMemberDef __pyx_CyFunction_members[] = {
20643  {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
20644  {0, 0, 0, 0, 0}
20645 };
20646 static PyObject *
20647 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
20648 {
20649 #if PY_MAJOR_VERSION >= 3
20650  Py_INCREF(m->func_qualname);
20651  return m->func_qualname;
20652 #else
20653  return PyString_FromString(m->func.m_ml->ml_name);
20654 #endif
20655 }
20656 static PyMethodDef __pyx_CyFunction_methods[] = {
20657  {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
20658  {0, 0, 0, 0}
20659 };
20660 #if PY_VERSION_HEX < 0x030500A0
20661 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
20662 #else
20663 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
20664 #endif
20665 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
20666  PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
20667  if (unlikely(op == NULL))
20668  return NULL;
20669  op->flags = flags;
20670  __Pyx_CyFunction_weakreflist(op) = NULL;
20671  op->func.m_ml = ml;
20672  op->func.m_self = (PyObject *) op;
20673  Py_XINCREF(closure);
20674  op->func_closure = closure;
20675  Py_XINCREF(module);
20676  op->func.m_module = module;
20677  op->func_dict = NULL;
20678  op->func_name = NULL;
20679  Py_INCREF(qualname);
20680  op->func_qualname = qualname;
20681  op->func_doc = NULL;
20682  op->func_classobj = NULL;
20683  op->func_globals = globals;
20684  Py_INCREF(op->func_globals);
20685  Py_XINCREF(code);
20686  op->func_code = code;
20687  op->defaults_pyobjects = 0;
20688  op->defaults_size = 0;
20689  op->defaults = NULL;
20690  op->defaults_tuple = NULL;
20691  op->defaults_kwdict = NULL;
20692  op->defaults_getter = NULL;
20693  op->func_annotations = NULL;
20694  return (PyObject *) op;
20695 }
20696 static int
20697 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
20698 {
20699  Py_CLEAR(m->func_closure);
20700  Py_CLEAR(m->func.m_module);
20701  Py_CLEAR(m->func_dict);
20702  Py_CLEAR(m->func_name);
20703  Py_CLEAR(m->func_qualname);
20704  Py_CLEAR(m->func_doc);
20705  Py_CLEAR(m->func_globals);
20706  Py_CLEAR(m->func_code);
20707  Py_CLEAR(m->func_classobj);
20708  Py_CLEAR(m->defaults_tuple);
20709  Py_CLEAR(m->defaults_kwdict);
20710  Py_CLEAR(m->func_annotations);
20711  if (m->defaults) {
20712  PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
20713  int i;
20714  for (i = 0; i < m->defaults_pyobjects; i++)
20715  Py_XDECREF(pydefaults[i]);
20716  PyObject_Free(m->defaults);
20717  m->defaults = NULL;
20718  }
20719  return 0;
20720 }
20721 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
20722 {
20723  if (__Pyx_CyFunction_weakreflist(m) != NULL)
20724  PyObject_ClearWeakRefs((PyObject *) m);
20725  __Pyx_CyFunction_clear(m);
20726  PyObject_GC_Del(m);
20727 }
20728 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
20729 {
20730  PyObject_GC_UnTrack(m);
20731  __Pyx__CyFunction_dealloc(m);
20732 }
20733 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
20734 {
20735  Py_VISIT(m->func_closure);
20736  Py_VISIT(m->func.m_module);
20737  Py_VISIT(m->func_dict);
20738  Py_VISIT(m->func_name);
20739  Py_VISIT(m->func_qualname);
20740  Py_VISIT(m->func_doc);
20741  Py_VISIT(m->func_globals);
20742  Py_VISIT(m->func_code);
20743  Py_VISIT(m->func_classobj);
20744  Py_VISIT(m->defaults_tuple);
20745  Py_VISIT(m->defaults_kwdict);
20746  if (m->defaults) {
20747  PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
20748  int i;
20749  for (i = 0; i < m->defaults_pyobjects; i++)
20750  Py_VISIT(pydefaults[i]);
20751  }
20752  return 0;
20753 }
20754 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
20755 {
20756 #if PY_MAJOR_VERSION < 3
20757  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
20758  if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
20759  Py_INCREF(func);
20760  return func;
20761  }
20762  if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
20763  if (type == NULL)
20764  type = (PyObject *)(Py_TYPE(obj));
20765  return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
20766  }
20767  if (obj == Py_None)
20768  obj = NULL;
20769 #endif
20770  return __Pyx_PyMethod_New(func, obj, type);
20771 }
20772 static PyObject*
20773 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
20774 {
20775 #if PY_MAJOR_VERSION >= 3
20776  return PyUnicode_FromFormat("<cyfunction %U at %p>",
20777  op->func_qualname, (void *)op);
20778 #else
20779  return PyString_FromFormat("<cyfunction %s at %p>",
20780  PyString_AsString(op->func_qualname), (void *)op);
20781 #endif
20782 }
20783 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
20784  PyCFunctionObject* f = (PyCFunctionObject*)func;
20785  PyCFunction meth = f->m_ml->ml_meth;
20786  Py_ssize_t size;
20787  switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
20788  case METH_VARARGS:
20789  if (likely(kw == NULL || PyDict_Size(kw) == 0))
20790  return (*meth)(self, arg);
20791  break;
20792  case METH_VARARGS | METH_KEYWORDS:
20793  return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
20794  case METH_NOARGS:
20795  if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
20796  size = PyTuple_GET_SIZE(arg);
20797  if (likely(size == 0))
20798  return (*meth)(self, NULL);
20799  PyErr_Format(PyExc_TypeError,
20800  "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
20801  f->m_ml->ml_name, size);
20802  return NULL;
20803  }
20804  break;
20805  case METH_O:
20806  if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
20807  size = PyTuple_GET_SIZE(arg);
20808  if (likely(size == 1)) {
20809  PyObject *result, *arg0;
20810  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20811  arg0 = PyTuple_GET_ITEM(arg, 0);
20812  #else
20813  arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
20814  #endif
20815  result = (*meth)(self, arg0);
20816  #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
20817  Py_DECREF(arg0);
20818  #endif
20819  return result;
20820  }
20821  PyErr_Format(PyExc_TypeError,
20822  "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
20823  f->m_ml->ml_name, size);
20824  return NULL;
20825  }
20826  break;
20827  default:
20828  PyErr_SetString(PyExc_SystemError, "Bad call flags in "
20829  "__Pyx_CyFunction_Call. METH_OLDARGS is no "
20830  "longer supported!");
20831  return NULL;
20832  }
20833  PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
20834  f->m_ml->ml_name);
20835  return NULL;
20836 }
20837 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
20838  return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
20839 }
20840 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
20841  PyObject *result;
20842  __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
20843  if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
20844  Py_ssize_t argc;
20845  PyObject *new_args;
20846  PyObject *self;
20847  argc = PyTuple_GET_SIZE(args);
20848  new_args = PyTuple_GetSlice(args, 1, argc);
20849  if (unlikely(!new_args))
20850  return NULL;
20851  self = PyTuple_GetItem(args, 0);
20852  if (unlikely(!self)) {
20853  Py_DECREF(new_args);
20854  PyErr_Format(PyExc_TypeError,
20855  "unbound method %.200S() needs an argument",
20856  cyfunc->func_qualname);
20857  return NULL;
20858  }
20859  result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
20860  Py_DECREF(new_args);
20861  } else {
20862  result = __Pyx_CyFunction_Call(func, args, kw);
20863  }
20864  return result;
20865 }
20866 static PyTypeObject __pyx_CyFunctionType_type = {
20867  PyVarObject_HEAD_INIT(0, 0)
20868  "cython_function_or_method",
20869  sizeof(__pyx_CyFunctionObject),
20870  0,
20871  (destructor) __Pyx_CyFunction_dealloc,
20872  0,
20873  0,
20874  0,
20875 #if PY_MAJOR_VERSION < 3
20876  0,
20877 #else
20878  0,
20879 #endif
20880  (reprfunc) __Pyx_CyFunction_repr,
20881  0,
20882  0,
20883  0,
20884  0,
20885  __Pyx_CyFunction_CallAsMethod,
20886  0,
20887  0,
20888  0,
20889  0,
20890  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
20891  0,
20892  (traverseproc) __Pyx_CyFunction_traverse,
20893  (inquiry) __Pyx_CyFunction_clear,
20894  0,
20895 #if PY_VERSION_HEX < 0x030500A0
20896  offsetof(__pyx_CyFunctionObject, func_weakreflist),
20897 #else
20898  offsetof(PyCFunctionObject, m_weakreflist),
20899 #endif
20900  0,
20901  0,
20902  __pyx_CyFunction_methods,
20903  __pyx_CyFunction_members,
20904  __pyx_CyFunction_getsets,
20905  0,
20906  0,
20907  __Pyx_CyFunction_descr_get,
20908  0,
20909  offsetof(__pyx_CyFunctionObject, func_dict),
20910  0,
20911  0,
20912  0,
20913  0,
20914  0,
20915  0,
20916  0,
20917  0,
20918  0,
20919  0,
20920  0,
20921  0,
20922 #if PY_VERSION_HEX >= 0x030400a1
20923  0,
20924 #endif
20925 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20926  0,
20927 #endif
20928 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20929  0,
20930 #endif
20931 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
20932  0,
20933 #endif
20934 };
20935 static int __pyx_CyFunction_init(void) {
20936  __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
20937  if (unlikely(__pyx_CyFunctionType == NULL)) {
20938  return -1;
20939  }
20940  return 0;
20941 }
20942 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
20943  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
20944  m->defaults = PyObject_Malloc(size);
20945  if (unlikely(!m->defaults))
20946  return PyErr_NoMemory();
20947  memset(m->defaults, 0, size);
20948  m->defaults_pyobjects = pyobjects;
20949  m->defaults_size = size;
20950  return m->defaults;
20951 }
20952 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
20953  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
20954  m->defaults_tuple = tuple;
20955  Py_INCREF(tuple);
20956 }
20957 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
20958  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
20959  m->defaults_kwdict = dict;
20960  Py_INCREF(dict);
20961 }
20962 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
20963  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
20964  m->func_annotations = dict;
20965  Py_INCREF(dict);
20966 }
20967 
20968 /* CythonFunction */
20969  static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
20970  PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
20971  PyObject *op = __Pyx_CyFunction_Init(
20972  PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
20973  ml, flags, qualname, closure, module, globals, code
20974  );
20975  if (likely(op)) {
20976  PyObject_GC_Track(op);
20977  }
20978  return op;
20979 }
20980 
20981 /* Py3ClassCreate */
20982  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
20983  PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
20984  PyObject *ns;
20985  if (metaclass) {
20986  PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
20987  if (prep) {
20988  PyObject *pargs = PyTuple_Pack(2, name, bases);
20989  if (unlikely(!pargs)) {
20990  Py_DECREF(prep);
20991  return NULL;
20992  }
20993  ns = PyObject_Call(prep, pargs, mkw);
20994  Py_DECREF(prep);
20995  Py_DECREF(pargs);
20996  } else {
20997  if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
20998  return NULL;
20999  PyErr_Clear();
21000  ns = PyDict_New();
21001  }
21002  } else {
21003  ns = PyDict_New();
21004  }
21005  if (unlikely(!ns))
21006  return NULL;
21007  if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
21008  if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
21009  if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
21010  return ns;
21011 bad:
21012  Py_DECREF(ns);
21013  return NULL;
21014 }
21015 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
21016  PyObject *dict, PyObject *mkw,
21017  int calculate_metaclass, int allow_py2_metaclass) {
21018  PyObject *result, *margs;
21019  PyObject *owned_metaclass = NULL;
21020  if (allow_py2_metaclass) {
21021  owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
21022  if (owned_metaclass) {
21023  metaclass = owned_metaclass;
21024  } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
21025  PyErr_Clear();
21026  } else {
21027  return NULL;
21028  }
21029  }
21030  if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
21031  metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
21032  Py_XDECREF(owned_metaclass);
21033  if (unlikely(!metaclass))
21034  return NULL;
21035  owned_metaclass = metaclass;
21036  }
21037  margs = PyTuple_Pack(3, name, bases, dict);
21038  if (unlikely(!margs)) {
21039  result = NULL;
21040  } else {
21041  result = PyObject_Call(metaclass, margs, mkw);
21042  Py_DECREF(margs);
21043  }
21044  Py_XDECREF(owned_metaclass);
21045  return result;
21046 }
21047 
21048 /* CLineInTraceback */
21049  #ifndef CYTHON_CLINE_IN_TRACEBACK
21050 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
21051  PyObject *use_cline;
21052  PyObject *ptype, *pvalue, *ptraceback;
21053 #if CYTHON_COMPILING_IN_CPYTHON
21054  PyObject **cython_runtime_dict;
21055 #endif
21056  if (unlikely(!__pyx_cython_runtime)) {
21057  return c_line;
21058  }
21059  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
21060 #if CYTHON_COMPILING_IN_CPYTHON
21061  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
21062  if (likely(cython_runtime_dict)) {
21063  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
21064  use_cline, *cython_runtime_dict,
21065  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
21066  } else
21067 #endif
21068  {
21069  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
21070  if (use_cline_obj) {
21071  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
21072  Py_DECREF(use_cline_obj);
21073  } else {
21074  PyErr_Clear();
21075  use_cline = NULL;
21076  }
21077  }
21078  if (!use_cline) {
21079  c_line = 0;
21080  (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
21081  }
21082  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
21083  c_line = 0;
21084  }
21085  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
21086  return c_line;
21087 }
21088 #endif
21089 
21090 /* CodeObjectCache */
21091  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
21092  int start = 0, mid = 0, end = count - 1;
21093  if (end >= 0 && code_line > entries[end].code_line) {
21094  return count;
21095  }
21096  while (start < end) {
21097  mid = start + (end - start) / 2;
21098  if (code_line < entries[mid].code_line) {
21099  end = mid;
21100  } else if (code_line > entries[mid].code_line) {
21101  start = mid + 1;
21102  } else {
21103  return mid;
21104  }
21105  }
21106  if (code_line <= entries[mid].code_line) {
21107  return mid;
21108  } else {
21109  return mid + 1;
21110  }
21111 }
21112 static PyCodeObject *__pyx_find_code_object(int code_line) {
21113  PyCodeObject* code_object;
21114  int pos;
21115  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
21116  return NULL;
21117  }
21118  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
21119  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
21120  return NULL;
21121  }
21122  code_object = __pyx_code_cache.entries[pos].code_object;
21123  Py_INCREF(code_object);
21124  return code_object;
21125 }
21126 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
21127  int pos, i;
21128  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
21129  if (unlikely(!code_line)) {
21130  return;
21131  }
21132  if (unlikely(!entries)) {
21133  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
21134  if (likely(entries)) {
21135  __pyx_code_cache.entries = entries;
21136  __pyx_code_cache.max_count = 64;
21137  __pyx_code_cache.count = 1;
21138  entries[0].code_line = code_line;
21139  entries[0].code_object = code_object;
21140  Py_INCREF(code_object);
21141  }
21142  return;
21143  }
21144  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
21145  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
21146  PyCodeObject* tmp = entries[pos].code_object;
21147  entries[pos].code_object = code_object;
21148  Py_DECREF(tmp);
21149  return;
21150  }
21151  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
21152  int new_max = __pyx_code_cache.max_count + 64;
21153  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
21154  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
21155  if (unlikely(!entries)) {
21156  return;
21157  }
21158  __pyx_code_cache.entries = entries;
21159  __pyx_code_cache.max_count = new_max;
21160  }
21161  for (i=__pyx_code_cache.count; i>pos; i--) {
21162  entries[i] = entries[i-1];
21163  }
21164  entries[pos].code_line = code_line;
21165  entries[pos].code_object = code_object;
21166  __pyx_code_cache.count++;
21167  Py_INCREF(code_object);
21168 }
21169 
21170 /* AddTraceback */
21171  #include "compile.h"
21172 #include "frameobject.h"
21173 #include "traceback.h"
21174 #if PY_VERSION_HEX >= 0x030b00a6
21175  #ifndef Py_BUILD_CORE
21176  #define Py_BUILD_CORE 1
21177  #endif
21178  #include "internal/pycore_frame.h"
21179 #endif
21180 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
21181  const char *funcname, int c_line,
21182  int py_line, const char *filename) {
21183  PyCodeObject *py_code = NULL;
21184  PyObject *py_funcname = NULL;
21185  #if PY_MAJOR_VERSION < 3
21186  PyObject *py_srcfile = NULL;
21187  py_srcfile = PyString_FromString(filename);
21188  if (!py_srcfile) goto bad;
21189  #endif
21190  if (c_line) {
21191  #if PY_MAJOR_VERSION < 3
21192  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
21193  if (!py_funcname) goto bad;
21194  #else
21195  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
21196  if (!py_funcname) goto bad;
21197  funcname = PyUnicode_AsUTF8(py_funcname);
21198  if (!funcname) goto bad;
21199  #endif
21200  }
21201  else {
21202  #if PY_MAJOR_VERSION < 3
21203  py_funcname = PyString_FromString(funcname);
21204  if (!py_funcname) goto bad;
21205  #endif
21206  }
21207  #if PY_MAJOR_VERSION < 3
21208  py_code = __Pyx_PyCode_New(
21209  0,
21210  0,
21211  0,
21212  0,
21213  0,
21214  __pyx_empty_bytes, /*PyObject *code,*/
21215  __pyx_empty_tuple, /*PyObject *consts,*/
21216  __pyx_empty_tuple, /*PyObject *names,*/
21217  __pyx_empty_tuple, /*PyObject *varnames,*/
21218  __pyx_empty_tuple, /*PyObject *freevars,*/
21219  __pyx_empty_tuple, /*PyObject *cellvars,*/
21220  py_srcfile, /*PyObject *filename,*/
21221  py_funcname, /*PyObject *name,*/
21222  py_line,
21223  __pyx_empty_bytes /*PyObject *lnotab*/
21224  );
21225  Py_DECREF(py_srcfile);
21226  #else
21227  py_code = PyCode_NewEmpty(filename, funcname, py_line);
21228  #endif
21229  Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
21230  return py_code;
21231 bad:
21232  Py_XDECREF(py_funcname);
21233  #if PY_MAJOR_VERSION < 3
21234  Py_XDECREF(py_srcfile);
21235  #endif
21236  return NULL;
21237 }
21238 static void __Pyx_AddTraceback(const char *funcname, int c_line,
21239  int py_line, const char *filename) {
21240  PyCodeObject *py_code = 0;
21241  PyFrameObject *py_frame = 0;
21242  PyThreadState *tstate = __Pyx_PyThreadState_Current;
21243  PyObject *ptype, *pvalue, *ptraceback;
21244  if (c_line) {
21245  c_line = __Pyx_CLineForTraceback(tstate, c_line);
21246  }
21247  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
21248  if (!py_code) {
21249  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
21250  py_code = __Pyx_CreateCodeObjectForTraceback(
21251  funcname, c_line, py_line, filename);
21252  if (!py_code) {
21253  /* If the code object creation fails, then we should clear the
21254  fetched exception references and propagate the new exception */
21255  Py_XDECREF(ptype);
21256  Py_XDECREF(pvalue);
21257  Py_XDECREF(ptraceback);
21258  goto bad;
21259  }
21260  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
21261  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
21262  }
21263  py_frame = PyFrame_New(
21264  tstate, /*PyThreadState *tstate,*/
21265  py_code, /*PyCodeObject *code,*/
21266  __pyx_d, /*PyObject *globals,*/
21267  0 /*PyObject *locals*/
21268  );
21269  if (!py_frame) goto bad;
21270  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
21271  PyTraceBack_Here(py_frame);
21272 bad:
21273  Py_XDECREF(py_code);
21274  Py_XDECREF(py_frame);
21275 }
21276 
21277 #if PY_MAJOR_VERSION < 3
21278 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
21279  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
21280  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
21281  return -1;
21282 }
21283 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
21284  PyObject *obj = view->obj;
21285  if (!obj) return;
21286  if (PyObject_CheckBuffer(obj)) {
21287  PyBuffer_Release(view);
21288  return;
21289  }
21290  if ((0)) {}
21291  view->obj = NULL;
21292  Py_DECREF(obj);
21293 }
21294 #endif
21295 
21296 
21297  /* Print */
21298  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
21299 static PyObject *__Pyx_GetStdout(void) {
21300  PyObject *f = PySys_GetObject((char *)"stdout");
21301  if (!f) {
21302  PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
21303  }
21304  return f;
21305 }
21306 static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
21307  int i;
21308  if (!f) {
21309  if (!(f = __Pyx_GetStdout()))
21310  return -1;
21311  }
21312  Py_INCREF(f);
21313  for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
21314  PyObject* v;
21315  if (PyFile_SoftSpace(f, 1)) {
21316  if (PyFile_WriteString(" ", f) < 0)
21317  goto error;
21318  }
21319  v = PyTuple_GET_ITEM(arg_tuple, i);
21320  if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
21321  goto error;
21322  if (PyString_Check(v)) {
21323  char *s = PyString_AsString(v);
21324  Py_ssize_t len = PyString_Size(v);
21325  if (len > 0) {
21326  switch (s[len-1]) {
21327  case ' ': break;
21328  case '\f': case '\r': case '\n': case '\t': case '\v':
21329  PyFile_SoftSpace(f, 0);
21330  break;
21331  default: break;
21332  }
21333  }
21334  }
21335  }
21336  if (newline) {
21337  if (PyFile_WriteString("\n", f) < 0)
21338  goto error;
21339  PyFile_SoftSpace(f, 0);
21340  }
21341  Py_DECREF(f);
21342  return 0;
21343 error:
21344  Py_DECREF(f);
21345  return -1;
21346 }
21347 #else
21348 static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
21349  PyObject* kwargs = 0;
21350  PyObject* result = 0;
21351  PyObject* end_string;
21352  if (unlikely(!__pyx_print)) {
21353  __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
21354  if (!__pyx_print)
21355  return -1;
21356  }
21357  if (stream) {
21358  kwargs = PyDict_New();
21359  if (unlikely(!kwargs))
21360  return -1;
21361  if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
21362  goto bad;
21363  if (!newline) {
21364  end_string = PyUnicode_FromStringAndSize(" ", 1);
21365  if (unlikely(!end_string))
21366  goto bad;
21367  if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
21368  Py_DECREF(end_string);
21369  goto bad;
21370  }
21371  Py_DECREF(end_string);
21372  }
21373  } else if (!newline) {
21374  if (unlikely(!__pyx_print_kwargs)) {
21375  __pyx_print_kwargs = PyDict_New();
21376  if (unlikely(!__pyx_print_kwargs))
21377  return -1;
21378  end_string = PyUnicode_FromStringAndSize(" ", 1);
21379  if (unlikely(!end_string))
21380  return -1;
21381  if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
21382  Py_DECREF(end_string);
21383  return -1;
21384  }
21385  Py_DECREF(end_string);
21386  }
21387  kwargs = __pyx_print_kwargs;
21388  }
21389  result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
21390  if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
21391  Py_DECREF(kwargs);
21392  if (!result)
21393  return -1;
21394  Py_DECREF(result);
21395  return 0;
21396 bad:
21397  if (kwargs != __pyx_print_kwargs)
21398  Py_XDECREF(kwargs);
21399  return -1;
21400 }
21401 #endif
21402 
21403 /* CIntFromPyVerify */
21404  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
21405  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
21406 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
21407  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
21408 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
21409  {\
21410  func_type value = func_value;\
21411  if (sizeof(target_type) < sizeof(func_type)) {\
21412  if (unlikely(value != (func_type) (target_type) value)) {\
21413  func_type zero = 0;\
21414  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
21415  return (target_type) -1;\
21416  if (is_unsigned && unlikely(value < zero))\
21417  goto raise_neg_overflow;\
21418  else\
21419  goto raise_overflow;\
21420  }\
21421  }\
21422  return (target_type) value;\
21423  }
21424 
21425 /* Declarations */
21426  #if CYTHON_CCOMPLEX
21427  #ifdef __cplusplus
21428  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
21429  return ::std::complex< float >(x, y);
21430  }
21431  #else
21432  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
21433  return x + y*(__pyx_t_float_complex)_Complex_I;
21434  }
21435  #endif
21436 #else
21437  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
21438  __pyx_t_float_complex z;
21439  z.real = x;
21440  z.imag = y;
21441  return z;
21442  }
21443 #endif
21444 
21445 /* Arithmetic */
21446  #if CYTHON_CCOMPLEX
21447 #else
21448  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21449  return (a.real == b.real) && (a.imag == b.imag);
21450  }
21451  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21452  __pyx_t_float_complex z;
21453  z.real = a.real + b.real;
21454  z.imag = a.imag + b.imag;
21455  return z;
21456  }
21457  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21458  __pyx_t_float_complex z;
21459  z.real = a.real - b.real;
21460  z.imag = a.imag - b.imag;
21461  return z;
21462  }
21463  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21464  __pyx_t_float_complex z;
21465  z.real = a.real * b.real - a.imag * b.imag;
21466  z.imag = a.real * b.imag + a.imag * b.real;
21467  return z;
21468  }
21469  #if 1
21470  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21471  if (b.imag == 0) {
21472  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
21473  } else if (fabsf(b.real) >= fabsf(b.imag)) {
21474  if (b.real == 0 && b.imag == 0) {
21475  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
21476  } else {
21477  float r = b.imag / b.real;
21478  float s = (float)(1.0) / (b.real + b.imag * r);
21479  return __pyx_t_float_complex_from_parts(
21480  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
21481  }
21482  } else {
21483  float r = b.real / b.imag;
21484  float s = (float)(1.0) / (b.imag + b.real * r);
21485  return __pyx_t_float_complex_from_parts(
21486  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
21487  }
21488  }
21489  #else
21490  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21491  if (b.imag == 0) {
21492  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
21493  } else {
21494  float denom = b.real * b.real + b.imag * b.imag;
21495  return __pyx_t_float_complex_from_parts(
21496  (a.real * b.real + a.imag * b.imag) / denom,
21497  (a.imag * b.real - a.real * b.imag) / denom);
21498  }
21499  }
21500  #endif
21501  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
21502  __pyx_t_float_complex z;
21503  z.real = -a.real;
21504  z.imag = -a.imag;
21505  return z;
21506  }
21507  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
21508  return (a.real == 0) && (a.imag == 0);
21509  }
21510  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
21511  __pyx_t_float_complex z;
21512  z.real = a.real;
21513  z.imag = -a.imag;
21514  return z;
21515  }
21516  #if 1
21517  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
21518  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
21519  return sqrtf(z.real*z.real + z.imag*z.imag);
21520  #else
21521  return hypotf(z.real, z.imag);
21522  #endif
21523  }
21524  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
21525  __pyx_t_float_complex z;
21526  float r, lnr, theta, z_r, z_theta;
21527  if (b.imag == 0 && b.real == (int)b.real) {
21528  if (b.real < 0) {
21529  float denom = a.real * a.real + a.imag * a.imag;
21530  a.real = a.real / denom;
21531  a.imag = -a.imag / denom;
21532  b.real = -b.real;
21533  }
21534  switch ((int)b.real) {
21535  case 0:
21536  z.real = 1;
21537  z.imag = 0;
21538  return z;
21539  case 1:
21540  return a;
21541  case 2:
21542  return __Pyx_c_prod_float(a, a);
21543  case 3:
21544  z = __Pyx_c_prod_float(a, a);
21545  return __Pyx_c_prod_float(z, a);
21546  case 4:
21547  z = __Pyx_c_prod_float(a, a);
21548  return __Pyx_c_prod_float(z, z);
21549  }
21550  }
21551  if (a.imag == 0) {
21552  if (a.real == 0) {
21553  return a;
21554  } else if (b.imag == 0) {
21555  z.real = powf(a.real, b.real);
21556  z.imag = 0;
21557  return z;
21558  } else if (a.real > 0) {
21559  r = a.real;
21560  theta = 0;
21561  } else {
21562  r = -a.real;
21563  theta = atan2f(0.0, -1.0);
21564  }
21565  } else {
21566  r = __Pyx_c_abs_float(a);
21567  theta = atan2f(a.imag, a.real);
21568  }
21569  lnr = logf(r);
21570  z_r = expf(lnr * b.real - theta * b.imag);
21571  z_theta = theta * b.real + lnr * b.imag;
21572  z.real = z_r * cosf(z_theta);
21573  z.imag = z_r * sinf(z_theta);
21574  return z;
21575  }
21576  #endif
21577 #endif
21578 
21579 /* Declarations */
21580  #if CYTHON_CCOMPLEX
21581  #ifdef __cplusplus
21582  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
21583  return ::std::complex< double >(x, y);
21584  }
21585  #else
21586  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
21587  return x + y*(__pyx_t_double_complex)_Complex_I;
21588  }
21589  #endif
21590 #else
21591  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
21592  __pyx_t_double_complex z;
21593  z.real = x;
21594  z.imag = y;
21595  return z;
21596  }
21597 #endif
21598 
21599 /* Arithmetic */
21600  #if CYTHON_CCOMPLEX
21601 #else
21602  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21603  return (a.real == b.real) && (a.imag == b.imag);
21604  }
21605  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21606  __pyx_t_double_complex z;
21607  z.real = a.real + b.real;
21608  z.imag = a.imag + b.imag;
21609  return z;
21610  }
21611  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21612  __pyx_t_double_complex z;
21613  z.real = a.real - b.real;
21614  z.imag = a.imag - b.imag;
21615  return z;
21616  }
21617  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21618  __pyx_t_double_complex z;
21619  z.real = a.real * b.real - a.imag * b.imag;
21620  z.imag = a.real * b.imag + a.imag * b.real;
21621  return z;
21622  }
21623  #if 1
21624  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21625  if (b.imag == 0) {
21626  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
21627  } else if (fabs(b.real) >= fabs(b.imag)) {
21628  if (b.real == 0 && b.imag == 0) {
21629  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
21630  } else {
21631  double r = b.imag / b.real;
21632  double s = (double)(1.0) / (b.real + b.imag * r);
21633  return __pyx_t_double_complex_from_parts(
21634  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
21635  }
21636  } else {
21637  double r = b.real / b.imag;
21638  double s = (double)(1.0) / (b.imag + b.real * r);
21639  return __pyx_t_double_complex_from_parts(
21640  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
21641  }
21642  }
21643  #else
21644  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21645  if (b.imag == 0) {
21646  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
21647  } else {
21648  double denom = b.real * b.real + b.imag * b.imag;
21649  return __pyx_t_double_complex_from_parts(
21650  (a.real * b.real + a.imag * b.imag) / denom,
21651  (a.imag * b.real - a.real * b.imag) / denom);
21652  }
21653  }
21654  #endif
21655  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
21656  __pyx_t_double_complex z;
21657  z.real = -a.real;
21658  z.imag = -a.imag;
21659  return z;
21660  }
21661  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
21662  return (a.real == 0) && (a.imag == 0);
21663  }
21664  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
21665  __pyx_t_double_complex z;
21666  z.real = a.real;
21667  z.imag = -a.imag;
21668  return z;
21669  }
21670  #if 1
21671  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
21672  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
21673  return sqrt(z.real*z.real + z.imag*z.imag);
21674  #else
21675  return hypot(z.real, z.imag);
21676  #endif
21677  }
21678  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
21679  __pyx_t_double_complex z;
21680  double r, lnr, theta, z_r, z_theta;
21681  if (b.imag == 0 && b.real == (int)b.real) {
21682  if (b.real < 0) {
21683  double denom = a.real * a.real + a.imag * a.imag;
21684  a.real = a.real / denom;
21685  a.imag = -a.imag / denom;
21686  b.real = -b.real;
21687  }
21688  switch ((int)b.real) {
21689  case 0:
21690  z.real = 1;
21691  z.imag = 0;
21692  return z;
21693  case 1:
21694  return a;
21695  case 2:
21696  return __Pyx_c_prod_double(a, a);
21697  case 3:
21698  z = __Pyx_c_prod_double(a, a);
21699  return __Pyx_c_prod_double(z, a);
21700  case 4:
21701  z = __Pyx_c_prod_double(a, a);
21702  return __Pyx_c_prod_double(z, z);
21703  }
21704  }
21705  if (a.imag == 0) {
21706  if (a.real == 0) {
21707  return a;
21708  } else if (b.imag == 0) {
21709  z.real = pow(a.real, b.real);
21710  z.imag = 0;
21711  return z;
21712  } else if (a.real > 0) {
21713  r = a.real;
21714  theta = 0;
21715  } else {
21716  r = -a.real;
21717  theta = atan2(0.0, -1.0);
21718  }
21719  } else {
21720  r = __Pyx_c_abs_double(a);
21721  theta = atan2(a.imag, a.real);
21722  }
21723  lnr = log(r);
21724  z_r = exp(lnr * b.real - theta * b.imag);
21725  z_theta = theta * b.real + lnr * b.imag;
21726  z.real = z_r * cos(z_theta);
21727  z.imag = z_r * sin(z_theta);
21728  return z;
21729  }
21730  #endif
21731 #endif
21732 
21733 /* CIntToPy */
21734  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
21735 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21736 #pragma GCC diagnostic push
21737 #pragma GCC diagnostic ignored "-Wconversion"
21738 #endif
21739  const long neg_one = (long) -1, const_zero = (long) 0;
21740 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21741 #pragma GCC diagnostic pop
21742 #endif
21743  const int is_unsigned = neg_one > const_zero;
21744  if (is_unsigned) {
21745  if (sizeof(long) < sizeof(long)) {
21746  return PyInt_FromLong((long) value);
21747  } else if (sizeof(long) <= sizeof(unsigned long)) {
21748  return PyLong_FromUnsignedLong((unsigned long) value);
21749 #ifdef HAVE_LONG_LONG
21750  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
21751  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
21752 #endif
21753  }
21754  } else {
21755  if (sizeof(long) <= sizeof(long)) {
21756  return PyInt_FromLong((long) value);
21757 #ifdef HAVE_LONG_LONG
21758  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
21759  return PyLong_FromLongLong((PY_LONG_LONG) value);
21760 #endif
21761  }
21762  }
21763  {
21764  int one = 1; int little = (int)*(unsigned char *)&one;
21765  unsigned char *bytes = (unsigned char *)&value;
21766  return _PyLong_FromByteArray(bytes, sizeof(long),
21767  little, !is_unsigned);
21768  }
21769 }
21770 
21771 /* PrintOne */
21772  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
21773 static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
21774  if (!f) {
21775  if (!(f = __Pyx_GetStdout()))
21776  return -1;
21777  }
21778  Py_INCREF(f);
21779  if (PyFile_SoftSpace(f, 0)) {
21780  if (PyFile_WriteString(" ", f) < 0)
21781  goto error;
21782  }
21783  if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
21784  goto error;
21785  if (PyFile_WriteString("\n", f) < 0)
21786  goto error;
21787  Py_DECREF(f);
21788  return 0;
21789 error:
21790  Py_DECREF(f);
21791  return -1;
21792  /* the line below is just to avoid C compiler
21793  * warnings about unused functions */
21794  return __Pyx_Print(f, NULL, 0);
21795 }
21796 #else
21797 static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
21798  int res;
21799  PyObject* arg_tuple = PyTuple_Pack(1, o);
21800  if (unlikely(!arg_tuple))
21801  return -1;
21802  res = __Pyx_Print(stream, arg_tuple, 1);
21803  Py_DECREF(arg_tuple);
21804  return res;
21805 }
21806 #endif
21807 
21808 /* CIntFromPy */
21809  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
21810 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21811 #pragma GCC diagnostic push
21812 #pragma GCC diagnostic ignored "-Wconversion"
21813 #endif
21814  const int neg_one = (int) -1, const_zero = (int) 0;
21815 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
21816 #pragma GCC diagnostic pop
21817 #endif
21818  const int is_unsigned = neg_one > const_zero;
21819 #if PY_MAJOR_VERSION < 3
21820  if (likely(PyInt_Check(x))) {
21821  if (sizeof(int) < sizeof(long)) {
21822  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
21823  } else {
21824  long val = PyInt_AS_LONG(x);
21825  if (is_unsigned && unlikely(val < 0)) {
21826  goto raise_neg_overflow;
21827  }
21828  return (int) val;
21829  }
21830  } else
21831 #endif
21832  if (likely(PyLong_Check(x))) {
21833  if (is_unsigned) {
21834 #if CYTHON_USE_PYLONG_INTERNALS
21835  const digit* digits = ((PyLongObject*)x)->ob_digit;
21836  switch (Py_SIZE(x)) {
21837  case 0: return (int) 0;
21838  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
21839  case 2:
21840  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
21841  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21842  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21843  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
21844  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
21845  }
21846  }
21847  break;
21848  case 3:
21849  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
21850  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21851  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21852  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
21853  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
21854  }
21855  }
21856  break;
21857  case 4:
21858  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
21859  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21860  __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])))
21861  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
21862  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
21863  }
21864  }
21865  break;
21866  }
21867 #endif
21868 #if CYTHON_COMPILING_IN_CPYTHON
21869  if (unlikely(Py_SIZE(x) < 0)) {
21870  goto raise_neg_overflow;
21871  }
21872 #else
21873  {
21874  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
21875  if (unlikely(result < 0))
21876  return (int) -1;
21877  if (unlikely(result == 1))
21878  goto raise_neg_overflow;
21879  }
21880 #endif
21881  if (sizeof(int) <= sizeof(unsigned long)) {
21882  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
21883 #ifdef HAVE_LONG_LONG
21884  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
21885  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
21886 #endif
21887  }
21888  } else {
21889 #if CYTHON_USE_PYLONG_INTERNALS
21890  const digit* digits = ((PyLongObject*)x)->ob_digit;
21891  switch (Py_SIZE(x)) {
21892  case 0: return (int) 0;
21893  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
21894  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
21895  case -2:
21896  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
21897  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21898  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21899  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
21900  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21901  }
21902  }
21903  break;
21904  case 2:
21905  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
21906  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
21907  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21908  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
21909  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21910  }
21911  }
21912  break;
21913  case -3:
21914  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
21915  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21916  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21917  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
21918  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21919  }
21920  }
21921  break;
21922  case 3:
21923  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
21924  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
21925  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
21926  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
21927  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21928  }
21929  }
21930  break;
21931  case -4:
21932  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
21933  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21934  __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])))
21935  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
21936  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21937  }
21938  }
21939  break;
21940  case 4:
21941  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
21942  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
21943  __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])))
21944  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
21945  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
21946  }
21947  }
21948  break;
21949  }
21950 #endif
21951  if (sizeof(int) <= sizeof(long)) {
21952  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
21953 #ifdef HAVE_LONG_LONG
21954  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
21955  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
21956 #endif
21957  }
21958  }
21959  {
21960 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
21961  PyErr_SetString(PyExc_RuntimeError,
21962  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
21963 #else
21964  int val;
21965  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
21966  #if PY_MAJOR_VERSION < 3
21967  if (likely(v) && !PyLong_Check(v)) {
21968  PyObject *tmp = v;
21969  v = PyNumber_Long(tmp);
21970  Py_DECREF(tmp);
21971  }
21972  #endif
21973  if (likely(v)) {
21974  int one = 1; int is_little = (int)*(unsigned char *)&one;
21975  unsigned char *bytes = (unsigned char *)&val;
21976  int ret = _PyLong_AsByteArray((PyLongObject *)v,
21977  bytes, sizeof(val),
21978  is_little, !is_unsigned);
21979  Py_DECREF(v);
21980  if (likely(!ret))
21981  return val;
21982  }
21983 #endif
21984  return (int) -1;
21985  }
21986  } else {
21987  int val;
21988  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
21989  if (!tmp) return (int) -1;
21990  val = __Pyx_PyInt_As_int(tmp);
21991  Py_DECREF(tmp);
21992  return val;
21993  }
21994 raise_overflow:
21995  PyErr_SetString(PyExc_OverflowError,
21996  "value too large to convert to int");
21997  return (int) -1;
21998 raise_neg_overflow:
21999  PyErr_SetString(PyExc_OverflowError,
22000  "can't convert negative value to int");
22001  return (int) -1;
22002 }
22003 
22004 /* CIntToPy */
22005  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
22006 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22007 #pragma GCC diagnostic push
22008 #pragma GCC diagnostic ignored "-Wconversion"
22009 #endif
22010  const int neg_one = (int) -1, const_zero = (int) 0;
22011 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22012 #pragma GCC diagnostic pop
22013 #endif
22014  const int is_unsigned = neg_one > const_zero;
22015  if (is_unsigned) {
22016  if (sizeof(int) < sizeof(long)) {
22017  return PyInt_FromLong((long) value);
22018  } else if (sizeof(int) <= sizeof(unsigned long)) {
22019  return PyLong_FromUnsignedLong((unsigned long) value);
22020 #ifdef HAVE_LONG_LONG
22021  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
22022  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
22023 #endif
22024  }
22025  } else {
22026  if (sizeof(int) <= sizeof(long)) {
22027  return PyInt_FromLong((long) value);
22028 #ifdef HAVE_LONG_LONG
22029  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
22030  return PyLong_FromLongLong((PY_LONG_LONG) value);
22031 #endif
22032  }
22033  }
22034  {
22035  int one = 1; int little = (int)*(unsigned char *)&one;
22036  unsigned char *bytes = (unsigned char *)&value;
22037  return _PyLong_FromByteArray(bytes, sizeof(int),
22038  little, !is_unsigned);
22039  }
22040 }
22041 
22042 /* CIntFromPy */
22043  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
22044 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22045 #pragma GCC diagnostic push
22046 #pragma GCC diagnostic ignored "-Wconversion"
22047 #endif
22048  const long neg_one = (long) -1, const_zero = (long) 0;
22049 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
22050 #pragma GCC diagnostic pop
22051 #endif
22052  const int is_unsigned = neg_one > const_zero;
22053 #if PY_MAJOR_VERSION < 3
22054  if (likely(PyInt_Check(x))) {
22055  if (sizeof(long) < sizeof(long)) {
22056  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
22057  } else {
22058  long val = PyInt_AS_LONG(x);
22059  if (is_unsigned && unlikely(val < 0)) {
22060  goto raise_neg_overflow;
22061  }
22062  return (long) val;
22063  }
22064  } else
22065 #endif
22066  if (likely(PyLong_Check(x))) {
22067  if (is_unsigned) {
22068 #if CYTHON_USE_PYLONG_INTERNALS
22069  const digit* digits = ((PyLongObject*)x)->ob_digit;
22070  switch (Py_SIZE(x)) {
22071  case 0: return (long) 0;
22072  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
22073  case 2:
22074  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
22075  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22076  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22077  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
22078  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
22079  }
22080  }
22081  break;
22082  case 3:
22083  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
22084  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22085  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22086  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
22087  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
22088  }
22089  }
22090  break;
22091  case 4:
22092  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
22093  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22094  __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])))
22095  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
22096  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
22097  }
22098  }
22099  break;
22100  }
22101 #endif
22102 #if CYTHON_COMPILING_IN_CPYTHON
22103  if (unlikely(Py_SIZE(x) < 0)) {
22104  goto raise_neg_overflow;
22105  }
22106 #else
22107  {
22108  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
22109  if (unlikely(result < 0))
22110  return (long) -1;
22111  if (unlikely(result == 1))
22112  goto raise_neg_overflow;
22113  }
22114 #endif
22115  if (sizeof(long) <= sizeof(unsigned long)) {
22116  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
22117 #ifdef HAVE_LONG_LONG
22118  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
22119  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
22120 #endif
22121  }
22122  } else {
22123 #if CYTHON_USE_PYLONG_INTERNALS
22124  const digit* digits = ((PyLongObject*)x)->ob_digit;
22125  switch (Py_SIZE(x)) {
22126  case 0: return (long) 0;
22127  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
22128  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
22129  case -2:
22130  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
22131  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22132  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22133  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22134  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
22135  }
22136  }
22137  break;
22138  case 2:
22139  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
22140  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
22141  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22142  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22143  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
22144  }
22145  }
22146  break;
22147  case -3:
22148  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22149  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22150  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22151  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22152  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
22153  }
22154  }
22155  break;
22156  case 3:
22157  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
22158  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
22159  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
22160  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22161  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
22162  }
22163  }
22164  break;
22165  case -4:
22166  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22167  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22168  __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])))
22169  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22170  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
22171  }
22172  }
22173  break;
22174  case 4:
22175  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
22176  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
22177  __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])))
22178  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22179  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
22180  }
22181  }
22182  break;
22183  }
22184 #endif
22185  if (sizeof(long) <= sizeof(long)) {
22186  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
22187 #ifdef HAVE_LONG_LONG
22188  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
22189  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
22190 #endif
22191  }
22192  }
22193  {
22194 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
22195  PyErr_SetString(PyExc_RuntimeError,
22196  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
22197 #else
22198  long val;
22199  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
22200  #if PY_MAJOR_VERSION < 3
22201  if (likely(v) && !PyLong_Check(v)) {
22202  PyObject *tmp = v;
22203  v = PyNumber_Long(tmp);
22204  Py_DECREF(tmp);
22205  }
22206  #endif
22207  if (likely(v)) {
22208  int one = 1; int is_little = (int)*(unsigned char *)&one;
22209  unsigned char *bytes = (unsigned char *)&val;
22210  int ret = _PyLong_AsByteArray((PyLongObject *)v,
22211  bytes, sizeof(val),
22212  is_little, !is_unsigned);
22213  Py_DECREF(v);
22214  if (likely(!ret))
22215  return val;
22216  }
22217 #endif
22218  return (long) -1;
22219  }
22220  } else {
22221  long val;
22222  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
22223  if (!tmp) return (long) -1;
22224  val = __Pyx_PyInt_As_long(tmp);
22225  Py_DECREF(tmp);
22226  return val;
22227  }
22228 raise_overflow:
22229  PyErr_SetString(PyExc_OverflowError,
22230  "value too large to convert to long");
22231  return (long) -1;
22232 raise_neg_overflow:
22233  PyErr_SetString(PyExc_OverflowError,
22234  "can't convert negative value to long");
22235  return (long) -1;
22236 }
22237 
22238 /* FastTypeChecks */
22239  #if CYTHON_COMPILING_IN_CPYTHON
22240 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
22241  while (a) {
22242  a = a->tp_base;
22243  if (a == b)
22244  return 1;
22245  }
22246  return b == &PyBaseObject_Type;
22247 }
22248 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
22249  PyObject *mro;
22250  if (a == b) return 1;
22251  mro = a->tp_mro;
22252  if (likely(mro)) {
22253  Py_ssize_t i, n;
22254  n = PyTuple_GET_SIZE(mro);
22255  for (i = 0; i < n; i++) {
22256  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
22257  return 1;
22258  }
22259  return 0;
22260  }
22261  return __Pyx_InBases(a, b);
22262 }
22263 #if PY_MAJOR_VERSION == 2
22264 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
22265  PyObject *exception, *value, *tb;
22266  int res;
22267  __Pyx_PyThreadState_declare
22268  __Pyx_PyThreadState_assign
22269  __Pyx_ErrFetch(&exception, &value, &tb);
22270  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
22271  if (unlikely(res == -1)) {
22272  PyErr_WriteUnraisable(err);
22273  res = 0;
22274  }
22275  if (!res) {
22276  res = PyObject_IsSubclass(err, exc_type2);
22277  if (unlikely(res == -1)) {
22278  PyErr_WriteUnraisable(err);
22279  res = 0;
22280  }
22281  }
22282  __Pyx_ErrRestore(exception, value, tb);
22283  return res;
22284 }
22285 #else
22286 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
22287  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
22288  if (!res) {
22289  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
22290  }
22291  return res;
22292 }
22293 #endif
22294 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22295  Py_ssize_t i, n;
22296  assert(PyExceptionClass_Check(exc_type));
22297  n = PyTuple_GET_SIZE(tuple);
22298 #if PY_MAJOR_VERSION >= 3
22299  for (i=0; i<n; i++) {
22300  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22301  }
22302 #endif
22303  for (i=0; i<n; i++) {
22304  PyObject *t = PyTuple_GET_ITEM(tuple, i);
22305  #if PY_MAJOR_VERSION < 3
22306  if (likely(exc_type == t)) return 1;
22307  #endif
22308  if (likely(PyExceptionClass_Check(t))) {
22309  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
22310  } else {
22311  }
22312  }
22313  return 0;
22314 }
22315 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
22316  if (likely(err == exc_type)) return 1;
22317  if (likely(PyExceptionClass_Check(err))) {
22318  if (likely(PyExceptionClass_Check(exc_type))) {
22319  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
22320  } else if (likely(PyTuple_Check(exc_type))) {
22321  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
22322  } else {
22323  }
22324  }
22325  return PyErr_GivenExceptionMatches(err, exc_type);
22326 }
22327 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
22328  assert(PyExceptionClass_Check(exc_type1));
22329  assert(PyExceptionClass_Check(exc_type2));
22330  if (likely(err == exc_type1 || err == exc_type2)) return 1;
22331  if (likely(PyExceptionClass_Check(err))) {
22332  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
22333  }
22334  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
22335 }
22336 #endif
22337 
22338 /* SwapException */
22339  #if CYTHON_FAST_THREAD_STATE
22340 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22341  PyObject *tmp_type, *tmp_value, *tmp_tb;
22342  #if CYTHON_USE_EXC_INFO_STACK
22343  _PyErr_StackItem *exc_info = tstate->exc_info;
22344  tmp_type = exc_info->exc_type;
22345  tmp_value = exc_info->exc_value;
22346  tmp_tb = exc_info->exc_traceback;
22347  exc_info->exc_type = *type;
22348  exc_info->exc_value = *value;
22349  exc_info->exc_traceback = *tb;
22350  #else
22351  tmp_type = tstate->exc_type;
22352  tmp_value = tstate->exc_value;
22353  tmp_tb = tstate->exc_traceback;
22354  tstate->exc_type = *type;
22355  tstate->exc_value = *value;
22356  tstate->exc_traceback = *tb;
22357  #endif
22358  *type = tmp_type;
22359  *value = tmp_value;
22360  *tb = tmp_tb;
22361 }
22362 #else
22363 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
22364  PyObject *tmp_type, *tmp_value, *tmp_tb;
22365  PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
22366  PyErr_SetExcInfo(*type, *value, *tb);
22367  *type = tmp_type;
22368  *value = tmp_value;
22369  *tb = tmp_tb;
22370 }
22371 #endif
22372 
22373 /* PyObjectGetMethod */
22374  static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
22375  PyObject *attr;
22376 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
22377  PyTypeObject *tp = Py_TYPE(obj);
22378  PyObject *descr;
22379  descrgetfunc f = NULL;
22380  PyObject **dictptr, *dict;
22381  int meth_found = 0;
22382  assert (*method == NULL);
22383  if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
22384  attr = __Pyx_PyObject_GetAttrStr(obj, name);
22385  goto try_unpack;
22386  }
22387  if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
22388  return 0;
22389  }
22390  descr = _PyType_Lookup(tp, name);
22391  if (likely(descr != NULL)) {
22392  Py_INCREF(descr);
22393 #if PY_MAJOR_VERSION >= 3
22394  #ifdef __Pyx_CyFunction_USED
22395  if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
22396  #else
22397  if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
22398  #endif
22399 #else
22400  #ifdef __Pyx_CyFunction_USED
22401  if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
22402  #else
22403  if (likely(PyFunction_Check(descr)))
22404  #endif
22405 #endif
22406  {
22407  meth_found = 1;
22408  } else {
22409  f = Py_TYPE(descr)->tp_descr_get;
22410  if (f != NULL && PyDescr_IsData(descr)) {
22411  attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
22412  Py_DECREF(descr);
22413  goto try_unpack;
22414  }
22415  }
22416  }
22417  dictptr = _PyObject_GetDictPtr(obj);
22418  if (dictptr != NULL && (dict = *dictptr) != NULL) {
22419  Py_INCREF(dict);
22420  attr = __Pyx_PyDict_GetItemStr(dict, name);
22421  if (attr != NULL) {
22422  Py_INCREF(attr);
22423  Py_DECREF(dict);
22424  Py_XDECREF(descr);
22425  goto try_unpack;
22426  }
22427  Py_DECREF(dict);
22428  }
22429  if (meth_found) {
22430  *method = descr;
22431  return 1;
22432  }
22433  if (f != NULL) {
22434  attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
22435  Py_DECREF(descr);
22436  goto try_unpack;
22437  }
22438  if (descr != NULL) {
22439  *method = descr;
22440  return 0;
22441  }
22442  PyErr_Format(PyExc_AttributeError,
22443 #if PY_MAJOR_VERSION >= 3
22444  "'%.50s' object has no attribute '%U'",
22445  tp->tp_name, name);
22446 #else
22447  "'%.50s' object has no attribute '%.400s'",
22448  tp->tp_name, PyString_AS_STRING(name));
22449 #endif
22450  return 0;
22451 #else
22452  attr = __Pyx_PyObject_GetAttrStr(obj, name);
22453  goto try_unpack;
22454 #endif
22455 try_unpack:
22456 #if CYTHON_UNPACK_METHODS
22457  if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
22458  PyObject *function = PyMethod_GET_FUNCTION(attr);
22459  Py_INCREF(function);
22460  Py_DECREF(attr);
22461  *method = function;
22462  return 1;
22463  }
22464 #endif
22465  *method = attr;
22466  return 0;
22467 }
22468 
22469 /* PyObjectCallMethod1 */
22470  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
22471  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
22472  Py_DECREF(method);
22473  return result;
22474 }
22475 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
22476  PyObject *method = NULL, *result;
22477  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
22478  if (likely(is_method)) {
22479  result = __Pyx_PyObject_Call2Args(method, obj, arg);
22480  Py_DECREF(method);
22481  return result;
22482  }
22483  if (unlikely(!method)) return NULL;
22484  return __Pyx__PyObject_CallMethod1(method, arg);
22485 }
22486 
22487 /* CoroutineBase */
22488  #include <structmember.h>
22489 #include <frameobject.h>
22490 #if PY_VERSION_HEX >= 0x030b00a6
22491  #ifndef Py_BUILD_CORE
22492  #define Py_BUILD_CORE 1
22493  #endif
22494  #include "internal/pycore_frame.h"
22495 #endif
22496 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
22497 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
22498  PyObject *et, *ev, *tb;
22499  PyObject *value = NULL;
22500  __Pyx_ErrFetch(&et, &ev, &tb);
22501  if (!et) {
22502  Py_XDECREF(tb);
22503  Py_XDECREF(ev);
22504  Py_INCREF(Py_None);
22505  *pvalue = Py_None;
22506  return 0;
22507  }
22508  if (likely(et == PyExc_StopIteration)) {
22509  if (!ev) {
22510  Py_INCREF(Py_None);
22511  value = Py_None;
22512  }
22513 #if PY_VERSION_HEX >= 0x030300A0
22514  else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
22515  value = ((PyStopIterationObject *)ev)->value;
22516  Py_INCREF(value);
22517  Py_DECREF(ev);
22518  }
22519 #endif
22520  else if (unlikely(PyTuple_Check(ev))) {
22521  if (PyTuple_GET_SIZE(ev) >= 1) {
22522 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
22523  value = PyTuple_GET_ITEM(ev, 0);
22524  Py_INCREF(value);
22525 #else
22526  value = PySequence_ITEM(ev, 0);
22527 #endif
22528  } else {
22529  Py_INCREF(Py_None);
22530  value = Py_None;
22531  }
22532  Py_DECREF(ev);
22533  }
22534  else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
22535  value = ev;
22536  }
22537  if (likely(value)) {
22538  Py_XDECREF(tb);
22539  Py_DECREF(et);
22540  *pvalue = value;
22541  return 0;
22542  }
22543  } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
22544  __Pyx_ErrRestore(et, ev, tb);
22545  return -1;
22546  }
22547  PyErr_NormalizeException(&et, &ev, &tb);
22548  if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
22549  __Pyx_ErrRestore(et, ev, tb);
22550  return -1;
22551  }
22552  Py_XDECREF(tb);
22553  Py_DECREF(et);
22554 #if PY_VERSION_HEX >= 0x030300A0
22555  value = ((PyStopIterationObject *)ev)->value;
22556  Py_INCREF(value);
22557  Py_DECREF(ev);
22558 #else
22559  {
22560  PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
22561  Py_DECREF(ev);
22562  if (likely(args)) {
22563  value = PySequence_GetItem(args, 0);
22564  Py_DECREF(args);
22565  }
22566  if (unlikely(!value)) {
22567  __Pyx_ErrRestore(NULL, NULL, NULL);
22568  Py_INCREF(Py_None);
22569  value = Py_None;
22570  }
22571  }
22572 #endif
22573  *pvalue = value;
22574  return 0;
22575 }
22576 static CYTHON_INLINE
22577 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
22578  PyObject *t, *v, *tb;
22579  t = exc_state->exc_type;
22580  v = exc_state->exc_value;
22581  tb = exc_state->exc_traceback;
22582  exc_state->exc_type = NULL;
22583  exc_state->exc_value = NULL;
22584  exc_state->exc_traceback = NULL;
22585  Py_XDECREF(t);
22586  Py_XDECREF(v);
22587  Py_XDECREF(tb);
22588 }
22589 #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
22590 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
22591  const char *msg;
22592  if ((0)) {
22593  #ifdef __Pyx_Coroutine_USED
22594  } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
22595  msg = "coroutine already executing";
22596  #endif
22597  #ifdef __Pyx_AsyncGen_USED
22598  } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
22599  msg = "async generator already executing";
22600  #endif
22601  } else {
22602  msg = "generator already executing";
22603  }
22604  PyErr_SetString(PyExc_ValueError, msg);
22605 }
22606 #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
22607 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
22608  const char *msg;
22609  if ((0)) {
22610  #ifdef __Pyx_Coroutine_USED
22611  } else if (__Pyx_Coroutine_Check(gen)) {
22612  msg = "can't send non-None value to a just-started coroutine";
22613  #endif
22614  #ifdef __Pyx_AsyncGen_USED
22615  } else if (__Pyx_AsyncGen_CheckExact(gen)) {
22616  msg = "can't send non-None value to a just-started async generator";
22617  #endif
22618  } else {
22619  msg = "can't send non-None value to a just-started generator";
22620  }
22621  PyErr_SetString(PyExc_TypeError, msg);
22622 }
22623 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
22624 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
22625  #ifdef __Pyx_Coroutine_USED
22626  if (!closing && __Pyx_Coroutine_Check(gen)) {
22627  PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
22628  } else
22629  #endif
22630  if (value) {
22631  #ifdef __Pyx_AsyncGen_USED
22632  if (__Pyx_AsyncGen_CheckExact(gen))
22633  PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
22634  else
22635  #endif
22636  PyErr_SetNone(PyExc_StopIteration);
22637  }
22638 }
22639 static
22640 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
22641  __Pyx_PyThreadState_declare
22642  PyThreadState *tstate;
22643  __Pyx_ExcInfoStruct *exc_state;
22644  PyObject *retval;
22645  assert(!self->is_running);
22646  if (unlikely(self->resume_label == 0)) {
22647  if (unlikely(value && value != Py_None)) {
22648  return __Pyx_Coroutine_NotStartedError((PyObject*)self);
22649  }
22650  }
22651  if (unlikely(self->resume_label == -1)) {
22652  return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
22653  }
22654 #if CYTHON_FAST_THREAD_STATE
22655  __Pyx_PyThreadState_assign
22656  tstate = __pyx_tstate;
22657 #else
22658  tstate = __Pyx_PyThreadState_Current;
22659 #endif
22660  exc_state = &self->gi_exc_state;
22661  if (exc_state->exc_type) {
22662  #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
22663  #else
22664  if (exc_state->exc_traceback) {
22665  PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
22666  PyFrameObject *f = tb->tb_frame;
22667  assert(f->f_back == NULL);
22668  #if PY_VERSION_HEX >= 0x030B00A1
22669  f->f_back = PyThreadState_GetFrame(tstate);
22670  #else
22671  Py_XINCREF(tstate->frame);
22672  f->f_back = tstate->frame;
22673  #endif
22674  }
22675  #endif
22676  }
22677 #if CYTHON_USE_EXC_INFO_STACK
22678  exc_state->previous_item = tstate->exc_info;
22679  tstate->exc_info = exc_state;
22680 #else
22681  if (exc_state->exc_type) {
22682  __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
22683  } else {
22684  __Pyx_Coroutine_ExceptionClear(exc_state);
22685  __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
22686  }
22687 #endif
22688  self->is_running = 1;
22689  retval = self->body((PyObject *) self, tstate, value);
22690  self->is_running = 0;
22691 #if CYTHON_USE_EXC_INFO_STACK
22692  exc_state = &self->gi_exc_state;
22693  tstate->exc_info = exc_state->previous_item;
22694  exc_state->previous_item = NULL;
22695  __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
22696 #endif
22697  return retval;
22698 }
22699 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
22700  PyObject *exc_tb = exc_state->exc_traceback;
22701  if (likely(exc_tb)) {
22702 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
22703 #else
22704  PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
22705  PyFrameObject *f = tb->tb_frame;
22706  Py_CLEAR(f->f_back);
22707 #endif
22708  }
22709 }
22710 static CYTHON_INLINE
22711 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
22712  if (unlikely(!retval)) {
22713  __Pyx_PyThreadState_declare
22714  __Pyx_PyThreadState_assign
22715  if (!__Pyx_PyErr_Occurred()) {
22716  PyObject *exc = PyExc_StopIteration;
22717  #ifdef __Pyx_AsyncGen_USED
22718  if (__Pyx_AsyncGen_CheckExact(gen))
22719  exc = __Pyx_PyExc_StopAsyncIteration;
22720  #endif
22721  __Pyx_PyErr_SetNone(exc);
22722  }
22723  }
22724  return retval;
22725 }
22726 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
22727 static CYTHON_INLINE
22728 PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
22729 #if PY_VERSION_HEX <= 0x030A00A1
22730  return _PyGen_Send(gen, arg);
22731 #else
22732  PyObject *result;
22733  if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
22734  if (PyAsyncGen_CheckExact(gen)) {
22735  assert(result == Py_None);
22736  PyErr_SetNone(PyExc_StopAsyncIteration);
22737  }
22738  else if (result == Py_None) {
22739  PyErr_SetNone(PyExc_StopIteration);
22740  }
22741  else {
22742  _PyGen_SetStopIterationValue(result);
22743  }
22744  Py_CLEAR(result);
22745  }
22746  return result;
22747 #endif
22748 }
22749 #endif
22750 static CYTHON_INLINE
22751 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
22752  PyObject *ret;
22753  PyObject *val = NULL;
22754  __Pyx_Coroutine_Undelegate(gen);
22755  __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
22756  ret = __Pyx_Coroutine_SendEx(gen, val, 0);
22757  Py_XDECREF(val);
22758  return ret;
22759 }
22760 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
22761  PyObject *retval;
22762  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
22763  PyObject *yf = gen->yieldfrom;
22764  if (unlikely(gen->is_running))
22765  return __Pyx_Coroutine_AlreadyRunningError(gen);
22766  if (yf) {
22767  PyObject *ret;
22768  gen->is_running = 1;
22769  #ifdef __Pyx_Generator_USED
22770  if (__Pyx_Generator_CheckExact(yf)) {
22771  ret = __Pyx_Coroutine_Send(yf, value);
22772  } else
22773  #endif
22774  #ifdef __Pyx_Coroutine_USED
22775  if (__Pyx_Coroutine_Check(yf)) {
22776  ret = __Pyx_Coroutine_Send(yf, value);
22777  } else
22778  #endif
22779  #ifdef __Pyx_AsyncGen_USED
22780  if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
22781  ret = __Pyx_async_gen_asend_send(yf, value);
22782  } else
22783  #endif
22784  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
22785  if (PyGen_CheckExact(yf)) {
22786  ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
22787  } else
22788  #endif
22789  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
22790  if (PyCoro_CheckExact(yf)) {
22791  ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
22792  } else
22793  #endif
22794  {
22795  if (value == Py_None)
22796  ret = Py_TYPE(yf)->tp_iternext(yf);
22797  else
22798  ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
22799  }
22800  gen->is_running = 0;
22801  if (likely(ret)) {
22802  return ret;
22803  }
22804  retval = __Pyx_Coroutine_FinishDelegation(gen);
22805  } else {
22806  retval = __Pyx_Coroutine_SendEx(gen, value, 0);
22807  }
22808  return __Pyx_Coroutine_MethodReturn(self, retval);
22809 }
22810 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
22811  PyObject *retval = NULL;
22812  int err = 0;
22813  #ifdef __Pyx_Generator_USED
22814  if (__Pyx_Generator_CheckExact(yf)) {
22815  retval = __Pyx_Coroutine_Close(yf);
22816  if (!retval)
22817  return -1;
22818  } else
22819  #endif
22820  #ifdef __Pyx_Coroutine_USED
22821  if (__Pyx_Coroutine_Check(yf)) {
22822  retval = __Pyx_Coroutine_Close(yf);
22823  if (!retval)
22824  return -1;
22825  } else
22826  if (__Pyx_CoroutineAwait_CheckExact(yf)) {
22827  retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
22828  if (!retval)
22829  return -1;
22830  } else
22831  #endif
22832  #ifdef __Pyx_AsyncGen_USED
22833  if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
22834  retval = __Pyx_async_gen_asend_close(yf, NULL);
22835  } else
22836  if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
22837  retval = __Pyx_async_gen_athrow_close(yf, NULL);
22838  } else
22839  #endif
22840  {
22841  PyObject *meth;
22842  gen->is_running = 1;
22843  meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
22844  if (unlikely(!meth)) {
22845  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
22846  PyErr_WriteUnraisable(yf);
22847  }
22848  PyErr_Clear();
22849  } else {
22850  retval = PyObject_CallFunction(meth, NULL);
22851  Py_DECREF(meth);
22852  if (!retval)
22853  err = -1;
22854  }
22855  gen->is_running = 0;
22856  }
22857  Py_XDECREF(retval);
22858  return err;
22859 }
22860 static PyObject *__Pyx_Generator_Next(PyObject *self) {
22861  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
22862  PyObject *yf = gen->yieldfrom;
22863  if (unlikely(gen->is_running))
22864  return __Pyx_Coroutine_AlreadyRunningError(gen);
22865  if (yf) {
22866  PyObject *ret;
22867  gen->is_running = 1;
22868  #ifdef __Pyx_Generator_USED
22869  if (__Pyx_Generator_CheckExact(yf)) {
22870  ret = __Pyx_Generator_Next(yf);
22871  } else
22872  #endif
22873  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
22874  if (PyGen_CheckExact(yf)) {
22875  ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
22876  } else
22877  #endif
22878  #ifdef __Pyx_Coroutine_USED
22879  if (__Pyx_Coroutine_Check(yf)) {
22880  ret = __Pyx_Coroutine_Send(yf, Py_None);
22881  } else
22882  #endif
22883  ret = Py_TYPE(yf)->tp_iternext(yf);
22884  gen->is_running = 0;
22885  if (likely(ret)) {
22886  return ret;
22887  }
22888  return __Pyx_Coroutine_FinishDelegation(gen);
22889  }
22890  return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
22891 }
22892 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
22893  return __Pyx_Coroutine_Close(self);
22894 }
22895 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
22896  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
22897  PyObject *retval, *raised_exception;
22898  PyObject *yf = gen->yieldfrom;
22899  int err = 0;
22900  if (unlikely(gen->is_running))
22901  return __Pyx_Coroutine_AlreadyRunningError(gen);
22902  if (yf) {
22903  Py_INCREF(yf);
22904  err = __Pyx_Coroutine_CloseIter(gen, yf);
22905  __Pyx_Coroutine_Undelegate(gen);
22906  Py_DECREF(yf);
22907  }
22908  if (err == 0)
22909  PyErr_SetNone(PyExc_GeneratorExit);
22910  retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
22911  if (unlikely(retval)) {
22912  const char *msg;
22913  Py_DECREF(retval);
22914  if ((0)) {
22915  #ifdef __Pyx_Coroutine_USED
22916  } else if (__Pyx_Coroutine_Check(self)) {
22917  msg = "coroutine ignored GeneratorExit";
22918  #endif
22919  #ifdef __Pyx_AsyncGen_USED
22920  } else if (__Pyx_AsyncGen_CheckExact(self)) {
22921 #if PY_VERSION_HEX < 0x03060000
22922  msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
22923 #else
22924  msg = "async generator ignored GeneratorExit";
22925 #endif
22926  #endif
22927  } else {
22928  msg = "generator ignored GeneratorExit";
22929  }
22930  PyErr_SetString(PyExc_RuntimeError, msg);
22931  return NULL;
22932  }
22933  raised_exception = PyErr_Occurred();
22934  if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
22935  if (raised_exception) PyErr_Clear();
22936  Py_INCREF(Py_None);
22937  return Py_None;
22938  }
22939  return NULL;
22940 }
22941 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
22942  PyObject *args, int close_on_genexit) {
22943  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
22944  PyObject *yf = gen->yieldfrom;
22945  if (unlikely(gen->is_running))
22946  return __Pyx_Coroutine_AlreadyRunningError(gen);
22947  if (yf) {
22948  PyObject *ret;
22949  Py_INCREF(yf);
22950  if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
22951  int err = __Pyx_Coroutine_CloseIter(gen, yf);
22952  Py_DECREF(yf);
22953  __Pyx_Coroutine_Undelegate(gen);
22954  if (err < 0)
22955  return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
22956  goto throw_here;
22957  }
22958  gen->is_running = 1;
22959  if (0
22960  #ifdef __Pyx_Generator_USED
22961  || __Pyx_Generator_CheckExact(yf)
22962  #endif
22963  #ifdef __Pyx_Coroutine_USED
22964  || __Pyx_Coroutine_Check(yf)
22965  #endif
22966  ) {
22967  ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
22968  #ifdef __Pyx_Coroutine_USED
22969  } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
22970  ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
22971  #endif
22972  } else {
22973  PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
22974  if (unlikely(!meth)) {
22975  Py_DECREF(yf);
22976  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
22977  gen->is_running = 0;
22978  return NULL;
22979  }
22980  PyErr_Clear();
22981  __Pyx_Coroutine_Undelegate(gen);
22982  gen->is_running = 0;
22983  goto throw_here;
22984  }
22985  if (likely(args)) {
22986  ret = PyObject_CallObject(meth, args);
22987  } else {
22988  ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
22989  }
22990  Py_DECREF(meth);
22991  }
22992  gen->is_running = 0;
22993  Py_DECREF(yf);
22994  if (!ret) {
22995  ret = __Pyx_Coroutine_FinishDelegation(gen);
22996  }
22997  return __Pyx_Coroutine_MethodReturn(self, ret);
22998  }
22999 throw_here:
23000  __Pyx_Raise(typ, val, tb, NULL);
23001  return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
23002 }
23003 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
23004  PyObject *typ;
23005  PyObject *val = NULL;
23006  PyObject *tb = NULL;
23007  if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
23008  return NULL;
23009  return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
23010 }
23011 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
23012  Py_VISIT(exc_state->exc_type);
23013  Py_VISIT(exc_state->exc_value);
23014  Py_VISIT(exc_state->exc_traceback);
23015  return 0;
23016 }
23017 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
23018  Py_VISIT(gen->closure);
23019  Py_VISIT(gen->classobj);
23020  Py_VISIT(gen->yieldfrom);
23021  return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
23022 }
23023 static int __Pyx_Coroutine_clear(PyObject *self) {
23024  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
23025  Py_CLEAR(gen->closure);
23026  Py_CLEAR(gen->classobj);
23027  Py_CLEAR(gen->yieldfrom);
23028  __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
23029 #ifdef __Pyx_AsyncGen_USED
23030  if (__Pyx_AsyncGen_CheckExact(self)) {
23031  Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
23032  }
23033 #endif
23034  Py_CLEAR(gen->gi_code);
23035  Py_CLEAR(gen->gi_frame);
23036  Py_CLEAR(gen->gi_name);
23037  Py_CLEAR(gen->gi_qualname);
23038  Py_CLEAR(gen->gi_modulename);
23039  return 0;
23040 }
23041 static void __Pyx_Coroutine_dealloc(PyObject *self) {
23042  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
23043  PyObject_GC_UnTrack(gen);
23044  if (gen->gi_weakreflist != NULL)
23045  PyObject_ClearWeakRefs(self);
23046  if (gen->resume_label >= 0) {
23047  PyObject_GC_Track(self);
23048 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
23049  if (PyObject_CallFinalizerFromDealloc(self))
23050 #else
23051  Py_TYPE(gen)->tp_del(self);
23052  if (Py_REFCNT(self) > 0)
23053 #endif
23054  {
23055  return;
23056  }
23057  PyObject_GC_UnTrack(self);
23058  }
23059 #ifdef __Pyx_AsyncGen_USED
23060  if (__Pyx_AsyncGen_CheckExact(self)) {
23061  /* We have to handle this case for asynchronous generators
23062  right here, because this code has to be between UNTRACK
23063  and GC_Del. */
23064  Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
23065  }
23066 #endif
23067  __Pyx_Coroutine_clear(self);
23068  PyObject_GC_Del(gen);
23069 }
23070 static void __Pyx_Coroutine_del(PyObject *self) {
23071  PyObject *error_type, *error_value, *error_traceback;
23072  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
23073  __Pyx_PyThreadState_declare
23074  if (gen->resume_label < 0) {
23075  return;
23076  }
23077 #if !CYTHON_USE_TP_FINALIZE
23078  assert(self->ob_refcnt == 0);
23079  __Pyx_SET_REFCNT(self, 1);
23080 #endif
23081  __Pyx_PyThreadState_assign
23082  __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
23083 #ifdef __Pyx_AsyncGen_USED
23084  if (__Pyx_AsyncGen_CheckExact(self)) {
23085  __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
23086  PyObject *finalizer = agen->ag_finalizer;
23087  if (finalizer && !agen->ag_closed) {
23088  PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
23089  if (unlikely(!res)) {
23090  PyErr_WriteUnraisable(self);
23091  } else {
23092  Py_DECREF(res);
23093  }
23094  __Pyx_ErrRestore(error_type, error_value, error_traceback);
23095  return;
23096  }
23097  }
23098 #endif
23099  if (unlikely(gen->resume_label == 0 && !error_value)) {
23100 #ifdef __Pyx_Coroutine_USED
23101 #ifdef __Pyx_Generator_USED
23102  if (!__Pyx_Generator_CheckExact(self))
23103 #endif
23104  {
23105  PyObject_GC_UnTrack(self);
23106 #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
23107  if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
23108  PyErr_WriteUnraisable(self);
23109 #else
23110  {PyObject *msg;
23111  char *cmsg;
23112  #if CYTHON_COMPILING_IN_PYPY
23113  msg = NULL;
23114  cmsg = (char*) "coroutine was never awaited";
23115  #else
23116  char *cname;
23117  PyObject *qualname;
23118  qualname = gen->gi_qualname;
23119  cname = PyString_AS_STRING(qualname);
23120  msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
23121  if (unlikely(!msg)) {
23122  PyErr_Clear();
23123  cmsg = (char*) "coroutine was never awaited";
23124  } else {
23125  cmsg = PyString_AS_STRING(msg);
23126  }
23127  #endif
23128  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
23129  PyErr_WriteUnraisable(self);
23130  Py_XDECREF(msg);}
23131 #endif
23132  PyObject_GC_Track(self);
23133  }
23134 #endif
23135  } else {
23136  PyObject *res = __Pyx_Coroutine_Close(self);
23137  if (unlikely(!res)) {
23138  if (PyErr_Occurred())
23139  PyErr_WriteUnraisable(self);
23140  } else {
23141  Py_DECREF(res);
23142  }
23143  }
23144  __Pyx_ErrRestore(error_type, error_value, error_traceback);
23145 #if !CYTHON_USE_TP_FINALIZE
23146  assert(Py_REFCNT(self) > 0);
23147  if (--self->ob_refcnt == 0) {
23148  return;
23149  }
23150  {
23151  Py_ssize_t refcnt = Py_REFCNT(self);
23152  _Py_NewReference(self);
23153  __Pyx_SET_REFCNT(self, refcnt);
23154  }
23155 #if CYTHON_COMPILING_IN_CPYTHON
23156  assert(PyType_IS_GC(Py_TYPE(self)) &&
23157  _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
23158  _Py_DEC_REFTOTAL;
23159 #endif
23160 #ifdef COUNT_ALLOCS
23161  --Py_TYPE(self)->tp_frees;
23162  --Py_TYPE(self)->tp_allocs;
23163 #endif
23164 #endif
23165 }
23166 static PyObject *
23167 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
23168 {
23169  PyObject *name = self->gi_name;
23170  if (unlikely(!name)) name = Py_None;
23171  Py_INCREF(name);
23172  return name;
23173 }
23174 static int
23175 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
23176 {
23177  PyObject *tmp;
23178 #if PY_MAJOR_VERSION >= 3
23179  if (unlikely(value == NULL || !PyUnicode_Check(value)))
23180 #else
23181  if (unlikely(value == NULL || !PyString_Check(value)))
23182 #endif
23183  {
23184  PyErr_SetString(PyExc_TypeError,
23185  "__name__ must be set to a string object");
23186  return -1;
23187  }
23188  tmp = self->gi_name;
23189  Py_INCREF(value);
23190  self->gi_name = value;
23191  Py_XDECREF(tmp);
23192  return 0;
23193 }
23194 static PyObject *
23195 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
23196 {
23197  PyObject *name = self->gi_qualname;
23198  if (unlikely(!name)) name = Py_None;
23199  Py_INCREF(name);
23200  return name;
23201 }
23202 static int
23203 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
23204 {
23205  PyObject *tmp;
23206 #if PY_MAJOR_VERSION >= 3
23207  if (unlikely(value == NULL || !PyUnicode_Check(value)))
23208 #else
23209  if (unlikely(value == NULL || !PyString_Check(value)))
23210 #endif
23211  {
23212  PyErr_SetString(PyExc_TypeError,
23213  "__qualname__ must be set to a string object");
23214  return -1;
23215  }
23216  tmp = self->gi_qualname;
23217  Py_INCREF(value);
23218  self->gi_qualname = value;
23219  Py_XDECREF(tmp);
23220  return 0;
23221 }
23222 static PyObject *
23223 __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
23224 {
23225  PyObject *frame = self->gi_frame;
23226  if (!frame) {
23227  if (unlikely(!self->gi_code)) {
23228  Py_RETURN_NONE;
23229  }
23230  frame = (PyObject *) PyFrame_New(
23231  PyThreadState_Get(), /*PyThreadState *tstate,*/
23232  (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
23233  __pyx_d, /*PyObject *globals,*/
23234  0 /*PyObject *locals*/
23235  );
23236  if (unlikely(!frame))
23237  return NULL;
23238  self->gi_frame = frame;
23239  }
23240  Py_INCREF(frame);
23241  return frame;
23242 }
23243 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
23244  PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
23245  PyObject *name, PyObject *qualname, PyObject *module_name) {
23246  __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
23247  if (unlikely(!gen))
23248  return NULL;
23249  return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
23250 }
23251 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
23252  __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
23253  PyObject *name, PyObject *qualname, PyObject *module_name) {
23254  gen->body = body;
23255  gen->closure = closure;
23256  Py_XINCREF(closure);
23257  gen->is_running = 0;
23258  gen->resume_label = 0;
23259  gen->classobj = NULL;
23260  gen->yieldfrom = NULL;
23261  gen->gi_exc_state.exc_type = NULL;
23262  gen->gi_exc_state.exc_value = NULL;
23263  gen->gi_exc_state.exc_traceback = NULL;
23264 #if CYTHON_USE_EXC_INFO_STACK
23265  gen->gi_exc_state.previous_item = NULL;
23266 #endif
23267  gen->gi_weakreflist = NULL;
23268  Py_XINCREF(qualname);
23269  gen->gi_qualname = qualname;
23270  Py_XINCREF(name);
23271  gen->gi_name = name;
23272  Py_XINCREF(module_name);
23273  gen->gi_modulename = module_name;
23274  Py_XINCREF(code);
23275  gen->gi_code = code;
23276  gen->gi_frame = NULL;
23277  PyObject_GC_Track(gen);
23278  return gen;
23279 }
23280 
23281 /* PatchModuleWithCoroutine */
23282  static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
23283 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23284  int result;
23285  PyObject *globals, *result_obj;
23286  globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
23287  result = PyDict_SetItemString(globals, "_cython_coroutine_type",
23288  #ifdef __Pyx_Coroutine_USED
23289  (PyObject*)__pyx_CoroutineType);
23290  #else
23291  Py_None);
23292  #endif
23293  if (unlikely(result < 0)) goto ignore;
23294  result = PyDict_SetItemString(globals, "_cython_generator_type",
23295  #ifdef __Pyx_Generator_USED
23296  (PyObject*)__pyx_GeneratorType);
23297  #else
23298  Py_None);
23299  #endif
23300  if (unlikely(result < 0)) goto ignore;
23301  if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
23302  if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
23303  result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
23304  if (unlikely(!result_obj)) goto ignore;
23305  Py_DECREF(result_obj);
23306  Py_DECREF(globals);
23307  return module;
23308 ignore:
23309  Py_XDECREF(globals);
23310  PyErr_WriteUnraisable(module);
23311  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
23312  Py_DECREF(module);
23313  module = NULL;
23314  }
23315 #else
23316  py_code++;
23317 #endif
23318  return module;
23319 }
23320 
23321 /* PatchGeneratorABC */
23322  #ifndef CYTHON_REGISTER_ABCS
23323 #define CYTHON_REGISTER_ABCS 1
23324 #endif
23325 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23326 static PyObject* __Pyx_patch_abc_module(PyObject *module);
23327 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
23328  module = __Pyx_Coroutine_patch_module(
23329  module, ""
23330 "if _cython_generator_type is not None:\n"
23331 " try: Generator = _module.Generator\n"
23332 " except AttributeError: pass\n"
23333 " else: Generator.register(_cython_generator_type)\n"
23334 "if _cython_coroutine_type is not None:\n"
23335 " try: Coroutine = _module.Coroutine\n"
23336 " except AttributeError: pass\n"
23337 " else: Coroutine.register(_cython_coroutine_type)\n"
23338  );
23339  return module;
23340 }
23341 #endif
23342 static int __Pyx_patch_abc(void) {
23343 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23344  static int abc_patched = 0;
23345  if (CYTHON_REGISTER_ABCS && !abc_patched) {
23346  PyObject *module;
23347  module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
23348  if (!module) {
23349  PyErr_WriteUnraisable(NULL);
23350  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
23351  ((PY_MAJOR_VERSION >= 3) ?
23352  "Cython module failed to register with collections.abc module" :
23353  "Cython module failed to register with collections module"), 1) < 0)) {
23354  return -1;
23355  }
23356  } else {
23357  module = __Pyx_patch_abc_module(module);
23358  abc_patched = 1;
23359  if (unlikely(!module))
23360  return -1;
23361  Py_DECREF(module);
23362  }
23363  module = PyImport_ImportModule("backports_abc");
23364  if (module) {
23365  module = __Pyx_patch_abc_module(module);
23366  Py_XDECREF(module);
23367  }
23368  if (!module) {
23369  PyErr_Clear();
23370  }
23371  }
23372 #else
23373  if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
23374 #endif
23375  return 0;
23376 }
23377 
23378 /* Generator */
23379  static PyMethodDef __pyx_Generator_methods[] = {
23380  {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
23381  (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
23382  {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
23383  (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
23384  {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
23385  (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
23386  {0, 0, 0, 0}
23387 };
23388 static PyMemberDef __pyx_Generator_memberlist[] = {
23389  {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
23390  {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
23391  (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
23392  {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
23393  {0, 0, 0, 0, 0}
23394 };
23395 static PyGetSetDef __pyx_Generator_getsets[] = {
23396  {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
23397  (char*) PyDoc_STR("name of the generator"), 0},
23398  {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
23399  (char*) PyDoc_STR("qualified name of the generator"), 0},
23400  {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
23401  (char*) PyDoc_STR("Frame of the generator"), 0},
23402  {0, 0, 0, 0, 0}
23403 };
23404 static PyTypeObject __pyx_GeneratorType_type = {
23405  PyVarObject_HEAD_INIT(0, 0)
23406  "generator",
23407  sizeof(__pyx_CoroutineObject),
23408  0,
23409  (destructor) __Pyx_Coroutine_dealloc,
23410  0,
23411  0,
23412  0,
23413  0,
23414  0,
23415  0,
23416  0,
23417  0,
23418  0,
23419  0,
23420  0,
23421  0,
23422  0,
23423  0,
23424  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
23425  0,
23426  (traverseproc) __Pyx_Coroutine_traverse,
23427  0,
23428  0,
23429  offsetof(__pyx_CoroutineObject, gi_weakreflist),
23430  0,
23431  (iternextfunc) __Pyx_Generator_Next,
23432  __pyx_Generator_methods,
23433  __pyx_Generator_memberlist,
23434  __pyx_Generator_getsets,
23435  0,
23436  0,
23437  0,
23438  0,
23439  0,
23440  0,
23441  0,
23442  0,
23443  0,
23444  0,
23445  0,
23446  0,
23447  0,
23448  0,
23449  0,
23450 #if CYTHON_USE_TP_FINALIZE
23451  0,
23452 #else
23453  __Pyx_Coroutine_del,
23454 #endif
23455  0,
23456 #if CYTHON_USE_TP_FINALIZE
23457  __Pyx_Coroutine_del,
23458 #elif PY_VERSION_HEX >= 0x030400a1
23459  0,
23460 #endif
23461 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
23462  0,
23463 #endif
23464 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
23465  0,
23466 #endif
23467 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
23468  0,
23469 #endif
23470 };
23471 static int __pyx_Generator_init(void) {
23472  __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
23473  __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
23474  __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
23475  if (unlikely(!__pyx_GeneratorType)) {
23476  return -1;
23477  }
23478  return 0;
23479 }
23480 
23481 /* CheckBinaryVersion */
23482  static int __Pyx_check_binary_version(void) {
23483  char ctversion[5];
23484  int same=1, i, found_dot;
23485  const char* rt_from_call = Py_GetVersion();
23486  PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
23487  found_dot = 0;
23488  for (i = 0; i < 4; i++) {
23489  if (!ctversion[i]) {
23490  same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
23491  break;
23492  }
23493  if (rt_from_call[i] != ctversion[i]) {
23494  same = 0;
23495  break;
23496  }
23497  }
23498  if (!same) {
23499  char rtversion[5] = {'\0'};
23500  char message[200];
23501  for (i=0; i<4; ++i) {
23502  if (rt_from_call[i] == '.') {
23503  if (found_dot) break;
23504  found_dot = 1;
23505  } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
23506  break;
23507  }
23508  rtversion[i] = rt_from_call[i];
23509  }
23510  PyOS_snprintf(message, sizeof(message),
23511  "compiletime version %s of module '%.100s' "
23512  "does not match runtime version %s",
23513  ctversion, __Pyx_MODULE_NAME, rtversion);
23514  return PyErr_WarnEx(NULL, message, 1);
23515  }
23516  return 0;
23517 }
23518 
23519 /* InitStrings */
23520  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
23521  while (t->p) {
23522  #if PY_MAJOR_VERSION < 3
23523  if (t->is_unicode) {
23524  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
23525  } else if (t->intern) {
23526  *t->p = PyString_InternFromString(t->s);
23527  } else {
23528  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
23529  }
23530  #else
23531  if (t->is_unicode | t->is_str) {
23532  if (t->intern) {
23533  *t->p = PyUnicode_InternFromString(t->s);
23534  } else if (t->encoding) {
23535  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
23536  } else {
23537  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
23538  }
23539  } else {
23540  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
23541  }
23542  #endif
23543  if (!*t->p)
23544  return -1;
23545  if (PyObject_Hash(*t->p) == -1)
23546  return -1;
23547  ++t;
23548  }
23549  return 0;
23550 }
23551 
23552 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
23553  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
23554 }
23555 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
23556  Py_ssize_t ignore;
23557  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
23558 }
23559 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
23560 #if !CYTHON_PEP393_ENABLED
23561 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23562  char* defenc_c;
23563  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
23564  if (!defenc) return NULL;
23565  defenc_c = PyBytes_AS_STRING(defenc);
23566 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23567  {
23568  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
23569  char* c;
23570  for (c = defenc_c; c < end; c++) {
23571  if ((unsigned char) (*c) >= 128) {
23572  PyUnicode_AsASCIIString(o);
23573  return NULL;
23574  }
23575  }
23576  }
23577 #endif
23578  *length = PyBytes_GET_SIZE(defenc);
23579  return defenc_c;
23580 }
23581 #else
23582 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23583  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
23584 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23585  if (likely(PyUnicode_IS_ASCII(o))) {
23586  *length = PyUnicode_GET_LENGTH(o);
23587  return PyUnicode_AsUTF8(o);
23588  } else {
23589  PyUnicode_AsASCIIString(o);
23590  return NULL;
23591  }
23592 #else
23593  return PyUnicode_AsUTF8AndSize(o, length);
23594 #endif
23595 }
23596 #endif
23597 #endif
23598 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
23599 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
23600  if (
23601 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
23602  __Pyx_sys_getdefaultencoding_not_ascii &&
23603 #endif
23604  PyUnicode_Check(o)) {
23605  return __Pyx_PyUnicode_AsStringAndSize(o, length);
23606  } else
23607 #endif
23608 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
23609  if (PyByteArray_Check(o)) {
23610  *length = PyByteArray_GET_SIZE(o);
23611  return PyByteArray_AS_STRING(o);
23612  } else
23613 #endif
23614  {
23615  char* result;
23616  int r = PyBytes_AsStringAndSize(o, &result, length);
23617  if (unlikely(r < 0)) {
23618  return NULL;
23619  } else {
23620  return result;
23621  }
23622  }
23623 }
23624 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
23625  int is_true = x == Py_True;
23626  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
23627  else return PyObject_IsTrue(x);
23628 }
23629 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
23630  int retval;
23631  if (unlikely(!x)) return -1;
23632  retval = __Pyx_PyObject_IsTrue(x);
23633  Py_DECREF(x);
23634  return retval;
23635 }
23636 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
23637 #if PY_MAJOR_VERSION >= 3
23638  if (PyLong_Check(result)) {
23639  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
23640  "__int__ returned non-int (type %.200s). "
23641  "The ability to return an instance of a strict subclass of int "
23642  "is deprecated, and may be removed in a future version of Python.",
23643  Py_TYPE(result)->tp_name)) {
23644  Py_DECREF(result);
23645  return NULL;
23646  }
23647  return result;
23648  }
23649 #endif
23650  PyErr_Format(PyExc_TypeError,
23651  "__%.4s__ returned non-%.4s (type %.200s)",
23652  type_name, type_name, Py_TYPE(result)->tp_name);
23653  Py_DECREF(result);
23654  return NULL;
23655 }
23656 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
23657 #if CYTHON_USE_TYPE_SLOTS
23658  PyNumberMethods *m;
23659 #endif
23660  const char *name = NULL;
23661  PyObject *res = NULL;
23662 #if PY_MAJOR_VERSION < 3
23663  if (likely(PyInt_Check(x) || PyLong_Check(x)))
23664 #else
23665  if (likely(PyLong_Check(x)))
23666 #endif
23667  return __Pyx_NewRef(x);
23668 #if CYTHON_USE_TYPE_SLOTS
23669  m = Py_TYPE(x)->tp_as_number;
23670  #if PY_MAJOR_VERSION < 3
23671  if (m && m->nb_int) {
23672  name = "int";
23673  res = m->nb_int(x);
23674  }
23675  else if (m && m->nb_long) {
23676  name = "long";
23677  res = m->nb_long(x);
23678  }
23679  #else
23680  if (likely(m && m->nb_int)) {
23681  name = "int";
23682  res = m->nb_int(x);
23683  }
23684  #endif
23685 #else
23686  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
23687  res = PyNumber_Int(x);
23688  }
23689 #endif
23690  if (likely(res)) {
23691 #if PY_MAJOR_VERSION < 3
23692  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
23693 #else
23694  if (unlikely(!PyLong_CheckExact(res))) {
23695 #endif
23696  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
23697  }
23698  }
23699  else if (!PyErr_Occurred()) {
23700  PyErr_SetString(PyExc_TypeError,
23701  "an integer is required");
23702  }
23703  return res;
23704 }
23705 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
23706  Py_ssize_t ival;
23707  PyObject *x;
23708 #if PY_MAJOR_VERSION < 3
23709  if (likely(PyInt_CheckExact(b))) {
23710  if (sizeof(Py_ssize_t) >= sizeof(long))
23711  return PyInt_AS_LONG(b);
23712  else
23713  return PyInt_AsSsize_t(b);
23714  }
23715 #endif
23716  if (likely(PyLong_CheckExact(b))) {
23717  #if CYTHON_USE_PYLONG_INTERNALS
23718  const digit* digits = ((PyLongObject*)b)->ob_digit;
23719  const Py_ssize_t size = Py_SIZE(b);
23720  if (likely(__Pyx_sst_abs(size) <= 1)) {
23721  ival = likely(size) ? digits[0] : 0;
23722  if (size == -1) ival = -ival;
23723  return ival;
23724  } else {
23725  switch (size) {
23726  case 2:
23727  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
23728  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23729  }
23730  break;
23731  case -2:
23732  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
23733  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23734  }
23735  break;
23736  case 3:
23737  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
23738  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23739  }
23740  break;
23741  case -3:
23742  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
23743  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
23744  }
23745  break;
23746  case 4:
23747  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
23748  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]));
23749  }
23750  break;
23751  case -4:
23752  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
23753  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]));
23754  }
23755  break;
23756  }
23757  }
23758  #endif
23759  return PyLong_AsSsize_t(b);
23760  }
23761  x = PyNumber_Index(b);
23762  if (!x) return -1;
23763  ival = PyInt_AsSsize_t(x);
23764  Py_DECREF(x);
23765  return ival;
23766 }
23767 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
23768  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
23769  return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
23770 #if PY_MAJOR_VERSION < 3
23771  } else if (likely(PyInt_CheckExact(o))) {
23772  return PyInt_AS_LONG(o);
23773 #endif
23774  } else {
23775  Py_ssize_t ival;
23776  PyObject *x;
23777  x = PyNumber_Index(o);
23778  if (!x) return -1;
23779  ival = PyInt_AsLong(x);
23780  Py_DECREF(x);
23781  return ival;
23782  }
23783 }
23784 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
23785  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
23786 }
23787 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
23788  return PyInt_FromSize_t(ival);
23789 }
23790 
23791 
23792 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
number
Int number
Definition: Headers.h:33
s
Double s
Definition: Headers.h:84
L
Double L
Definition: Headers.h:72
n
Int n
Definition: Headers.h:28
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
ns
Int ns
Definition: Headers.h:30
c
Double c
Definition: Headers.h:54
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8