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  /* "Isosurfa